forked from jnohlgard/python-v4l2capture
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmfvideoin.h
81 lines (67 loc) · 1.92 KB
/
mfvideoin.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef MFVIDEOIN_H
#define MFVIDEOIN_H
#include <vector>
#include <string>
#include <mfidl.h>
#include <mfreadwrite.h>
#include "base.h"
class WmfBase : public Base_Video_In
{
public:
WmfBase();
virtual ~WmfBase();
};
class MfVideoIn : public WmfBase
{
public:
MfVideoIn(const wchar_t *devName);
virtual ~MfVideoIn();
virtual void Stop();
virtual void WaitForStop();
virtual void OpenDevice();
virtual void SetFormat(const char *fmt, int width, int height);
virtual void StartDevice(int buffer_count);
virtual void StopDevice();
virtual void CloseDevice();
virtual int GetFrame(unsigned char **buffOut, class FrameMetaData *metaOut);
virtual int GetMfControl(long prop, int range = 0);
virtual int SetMfControl(long prop, long value = 0, long flags = 0);
virtual int GetMfParameter(long param, int range = 0);
virtual int SetMfParameter(long param, long value = 0, long flags = 0);
void Run();
protected:
IMFSourceReader* reader;
IMFMediaSource* source;
int asyncMode;
std::wstring devName;
class SourceReaderCB* readerCallback;
int stopping;
int stopped;
int openDevFlag;
int startDevFlag;
int stopDevFlag;
int closeDevFlag;
CRITICAL_SECTION lock;
unsigned maxBuffSize;
std::vector<char *> frameBuff;
std::vector<DWORD> frameLenBuff;
std::vector<HRESULT> hrStatusBuff;
std::vector<DWORD> dwStreamIndexBuff;
std::vector<DWORD> dwStreamFlagsBuff;
std::vector<LONGLONG> llTimestampBuff;
std::vector<LONG> plStrideBuff;
std::vector<std::wstring> majorTypeBuff, subTypeBuff;
std::vector<UINT32> widthBuff;
std::vector<UINT32> heightBuff;
std::vector<char> isCompressedBuff;
void OpenDeviceInternal();
void StartDeviceInternal();
void SetSampleMetaData(DWORD streamIndex);
void PopFrontMetaDataBuff();
void ReadFramesInternal();
void StopDeviceInternal();
void CloseDeviceInternal();
};
void *MfVideoIn_Worker_thread(void *arg);
std::vector<std::vector<std::wstring> > List_in_devices();
#endif //MFVIDEOIN_H