Rev | Line | |
---|
[6663] | 1 | /*! |
---|
| 2 | * @file recorder.h |
---|
[6981] | 3 | * |
---|
[6663] | 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _RECORDER_H |
---|
| 7 | #define _RECORDER_H |
---|
| 8 | |
---|
[6775] | 9 | #include "sdlincl.h" |
---|
[6663] | 10 | |
---|
| 11 | #ifdef HAVE_AVFORMAT_H |
---|
| 12 | #include <avformat.h> |
---|
| 13 | #else |
---|
| 14 | #include <ffmpeg/avformat.h> |
---|
| 15 | #endif |
---|
| 16 | |
---|
| 17 | #include "glincl.h" |
---|
| 18 | #include "world_entity.h" |
---|
| 19 | |
---|
| 20 | class Recorder : public WorldEntity |
---|
| 21 | { |
---|
| 22 | public: |
---|
| 23 | Recorder (const TiXmlElement* root = NULL); |
---|
[6981] | 24 | virtual ~Recorder (); |
---|
[6663] | 25 | |
---|
| 26 | virtual void draw () const; |
---|
| 27 | virtual void tick (float dt); |
---|
| 28 | |
---|
| 29 | virtual void loadParams(const TiXmlElement* root); |
---|
| 30 | |
---|
| 31 | private: |
---|
[7221] | 32 | void initVideo(const std::string& filename); |
---|
[6663] | 33 | void addVideoStream(); |
---|
| 34 | void openVideo(); |
---|
| 35 | void closeVideo(); |
---|
| 36 | void allocPicture(); |
---|
| 37 | void writeVideoFrame(); |
---|
| 38 | void fillYuvImage(); |
---|
[6681] | 39 | |
---|
| 40 | void setStreamDuration(float duration); |
---|
| 41 | void setFPS(float fps); |
---|
[7221] | 42 | |
---|
| 43 | |
---|
| 44 | private: |
---|
| 45 | AVFrame* picture; |
---|
| 46 | uint8_t* buffer; |
---|
| 47 | int frame_count; |
---|
| 48 | int buffer_size; |
---|
| 49 | |
---|
| 50 | AVOutputFormat* output_format; |
---|
| 51 | AVFormatContext* format_context; |
---|
| 52 | AVCodecContext* codec_context; |
---|
| 53 | AVCodec* codec; |
---|
| 54 | AVStream* video_stream; |
---|
| 55 | AVPacket packet; |
---|
| 56 | double video_pts; |
---|
| 57 | |
---|
| 58 | uint8_t* picture_buf; |
---|
| 59 | int size; |
---|
| 60 | |
---|
| 61 | int height; |
---|
| 62 | int width; |
---|
| 63 | float time; |
---|
| 64 | |
---|
| 65 | float stream_duration; |
---|
| 66 | float stream_frame_rate; |
---|
| 67 | int stream_nb_frames; |
---|
| 68 | |
---|
| 69 | AVFrame* RGB_frame; |
---|
[6663] | 70 | }; |
---|
| 71 | |
---|
| 72 | #endif /* _RECORDER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.