| 1 |
/* |
| 2 |
# (C) 2008 Hans de Goede <[email protected]> |
| 3 |
|
| 4 |
# This program is free software; you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU Lesser General Public License as published by |
| 6 |
# the Free Software Foundation; either version 2.1 of the License, or |
| 7 |
# (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU Lesser General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU Lesser General Public License |
| 15 |
# along with this program; if not, write to the Free Software |
| 16 |
# Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifndef __LIBV4L1_PRIV_H |
| 20 |
#define __LIBV4L1_PRIV_H |
| 21 |
|
| 22 |
#include <stdio.h> |
| 23 |
#include <pthread.h> |
| 24 |
|
| 25 |
#include "../libv4lconvert/libv4lsyscall-priv.h" |
| 26 |
|
| 27 |
#define V4L1_MAX_DEVICES 16 |
| 28 |
#define V4L1_NO_FRAMES 4 |
| 29 |
#define V4L1_FRAME_BUF_SIZE (4096 * 4096) |
| 30 |
|
| 31 |
extern FILE *v4l1_log_file; |
| 32 |
|
| 33 |
#define V4L1_LOG_ERR(...) \ |
| 34 |
do { \ |
| 35 |
if (v4l1_log_file) { \ |
| 36 |
fprintf(v4l1_log_file, "libv4l1: error " __VA_ARGS__); \ |
| 37 |
fflush(v4l1_log_file); \ |
| 38 |
} else \ |
| 39 |
fprintf(stderr, "libv4l1: error " __VA_ARGS__); \ |
| 40 |
} while (0) |
| 41 |
|
| 42 |
#define V4L1_LOG_WARN(...) \ |
| 43 |
do { \ |
| 44 |
if (v4l1_log_file) { \ |
| 45 |
fprintf(v4l1_log_file, "libv4l1: warning " __VA_ARGS__); \ |
| 46 |
fflush(v4l1_log_file); \ |
| 47 |
} else \ |
| 48 |
fprintf(stderr, "libv4l1: warning " __VA_ARGS__); \ |
| 49 |
} while (0) |
| 50 |
|
| 51 |
#define V4L1_LOG(...) \ |
| 52 |
do { \ |
| 53 |
if (v4l1_log_file) { \ |
| 54 |
fprintf(v4l1_log_file, "libv4l1: " __VA_ARGS__); \ |
| 55 |
fflush(v4l1_log_file); \ |
| 56 |
} \ |
| 57 |
} while (0) |
| 58 |
|
| 59 |
#ifndef min |
| 60 |
#define min(a, b) (((a) < (b)) ? (a) : (b)) |
| 61 |
#endif |
| 62 |
|
| 63 |
struct v4l1_dev_info { |
| 64 |
int fd; |
| 65 |
int flags; |
| 66 |
int open_count; |
| 67 |
int v4l1_frame_buf_map_count; |
| 68 |
pthread_mutex_t stream_lock; |
| 69 |
unsigned int depth; |
| 70 |
unsigned int v4l1_pal; /* VIDEO_PALETTE */ |
| 71 |
unsigned int v4l2_pixfmt; /* V4L2_PIX_FMT */ |
| 72 |
unsigned int min_width, min_height, max_width, max_height; |
| 73 |
unsigned int width, height; |
| 74 |
unsigned char *v4l1_frame_pointer; |
| 75 |
}; |
| 76 |
|
| 77 |
/* From log.c */ |
| 78 |
void v4l1_log_ioctl(unsigned long int request, void *arg, int result); |
| 79 |
|
| 80 |
#endif |