#ifndef _VIDEOFRAME_H_
#define _VIDEOFRAME_H_

#include "gui.h"
#include "config.h"


class FloatImage {
public:
	int w;
	int h;
	uint32_t size;
	float *data;

	FloatImage();
	~FloatImage();

	FloatImage operator=(FloatImage rightside);

	void SetSize(int nw, int nh);
	void SetW(int nw) { SetSize(nw, h); };
	void SetH(int nh) { SetSize(w, nh); };
	void CopyFrom(FloatImage *source);
	void Delete() { w = 0; h = 0; };
};


/*
 * contains RGB data
 */
class VideoFrame {
private:
public:
	int w;
	int h;
	uint32_t size;
	unsigned char *data;

	VideoFrame();
	~VideoFrame();

	VideoFrame operator=(VideoFrame rightside);

	void SetSize(int nw, int nh);
	void SetW(int nw) { SetSize(nw, h); };
	void SetH(int nh) { SetSize(w, nh); };
	void CopyFrom(VideoFrame *source);
	void CopyFrom(FloatImage *source);
	void CopyTo(FloatImage *dest);
	void ToPixbuf(GdkPixbuf** dest);
	void Delete() { w = 0; h = 0; };
};


class VideoFrameRaw {
private:
public:
	unsigned char *data;
	int size;
	int w;
	int h;
	uint32_t pixfmt;
	VideoFrameRaw();
	~VideoFrameRaw();
	int ReAlloc(int newsize);
	int CopyFrom(VideoFrame *src);
	int CopyFrom(VideoFrameRaw *src);
	int CopyFrom(int spixfmt, int sw, int sh, int ssize, unsigned char *sdata);
	int RectCopyFrom(VideoFrameRaw *src, int rectx, int recty, int rectw, int recth);
	void Delete() { w = 0; h = 0; pixfmt = 0;};
};



#endif

