- Timestamp:
- Jan 25, 2006, 4:18:25 PM (19 years ago)
- Location:
- branches/avi_play/src/lib/graphics/importer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/avi_play/src/lib/graphics/importer/media_container.cc
r6704 r6711 45 45 } 46 46 47 MediaContainer::MediaContainer()48 {49 // set the class id for the base object50 this->setClassID(CL_MEDIA_CONTAINER, "MediaContainer");51 52 fps = 0;53 mediaLoaded = false;54 }55 56 47 /** 57 48 * Default destructor … … 105 96 return false; 106 97 } 107 108 109 98 110 99 // register all formats and codecs -
branches/avi_play/src/lib/graphics/importer/media_container.h
r6704 r6711 44 44 public: 45 45 46 MediaContainer(const char* filename); 47 MediaContainer(); 46 MediaContainer(const char* filename = NULL); 48 47 ~MediaContainer(); 49 48 -
branches/avi_play/src/lib/graphics/importer/movie_player.cc
r6611 r6711 33 33 MoviePlayer::MoviePlayer(const char* filename) 34 34 { 35 this->init();36 37 if (filename != NULL) 38 {39 if(!this->loadMovie(filename))40 PRINTF(1)("MoviePlayer::loadMovie() failes for %s\n", filename);41 } 42 } 43 44 MoviePlayer::MoviePlayer() 45 { 46 this->init(); 47 } 35 // set the class id for the base object 36 this->setClassID(CL_MOVIE_PLAYER, "MoviePlayer"); 37 38 status = STOP; 39 timer = 0; 40 frame_number = 0; 41 42 mediaLoaded = false; 43 44 this->loadMovie(filename); 45 46 } 47 48 48 49 49 MoviePlayer::~MoviePlayer() 50 50 { 51 //delete material; 52 //delete model; 51 this->unloadMedia(); 52 } 53 54 void MoviePlayer::unloadMedia() 55 { 56 // check whether a movie is already loaded 57 if(!mediaLoaded) 58 return; 53 59 54 60 if (glIsTexture(texture)) … … 67 73 // Close the video file 68 74 av_close_input_file(format_context); 69 }70 71 void MoviePlayer::init()72 {73 // set the class id for the base object74 this->setClassID(CL_MOVIE_PLAYER, "MoviePlayer");75 75 76 76 status = STOP; 77 77 timer = 0; 78 78 frame_number = 0; 79 loading = false; 80 } 79 80 mediaLoaded = false; 81 82 } 83 81 84 82 85 bool MoviePlayer::loadMovie(const char* filename) 83 86 { 87 this->unloadMedia(); 88 89 if(filename == NULL) 90 return false; 91 // check whether file exists 92 if(!ResourceManager::isInDataDir(filename)) 93 { 94 PRINTF(1)("Could not find %s\n", filename); 95 return false; 96 } 97 84 98 // register all formats and codecs 85 99 av_register_all(); … … 164 178 glBindTexture(GL_TEXTURE_2D, 0); 165 179 166 loading= true;180 mediaLoaded = true; 167 181 return true; 168 182 } … … 264 278 bool MoviePlayer::gotoFrame(int frames) 265 279 { 266 if(! loading)280 if(!mediaLoaded) 267 281 { 268 282 PRINTF(0)("Load first the media file with loadMovie\n"); … … 390 404 void MoviePlayer::printInformation() 391 405 { 392 if(! loading)406 if(!mediaLoaded) 393 407 { 394 408 PRINTF(0)("Load first the media file with loadMovie\n"); -
branches/avi_play/src/lib/graphics/importer/movie_player.h
r6611 r6711 54 54 float fps; 55 55 int duration; 56 bool loading;56 bool mediaLoaded; 57 57 58 58 public: 59 59 60 MoviePlayer(const char* filename); 61 MoviePlayer(); 60 MoviePlayer(const char* filename = NULL); 62 61 ~MoviePlayer(); 63 62 … … 79 78 private: 80 79 81 void init();82 80 void getNextFrame(); 83 81 void skipFrame(int frames); 84 82 bool gotoFrame(int frames); 85 83 84 void unloadMedia(); 85 86 86 }; 87 87
Note: See TracChangeset
for help on using the changeset viewer.