V4L2 frameserver implementation.
More...
#include "os/os_time.h"
#include "util/u_var.h"
#include "util/u_misc.h"
#include "util/u_debug.h"
#include "util/u_format.h"
#include "v4l2_interface.h"
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <pthread.h>
#include <linux/videodev2.h>
#include <linux/v4l2-common.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <fcntl.h>
|
#define | V_SPEW(p, ...) |
|
#define | V_DEBUG(p, ...) |
|
#define | V_ERROR(p, ...) |
|
#define | V_CONTROL_GET(VID, CONTROL) |
|
#define | V_CONTROL_SET(VID, CONTROL, VALUE) |
|
#define | NUM_V4L2_BUFFERS 3 |
|
#define | CASE(CONTROL) case V4L2_CID_##CONTROL: str = "V4L2_CID_" #CONTROL; break |
|
#define | V_CHECK(FLAG) |
|
◆ V_CHECK
Value:do { \
if (queryctrl.flags & V4L2_CTRL_FLAG_##FLAG) { \
fprintf(stderr, ", " #FLAG); \
} \
} while (false)
◆ V_CONTROL_GET
#define V_CONTROL_GET |
( |
|
VID, |
|
|
|
CONTROL |
|
) |
| |
Value:do { \
int _value = 0; \
if (v4l2_control_get(VID, V4L2_CID_##CONTROL, &_value) != 0) { \
V_ERROR(VID, "failed to get V4L2_CID_" #CONTROL); \
} else { \
V_DEBUG(VID, "V4L2_CID_" #CONTROL " = %i", _value); \
} \
} while (false);
◆ V_CONTROL_SET
#define V_CONTROL_SET |
( |
|
VID, |
|
|
|
CONTROL, |
|
|
|
VALUE |
|
) |
| |
Value:do { \
if (v4l2_control_set(VID, V4L2_CID_##CONTROL, VALUE) != 0) { \
V_ERROR(VID, "failed to set V4L2_CID_" #CONTROL); \
} \
} while (false);
◆ V_DEBUG
#define V_DEBUG |
( |
|
p, |
|
|
|
... |
|
) |
| |
Value:do { \
if (p->print_debug) { \
fprintf(stderr, "%s - ", __func__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
} \
} while (false)
◆ V_ERROR
#define V_ERROR |
( |
|
p, |
|
|
|
... |
|
) |
| |
Value:do { \
fprintf(stderr, "%s - ", __func__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
} while (false)
◆ V_SPEW
#define V_SPEW |
( |
|
p, |
|
|
|
... |
|
) |
| |
Value:do { \
if (p->print_spew) { \
fprintf(stderr, "%s - ", __func__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
} \
} while (false)