
#ifndef _CONVERT_H_
#define _CONVERT_H_

#include <list>
#include <string>
#include <setjmp.h>

#include "video.h"
#include "videoframe.h"

#ifndef CLEAR
#define CLEAR(x) memset (&(x), 0, sizeof (x))
#endif

struct {
	struct jpeg_decompress_struct cinfo;
} typedef ConvertData;

int Convert (ConvertData *cdata, VideoFrame *dest, unsigned char *ptrsrc, int srcsize, uint32_t pixelformat, int srcw, int srch);
int ConvertStart(ConvertData *cdata, uint32_t pixelformat);
int ConvertStop(ConvertData *cdata, uint32_t pixelformat);

int PixCopy(unsigned char *srcdata, uint32_t srcpixfmt, int srcw, int srch,
			unsigned char **dstdataptr, int *dstsize, int *dstw, int *dsth,
			int regionx, int regiony, int regionw, int regionh);

extern uint32_t convert_pixelformats[];
std::string convert_from_pixelformat (uint32_t fmt);
uint32_t convert_to_pixelformat(std::string s);


#endif
