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 "sdlincl.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 | GLuint getTexture(); |
---|
81 | |
---|
82 | void setFPS(float fps); |
---|
83 | float getFPS(); |
---|
84 | const MP_STATUS getStatus(); |
---|
85 | void printInformation(); |
---|
86 | |
---|
87 | private: |
---|
88 | |
---|
89 | void init(); |
---|
90 | void getNextFrame(); |
---|
91 | void skipFrame(int frames); |
---|
92 | bool gotoFrame(int frames); |
---|
93 | |
---|
94 | }; |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | #endif // _MOVIE_PLAYER |
---|
Note: See
TracBrowser
for help on using the repository browser.