Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 25, 2006, 6:46:06 PM (20 years ago)
Author:
bensch
Message:

merged avi_play back to the trunk. command https://svn.orxonox.net/orxonox/branches/avi_play . -r6602:HEAD

File:
1 edited

Legend:

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

    r6532 r6731  
    4040
    4141  fps = 0;
    42 
    43   if (filename != NULL)
    44   {
    45     if(!this->loadMedia(filename))
    46       PRINTF(1)("MediaContainer::loadMedia() failed for %s\n", filename);
    47   }
    48 }
    49 
    50 MediaContainer::MediaContainer()
    51 {
    52   // set the class id for the base object
    53   this->setClassID(CL_MEDIA_CONTAINER, "MediaContainer");
    54 
    55   fps = 0;
     42  mediaLoaded = false;
     43
     44  this->loadMedia(filename);
    5645}
    5746
     
    6150MediaContainer::~MediaContainer()
    6251{
     52  this->unloadMedia();
     53}
     54
     55void MediaContainer::unloadMedia()
     56{
     57  // check whether a movie is already loaded
     58  if(!mediaLoaded)
     59    return;
     60
     61  fps = 0;
     62
     63  // clear texturelist
     64  this->clearLists();
     65
    6366  if (glIsTexture(texture))
    64     glDeleteTextures(1, &texture);
     67  glDeleteTextures(1, &texture);
    6568
    6669  // Free the RGB image
     
    7679  // Close the video file
    7780  av_close_input_file(format_context);
     81
     82  mediaLoaded = false;
     83
    7884}
    7985
    8086bool MediaContainer::loadMedia(const char* filename)
    8187{
     88  this->unloadMedia();
     89
     90  if(filename == NULL)
     91    return false;
     92  // check whether file exists
     93  if(!ResourceManager::isInDataDir(filename))
     94  {
     95    PRINTF(1)("Could not find %s\n", filename);
     96    return false;
     97  }
     98
    8299  // register all formats and codecs
    83100  av_register_all();
     
    146163  // read the frames and save them in a sequence as textures
    147164  this->loadFrames();
     165  mediaLoaded = true;
    148166
    149167  return true;
Note: See TracChangeset for help on using the changeset viewer.