Changeset 6600 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Jan 18, 2006, 5:25:48 PM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/movie_player.cc
r6532 r6600 49 49 MoviePlayer::~MoviePlayer() 50 50 { 51 delete material;52 delete model;51 //delete material; 52 //delete model; 53 53 54 54 if (glIsTexture(texture)) … … 81 81 loading = false; 82 82 83 material = new Material;83 /*material = new Material; 84 84 material->setDiffuseMap("maps/radialTransparency.png"); 85 85 … … 90 90 (new Light())->setAbsCoor(5.0, 10.0, 40.0); 91 91 (new Light())->setAbsCoor(-10, -20, -100); 92 */ 92 93 } 93 94 … … 195 196 // Free the packet that was allocated by av_read_frame 196 197 av_free_packet(&packet); 197 198 198 199 // Did we get a video frame? 199 200 if(frame_finished) … … 248 249 void MoviePlayer::skipFrame(int frames) 249 250 { 250 251 251 252 while(frames != 0) 252 253 { … … 259 260 avcodec_decode_video(codec_context, frame, &frame_finished, 260 261 packet.data, packet.size); 261 262 262 263 // Did we get a video frame? 263 264 if(frame_finished) … … 269 270 av_free_packet(&packet); 270 271 } 271 272 272 273 this->getNextFrame(); 273 274 … … 307 308 return false; 308 309 } 309 310 310 311 // go from the keyframe to the exact position 311 312 codec_context->hurry_up = 1; … … 327 328 } while(1); 328 329 codec_context->hurry_up = 0; 329 330 330 331 this->frame_number = frames; 331 332 } 332 333 333 334 return true; 334 335 } … … 343 344 status = PLAY; 344 345 timer = 0; 345 346 346 347 this->gotoFrame(start_frame); 347 348 348 349 PRINTF(0)("start\n"); 349 350 } … … 380 381 { 381 382 timer += dt; 382 actual_frame = timer * fps + start_frame;383 actual_frame = (int)(timer * fps + start_frame); 383 384 if(actual_frame != frame_number) 384 385 { … … 387 388 else 388 389 this->skipFrame(actual_frame - frame_number - 1); 389 } 390 } 390 391 //PRINTF(0)("frame_number: %i\n", frame_number); 391 392 } 392 393 } 393 394 394 const void MoviePlayer::draw()395 /*const void MoviePlayer::draw() 395 396 { 396 397 material->select(); … … 399 400 400 401 LightManager::getInstance()->draw(); 402 }*/ 403 404 GLuint MoviePlayer::getTexture() 405 { 406 return this->texture; 401 407 } 402 408 -
trunk/src/lib/graphics/importer/movie_player.h
r6532 r6600 18 18 #include "glincl.h" 19 19 20 #include "light.h"20 //#include "light.h" 21 21 #include "texture.h" 22 #include "material.h"23 #include "primitive_model.h"22 //#include "material.h" 23 //#include "primitive_model.h" 24 24 25 25 // include base_object.h since all classes are derived from this one … … 29 29 typedef enum MP_STATUS { 30 30 PLAY, 31 32 31 PAUSE, 32 STOP 33 33 }; 34 34 … … 38 38 private: 39 39 40 Model* model;41 Material* material;40 //Model* model; 41 //Material* material; 42 42 43 43 AVFormatContext* format_context; … … 54 54 int video_stream; 55 55 56 MP_STATUS status; 56 MP_STATUS status; 57 57 float timer; 58 58 int start_frame; … … 61 61 float fps; 62 62 int duration; 63 bool loading; 63 bool loading; 64 64 65 65 public: … … 71 71 bool loadMovie(const char* filename); 72 72 73 74 75 76 73 void start(float start_time); 74 void resume(); 75 void pause(); 76 void stop(); 77 77 78 void tick(float dt); 79 const void draw(); 78 void tick(float dt); 79 //const void draw(); 80 GLuint getTexture(); 80 81 81 82 83 82 void setFPS(float fps); 83 float getFPS(); 84 const MP_STATUS getStatus(); 84 85 void printInformation(); 85 86 86 87 private: 87 88 88 89 void init(); 89 90 void getNextFrame();
Note: See TracChangeset
for help on using the changeset viewer.