Changeset 6704 in orxonox.OLD for branches/avi_play/src/lib/graphics
- Timestamp:
- Jan 25, 2006, 3:18:45 PM (19 years ago)
- 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
r6532 r6704 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 } 42 mediaLoaded = false; 43 44 this->loadMedia(filename); 48 45 } 49 46 … … 54 51 55 52 fps = 0; 53 mediaLoaded = false; 56 54 } 57 55 … … 61 59 MediaContainer::~MediaContainer() 62 60 { 61 this->unloadMedia(); 62 } 63 64 void MediaContainer::unloadMedia() 65 { 66 // check whether a movie is already loaded 67 if(!mediaLoaded) 68 return; 69 70 fps = 0; 71 72 // clear texturelist 73 this->clearLists(); 74 63 75 if (glIsTexture(texture)) 64 76 glDeleteTextures(1, &texture); 65 77 66 78 // Free the RGB image … … 76 88 // Close the video file 77 89 av_close_input_file(format_context); 90 91 mediaLoaded = false; 92 78 93 } 79 94 80 95 bool MediaContainer::loadMedia(const char* filename) 81 96 { 97 this->unloadMedia(); 98 99 if(filename == NULL) 100 return false; 101 // check whether file exists 102 if(!ResourceManager::isInDataDir(filename)) 103 { 104 PRINTF(1)("Could not find %s\n", filename); 105 return false; 106 } 107 108 109 82 110 // register all formats and codecs 83 111 av_register_all(); … … 146 174 // read the frames and save them in a sequence as textures 147 175 this->loadFrames(); 176 mediaLoaded = true; 148 177 149 178 return true; -
branches/avi_play/src/lib/graphics/importer/media_container.h
r6532 r6704 40 40 int video_stream; 41 41 double fps; 42 bool mediaLoaded; 42 43 43 44 public: … … 55 56 56 57 GLuint getNextFrame(); 57 58 void unloadMedia(); 58 59 }; 59 60
Note: See TracChangeset
for help on using the changeset viewer.