Changeset 6704 in orxonox.OLD for branches/avi_play
- Timestamp:
- Jan 25, 2006, 3:18:45 PM (19 years ago)
- Location:
- branches/avi_play/src
- Files:
-
- 4 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 -
branches/avi_play/src/world_entities/movie_entity.cc
r6600 r6704 40 40 height = 20; 41 41 width = 20; 42 mediaLoaded = false; 42 43 43 44 this->toList(OM_COMMON); … … 64 65 LoadParam(root, "name", this, MovieEntity, loadMovie); 65 66 LoadParam(root, "axis", this, MovieEntity, setAxis); 66 LoadParam(root, "rotation", this, MovieEntity, setRotation);67 //LoadParam(root, "rotation", this, MovieEntity, setRotation); 67 68 LoadParam(root, "size", this, MovieEntity, setSize); 68 69 } … … 70 71 void MovieEntity::loadMovie(const char* filename) 71 72 { 72 media_container->loadMedia(filename); 73 if(media_container->loadMedia(filename)) 74 mediaLoaded = true; 75 else 76 mediaLoaded = false; 73 77 } 74 78 … … 98 102 void MovieEntity::tick(float time) 99 103 { 104 if(!mediaLoaded) 105 return; 106 100 107 timer += time; 101 108 … … 123 130 void MovieEntity::draw() const 124 131 { 132 if(!mediaLoaded) 133 false; 125 134 126 135 glPushMatrix(); -
branches/avi_play/src/world_entities/movie_entity.h
r6600 r6704 26 26 float width; 27 27 28 bool mediaLoaded; 29 28 30 public: 29 31 MovieEntity (const TiXmlElement* root = NULL);
Note: See TracChangeset
for help on using the changeset viewer.