source:
orxonox.OLD/trunk/src/lib/graphics/importer/movie_player.h
@
8927
Last change on this file since 8927 was 7221, checked in by bensch, 19 years ago | |
---|---|
File size: 1.4 KB |
Rev | Line | |
---|---|---|
[5939] | 1 | /*! |
2 | * @file movie_player.h | |
3 | * Manages the media files | |
4 | ||
5 | */ | |
6 | ||
7 | #ifndef _MOVIE_PLAYER | |
8 | #define _MOVIE_PLAYER | |
9 | ||
[6607] | 10 | #include "sdlincl.h" |
[6486] | 11 | |
12 | #ifdef HAVE_AVFORMAT_H | |
13 | #include <avformat.h> | |
14 | #else | |
15 | #include <ffmpeg/avformat.h> | |
16 | #endif | |
17 | ||
[5939] | 18 | #include "glincl.h" |
[6486] | 19 | #include "texture.h" |
20 | ||
21 | // include base_object.h since all classes are derived from this one | |
[5939] | 22 | #include "base_object.h" |
23 | ||
[6486] | 24 | // The state of the MoviePlayer |
[5950] | 25 | typedef enum MP_STATUS { |
26 | PLAY, | |
[6731] | 27 | PAUSE, |
28 | STOP | |
[5950] | 29 | }; |
30 | ||
[5939] | 31 | class MoviePlayer : public BaseObject |
32 | { | |
33 | ||
34 | private: | |
35 | ||
[6486] | 36 | AVFormatContext* format_context; |
37 | AVCodecContext* codec_context; | |
38 | AVCodec* codec; | |
39 | AVFrame* frame; | |
40 | AVPacket packet; | |
41 | AVFrame* RGB_frame; | |
[5939] | 42 | |
[6486] | 43 | GLuint texture; |
44 | uint8_t* data; | |
45 | uint8_t* buffer; | |
46 | int num_bytes; | |
47 | int video_stream; | |
48 | ||
[6600] | 49 | MP_STATUS status; |
[6486] | 50 | float timer; |
51 | int start_frame; | |
52 | int actual_frame; | |
53 | int frame_number; | |
54 | float fps; | |
55 | int duration; | |
[6731] | 56 | bool mediaLoaded; |
[6486] | 57 | |
[5939] | 58 | public: |
59 | ||
[7221] | 60 | MoviePlayer(const std::string& filename = ""); |
[6981] | 61 | virtual ~MoviePlayer(); |
[5939] | 62 | |
[7221] | 63 | bool loadMovie(const std::string& filename); |
[6486] | 64 | |
[6731] | 65 | void start(float start_time); |
66 | void resume(); | |
67 | void pause(); | |
68 | void stop(); | |
[5939] | 69 | |
[6731] | 70 | void tick(float dt); |
71 | GLuint getTexture(); | |
[5939] | 72 | |
[6731] | 73 | void setFPS(float fps); |
74 | float getFPS(); | |
75 | const MP_STATUS getStatus(); | |
[6486] | 76 | void printInformation(); |
[5939] | 77 | |
[6486] | 78 | private: |
[6600] | 79 | |
[6486] | 80 | void getNextFrame(); |
81 | void skipFrame(int frames); | |
82 | bool gotoFrame(int frames); | |
83 | ||
[6731] | 84 | void unloadMedia(); |
85 | ||
[5939] | 86 | }; |
87 | ||
[6486] | 88 | #endif // _MOVIE_PLAYER |
Note: See TracBrowser
for help on using the repository browser.