Changeset 6057 in orxonox.OLD for branches/avi_play/src
- Timestamp:
- Dec 12, 2005, 1:07:57 AM (19 years ago)
- Location:
- branches/avi_play/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/avi_play/src/lib/graphics/importer/media_container.cc
r6049 r6057 42 42 current_frame = 0; 43 43 num_frames = 0; 44 frames_left = true; 44 45 45 46 if (filename != NULL) … … 77 78 SDL_Surface* MediaContainer::getFrame(int frame_number) 78 79 { 79 SDL_Surface* frame; 80 81 82 return frame; 80 83 81 } 84 82 85 83 SDL_Surface* MediaContainer::getNextFrame() 86 84 { 87 current_frame++; 88 return this->getFrame(current_frame); 85 /* get next frame */ 86 if(av_read_frame(format_context, &packet) >= 0) 87 { 88 frames_left = true; 89 current_frame++; 90 PRINTF(1)("current_frame: %i\n", current_frame); 91 92 93 /* work with the frame */ 94 /* packet -> SDL_Surface */ 95 96 97 98 99 } 100 else 101 frames_left = false; 102 89 103 } 90 104 … … 136 150 int MediaContainer::getHeight() 137 151 { 138 152 return codec_context->height; 139 153 } 140 154 141 155 int MediaContainer::getWidth() 142 156 { 143 157 return codec_context->width; 144 158 } 145 159 … … 153 167 154 168 } 169 170 bool MediaContainer::framesLeft() 171 { 172 return frames_left; 173 } 174 175 void MediaContainer::printMediaInformation() 176 { 177 PRINTF(1)("========================\n"); 178 PRINTF(1)("========================\n"); 179 PRINTF(1)("= MEDIACONTAINER =\n"); 180 PRINTF(1)("========================\n"); 181 PRINTF(1)("========================\n"); 182 PRINTF(1)("= AVFormatContext =\n"); 183 PRINTF(1)("========================\n"); 184 PRINTF(1)("filename: %s\n", format_context->filename); 185 PRINTF(1)("nb_streams: %i\n", format_context->nb_streams); 186 PRINTF(1)("duration: %fs\n", format_context->duration/1000000.); 187 PRINTF(1)("file_size: %ikb\n", format_context->file_size/1024); 188 PRINTF(1)("bit_rate: %ikb/s\n", format_context->bit_rate/1000); 189 PRINTF(1)("nb_frames: %i\n", format_context->streams[video_stream]->nb_frames); 190 //PRINTF(1)("r_frame_rate: %ifps\n", format_context->streams[video_stream]->r_frame_rate.num); 191 PRINTF(1)("========================\n"); 192 PRINTF(1)("= AVCodecContext =\n"); 193 PRINTF(1)("========================\n"); 194 PRINTF(1)("width: %i\n", codec_context->width); 195 PRINTF(1)("height: %i\n", codec_context->height); 196 PRINTF(1)("========================\n"); 197 PRINTF(1)("= AVCodec =\n"); 198 PRINTF(1)("========================\n"); 199 PRINTF(1)("codec name: %s\n", codec->name); 200 PRINTF(1)("========================\n"); 201 PRINTF(1)("========================\n"); 202 } -
branches/avi_play/src/lib/graphics/importer/media_container.h
r6003 r6057 32 32 private: 33 33 34 char* filename;35 34 int current_frame; 36 35 int num_frames; … … 44 43 int num_bytes; 45 44 int video_stream; 45 bool frames_left; 46 46 47 47 public: … … 61 61 void getStream(/* stream */); 62 62 63 bool framesLeft(); 64 65 /* prints some information about the 66 media file for debug reasons */ 67 void printMediaInformation(); 68 63 69 }; 64 70 -
branches/avi_play/src/subprojects/importer/importer.cc
r6049 r6057 28 28 29 29 Model* obj; 30 MediaContainer* movie; 30 31 31 32 void Framework::moduleInit(int argc, char** argv) 32 33 { 33 MediaContainer* test2;34 35 test2 = new MediaContainer(argv[1]);36 34 35 movie = new MediaContainer(argv[1]); 37 36 37 // print information about the media file 38 movie->printMediaInformation(); 39 40 /* 38 41 ResourceManager::getInstance()->addImageDir("./"); 39 42 … … 57 60 lightMan->setAmbientColor(.1,.1,.1); 58 61 (new Light())->setAbsCoor(5.0, 10.0, 40.0); 59 (new Light())->setAbsCoor(-10, -20, -100); 62 (new Light())->setAbsCoor(-10, -20, -100);*/ 60 63 } 61 64 … … 75 78 void Framework::moduleTick(float dt) 76 79 { 77 80 if(movie->framesLeft()) 81 movie->getNextFrame(); 78 82 } 79 83 80 84 void Framework::moduleDraw(void) const 81 85 { 82 obj->draw();86 //obj->draw(); 83 87 84 LightManager::getInstance()->draw();88 //LightManager::getInstance()->draw(); 85 89 } 86 90
Note: See TracChangeset
for help on using the changeset viewer.