- Timestamp:
- Jun 10, 2009 7:04:59 PM (15 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Command.cpp
r1495 r1508 608 608 } 609 609 Rappture::Outcome err; 610 unsigned int flags;611 flags = RPENC_Z|RPENC_B64;612 610 Trace("Checking header[%.13s]\n", buf.bytes()); 613 611 if (strncmp (buf.bytes(), "@@RP-ENC:", 9) == 0) { 614 flags = RPENC_HDR; 615 } 616 if (!Rappture::encoding::decode(err, buf, flags)) { 617 printf("ERROR -- DECODING\n"); 618 fflush(stdout); 619 Tcl_AppendResult(interp, err.remark(), (char*)NULL); 620 return TCL_ERROR; 612 /* There's a header on the buffer, use it to decode the data. */ 613 if (!Rappture::encoding::decode(err, buf, RPENC_HDR)) { 614 Tcl_AppendResult(interp, err.remark(), (char*)NULL); 615 return TCL_ERROR; 616 } 617 } else if (Rappture::encoding::isBase64(buf.bytes(), buf.size())) { 618 /* No header, but it's base64 encoded. It's likely that it's both 619 * base64 encoded and compressed. */ 620 if (!Rappture::encoding::decode(err, buf, RPENC_B64)) { 621 Tcl_AppendResult(interp, err.remark(), (char*)NULL); 622 return TCL_ERROR; 623 } 621 624 } 622 625 return TCL_OK; -
trunk/packages/vizservers/nanovis/FlowCmd.cpp
r1505 r1508 181 181 FlowBox::Render(Volume *volPtr) 182 182 { 183 Trace(" rendering boxes%s\n", _name);183 Trace("Rendering box %s\n", _name); 184 184 glColor4d(_sv.color.r, _sv.color.g, _sv.color.b, _sv.color.a); 185 185 … … 206 206 min = volPtr->getPhysicalBBoxMin(); 207 207 max = volPtr->getPhysicalBBoxMax(); 208 209 Trace("box is %g,%g %g,%g %g,%g\n", 210 _sv.corner1.x, _sv.corner2.x, 211 _sv.corner1.y, _sv.corner2.y, 212 _sv.corner1.z, _sv.corner2.z); 213 Trace("world is %g,%g %g,%g %g,%g\n", 214 min.x, max.x, min.y, max.y, min.z, max.z); 208 215 209 216 float x0, y0, z0, x1, y1, z1; … … 592 599 FlowBox *boxPtr; 593 600 for (boxPtr = FirstBox(&iter); boxPtr != NULL; boxPtr = NextBox(&iter)) { 601 Trace("found box %s\n", boxPtr->name()); 594 602 if (boxPtr->visible()) { 595 603 boxPtr->Render(_volPtr); … … 982 990 * flow vectors. 983 991 */ 992 magMin = DBL_MAX, magMax = -DBL_MAX; 993 984 994 FlowCmd *flowPtr; 985 995 FlowIterator iter; … … 1019 1029 } 1020 1030 } 1021 1022 1031 /* 1023 1032 * Step 2. Generate the vector field from each data set. … … 1897 1906 } 1898 1907 // Save the old dimensions of the offscreen buffer. 1899 size_t oldWidth, oldHeight;1908 int oldWidth, oldHeight; 1900 1909 oldWidth = NanoVis::win_width; 1901 1910 oldHeight = NanoVis::win_height; 1902 1911 1903 1912 char fileName[200]; 1904 sprintf(fileName,"/tmp/flow%d.mp 4", getpid());1913 sprintf(fileName,"/tmp/flow%d.mpeg", getpid()); 1905 1914 1906 1915 Trace("FLOW started\n"); -
trunk/packages/vizservers/nanovis/RpAVTranslate.cpp
r1503 r1508 94 94 { 95 95 status.addContext("Rappture::AVTranslate::init()"); 96 /* initialize libavcodec, and register all codecs and formats */ 96 /* Initialize libavcodec, and register all codecs and formats */ 97 avcodec_init(); 98 avcodec_register_all(); 97 99 av_register_all(); 98 100 99 /* auto detect the output format from the name. default is 100 mpeg. */ 101 /* Auto detect the output format from the name. default is mpeg. */ 101 102 _fmtPtr = guess_format(NULL, filename, NULL); 102 103 if (_fmtPtr == NULL) { … … 113 114 114 115 #ifdef HAVE_AVFORMAT_ALLOC_CONTEXT 115 /* allocate the output media context*/116 /* Allocate the output media context. */ 116 117 _ocPtr = avformat_alloc_context(); 117 118 #else 118 119 _ocPtr = av_alloc_format_context(); 119 120 #endif 120 121 121 if (!_ocPtr) { 122 122 status.addError("Memory error while allocating format context"); … … 126 126 snprintf(_ocPtr->filename, sizeof(_ocPtr->filename), "%s", filename); 127 127 128 /* add the video stream using the default format codecs129 and initialize the codecs*/128 /* Add the video stream using the default format codecs and initialize the 129 codecs. */ 130 130 _avStreamPtr = NULL; 131 131 if (_fmtPtr->video_codec != CODEC_ID_NONE) { 132 if ( (!addVideoStream(status, _fmtPtr->video_codec, &_avStreamPtr)) ) {132 if ( (!addVideoStream(status, _fmtPtr->video_codec, &_avStreamPtr)) ) { 133 133 return false; 134 134 } 135 135 } 136 136 137 /* set the output parameters (must be done even if no 138 parameters). */ 137 /* Set the output parameters (must be done even if no parameters). */ 139 138 if (av_set_parameters(_ocPtr, NULL) < 0) { 140 139 status.addError("Invalid output format parameters"); … … 144 143 dump_format(_ocPtr, 0, filename, 1); 145 144 146 /* now that all the parameters are set, we can open the147 video codec andallocate the necessary encode buffers */145 /* Now that all the parameters are set, we can open the video codec and 146 allocate the necessary encode buffers */ 148 147 if (_avStreamPtr) { 149 148 if (!openVideo(status)) { … … 152 151 } 153 152 154 /* open the output file, if needed*/153 /* Open the output file, if needed. */ 155 154 if (!(_fmtPtr->flags & AVFMT_NOFILE)) { 156 155 if (url_fopen(&_ocPtr->pb, filename, URL_WRONLY) < 0) { … … 190 189 191 190 #ifdef HAVE_IMG_CONVERT 192 // use img_convert instead of sws_scale because img_convert193 // is lgpl nad sws_scale is gpl191 // Use img_convert instead of sws_scale because img_convert is LGPL and 192 // sws_scale is GPL 194 193 img_convert((AVPicture *)_pictPtr, PIX_FMT_YUV420P, 195 194 (AVPicture *)_rgbPictPtr, PIX_FMT_RGB24, … … 207 206 size_t i = 0; 208 207 209 /* close each codec */208 /* Close each codec */ 210 209 if (_avStreamPtr) { 211 210 closeVideo(status); 212 211 } 213 212 214 /* write the trailer, if any */213 /* Write the trailer, if any */ 215 214 av_write_trailer(_ocPtr); 216 215 217 /* free the streams */216 /* Free the streams */ 218 217 for(i = 0; i < _ocPtr->nb_streams; i++) { 219 218 av_freep(&_ocPtr->streams[i]->codec); … … 229 228 } 230 229 231 /* free the stream */230 /* Free the stream */ 232 231 av_free(_ocPtr); 233 232 _ocPtr = NULL; … … 236 235 237 236 238 /* add a video output stream */237 /* Add a video output stream */ 239 238 bool 240 239 AVTranslate::addVideoStream(Outcome &status, CodecID codec_id, … … 259 258 codecPtr->codec_type = CODEC_TYPE_VIDEO; 260 259 261 /* put sample parameters */260 /* Put sample parameters */ 262 261 codecPtr->bit_rate = _bitRate; 263 262 /* resolution must be a multiple of two */ … … 270 269 codecPtr->time_base.den = _frameRate; 271 270 codecPtr->time_base.num = 1; 272 codecPtr->gop_size = 12; /* emit one intra frame every twelve frames at273 *most */271 codecPtr->gop_size = 12; /* Emit one intra frame every twelve 272 * frames at most */ 274 273 codecPtr->pix_fmt = PIX_FMT_YUV420P; 275 274 if (codecPtr->codec_id == CODEC_ID_MPEG2VIDEO) { … … 279 278 if (codecPtr->codec_id == CODEC_ID_MPEG1VIDEO) { 280 279 /* Needed to avoid using macroblocks in which some coeffs overflow. 281 This does not happen with normal video, it just happens here as 282 themotion of the chroma plane does not match the luma plane. */280 This does not happen with normal video, it just happens here as the 281 motion of the chroma plane does not match the luma plane. */ 283 282 codecPtr->mb_decision=2; 284 283 } 285 / / some formats want stream headers to be separate284 /* some formats want stream headers to be separate */ 286 285 if((strcmp(_ocPtr->oformat->name, "mp4") == 0) || 287 286 (strcmp(_ocPtr->oformat->name, "mov") == 0) || … … 335 334 /* find the video encoder */ 336 335 codec = avcodec_find_encoder(c->codec_id); 337 if ( !codec) {338 status.addError("c odec not found");336 if (codec == NULL) { 337 status.addError("can't find codec %d\n", c->codec->id); 339 338 return false; 340 339 } … … 342 341 /* open the codec */ 343 342 if (avcodec_open(c, codec) < 0) { 344 status.addError("c ould not open codec");343 status.addError("can't open codec %d", c->codec->id); 345 344 return false; 346 345 } -
trunk/packages/vizservers/nanovis/nanovis.cpp
r1493 r1508 148 148 unsigned int NanoVis::flags = 0; 149 149 Tcl_HashTable NanoVis::flowTable; 150 floatNanoVis::magMin;151 floatNanoVis::magMax;150 double NanoVis::magMin; 151 double NanoVis::magMax; 152 152 float NanoVis::xMin; 153 153 float NanoVis::xMax; -
trunk/packages/vizservers/nanovis/nanovis.h
r1493 r1508 210 210 static unsigned int flags; 211 211 static Tcl_HashTable flowTable; 212 static floatmagMin, magMax;212 static double magMin, magMax; 213 213 static float xMin, xMax, yMin, yMax, zMin, zMax, wMin, wMax; 214 214 static float xOrigin, yOrigin, zOrigin;
Note: See TracChangeset
for help on using the changeset viewer.