Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 27, 2005, 10:25:48 PM (19 years ago)
Author:
hdavid
Message:

branches\avi_play: MoviePlayer works, at the moment not very fast

File:
1 edited

Legend:

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

    r6323 r6324  
    5757{
    5858  status = STOP;
     59  timer = 0;
    5960
    6061  material = new Material;
     
    8283void MoviePlayer::start(unsigned int start_frame)
    8384{
    84   texture = media_container->getFrame(start_frame);
     85  status = PLAY;
     86  timer = 0;
     87  fps = media_container->getFPS();
    8588
    86   status = PLAY;
     89  media_container->gotoFrame(start_frame);
     90
     91   PRINTF(0)("start\n");
    8792}
    8893
     
    9095{
    9196  if(status == STOP)
    92     texture = media_container->getFrame(0);
    93   status = PLAY;
     97    this->start(0);
     98  else
     99    status = PLAY;
     100
     101   PRINTF(0)("resume\n");
    94102}
    95103
     
    98106  if(status != STOP)
    99107    status = PAUSE;
     108
     109  PRINTF(0)("pause\n");
    100110}
    101111
     
    104114  status = STOP;
    105115  texture = NULL;
     116
     117  PRINTF(0)("stop\n");
    106118}
    107119
    108 void MoviePlayer::tick(float time)
     120void MoviePlayer::tick(float dt)
    109121{
    110122  if(status == PLAY)
    111123  {
    112     texture = media_container->getNextFrame();
     124    current_frame = media_container->getFrameNumber();
     125    timer += dt;
     126    actuel_frame = timer * fps;
     127
     128    if(actuel_frame != current_frame)
     129    {
     130      if(actuel_frame - current_frame == 1)
     131        texture = media_container->getNextFrame();
     132      else
     133        texture = media_container->skipFrame(actuel_frame - current_frame - 1);
     134    }   
    113135    //PRINTF(0)("frame_number: %i\n", media_container->getFrameNumber());
    114     if(texture == NULL)
    115       status = STOP;
     136
     137    if(texture == NULL && current_frame != 0)
     138      this->stop();
    116139  }
    117140}
Note: See TracChangeset for help on using the changeset viewer.