-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvideo.h
More file actions
91 lines (77 loc) · 2.62 KB
/
video.h
File metadata and controls
91 lines (77 loc) · 2.62 KB
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
91
#ifndef SB_RASPIVIDEO_H_
#define SB_RASPIVIDEO_H_
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct RaspivideoCamera RaspivideoCamera;
typedef enum {
RaspivideoFormatRGB,
RaspivideoFormatBGR,
RaspivideoFormatJPEG,
} RaspivideoFormat;
typedef enum {
RaspivideoSuccess,
RaspivideoNoMemory,
RaspivideoCannotInitMutex,
RaspivideoCannotInitCond,
RaspivideoCannotCreateCamera,
RaspivideoCannotSetCamera,
RaspivideoCannotSetCameraConfig,
RaspivideoCannotCommitFormat,
RaspivideoCannotEnableCamera,
RaspivideoCannotCreatePool,
RaspivideoCannotEnableVideoPort,
RaspivideoCannotSendBuffer,
RaspivideoCannotStartCapture,
RaspivideoCameraDestroyed,
RaspivideoCannotCreateEncoder,
RaspivideoCannotEnableEncoder,
RaspivideoCannotEnableEncoderPort,
RaspivideoCannotCreateConnection,
RaspivideoCannotEnableConnection,
} RaspivideoErrorCode;
/*
RaspivideoInitialize initializes the multimedia library of Raspberry Pi. It
must not be called more than once.
*/
void RaspivideoInitialize();
/*
RaspivideoCreateCamera creates a RaspivideoCamera component and
immediately starts capturing frames. This function assumes that width and
height are validated by the caller.
*/
RaspivideoErrorCode RaspivideoCreateCamera(RaspivideoCamera** c, int width, int height, RaspivideoFormat format);
/*
RaspivideoLockFrame locks the frame information. It has to be called before
calling some functions.
*/
void RaspivideoLockFrame(RaspivideoCamera* c);
/*
RaspivideoUnlockFrame unlocks the mutex locked by RaspivideoLockFrame.
*/
void RaspivideoUnlockFrame(RaspivideoCamera* c);
/*
RaspivideoRetrieveFrame returns the latest frame that has been captured.
buffer's size needs to be at least the value returned from RaspivideoFrameSize.
This function clears the ready flag, so the next call will wait until the
next frame becomes ready.
RaspivideoLockFrame must be called before calling this function.
*/
RaspivideoErrorCode RaspivideoRetrieveFrame(RaspivideoCamera* c, char* buffer);
/*
RaspivideoFrameSize returns the size of the buffer required to have the
captured frame data. RaspivideoLockFrame must be called before calling
this function. It blocks until the new frame arrives. It returns 0 if the
RaspivideoCamera is being or already destroyed.
*/
size_t RaspivideoFrameSize(RaspivideoCamera* c);
/*
RaspivideoDestroyCamera destroys a RaspivideoCamera. The destroyed
RaspivideoCamera must not be passed to any function.
*/
void RaspivideoDestroyCamera(RaspivideoCamera* c);
#ifdef __cplusplus
}
#endif
#endif