Changeset 6382 in orxonox.OLD for branches/avi_play/src/lib/graphics/importer/movie_player.cc
- Timestamp:
- Jan 1, 2006, 7:58:56 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/avi_play/src/lib/graphics/importer/movie_player.cc
r6373 r6382 102 102 103 103 // Find the first video stream and take it 104 video_stream = -1; 105 for(int i = 0; i < format_context->nb_streams; i++) 106 { 107 // NOTE: different code for the 0.4.9-pre1 release of ffmpeg (tardis) 108 // if(format_context->streams[i]->codec.codec_type == CODEC_TYPE_VIDEO) 109 if(format_context->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) 110 { 111 video_stream = i; 112 break; 113 } 114 } 104 video_stream = av_find_default_stream_index(format_context); 115 105 116 106 if(video_stream == -1) … … 141 131 // Assign appropriate parts of buffer to image planes in RGB_frame 142 132 avpicture_fill((AVPicture *)RGB_frame, buffer, PIX_FMT_RGB24, codec_context->width, codec_context->height); 133 134 // data buffer for the texture 135 data = new uint8_t[codec_context->width*codec_context->height*3*sizeof(uint8_t)]; 143 136 144 137 // Calculate fps … … 192 185 codec_context->pix_fmt, codec_context->width, codec_context->height); 193 186 194 data = 0;195 data = new uint8_t[codec_context->width*codec_context->height*3*sizeof(uint8_t)];196 187 for(int i = 0; i < codec_context->height; i++) 197 188 memcpy(&data[i*codec_context->width*3], ((AVPicture*)RGB_frame)->data[0]+i * … … 247 238 data); 248 239 glBindTexture(GL_TEXTURE_2D, 0); 249 250 //avcodec_flush_buffers(codec_context);251 240 252 241 } … … 327 316 } 328 317 329 void MoviePlayer::start( unsigned int start_time)318 void MoviePlayer::start(float start_time) 330 319 { 331 320 status = PLAY; … … 339 328 void MoviePlayer::resume() 340 329 { 341 if(status == STOP) 342 this->start(0); 343 else 330 if(status == PAUSE) 331 { 344 332 status = PLAY; 345 346 PRINTF(0)("resume\n");333 PRINTF(0)("resume\n"); 334 } 347 335 } 348 336 349 337 void MoviePlayer::pause() 350 338 { 351 if(status != STOP) 339 if(status == PLAY) 340 { 352 341 status = PAUSE; 353 354 PRINTF(0)("pause\n");342 PRINTF(0)("pause\n"); 343 } 355 344 } 356 345
Note: See TracChangeset
for help on using the changeset viewer.