
#ifndef _H_VIDEODEV_SVBCAM_H_
#define _H_VIDEODEV_SVBCAM_H_

#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <getopt.h>
#ifndef BUILD_WINDOWS
#include <sys/ioctl.h>
#endif
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#ifndef BUILD_WINDOWS
#include <sys/mman.h>
#include <linux/videodev2.h>
#endif

#include <list>
#include <string>

#ifdef BUILD_WINDOWS
#include "windows.h"
#endif

#include "convert.h"
#include "gui.h"
#include "videodev.h"


class VideoDev_SVBCam: public VideoDev {
private:
	unsigned char *inframe;
	int inframe_size;
	int inframe_w, inframe_h;
	int inframe_pixfmt;

	ConvertData cdata;
	int camid;

	int Grab(VideoFrameRaw *vfr);
	int Open();
	int Close();
	int CaptureStart();
	int CaptureStop();
	int SetDevCtrl(unsigned int id, int value);
	int GetDevCtrl(unsigned int id, int *value);

	void print_error(int err);
public:
	VideoDev_SVBCam();
	~VideoDev_SVBCam();
	int GetDeviceList(std::list<std::string> *list);
	int GetDeviceFormats(string device, std::list<string> *formats);
	int GetDeviceResolutions(string device, std::list<string> *formats) { return VDEV_STATUS_OK; };
};

#endif
