34
34
#define V4L2_FRAME_BUF_SIZE (4096 * 4096)
35
35
#define V4L2_IGNORE_FIRST_FRAME_ERRORS 3
37
#define V4L2_LOG_ERR(...) \
39
if (v4l2_log_file) { \
40
fprintf(v4l2_log_file, "libv4l2: error " __VA_ARGS__); \
41
fflush(v4l2_log_file); \
43
fprintf(stderr, "libv4l2: error " __VA_ARGS__); \
46
#define V4L2_LOG_WARN(...) \
48
if (v4l2_log_file) { \
49
fprintf(v4l2_log_file, "libv4l2: warning " __VA_ARGS__); \
50
fflush(v4l2_log_file); \
52
fprintf(stderr, "libv4l2: warning " __VA_ARGS__); \
55
#define V4L2_LOG(...) \
57
if (v4l2_log_file) { \
58
fprintf(v4l2_log_file, "libv4l2: " __VA_ARGS__); \
59
fflush(v4l2_log_file); \
63
#define MIN(a,b) (((a)<(b))?(a):(b))
37
#define V4L2_LOG_ERR(...) \
39
if (v4l2_log_file) { \
40
fprintf(v4l2_log_file, "libv4l2: error " __VA_ARGS__); \
41
fflush(v4l2_log_file); \
43
fprintf(stderr, "libv4l2: error " __VA_ARGS__); \
46
#define V4L2_LOG_WARN(...) \
48
if (v4l2_log_file) { \
49
fprintf(v4l2_log_file, "libv4l2: warning " __VA_ARGS__); \
50
fflush(v4l2_log_file); \
52
fprintf(stderr, "libv4l2: warning " __VA_ARGS__); \
55
#define V4L2_LOG(...) \
57
if (v4l2_log_file) { \
58
fprintf(v4l2_log_file, "libv4l2: " __VA_ARGS__); \
59
fflush(v4l2_log_file); \
63
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
65
65
struct v4l2_dev_info {
69
/* actually format of the cam */
70
struct v4l2_format src_fmt;
71
/* fmt as seen by the application (iow after conversion) */
72
struct v4l2_format dest_fmt;
73
pthread_mutex_t stream_lock;
74
unsigned int no_frames;
75
unsigned int nreadbuffers;
77
struct v4lconvert_data *convert;
78
unsigned char *convert_mmap_buf;
79
/* Frame bookkeeping is only done when in read or mmap-conversion mode */
80
unsigned char *frame_pointers[V4L2_MAX_NO_FRAMES];
81
int frame_sizes[V4L2_MAX_NO_FRAMES];
82
int frame_queued; /* 1 status bit per frame */
83
/* mapping tracking of our fake (converting mmap) frame buffers */
84
unsigned char frame_map_count[V4L2_MAX_NO_FRAMES];
85
/* buffer when doing conversion and using read() for read() */
87
unsigned char *readbuf;
69
/* actually format of the cam */
70
struct v4l2_format src_fmt;
71
/* fmt as seen by the application (iow after conversion) */
72
struct v4l2_format dest_fmt;
73
pthread_mutex_t stream_lock;
74
unsigned int no_frames;
75
unsigned int nreadbuffers;
77
struct v4lconvert_data *convert;
78
unsigned char *convert_mmap_buf;
79
/* Frame bookkeeping is only done when in read or mmap-conversion mode */
80
unsigned char *frame_pointers[V4L2_MAX_NO_FRAMES];
81
int frame_sizes[V4L2_MAX_NO_FRAMES];
82
int frame_queued; /* 1 status bit per frame */
83
/* mapping tracking of our fake (converting mmap) frame buffers */
84
unsigned char frame_map_count[V4L2_MAX_NO_FRAMES];
85
/* buffer when doing conversion and using read() for read() */
87
unsigned char *readbuf;