#ifndef AVIFILE_CREATORS_H
#define AVIFILE_CREATORS_H

#include <formats.h>
#include <infotypes.h>

#include <videodecoder.h>
#include <videoencoder.h>
#include <audiodecoder.h>
#include <audioencoder.h>

#define CREATORS_BEGIN_NAMESPACE    namespace Creators {
#define CREATORS_END_NAMESPACE      };

CREATORS_BEGIN_NAMESPACE
/**
 *	Attempts to create decoder for specified format. Returns
 *	valid interface on success, 0 on failure.
 */

IAudioDecoder* CreateAudioDecoder(const WAVEFORMATEX* format);

/**
 * Creates the encoder for specified format. Pass desired format id in
 * fourcc ( see lib/libwin32/loader/wine/mmreg.h
 * (you could be more specific with the codec's name)
 * or lib/audiodecoder/audiodecoder.cpp
 * for values ) and format of input data in fmt.
 * Returns interface on success, 0 on failure.
 */
IAudioEncoder* CreateAudioEncoder(fourcc_t compressor, const WAVEFORMATEX* fmt);
IVideoDecoder* CreateVideoDecoder(const BITMAPINFOHEADER& bh, int depth = 24, int flip = 0);
IVideoEncoder* CreateVideoEncoder(fourcc_t compressor, const BITMAPINFOHEADER& bh, const char* cname = 0);
IVideoEncoder* CreateVideoEncoder(const VideoEncoderInfo& info);
void FreeAudioDecoder(IAudioDecoder* decoder);
void FreeAudioEncoder(IAudioEncoder* encoder);
void FreeVideoDecoder(IVideoDecoder* decoder);
void FreeVideoEncoder(IVideoEncoder* encoder);

int GetCodecAttr(const CodecInfo& info, const char* attribute, int& value)
;
int SetCodecAttr(const CodecInfo& info, const char* attribute, int value)
;
int GetCodecAttr(const CodecInfo& info, const char* attribute, char* value, int size)
;
int SetCodecAttr(const CodecInfo& info, const char* attribute, const char* value)
;

/**
 * list of prefered codecs - delimited with commas  ","
 * e.g: DivX ;-) fast-motion,ATI VCR-1,
 *
 * spaces are important!
 * comma could not be in the codecs name!
 */
int SortVideoCodecs(const char* orderlist);
int SortAudioCodecs(const char* orderlist);

std::string GetError();

CREATORS_END_NAMESPACE

#endif //AVIFILE_CREATORS_H
