| 1 |
#ifndef __VIDEOENCODER_H |
| 2 |
#define __VIDEOENCODER_H |
| 3 |
/******************************************************** |
| 4 |
|
| 5 |
Video encoder interface |
| 6 |
Copyright 2000 Eugene Kuznetsov ([email protected]) |
| 7 |
|
| 8 |
*********************************************************/ |
| 9 |
|
| 10 |
#include "videoencoder.h" |
| 11 |
#include "Module.h" |
| 12 |
|
| 13 |
AVM_BEGIN_NAMESPACE; |
| 14 |
|
| 15 |
class VideoEncoder: public IVideoEncoder |
| 16 |
{ |
| 17 |
public: |
| 18 |
VideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& header); |
| 19 |
~VideoEncoder(); |
| 20 |
// |
| 21 |
// Encodes single frame |
| 22 |
// On success, is_keyframe contains 0 if frame was encoded into delta frame, otherwise AVIIF_KEYFRAME (?) |
| 23 |
// size receives size of compressed frame |
| 24 |
// |
| 25 |
virtual int EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid = 0); |
| 26 |
// |
| 27 |
// Queries encoder about desired buffer size for compression |
| 28 |
// You should allocate at least this much bytes for dest ( arg for EncodeFrame ) |
| 29 |
// |
| 30 |
virtual const BITMAPINFOHEADER& GetOutputFormat() const; |
| 31 |
virtual size_t GetOutputSize() const; |
| 32 |
|
| 33 |
virtual int Start(); |
| 34 |
virtual int Stop(); |
| 35 |
// |
| 36 |
// Quality takes values from 0 to 10000, 10000 the best |
| 37 |
// |
| 38 |
virtual int GetQuality() const { return m_iQuality; } |
| 39 |
virtual int SetQuality(int quality); |
| 40 |
virtual int GetKeyFrame() const { return m_iKeyRate; } |
| 41 |
virtual int SetKeyFrame(int frequency); |
| 42 |
virtual float GetFps() const { return m_fFps; } |
| 43 |
virtual int SetFps(float fps); |
| 44 |
|
| 45 |
int init(); // avoid throws |
| 46 |
protected: |
| 47 |
void setDivXRegs(void); |
| 48 |
Module* m_pModule; |
| 49 |
HIC m_HIC; |
| 50 |
BitmapInfo* m_bh; |
| 51 |
BitmapInfo* m_bhorig; |
| 52 |
BITMAPINFOHEADER* m_obh; |
| 53 |
BITMAPINFOHEADER* m_obhformat; |
| 54 |
char* m_prev; |
| 55 |
char* m_pConfigData; |
| 56 |
int m_iConfigDataSize; |
| 57 |
int m_comp_id; |
| 58 |
int m_iState; |
| 59 |
int m_iFrameNum; |
| 60 |
int m_iQuality; |
| 61 |
int m_iKeyRate; |
| 62 |
int m_iBitrate; |
| 63 |
int m_iLastKF; |
| 64 |
float m_fFps; |
| 65 |
}; |
| 66 |
|
| 67 |
AVM_END_NAMESPACE; |
| 68 |
|
| 69 |
#endif // __VIDEOENCODER_H |