-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideoci.h
85 lines (66 loc) · 3.66 KB
/
videoci.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
//
// Created by Walter Gamba on 09/04/17.
//
#ifndef BIKAMERA_VIDEOCI_H
#define BIKAMERA_VIDEOCI_H
#include <stdio.h>
#include "bcm_host.h"
#include "interface/vcos/vcos.h"
#include "interface/mmal/mmal.h"
#include "interface/mmal/mmal_logging.h"
#include "interface/mmal/mmal_buffer.h"
#include "interface/mmal/util/mmal_util.h"
#include "interface/mmal/util/mmal_util_params.h"
#include "interface/mmal/util/mmal_default_components.h"
#include "interface/mmal/util/mmal_connection.h"
#include "RaspiCamControl.h"
#include "RaspiPreview.h"
#include "RaspiCLI.h"
// Forward
typedef struct RASPIVIDYUV_STATE_S RASPIVIDYUV_STATE;
/** Struct used to pass information in camera video port userdata to callback
*/
typedef struct
{
void *buffer; /// Memory buffer
FILE *file_handle; /// File handle to write buffer data to.
RASPIVIDYUV_STATE *pstate; /// pointer to our state in case required in callback
int abort; /// Set to 1 in callback if an error occurs to attempt to abort the capture
int frame_count; /// used to keep track of frames
void (*frame_callback_function)(char *); //call this callback for every frame
} PORT_USERDATA;
/** Structure containing all state information for the current run
*/
struct RASPIVIDYUV_STATE_S
{
int timeout; /// Time taken before frame is grabbed and app then shuts down. Units are milliseconds
int width; /// Requested width of image
int height; /// requested height of image
int framerate; /// Requested frame rate (fps)
char *filename; /// filename of output file
int verbose; /// !0 if want detailed run information
int demoMode; /// Run app in demo mode
int demoInterval; /// Interval between camera settings changes
int waitMethod; /// Method for switching between pause and capture
int onTime; /// In timed cycle mode, the amount of time the capture is on per cycle
int offTime; /// In timed cycle mode, the amount of time the capture is off per cycle
int onlyLuma; /// Only output the luma / Y plane of the YUV data
int useRGB; /// Output RGB data rather than YUV
RASPIPREVIEW_PARAMETERS preview_parameters; /// Preview setup parameters
RASPICAM_CAMERA_PARAMETERS camera_parameters; /// Camera setup parameters
MMAL_COMPONENT_T *camera_component; /// Pointer to the camera component
MMAL_CONNECTION_T *preview_connection; /// Pointer to the connection from camera to preview
MMAL_POOL_T *camera_pool; /// Pointer to the pool of buffers used by camera video port
PORT_USERDATA callback_data; /// Used to move data to the camera callback
int bCapturing; /// State of capture/pause
int cameraNum; /// Camera number
int settings; /// Request settings from the camera
int sensor_mode; /// Sensor mode. 0=auto. Check docs/forum for modes selected by other values.
};
RASPIVIDYUV_STATE *raspivideo_create_status();
void raspivideo_get_actual_capture_size(RASPIVIDYUV_STATE *state, int *width, int *height);
int raspivideo_init(RASPIVIDYUV_STATE *state);
int raspivideo_start_capture(RASPIVIDYUV_STATE *state, char *buffer);
int raspivideo_end_capture(RASPIVIDYUV_STATE *state);
int raspivideo_tear_down(RASPIVIDYUV_STATE *state, MMAL_STATUS_T status);
#endif //BIKAMERA_VIDEOCI_H