
#ifndef _H_VIDEODEV_DUMPFILE_H_
#define _H_VIDEODEV_DUMPFILE_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>
// #include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
// #include <sys/mman.h>
// #include <linux/videodev2.h>

#include <list>
#include <string>

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


class VideoDev_Dumpfile: public VideoDev {
private:
	ConvertData cdata;
	int fd;
	uint32_t w;
	uint32_t h;
	uint32_t pixformat;
	off_t filesize;
	off_t filepos;
	struct timeval starttv;
	unsigned char *inframe;
	uint32_t inframe_nexttime;
	int inframe_maxsize;
	int inframe_size;
	int fixedframesize;

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

	int ReadFrame();
public:
	VideoDev_Dumpfile();
	~VideoDev_Dumpfile();
	int GetDeviceList(std::list<std::string> *list);
	int GetDeviceFormats(string device, std::list<string> *formats) { return VDEV_STATUS_OK; };
	int GetDeviceResolutions(string device, std::list<string> *formats) { return VDEV_STATUS_OK; };
};

#endif
