Changeset 1508 for trunk


Ignore:
Timestamp:
Jun 10, 2009 7:04:59 PM (15 years ago)
Author:
gah
Message:
 
Location:
trunk/packages/vizservers/nanovis
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/Command.cpp

    r1495 r1508  
    608608    }
    609609    Rappture::Outcome err;
    610     unsigned int flags;
    611     flags = RPENC_Z|RPENC_B64;
    612610    Trace("Checking header[%.13s]\n", buf.bytes());
    613611    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        }
    621624    }
    622625    return TCL_OK;
  • trunk/packages/vizservers/nanovis/FlowCmd.cpp

    r1505 r1508  
    181181FlowBox::Render(Volume *volPtr)
    182182{
    183     Trace("rendering boxes %s\n", _name);
     183    Trace("Rendering box %s\n", _name);
    184184    glColor4d(_sv.color.r, _sv.color.g, _sv.color.b, _sv.color.a);
    185185
     
    206206    min = volPtr->getPhysicalBBoxMin();
    207207    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);
    208215
    209216    float x0, y0, z0, x1, y1, z1;
     
    592599    FlowBox *boxPtr;
    593600    for (boxPtr = FirstBox(&iter); boxPtr != NULL; boxPtr = NextBox(&iter)) {
     601        Trace("found box %s\n", boxPtr->name());
    594602        if (boxPtr->visible()) {
    595603            boxPtr->Render(_volPtr);
     
    982990     *          flow vectors.
    983991     */
     992    magMin = DBL_MAX, magMax = -DBL_MAX;
     993
    984994    FlowCmd *flowPtr;
    985995    FlowIterator iter;
     
    10191029        }
    10201030    }
    1021 
    10221031    /*
    10231032     * Step 2.  Generate the vector field from each data set.
     
    18971906    }
    18981907    // Save the old dimensions of the offscreen buffer.
    1899     size_t oldWidth, oldHeight;
     1908    int oldWidth, oldHeight;
    19001909    oldWidth = NanoVis::win_width;
    19011910    oldHeight = NanoVis::win_height;
    19021911
    19031912    char fileName[200];
    1904     sprintf(fileName,"/tmp/flow%d.mp4", getpid());
     1913    sprintf(fileName,"/tmp/flow%d.mpeg", getpid());
    19051914
    19061915    Trace("FLOW started\n");
  • trunk/packages/vizservers/nanovis/RpAVTranslate.cpp

    r1503 r1508  
    9494{
    9595    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();
    9799    av_register_all();
    98100
    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. */
    101102    _fmtPtr = guess_format(NULL, filename, NULL);
    102103    if (_fmtPtr == NULL) {
     
    113114
    114115#ifdef HAVE_AVFORMAT_ALLOC_CONTEXT
    115     /* allocate the output media context */
     116    /* Allocate the output media context. */
    116117    _ocPtr = avformat_alloc_context();
    117118#else
    118119    _ocPtr = av_alloc_format_context();
    119120#endif
    120 
    121121    if (!_ocPtr) {
    122122        status.addError("Memory error while allocating format context");
     
    126126    snprintf(_ocPtr->filename, sizeof(_ocPtr->filename), "%s", filename);
    127127
    128     /* add the video stream using the default format codecs
    129        and initialize the codecs */
     128    /* Add the video stream using the default format codecs and initialize the
     129       codecs. */
    130130    _avStreamPtr = NULL;
    131131    if (_fmtPtr->video_codec != CODEC_ID_NONE) {
    132         if ( (!addVideoStream(status, _fmtPtr->video_codec,&_avStreamPtr)) ) {
     132        if ( (!addVideoStream(status, _fmtPtr->video_codec, &_avStreamPtr)) ) {
    133133            return false;
    134134        }
    135135    }
    136136
    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). */
    139138    if (av_set_parameters(_ocPtr, NULL) < 0) {
    140139        status.addError("Invalid output format parameters");
     
    144143    dump_format(_ocPtr, 0, filename, 1);
    145144
    146     /* now that all the parameters are set, we can open the
    147        video codec and allocate 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 */
    148147    if (_avStreamPtr) {
    149148        if (!openVideo(status)) {
     
    152151    }
    153152
    154     /* open the output file, if needed */
     153    /* Open the output file, if needed. */
    155154    if (!(_fmtPtr->flags & AVFMT_NOFILE)) {
    156155        if (url_fopen(&_ocPtr->pb, filename, URL_WRONLY) < 0) {
     
    190189
    191190#ifdef HAVE_IMG_CONVERT
    192     // use img_convert instead of sws_scale because img_convert
    193     // is lgpl nad sws_scale is gpl
     191    // Use img_convert instead of sws_scale because img_convert is LGPL and
     192    // sws_scale is GPL
    194193    img_convert((AVPicture *)_pictPtr, PIX_FMT_YUV420P,
    195194                (AVPicture *)_rgbPictPtr, PIX_FMT_RGB24,
     
    207206    size_t i = 0;
    208207
    209     /* close each codec */
     208    /* Close each codec */
    210209    if (_avStreamPtr) {
    211210        closeVideo(status);
    212211    }
    213212
    214     /* write the trailer, if any */
     213    /* Write the trailer, if any */
    215214    av_write_trailer(_ocPtr);
    216215
    217     /* free the streams */
     216    /* Free the streams */
    218217    for(i = 0; i < _ocPtr->nb_streams; i++) {
    219218        av_freep(&_ocPtr->streams[i]->codec);
     
    229228    }
    230229
    231     /* free the stream */
     230    /* Free the stream */
    232231    av_free(_ocPtr);
    233232    _ocPtr = NULL;
     
    236235
    237236
    238 /* add a video output stream */
     237/* Add a video output stream */
    239238bool
    240239AVTranslate::addVideoStream(Outcome &status, CodecID codec_id,
     
    259258    codecPtr->codec_type = CODEC_TYPE_VIDEO;
    260259
    261     /* put sample parameters */
     260    /* Put sample parameters */
    262261    codecPtr->bit_rate = _bitRate;
    263262    /* resolution must be a multiple of two */
     
    270269    codecPtr->time_base.den = _frameRate;
    271270    codecPtr->time_base.num = 1;
    272     codecPtr->gop_size = 12;    /* emit one intra frame every twelve frames at
    273                                  * most */
     271    codecPtr->gop_size = 12;            /* Emit one intra frame every twelve
     272                                         * frames at most */
    274273    codecPtr->pix_fmt = PIX_FMT_YUV420P;
    275274    if (codecPtr->codec_id == CODEC_ID_MPEG2VIDEO) {
     
    279278    if (codecPtr->codec_id == CODEC_ID_MPEG1VIDEO) {
    280279        /* Needed to avoid using macroblocks in which some coeffs overflow.
    281            This does not happen with normal video, it just happens here as
    282            the motion 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. */
    283282        codecPtr->mb_decision=2;
    284283    }
    285     // some formats want stream headers to be separate
     284    /* some formats want stream headers to be separate */
    286285    if((strcmp(_ocPtr->oformat->name, "mp4") == 0) ||
    287286       (strcmp(_ocPtr->oformat->name, "mov") == 0) ||
     
    335334    /* find the video encoder */
    336335    codec = avcodec_find_encoder(c->codec_id);
    337     if (!codec) {
    338         status.addError("codec not found");
     336    if (codec == NULL) {
     337        status.addError("can't find codec %d\n", c->codec->id);
    339338        return false;
    340339    }
     
    342341    /* open the codec */
    343342    if (avcodec_open(c, codec) < 0) {
    344         status.addError("could not open codec");
     343        status.addError("can't open codec %d", c->codec->id);
    345344        return false;
    346345    }
  • trunk/packages/vizservers/nanovis/nanovis.cpp

    r1493 r1508  
    148148unsigned int NanoVis::flags = 0;
    149149Tcl_HashTable NanoVis::flowTable;
    150 float NanoVis::magMin;
    151 float NanoVis::magMax;
     150double NanoVis::magMin;
     151double NanoVis::magMax;
    152152float NanoVis::xMin;
    153153float NanoVis::xMax;
  • trunk/packages/vizservers/nanovis/nanovis.h

    r1493 r1508  
    210210    static unsigned int flags;
    211211    static Tcl_HashTable flowTable;
    212     static float magMin, magMax;
     212    static double magMin, magMax;
    213213    static float xMin, xMax, yMin, yMax, zMin, zMax, wMin, wMax;
    214214    static float xOrigin, yOrigin, zOrigin;
Note: See TracChangeset for help on using the changeset viewer.