Changeset 6731 in orxonox.OLD for trunk/src/lib/graphics/importer/media_container.cc
- Timestamp:
- Jan 25, 2006, 6:46:06 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/media_container.cc
r6532 r6731 40 40 41 41 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); 56 45 } 57 46 … … 61 50 MediaContainer::~MediaContainer() 62 51 { 52 this->unloadMedia(); 53 } 54 55 void 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 63 66 if (glIsTexture(texture)) 64 67 glDeleteTextures(1, &texture); 65 68 66 69 // Free the RGB image … … 76 79 // Close the video file 77 80 av_close_input_file(format_context); 81 82 mediaLoaded = false; 83 78 84 } 79 85 80 86 bool MediaContainer::loadMedia(const char* filename) 81 87 { 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 82 99 // register all formats and codecs 83 100 av_register_all(); … … 146 163 // read the frames and save them in a sequence as textures 147 164 this->loadFrames(); 165 mediaLoaded = true; 148 166 149 167 return true;
Note: See TracChangeset
for help on using the changeset viewer.