Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6254 in orxonox.OLD for branches/avi_play/src/lib/graphics/importer


Ignore:
Timestamp:
Dec 21, 2005, 5:25:04 PM (19 years ago)
Author:
stefalie
Message:

branches\avi_play: some changes….

Location:
branches/avi_play/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/avi_play/src/lib/graphics/importer/media_container.cc

    r6163 r6254  
    7575}
    7676
    77 SDL_Surface* MediaContainer::getFrame(int frame_number)
    78 {
    79 
     77SDL_Surface* MediaContainer::getFrame(float time_stamp)
     78{
     79  if (time_stamp != AV_NOPTS_VALUE)
     80  {
     81    /* add the stream start time */
     82    //time_stamp += AV_NOPTS_VALUE;
     83    //PRINTF(1)("starttime %f\n", format_context->start_time);
     84    //time_stamp += format_context->start_time;
     85    int err = av_seek_frame(format_context, video_stream, time_stamp, AVSEEK_FLAG_BACKWARD);
     86    if (err < 0)
     87    {
     88      PRINTF(1)("could not seek to position %f\n", time_stamp);
     89      return NULL;
     90    }
     91
     92    return this->getNextFrame();
     93  }
     94
     95  return this->getNextFrame();
    8096}
    8197
     
    98114      if(frame_finished)
    99115      {
     116        //PRINTF(1)("frame_number: %i\n", this->getFrameNumber());
    100117        // Conversion from YUV to RGB
    101118        // Most codecs return images in YUV 420 format
     
    227244  // Calculate fps
    228245  fps = av_q2d(format_context->streams[video_stream]->r_frame_rate);
     246
     247  // duration
     248  duration = format_context->duration / 1000000LL;
    229249}
    230250
     
    260280  PRINTF(1)("filename: %s\n", format_context->filename);
    261281  PRINTF(1)("nb_streams: %i\n", format_context->nb_streams);
    262   PRINTF(1)("duration: %fs\n", format_context->duration/1000000.);
     282  PRINTF(1)("duration: (%02d:%02d:%02d)\n", duration/3600, (duration%3600)/60, duration%60);
    263283  PRINTF(1)("file_size: %ikb\n", format_context->file_size/1024);
    264284  PRINTF(1)("bit_rate: %ikb/s\n", format_context->bit_rate/1000);
  • branches/avi_play/src/lib/graphics/importer/media_container.h

    r6163 r6254  
    4343  uint8_t *buffer;
    4444  int video_stream;
     45  int duration;
    4546
    4647  vector<SDL_Surface*>    surface_list;
     
    5152  ~MediaContainer();
    5253
    53   SDL_Surface* getFrame(int frame_number);
     54  SDL_Surface* getFrame(float time_stamp);
    5455  SDL_Surface* getNextFrame();
    5556  vector<SDL_Surface*> getFrameList();
Note: See TracChangeset for help on using the changeset viewer.