Changeset 6127 in orxonox.OLD for branches/avi_play/src
- Timestamp:
- Dec 15, 2005, 11:54:48 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
r6112 r6127 40 40 av_register_all(); 41 41 42 current_frame= 0;42 fps = 0; 43 43 44 44 if (filename != NULL) … … 89 89 if(frame_finished) 90 90 { 91 current_frame++; 92 PRINTF(1)("current_frame: %i\n", current_frame); 93 94 // Convert the image from its native format to RGB 91 PRINTF(1)("frame_number: %i\n", codec_context->frame_number); 92 93 // Convert the image from its native format to RGB 95 94 img_convert((AVPicture*)RGB_frame, PIX_FMT_RGB24, (AVPicture*)frame, codec_context->pix_fmt, 96 95 codec_context->width, codec_context->height); … … 145 144 146 145 // Open file 147 sprintf(filename, "frame%i.ppm", c urrent_frame);146 sprintf(filename, "frame%i.ppm", codec_context->frame_number); 148 147 file = fopen(filename, "wb"); 149 148 if(file == NULL) … … 215 214 avpicture_fill((AVPicture *)RGB_frame, buffer, PIX_FMT_RGB24, codec_context->width, codec_context->height); 216 215 216 // Calculate fps 217 fps = av_q2d(format_context->streams[video_stream]->r_frame_rate); 217 218 } 218 219 … … 227 228 } 228 229 229 int MediaContainer::getCurrentFrame() 230 { 231 return this->current_frame; 232 } 233 234 int MediaContainer::getFrameRate() 235 { 236 237 } 238 239 void MediaContainer::getStream(/* stream */) 240 { 241 230 int MediaContainer::getFrameNumber() 231 { 232 return codec_context->frame_number; 233 } 234 235 double MediaContainer::getFPS() 236 { 237 return this->fps; 242 238 } 243 239 … … 258 254 PRINTF(1)("nb_frames: %i\n", format_context->streams[video_stream]->nb_frames); 259 255 PRINTF(1)("r_frame_rate: %i\n", format_context->streams[video_stream]->r_frame_rate.num); 256 PRINTF(1)("FPS: %f\n", av_q2d(format_context->streams[video_stream]->r_frame_rate)); 260 257 PRINTF(1)("========================\n"); 261 258 PRINTF(1)("= AVCodecContext =\n"); … … 263 260 PRINTF(1)("width: %i\n", codec_context->width); 264 261 PRINTF(1)("height: %i\n", codec_context->height); 262 PRINTF(1)("time_base.den: %i\n", codec_context->time_base.den); 263 PRINTF(1)("time_base.num: %i\n", codec_context->time_base.num); 265 264 PRINTF(1)("========================\n"); 266 265 PRINTF(1)("= AVCodec =\n"); … … 286 285 PRINTF(1)("========================\n"); 287 286 } 287 288 289 //pts = av_q2d(is->video_st->time_base)*pkt->dts; 290 //pkt = packet 291 //avstrream = viedo_st 292 //pts = double -
branches/avi_play/src/lib/graphics/importer/media_container.h
r6112 r6127 29 29 private: 30 30 31 int current_frame; 32 int num_frames; 31 double fps; 33 32 GLuint texture; 34 33 uint8_t* data; … … 57 56 int getHeight(); 58 57 int getWidth(); 59 int getCurrentFrame(); 60 int getFrameRate(); 61 void getStream(/* stream */); 58 int getFrameNumber(); 59 double getFPS(); 62 60 63 61 /* prints some information about the -
branches/avi_play/src/subprojects/importer/importer.cc
r6094 r6127 60 60 void Framework::moduleTick(float dt) 61 61 { 62 while(movie->getNextFrame() != NULL)63 movie->saveCurrentFrame();62 //while(movie->getNextFrame() != NULL); 63 // movie->saveCurrentFrame(); 64 64 } 65 65 -
branches/avi_play/src/subprojects/importer/multitex.cc
r6112 r6127 37 37 MediaContainer* movie; 38 38 39 int counter = 0;39 float counter = 0; 40 40 41 41 42 42 void Framework::moduleInit(int argc, char** argv) 43 43 { 44 movie = new MediaContainer("/home/ lieni/Desktop/Face2.avi");44 movie = new MediaContainer("/home/david/Desktop/Face2.avi"); 45 45 46 46 // print information about the media file … … 52 52 53 53 seq = new TextureSequence(); 54 //for (int i = 1; i < argc; i++)55 //{56 //seq->addFrame(argv[i]);57 //printf("%s\n", argv[i]);58 //}54 for (int i = 1; i < argc; i++) 55 { 56 seq->addFrame(argv[i]); 57 printf("%s\n", argv[i]); 58 } 59 59 60 60 // add one frame from the movie 61 //seq->addFrame(movie->getNextFrame());61 seq->addFrame(movie->getNextFrame()); 62 62 GLuint tex; 63 while((tex = movie->getNextFrame()) != NULL)64 seq->addFrame(tex);63 //while((tex = movie->getNextFrame()) != NULL) 64 // seq->addFrame(tex); 65 65 66 66 test = new Texture(argv[1]); … … 102 102 void Framework::moduleTick(float dt) 103 103 { 104 counter ++;104 counter += dt; 105 105 106 seq->gotoFrame( counter);106 seq->gotoFrame((unsigned int)counter); 107 107 108 if ( counter > seq->getFrameCount())108 if ((unsigned int)counter > seq->getFrameCount()) 109 109 counter = 0; 110 110
Note: See TracChangeset
for help on using the changeset viewer.