Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6254 in orxonox.OLD


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
Files:
3 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();
  • branches/avi_play/src/subprojects/importer/multitex.cc

    r6168 r6254  
    4444void Framework::moduleInit(int argc, char** argv)
    4545{
    46   if( argc <= 1)
     46  if( argc <= 2)
    4747  {
    4848    printf("Wrong arguments try following notations:\n");
    49     printf("./multitex [mediaFile]\n");
     49    printf("./multitex [media_file] [start_time]\n");
    5050    exit(0);
    5151  }
     
    5353  movie = new MediaContainer(argv[1]);
    5454  fps = movie->getFPS();
     55
     56  float start_time = atoi(argv[2]);
    5557
    5658  // print information about the media file
     
    6365  seq = new TextureSequence();
    6466
    65   // get each fram individually 
     67  // get each fram individually
    6668  //while(seq->addFrame(movie->getNextFrame()) != NULL);
    6769  // get a list of frames
     70  seq->addFrame(movie->getFrame(start_time));
    6871  seq->addFrameList(movie->getFrameList());
    6972
     
    122125  {
    123126    counter = fps * timer;
    124  
     127
    125128    if (counter > seq->getFrameCount())
    126129    {
     
    130133
    131134    seq->gotoFrame(counter);
    132   }   
     135  }
    133136}
    134137
Note: See TracChangeset for help on using the changeset viewer.