/******************************************************** Video encoder interface Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #ifndef _videoencoder_h #define _videoencoder_h #include #include #include #include #include #include #include //#include #include /** * * Video encoder class. * * Usage ( preliminary info ): * * Create encoder object. Call Init(), optionally * set quality and key-frame frequency. Call Start(). * Call QueryOutputSize() to identify maximum possible * size of compressed frame. Allocate buffer of this size. * Pass it as 'dest' in calls to EncodeFrame(). At the end * call Stop(). * * Some codec DLLs have be controlled by special codec-specific * parameters. In Windows you can set them from codec configuration * dialog, but since we are completely GUI-independent, we'll need * an internal method to set them. Currently it is done by calling * static func SetExtendedAttr(), which takes FOURCC of codec, * name of parameter and its integer value. Complete list of * supported attributes can be found in source of function * SetExtendedAttr() ;-) This func should be called before Init() * because values for these attributes are typically stored in * registry and read by codec during object creation. * * The complete scheme looks extremely ugly, but it is in very alpha. * This class was actually written in half an hour at the very beginning * of Avifile and almost didn't change since then. Some day I'll * return here and fix everything. * */ class IVideoEncoder { public: static IVideoEncoder* Create(int compressor, const BITMAPINFOHEADER& bh); static IVideoEncoder* Create(const VideoEncoderInfo& info); virtual void Close() =0; virtual void Start() =0; virtual void Stop() =0; virtual int QueryOutputSize() =0; virtual const BITMAPINFOHEADER& QueryOutputFormat() const =0; virtual int EncodeFrame(CImage* src, char* dest, int* is_keyframe, int* size, int* lpckid=0) =0; virtual int SetQuality(int quality) =0; virtual int GetQuality() =0; virtual int SetKeyFrame(int frequency) =0; virtual int GetKeyFrame() =0; static int GetExtendedAttr(int comp_id, const char* attribute, int &value); static int GetExtendedAttr(int comp_id, const char* attribute, char* value, int size) ; static int SetExtendedAttr(int comp_id, const char* attribute, int value) ; static int SetExtendedAttr(int comp_id, const char* attribute, const char* value) ; static int SetRegValue(int fccHandler, const char* name, int value) ; static int GetRegValue(int fccHandler, const char* name, int* place) ; virtual const CodecInfo& GetCodecInfo() const =0; }; extern std::vector video_codecs; extern std::map > video_attributes; #endif