You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SimpleSkyCam/videodev-simulation.h

91 lines
1.7 KiB

#ifndef _H_VIDEODEV_SIMULATION_H_
#define _H_VIDEODEV_SIMULATION_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 "convert.h"
#include "gui.h"
#include "videodev.h"
struct SimAxisCtl {
int active;
double vdest;
double v;
double defLen;
double defAngle;
};
class Simulation {
private:
int w;
int h;
double posX;
double posY;
double dAngle;
double dLen;
int running;
struct SimAxisCtl axis[2];
GMutex mutex;
public:
Simulation();
~Simulation();
void GetPos (int *nx, int *ny);
void ThreadProcess();
void Start();
void Stop();
void Reset();
void AxisSetValue(int a, double v);
void AxisStop();
void SetResolution (int w, int h);
void LockMutex() { g_mutex_lock(&mutex); };
void UnLockMutex() { g_mutex_unlock(&mutex); };
};
class VideoDev_Simulation: public VideoDev {
private:
struct timeval lastframetv;
unsigned char *inframe;
ConvertData cdata;
GThread *simulation_thread;
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);
public:
VideoDev_Simulation();
~VideoDev_Simulation();
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