#ifndef LIBRARIES_OPENDIVX_H
#define LIBRARIES_OPENDIVX_H

#define DEC_OPT_INIT 32768
#define DEC_OPT_RELEASE 65536
#define DEC_OPT_SETPP 0x20000
#define DEC_OPT_DECODE_RGB 0
#define DEC_OPT_DECODE_YUV 1
#define DIVX_FORCE_68k 2
#define DEC_OPT_DECODE_GREY 4

#define ENC_OPT_KEY 1
#define ENC_OPT_WRITE 1024
#define ENC_OPT_INIT 32768
#define ENC_OPT_RELEASE 65536

#define DEC_OK 0
#define DEC_MEMORY 1
#define DEC_BAD_FORMAT 2
#define DEC_OPERATION_UNIMPLEMENTED 3

#define ENC_OK 0
#define ENC_MEMORY 1
#define ENC_BAD_FORMAT 2

typedef struct _DEC_PARAM_
{
	int x_dim; // x dimension of the frames to be decoded
	int y_dim; // y dimension of the frames to be decoded
	unsigned long color_depth;
} DEC_PARAM;

typedef struct _DEC_FRAME_
{
	void *bmp; // the 24-bit decoded bitmap
	void *bitstream; // the decoder buffer
	long length; // the lenght of the decoder stream
	int render_flag;
} DEC_FRAME;

typedef struct _DEC_SET_
{
	int postproc_level; // valid interval are [0..100]
} DEC_SET;

typedef struct _ENC_PARAM_ {
	int x_dim;		// the x dimension of the frames to be encoded
	int y_dim;		// the y dimension of the frames to be encoded
	float framerate;// the frame rate of the sequence to be encoded
	long bitrate;	// the bitrate of the target encoded stream
	long rc_period; // the intended keyframe_rate for encoding
	int max_quantizer; // the upper limit of the quantizer
	int min_quantizer; // the lower limit of the quantizer
	int search_range; // the forward search range for motion estimation
	int flip; // the flag to indicate whether to flip the input image
} ENC_PARAM;

typedef struct _ENC_FRAME_ {
	void *bmp;		// the 24-bit bitmap to be encoded
	void *bitstream;// the buffer for encoded bitstream
	long length;	// the length of the encoded bitstream
} ENC_FRAME;

typedef struct _ENC_RESULT_ {
	int isKeyFrame; // the current frame is encoded as a key frame
} ENC_RESULT;

#endif