Last change
on this file since 6160 was
6160,
checked in by hdavid, 18 years ago
|
branches/avi_play: frames are displayed correct and fast…took me only 3 days to find out that the only faut was wrong number in the SDL_CreateRGBSurfaceFrom call :-/
|
File size:
1.2 KB
|
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 | |
---|
11 | #ifdef HAVE_AVFORMAT_H |
---|
12 | #include <avformat.h> |
---|
13 | #else |
---|
14 | #include <ffmpeg/avformat.h> |
---|
15 | #endif |
---|
16 | |
---|
17 | |
---|
18 | #include "glincl.h" |
---|
19 | |
---|
20 | /* include base_object.h since all classes are derived from this one */ |
---|
21 | #include "base_object.h" |
---|
22 | |
---|
23 | #include <SDL.h> |
---|
24 | |
---|
25 | /* using namespace std is default, this needs to be here */ |
---|
26 | using namespace std; |
---|
27 | |
---|
28 | class MediaContainer : public BaseObject |
---|
29 | { |
---|
30 | |
---|
31 | private: |
---|
32 | |
---|
33 | double fps; |
---|
34 | Uint32 rmask, gmask, bmask; |
---|
35 | SDL_Surface *surface; |
---|
36 | uint8_t* data; |
---|
37 | |
---|
38 | AVFormatContext* format_context; |
---|
39 | AVCodecContext* codec_context; |
---|
40 | AVCodec* codec; |
---|
41 | AVFrame* frame; |
---|
42 | AVPacket packet; |
---|
43 | AVPicture* picture; |
---|
44 | AVFrame* RGB_frame; |
---|
45 | |
---|
46 | int num_bytes; |
---|
47 | uint8_t *buffer; |
---|
48 | int video_stream; |
---|
49 | |
---|
50 | public: |
---|
51 | |
---|
52 | MediaContainer(const char* filename); |
---|
53 | ~MediaContainer(); |
---|
54 | |
---|
55 | SDL_Surface* getFrame(int frame_number); |
---|
56 | SDL_Surface* getNextFrame(); |
---|
57 | void loadMedia(const char* filename); |
---|
58 | |
---|
59 | int getHeight(); |
---|
60 | int getWidth(); |
---|
61 | int getFrameNumber(); |
---|
62 | double getFPS(); |
---|
63 | |
---|
64 | /* prints some information about the |
---|
65 | media file for debug reasons */ |
---|
66 | void printMediaInformation(); |
---|
67 | void printPacketInformation(); |
---|
68 | void saveCurrentFrame(); |
---|
69 | |
---|
70 | }; |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | #endif /* _MEDIA_CONTAINER */ |
---|
Note: See
TracBrowser
for help on using the repository browser.