This repository has been archived by the owner on Apr 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VideoProvider.h
86 lines (64 loc) · 1.81 KB
/
VideoProvider.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
/*
* VideoProvider.h
*
* Created on: 2011-5-4
* Author: simophin
*/
#ifndef VIDEOPROVIDER_H_
#define VIDEOPROVIDER_H_
#include "VideoCodec.h"
#include "Geometry.h"
#include "ImageBuffer.h"
#include "FrameRate.h"
#include "Serializable.hpp"
#include "Error.h"
#include <vector>
#include "RString.h"
#include "VideoInfo.h"
class VideoProvider {
public:
VideoProvider();
virtual ~VideoProvider();
typedef VideoInfo Param;
class Info: public Serializable {
public:
std::vector<VideoCodec> supportedCodecs;
std::vector<Geometry> supportedGeometries;
std::vector<FrameRate> supportedFrameRates;
virtual String toString() const;
virtual bool isValid() const { return true; }
static Info fromString(const String &);
};
class PreviewImageBuffer {
public:
ImageFormat pixFmt;
Geometry geo;
ImageBuffer buf;
size_t usedSize;
PreviewImageBuffer ()
:pixFmt (IF_INVALID),
geo(0,0),
buf(0,0),
usedSize(0) {
}
};
Error initDevice();
Error queryInfo(Info &) const;
Error getParam(Param &) const;
Error setParam(const Param &);
Error startCapture();
Error stopCapture();
Error getData(ImageBuffer &, size_t *size, int ms = -1);
Error getData(unsigned char *, size_t , size_t *returned, int ms = -1);
Error getPreviewImage (PreviewImageBuffer &, int ms = -1);
protected:
virtual Error doInitDevice() = 0;
virtual Error doQueryInfo(Info &) const = 0;
virtual Error doGetParam(Param &) const = 0;
virtual Error doSetParam(const Param &) = 0;
virtual Error doStartCapture() = 0;
virtual Error doStopCapture() = 0;
virtual Error doGetData(unsigned char *, size_t, size_t *returned, int ms) = 0;
virtual Error doGetPreviewImage (PreviewImageBuffer &, int ms) = 0;
};
#endif /* VIDEOPROVIDER_H_ */