Line | |
---|
1 | /*! |
---|
2 | * @file media_container.h |
---|
3 | * Manages the media files |
---|
4 | |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _MEDIA_CONTAINER |
---|
8 | #define _MEDIA_CONTAINER |
---|
9 | |
---|
10 | #include <SDL.h> |
---|
11 | #include <vector> |
---|
12 | |
---|
13 | #ifdef HAVE_AVFORMAT_H |
---|
14 | #include <avformat.h> |
---|
15 | #else |
---|
16 | #include <ffmpeg/avformat.h> |
---|
17 | #endif |
---|
18 | |
---|
19 | /* include base_object.h since all classes are derived from this one */ |
---|
20 | #include "base_object.h" |
---|
21 | |
---|
22 | /* using namespace std is default, this needs to be here */ |
---|
23 | using namespace std; |
---|
24 | |
---|
25 | class MediaContainer : public BaseObject |
---|
26 | { |
---|
27 | |
---|
28 | private: |
---|
29 | |
---|
30 | double fps; |
---|
31 | SDL_Surface* surface; |
---|
32 | uint8_t* data; |
---|
33 | |
---|
34 | AVFormatContext* format_context; |
---|
35 | AVCodecContext* codec_context; |
---|
36 | AVCodec* codec; |
---|
37 | AVFrame* frame; |
---|
38 | AVPacket packet; |
---|
39 | AVFrame* RGB_frame; |
---|
40 | AVPicture* picture; |
---|
41 | |
---|
42 | int num_bytes; |
---|
43 | uint8_t *buffer; |
---|
44 | int video_stream; |
---|
45 | int duration; |
---|
46 | |
---|
47 | vector<SDL_Surface*> surface_list; |
---|
48 | |
---|
49 | public: |
---|
50 | |
---|
51 | MediaContainer(const char* filename); |
---|
52 | ~MediaContainer(); |
---|
53 | |
---|
54 | SDL_Surface* getFrame(float time_stamp); |
---|
55 | SDL_Surface* getNextFrame(); |
---|
56 | vector<SDL_Surface*> getFrameList(); |
---|
57 | void loadMedia(const char* filename); |
---|
58 | |
---|
59 | int getHeight(); |
---|
60 | int getWidth(); |
---|
61 | int getFrameNumber(); |
---|
62 | double getFPS(); |
---|
63 | |
---|
64 | void saveCurrentFrame(); |
---|
65 | |
---|
66 | void printMediaInformation(); |
---|
67 | void printPacketInformation(); |
---|
68 | |
---|
69 | }; |
---|
70 | |
---|
71 | |
---|
72 | #endif /* _MEDIA_CONTAINER */ |
---|
Note: See
TracBrowser
for help on using the repository browser.