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 | { |
---|
[9869] | 22 | ObjectListDeclaration(Recorder); |
---|
[6663] | 23 | public: |
---|
| 24 | Recorder (const TiXmlElement* root = NULL); |
---|
[6981] | 25 | virtual ~Recorder (); |
---|
[6663] | 26 | |
---|
| 27 | virtual void draw () const; |
---|
| 28 | virtual void tick (float dt); |
---|
| 29 | |
---|
| 30 | virtual void loadParams(const TiXmlElement* root); |
---|
| 31 | |
---|
| 32 | private: |
---|
[7221] | 33 | void initVideo(const std::string& filename); |
---|
[6663] | 34 | void addVideoStream(); |
---|
| 35 | void openVideo(); |
---|
| 36 | void closeVideo(); |
---|
| 37 | void allocPicture(); |
---|
| 38 | void writeVideoFrame(); |
---|
| 39 | void fillYuvImage(); |
---|
[6681] | 40 | |
---|
| 41 | void setStreamDuration(float duration); |
---|
| 42 | void setFPS(float fps); |
---|
[7221] | 43 | |
---|
| 44 | |
---|
| 45 | private: |
---|
| 46 | AVFrame* picture; |
---|
| 47 | uint8_t* buffer; |
---|
| 48 | int frame_count; |
---|
| 49 | int buffer_size; |
---|
| 50 | |
---|
| 51 | AVOutputFormat* output_format; |
---|
| 52 | AVFormatContext* format_context; |
---|
| 53 | AVCodecContext* codec_context; |
---|
| 54 | AVCodec* codec; |
---|
| 55 | AVStream* video_stream; |
---|
| 56 | AVPacket packet; |
---|
| 57 | double video_pts; |
---|
| 58 | |
---|
| 59 | uint8_t* picture_buf; |
---|
| 60 | int size; |
---|
| 61 | |
---|
| 62 | int height; |
---|
| 63 | int width; |
---|
| 64 | float time; |
---|
| 65 | |
---|
| 66 | float stream_duration; |
---|
| 67 | float stream_frame_rate; |
---|
| 68 | int stream_nb_frames; |
---|
| 69 | |
---|
| 70 | AVFrame* RGB_frame; |
---|
[6663] | 71 | }; |
---|
| 72 | |
---|
| 73 | #endif /* _RECORDER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.