| 1 |
#ifndef _VIDEO_CAPTURE_H_ |
| 2 |
#define _VIDEO_CAPTURE_H_ |
| 3 |
|
| 4 |
#define VC_MAX_PLANES 4 |
| 5 |
|
| 6 |
typedef struct video_capture* vcapture; |
| 7 |
|
| 8 |
enum vcapture_format_type |
| 9 |
{ |
| 10 |
VC_TYPE_UNKNOWN, |
| 11 |
VC_TYPE_RGB, |
| 12 |
VC_TYPE_ARGB, |
| 13 |
VC_TYPE_RGBA, |
| 14 |
VC_TYPE_FOURCC_2uvy, |
| 15 |
VC_TYPE_FOURCC_yuvs, |
| 16 |
VC_TYPE_FOURCC_YVYU, |
| 17 |
VC_TYPE_FOURCC_yuvu, |
| 18 |
}; |
| 19 |
|
| 20 |
enum vcapture_error |
| 21 |
{ |
| 22 |
VC_SUCCESS = 0, |
| 23 |
VC_INVALID_DEVICE = -1, |
| 24 |
VC_DEVICE_OPEN_ERROR = -2, |
| 25 |
VC_NO_ACTIVE_DEVICE = -3, |
| 26 |
VC_DEVICE_RUNNING = -4 |
| 27 |
}; |
| 28 |
|
| 29 |
struct vcapture_frame |
| 30 |
{ |
| 31 |
int count; |
| 32 |
void* planes[VC_MAX_PLANES]; |
| 33 |
}; |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
struct vcapture_frame_format |
| 39 |
{ |
| 40 |
enum vcapture_format_type type; |
| 41 |
unsigned int fourcc; |
| 42 |
int width; |
| 43 |
int height; |
| 44 |
int bytes_per_row; |
| 45 |
int pad_left; |
| 46 |
int pad_top; |
| 47 |
int pad_right; |
| 48 |
int pad_bottom; |
| 49 |
}; |
| 50 |
|
| 51 |
typedef void (*vcapture_frame_callback)(const struct vcapture_frame_format* format, |
| 52 |
const struct vcapture_frame* frame, |
| 53 |
unsigned long long int timestamp, |
| 54 |
void* userdata); |
| 55 |
|
| 56 |
#ifdef __cplusplus |
| 57 |
extern "C" |
| 58 |
{ |
| 59 |
#endif |
| 60 |
|
| 61 |
unsigned int vcapture_type_to_fourcc(enum vcapture_format_type type); |
| 62 |
enum vcapture_format_type vcapture_fourcc_to_type(unsigned int fourcc); |
| 63 |
|
| 64 |
void vcapture_poll(int msec); |
| 65 |
|
| 66 |
vcapture vcapture_alloc(); |
| 67 |
void vcapture_free(vcapture v); |
| 68 |
|
| 69 |
int vcapture_device_count(vcapture v); |
| 70 |
const char* vcapture_device_name(vcapture v, int device); |
| 71 |
|
| 72 |
int vcapture_get_device(vcapture v); |
| 73 |
int vcapture_set_device(vcapture v, int device); |
| 74 |
|
| 75 |
int vcapture_get_requested_format(vcapture v, struct vcapture_frame_format* f); |
| 76 |
int vcapture_set_requested_format(vcapture v, const struct vcapture_frame_format* f); |
| 77 |
|
| 78 |
vcapture_frame_callback vcapture_get_callback(vcapture v); |
| 79 |
int vcapture_set_callback(vcapture v, |
| 80 |
vcapture_frame_callback callback, |
| 81 |
void* userdata); |
| 82 |
|
| 83 |
int vcapture_active(vcapture v); |
| 84 |
int vcapture_start(vcapture v); |
| 85 |
int vcapture_stop(vcapture v); |
| 86 |
|
| 87 |
#ifdef __cplusplus |
| 88 |
} |
| 89 |
#endif |
| 90 |
|
| 91 |
#endif |