Changeset 6254 in orxonox.OLD for branches/avi_play/src/lib/graphics/importer
- Timestamp:
- Dec 21, 2005, 5:25:04 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
r6163 r6254 75 75 } 76 76 77 SDL_Surface* MediaContainer::getFrame(int frame_number) 78 { 79 77 SDL_Surface* MediaContainer::getFrame(float time_stamp) 78 { 79 if (time_stamp != AV_NOPTS_VALUE) 80 { 81 /* add the stream start time */ 82 //time_stamp += AV_NOPTS_VALUE; 83 //PRINTF(1)("starttime %f\n", format_context->start_time); 84 //time_stamp += format_context->start_time; 85 int err = av_seek_frame(format_context, video_stream, time_stamp, AVSEEK_FLAG_BACKWARD); 86 if (err < 0) 87 { 88 PRINTF(1)("could not seek to position %f\n", time_stamp); 89 return NULL; 90 } 91 92 return this->getNextFrame(); 93 } 94 95 return this->getNextFrame(); 80 96 } 81 97 … … 98 114 if(frame_finished) 99 115 { 116 //PRINTF(1)("frame_number: %i\n", this->getFrameNumber()); 100 117 // Conversion from YUV to RGB 101 118 // Most codecs return images in YUV 420 format … … 227 244 // Calculate fps 228 245 fps = av_q2d(format_context->streams[video_stream]->r_frame_rate); 246 247 // duration 248 duration = format_context->duration / 1000000LL; 229 249 } 230 250 … … 260 280 PRINTF(1)("filename: %s\n", format_context->filename); 261 281 PRINTF(1)("nb_streams: %i\n", format_context->nb_streams); 262 PRINTF(1)("duration: %fs\n", format_context->duration/1000000.);282 PRINTF(1)("duration: (%02d:%02d:%02d)\n", duration/3600, (duration%3600)/60, duration%60); 263 283 PRINTF(1)("file_size: %ikb\n", format_context->file_size/1024); 264 284 PRINTF(1)("bit_rate: %ikb/s\n", format_context->bit_rate/1000); -
branches/avi_play/src/lib/graphics/importer/media_container.h
r6163 r6254 43 43 uint8_t *buffer; 44 44 int video_stream; 45 int duration; 45 46 46 47 vector<SDL_Surface*> surface_list; … … 51 52 ~MediaContainer(); 52 53 53 SDL_Surface* getFrame( int frame_number);54 SDL_Surface* getFrame(float time_stamp); 54 55 SDL_Surface* getNextFrame(); 55 56 vector<SDL_Surface*> getFrameList();
Note: See TracChangeset
for help on using the changeset viewer.