Last change
on this file since 6550 was
6532,
checked in by bensch, 19 years ago
|
orxonox/trunk: merged branches/movie_play to the trunk. no conflicts, but a minor virtual function
|
File size:
1.4 KB
|
Line | |
---|
1 | /*! |
---|
2 | * @file movie_player.h |
---|
3 | * Manages the media files |
---|
4 | |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _MOVIE_PLAYER |
---|
8 | #define _MOVIE_PLAYER |
---|
9 | |
---|
10 | #include <SDL.h> |
---|
11 | |
---|
12 | #ifdef HAVE_AVFORMAT_H |
---|
13 | #include <avformat.h> |
---|
14 | #else |
---|
15 | #include <ffmpeg/avformat.h> |
---|
16 | #endif |
---|
17 | |
---|
18 | #include "glincl.h" |
---|
19 | |
---|
20 | #include "light.h" |
---|
21 | #include "texture.h" |
---|
22 | #include "material.h" |
---|
23 | #include "primitive_model.h" |
---|
24 | |
---|
25 | // include base_object.h since all classes are derived from this one |
---|
26 | #include "base_object.h" |
---|
27 | |
---|
28 | // The state of the MoviePlayer |
---|
29 | typedef enum MP_STATUS { |
---|
30 | PLAY, |
---|
31 | PAUSE, |
---|
32 | STOP |
---|
33 | }; |
---|
34 | |
---|
35 | class MoviePlayer : public BaseObject |
---|
36 | { |
---|
37 | |
---|
38 | private: |
---|
39 | |
---|
40 | Model* model; |
---|
41 | Material* material; |
---|
42 | |
---|
43 | AVFormatContext* format_context; |
---|
44 | AVCodecContext* codec_context; |
---|
45 | AVCodec* codec; |
---|
46 | AVFrame* frame; |
---|
47 | AVPacket packet; |
---|
48 | AVFrame* RGB_frame; |
---|
49 | |
---|
50 | GLuint texture; |
---|
51 | uint8_t* data; |
---|
52 | uint8_t* buffer; |
---|
53 | int num_bytes; |
---|
54 | int video_stream; |
---|
55 | |
---|
56 | MP_STATUS status; |
---|
57 | float timer; |
---|
58 | int start_frame; |
---|
59 | int actual_frame; |
---|
60 | int frame_number; |
---|
61 | float fps; |
---|
62 | int duration; |
---|
63 | bool loading; |
---|
64 | |
---|
65 | public: |
---|
66 | |
---|
67 | MoviePlayer(const char* filename); |
---|
68 | MoviePlayer(); |
---|
69 | ~MoviePlayer(); |
---|
70 | |
---|
71 | bool loadMovie(const char* filename); |
---|
72 | |
---|
73 | void start(float start_time); |
---|
74 | void resume(); |
---|
75 | void pause(); |
---|
76 | void stop(); |
---|
77 | |
---|
78 | void tick(float dt); |
---|
79 | const void draw(); |
---|
80 | |
---|
81 | void setFPS(float fps); |
---|
82 | float getFPS(); |
---|
83 | const MP_STATUS getStatus(); |
---|
84 | void printInformation(); |
---|
85 | |
---|
86 | private: |
---|
87 | |
---|
88 | void init(); |
---|
89 | void getNextFrame(); |
---|
90 | void skipFrame(int frames); |
---|
91 | bool gotoFrame(int frames); |
---|
92 | |
---|
93 | }; |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | #endif // _MOVIE_PLAYER |
---|
Note: See
TracBrowser
for help on using the repository browser.