source:
orxonox.OLD/trunk/src/lib/graphics/importer/movie_player.h
@
10585
Last change on this file since 10585 was 9869, checked in by bensch, 18 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 | { | |
[9869] | 33 | ObjectListDeclaration(MoviePlayer); |
[5939] | 34 | |
35 | private: | |
36 | ||
[6486] | 37 | AVFormatContext* format_context; |
38 | AVCodecContext* codec_context; | |
39 | AVCodec* codec; | |
40 | AVFrame* frame; | |
41 | AVPacket packet; | |
42 | AVFrame* RGB_frame; | |
[5939] | 43 | |
[6486] | 44 | GLuint texture; |
45 | uint8_t* data; | |
46 | uint8_t* buffer; | |
47 | int num_bytes; | |
48 | int video_stream; | |
49 | ||
[6600] | 50 | MP_STATUS status; |
[6486] | 51 | float timer; |
52 | int start_frame; | |
53 | int actual_frame; | |
54 | int frame_number; | |
55 | float fps; | |
56 | int duration; | |
[6731] | 57 | bool mediaLoaded; |
[6486] | 58 | |
[5939] | 59 | public: |
60 | ||
[7221] | 61 | MoviePlayer(const std::string& filename = ""); |
[6981] | 62 | virtual ~MoviePlayer(); |
[5939] | 63 | |
[7221] | 64 | bool loadMovie(const std::string& filename); |
[6486] | 65 | |
[6731] | 66 | void start(float start_time); |
67 | void resume(); | |
68 | void pause(); | |
69 | void stop(); | |
[5939] | 70 | |
[6731] | 71 | void tick(float dt); |
72 | GLuint getTexture(); | |
[5939] | 73 | |
[6731] | 74 | void setFPS(float fps); |
75 | float getFPS(); | |
76 | const MP_STATUS getStatus(); | |
[6486] | 77 | void printInformation(); |
[5939] | 78 | |
[6486] | 79 | private: |
[6600] | 80 | |
[6486] | 81 | void getNextFrame(); |
82 | void skipFrame(int frames); | |
83 | bool gotoFrame(int frames); | |
84 | ||
[6731] | 85 | void unloadMedia(); |
86 | ||
[5939] | 87 | }; |
88 | ||
[6486] | 89 | #endif // _MOVIE_PLAYER |
Note: See TracBrowser
for help on using the repository browser.