00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <ardev/ardevconfig.h>
00021 #ifdef HAVE_FFMPEG
00022
00023 #ifndef FFMPEG_H
00024 #define FFMPEG_H
00025
00026 #include <ffmpeg/avformat.h>
00027
00028 class ffmpeg
00029 {
00030 public:
00031
00032 ffmpeg(char * filename, int width, int height, int framerate = 25);
00033 ~ffmpeg();
00034
00035 int OpenStream();
00036 int WriteFrame(AVFrame * frame);
00037 int CloseStream();
00038
00039 AVFrame *alloc_pictureframe(int pix_fmt, int width, int height);
00040 void free_pictureframe(AVFrame * picture);
00041 private:
00042 AVStream *add_video_stream(AVFormatContext *oc, int codec_id);
00043
00044 void open_video(AVFormatContext *oc, AVStream *st);
00045 void write_video_frame(AVFormatContext *oc, AVStream *st, AVFrame * in_picture);
00046 void close_video(AVFormatContext *oc, AVStream *st);
00047
00048 int Width, Height, FrameRate;
00049 char * Filename;
00050
00051 AVOutputFormat *fmt;
00052 AVFormatContext *oc;
00053 AVStream *video_st;
00054
00055 AVFrame * picture;
00056 uint8_t *video_outbuf;
00057 int frame_count, video_outbuf_size;
00058 };
00059
00060 #endif
00061
00062 #endif
00063