Changeset 6254 in orxonox.OLD for branches/avi_play/src
- Timestamp:
- Dec 21, 2005, 5:25:04 PM (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
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(); -
branches/avi_play/src/subprojects/importer/multitex.cc
r6168 r6254 44 44 void Framework::moduleInit(int argc, char** argv) 45 45 { 46 if( argc <= 1)46 if( argc <= 2) 47 47 { 48 48 printf("Wrong arguments try following notations:\n"); 49 printf("./multitex [media File]\n");49 printf("./multitex [media_file] [start_time]\n"); 50 50 exit(0); 51 51 } … … 53 53 movie = new MediaContainer(argv[1]); 54 54 fps = movie->getFPS(); 55 56 float start_time = atoi(argv[2]); 55 57 56 58 // print information about the media file … … 63 65 seq = new TextureSequence(); 64 66 65 // get each fram individually 67 // get each fram individually 66 68 //while(seq->addFrame(movie->getNextFrame()) != NULL); 67 69 // get a list of frames 70 seq->addFrame(movie->getFrame(start_time)); 68 71 seq->addFrameList(movie->getFrameList()); 69 72 … … 122 125 { 123 126 counter = fps * timer; 124 127 125 128 if (counter > seq->getFrameCount()) 126 129 { … … 130 133 131 134 seq->gotoFrame(counter); 132 } 135 } 133 136 } 134 137
Note: See TracChangeset
for help on using the changeset viewer.