#include "mjpeg_decoder.h"
#include "mjpeg_encoder.h"
#include <plugin.h>
#include <fourcc.h>

using namespace std;

static int mjpg_codecs[] = { fccmjpg, fccMJPG, 0 };
static char mjpeg_about[] = "Open-source Motion JPEG codec, based on libjpeg.";
static const CodecInfo MPJPEG_info(mjpg_codecs, "OS Motion JPEG", "", mjpeg_about, CodecInfo::Plugin);

static vector<CodecInfo> s_plugin_props;

extern "C" int GetPluginVersion()
{
    return PLUGIN_API_VERSION;
}

extern "C" const vector<CodecInfo>& RegisterPlugin()
{
    if (!s_plugin_props.size())
	s_plugin_props.push_back(MPJPEG_info);
    return s_plugin_props;
}

extern "C" IVideoEncoder* CreateVideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh)
{
    return new MJPEG_VideoEncoder(info, compressor, bh);
}

extern "C" IVideoDecoder* CreateVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip)
{
    return new MJPEG_VideoDecoder(info, bh, flip);
}
