Changeset 4616

Show
Ignore:
Timestamp:
02/17/10 16:35:03 (4 years ago)
Author:
soohyunc
Message:

changed a confusing variable name to a right one:

o num_frame_ has nothing to do with the number of frames,

instead it represents the number of bytes

added device status variable for Tcl binding (for stillYuvDevice)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vic/branches/cc/video/grabber-still.cpp

    r4614 r4616  
    100100        int width_;                     // width in pixel 
    101101        int height_;            // height in pixel 
    102         int num_frame_;         // current frame number 
     102        int nbytes_;            // current bytes 
    103103}; 
    104104 
     
    113113    char *frame_; 
    114114    int len_; 
     115        int devstat_;   // device status 
    115116private: 
    116117}; 
     
    119120 
    120121StillDevice::StillDevice(const char* s) : InputDevice(s), 
    121                 frame_(NULL), len_(0) 
     122                frame_(NULL), len_(0), devstat_(-1) 
    122123{ 
    123124    attributes_ = "format { 411 422 jpeg cif } size { small large cif }"; 
     
    194195    frame_ = new char[len_ + 1]; 
    195196        fread(frame_, len_, 1, fp); 
    196  
     197        debug_msg("Successfully loaded %s\n", f); 
     198 
     199        devstat_ = 0;   // device is now ready 
    197200    fclose(fp); 
    198201} 
     
    223226StillGrabber::StillGrabber()  
    224227{ 
     228        // set device status 
     229        status_ = still_device.devstat_; 
    225230} 
    226231 
     
    303308 
    304309StillYuvGrabber::StillYuvGrabber() : 
    305         width_(0), height_(0), num_frame_(0) 
     310        width_(0), height_(0), nbytes_(0) 
    306311{ 
    307312        stillYuv_ts_off_ = stillYuv_now(); 
     
    361366        // "framesize_" is just the number of pixels,  
    362367        // so the number of bytes becomes "3 * framesize_ / 2" 
    363         memcpy (frame_, still_device.frame_ + num_frame_,  
     368        memcpy (frame_, still_device.frame_ + nbytes_,  
    364369                        framesize_ + (framesize_ >> 1)); 
    365370 
    366         if ((num_frame_ += framesize_+(framesize_ >> 1)) < still_device.len_) { 
     371        if ((nbytes_ += framesize_+(framesize_ >> 1)) < still_device.len_) { 
    367372        } else { 
    368                 num_frame_=0; 
     373                nbytes_=0; 
    369374        } 
    370375         
    371376#ifdef DEBUG 
    372         debug_msg(" number of frames: %d\n", num_frame_); 
     377        debug_msg(" number of bytes: %d\n", nbytes_); 
    373378#endif 
    374379 
     
    376381        saveblks(frame_); 
    377382        YuvFrame f(media_ts(), (u_int8_t *) frame_, crvec_, outw_, outh_); 
    378  
    379         frc = target_->consume(&f); 
    380383 
    381384        // time measurement 
     
    384387        fprintf(stderr, "num: %d\tgrab_time: %f\n", 
    385388                num_grab_++, end_grab_ - start_grab_); 
     389 
     390        frc = target_->consume(&f); 
    386391    return frc; 
    387392}