forked from jnohlgard/python-v4l2capture
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase.h
91 lines (75 loc) · 1.74 KB
/
base.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
82
83
84
85
86
87
88
89
90
#ifndef BASE_H
#define BASE_H
#include <string>
class FrameMetaData
{
public:
std::string fmt;
int width;
int height;
unsigned buffLen;
unsigned long sequence;
unsigned long tv_sec;
unsigned long tv_usec;
FrameMetaData()
{
width = 0;
height = 0;
buffLen = 0;
sequence = 0;
tv_sec = 0;
tv_usec = 0;
}
FrameMetaData(const FrameMetaData &in)
{
FrameMetaData::operator=(in);
}
const FrameMetaData &operator=(const FrameMetaData &in)
{
width = in.width;
height = in.height;
fmt = in.fmt;
buffLen = in.buffLen;
sequence = in.sequence;
tv_sec = in.tv_sec;
tv_usec = in.tv_usec;
return *this;
}
};
class Base_Video_In
{
public:
Base_Video_In() {};
virtual ~Base_Video_In() {};
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) {return 0;};
void Run() {};
};
// **********************************************************************
class Base_Video_Out
{
public:
Base_Video_Out() {};
virtual ~Base_Video_Out() {};
virtual void SendFrame(const char *imgIn,
unsigned imgLen,
const char *pxFmt,
int width,
int height,
unsigned long tv_sec = 0,
unsigned long tv_usec = 0) {};
virtual void Stop() {};
virtual int WaitForStop() {return 1;};
virtual void SetOutputSize(int width, int height) {};
virtual void SetOutputPxFmt(const char *fmt) {};
virtual void SetFrameRate(unsigned int frameRateIn) {};
virtual void SetVideoCodec(const char *codec, unsigned int bitrate) {};
void Run() {};
};
#endif //BASE_H