summaryrefslogtreecommitdiff
path: root/include/qhy/Context.h
blob: ab2c490873f662ba423a2def7e316a8d7fdecae8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once

#define QCAM_RAWDATACACHESIZE (75000000)
#define QCAM_FRAMECACHESIZE 1
#define QCAM_MAXCORECOUNT 16

class Mutex
{
private:
	CRITICAL_SECTION cs;

public:
	Mutex()
	{
		::InitializeCriticalSection(&this->cs);
	}

	~Mutex()
	{
		::DeleteCriticalSection(&this->cs);
	}

	void Lock()
	{
		::EnterCriticalSection(&this->cs);
	}

	void Unlock()
	{
		::LeaveCriticalSection(&this->cs);
	}
};

class CamContext
{
public:
	unsigned char ioType;
	HANDLE hCam;
	int camType;
	int resX, resY;
	int frameLen;
	unsigned char depth;

	BOOL live;
	unsigned char *rawDataCache;
	HANDLE hIoThread;
	BOOL raw;

	CamContext()
	{
		this->hCam = INVALID_HANDLE_VALUE;
	}

};

void InitContext(int framesize,CCyUSBDevice* pDev);
CamContext* GetContext(HANDLE hCam);