diff options
author | hans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain> | 2009-04-14 09:51:35 +0200 |
---|---|---|
committer | hans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain> | 2009-04-14 09:51:35 +0200 |
commit | 10a09b9ec6e08fb95c36f26d7f69834b0387386b (patch) | |
tree | f135d19a9f7d69205f17cb2b22efc9623ef01e6e /v4l2-apps/libv4l | |
parent | b1352a9018aeac6722d2e8d606f9c0ea140e0abd (diff) | |
download | mediapointer-dvb-s2-10a09b9ec6e08fb95c36f26d7f69834b0387386b.tar.gz mediapointer-dvb-s2-10a09b9ec6e08fb95c36f26d7f69834b0387386b.tar.bz2 |
libv4l: Enable whitebalancing algorithm based on USB id's
From: Hans de Goede <hdegoede@redhat.com>
* Determine wether or not to do whitebalance and/or normalize at all
based on USB-ID's.
* Add rotate90 hack to flags based on usb-id.
Priority: normal
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'v4l2-apps/libv4l')
-rw-r--r-- | v4l2-apps/libv4l/TODO | 7 | ||||
-rw-r--r-- | v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol-priv.h | 21 | ||||
-rw-r--r-- | v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c | 159 | ||||
-rw-r--r-- | v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.h | 7 | ||||
-rw-r--r-- | v4l2-apps/libv4l/libv4lconvert/flip.c | 5 | ||||
-rw-r--r-- | v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h | 25 | ||||
-rw-r--r-- | v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c | 128 |
7 files changed, 202 insertions, 150 deletions
diff --git a/v4l2-apps/libv4l/TODO b/v4l2-apps/libv4l/TODO index 2bd2fc992..f1aac5a95 100644 --- a/v4l2-apps/libv4l/TODO +++ b/v4l2-apps/libv4l/TODO @@ -9,5 +9,12 @@ -take the possibility of pitch != width into account everywhere + -only report faked formats in list formats and only allow setting fake formats when processing or flipping. + +-make updating of parameters happen based on time elapsed rather then + frames + +-add fake flip controls on devices where we are already limiting the + formats which can be set diff --git a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol-priv.h b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol-priv.h index 59305a237..0dd675754 100644 --- a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol-priv.h @@ -24,10 +24,27 @@ #define V4LCONTROL_SHM_SIZE 4096 +#define V4LCONTROL_WANTS_WB (1 << V4LCONTROL_WHITEBALANCE) +#define V4LCONTROL_WANTS_NORM ((1 << V4LCONTROL_NORMALIZE) | \ + (1 << V4LCONTROL_NORM_LOW_BOUND) | \ + (1 << V4LCONTROL_NORM_HIGH_BOUND)) + struct v4lcontrol_data { - int fd; /* Knowledge of the fd is needed in original syscalls */ - unsigned int controls; /* Which controls to use for this device */ + int fd; /* Device fd */ + int flags; /* Special flags for this device */ + int controls; /* Which controls to use for this device */ unsigned int *shm_values; /* shared memory control value store */ }; +struct v4lcontrol_flags_info { + unsigned short vendor_id; + unsigned short product_id; + unsigned short product_mask; +/* We could also use the USB manufacturer and product strings some devices have + const char *manufacturer; + const char *product; */ + int flags; + int controls; +}; + #endif diff --git a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c index cb4e34327..de8b608f9 100644 --- a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c +++ b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c @@ -40,27 +40,139 @@ /* end broken header workaround includes */ #include <linux/videodev2.h> -static void v4lcontrol_init(struct v4lcontrol_data *data, int first_time) +#define ARRAY_SIZE(x) ((int)sizeof(x)/(int)sizeof((x)[0])) + +/* Workaround these potentially missing from videodev2.h */ +#ifndef V4L2_IN_ST_HFLIP +#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */ +#endif + +#ifndef V4L2_IN_ST_VFLIP +#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */ +#endif + + +/* List of cams which need special flags */ +static const struct v4lcontrol_flags_info v4lcontrol_flags[] = { +/* First: Upside down devices */ + /* Philips SPC200NC */ + { 0x0471, 0x0325, 0, V4LCONTROL_HFLIPPED|V4LCONTROL_VFLIPPED, 0 }, + /* Philips SPC300NC */ + { 0x0471, 0x0326, 0, V4LCONTROL_HFLIPPED|V4LCONTROL_VFLIPPED, 0 }, + /* Philips SPC210NC */ + { 0x0471, 0x032d, 0, V4LCONTROL_HFLIPPED|V4LCONTROL_VFLIPPED, 0 }, + /* Genius E-M 112 */ + { 0x093a, 0x2476, 0, V4LCONTROL_HFLIPPED|V4LCONTROL_VFLIPPED, 0 }, +/* Second: devices which can benifit from software video processing */ + /* Pac207 based devices */ + { 0x041e, 0x4028, 0, 0, V4LCONTROL_WANTS_WB }, + { 0x093a, 0x2460, 0x1f, 0, V4LCONTROL_WANTS_WB }, + { 0x145f, 0x013a, 0, 0, V4LCONTROL_WANTS_WB }, + { 0x2001, 0xf115, 0, 0, V4LCONTROL_WANTS_WB }, + /* Pac7302 based devices */ + { 0x093a, 0x2620, 0x0f, V4LCONTROL_ROTATED_90_JPEG, V4LCONTROL_WANTS_WB }, +}; + +static void v4lcontrol_init_flags(struct v4lcontrol_data *data) { - /* FIXME: Temporary spoof future communication with driver by always enabling - the fake controls */ - data->controls = (1 << V4LCONTROL_WHITEBALANCE) | - (1 << V4LCONTROL_NORMALIZE) | (1 << V4LCONTROL_NORM_LOW_BOUND) | - (1 << V4LCONTROL_NORM_HIGH_BOUND); - - if (first_time) { - /* Initialize the new shm object when created */ - memset(data->shm_values, 0, sizeof(V4LCONTROL_SHM_SIZE)); - data->shm_values[V4LCONTROL_WHITEBALANCE] = 1; - data->shm_values[V4LCONTROL_NORM_HIGH_BOUND] = 255; + struct stat st; + FILE *f; + char sysfs_name[512]; + unsigned short vendor_id = 0; + unsigned short product_id = 0; + int i, minor; + char c, *s, buf[32]; + struct v4l2_input input; + + if ((syscall(SYS_ioctl, data->fd, VIDIOC_G_INPUT, &input.index) == 0) && + (syscall(SYS_ioctl, data->fd, VIDIOC_ENUMINPUT, &input) == 0)) { + if (input.status & V4L2_IN_ST_HFLIP) + data->flags |= V4LCONTROL_HFLIPPED; + if (input.status & V4L2_IN_ST_VFLIP) + data->flags |= V4LCONTROL_VFLIPPED; } + + if (fstat(data->fd, &st) || !S_ISCHR(st.st_mode)) { + return; /* Should never happen */ + } + + /* <Sigh> find ourselve in sysfs */ + for (i = 0; i < 256; i++) { + snprintf(sysfs_name, sizeof(sysfs_name), + "/sys/class/video4linux/video%d/dev", i); + f = fopen(sysfs_name, "r"); + if (!f) + continue; + + s = fgets(buf, sizeof(buf), f); + fclose(f); + + if (s && sscanf(buf, "%*d:%d%c", &minor, &c) == 2 && c == '\n' && + minor == minor(st.st_rdev)) + break; + } + if (i == 256) + return; /* Not found, sysfs not mounted? */ + + /* Get vendor and product ID */ + snprintf(sysfs_name, sizeof(sysfs_name), + "/sys/class/video4linux/video%d/device/modalias", i); + f = fopen(sysfs_name, "r"); + if (f) { + s = fgets(buf, sizeof(buf), f); + fclose(f); + + if (!s || + sscanf(s, "usb:v%4hxp%4hx%c", &vendor_id, &product_id, &c) != 3 || + c != 'd') + return; /* Not an USB device */ + } else { + /* Try again assuming the device link points to the usb + device instead of the usb interface (bug in older versions + of gspca) */ + + /* Get product ID */ + snprintf(sysfs_name, sizeof(sysfs_name), + "/sys/class/video4linux/video%d/device/idVendor", i); + f = fopen(sysfs_name, "r"); + if (!f) + return; /* Not an USB device (or no sysfs) */ + + s = fgets(buf, sizeof(buf), f); + fclose(f); + + if (!s || sscanf(s, "%04hx%c", &vendor_id, &c) != 2 || c != '\n') + return; /* Should never happen */ + + /* Get product ID */ + snprintf(sysfs_name, sizeof(sysfs_name), + "/sys/class/video4linux/video%d/device/idProduct", i); + f = fopen(sysfs_name, "r"); + if (!f) + return; /* Should never happen */ + + s = fgets(buf, sizeof(buf), f); + fclose(f); + + if (!s || sscanf(s, "%04hx%c", &product_id, &c) != 2 || c != '\n') + return; /* Should never happen */ + } + + for (i = 0; i < ARRAY_SIZE(v4lcontrol_flags); i++) + if (v4lcontrol_flags[i].vendor_id == vendor_id && + v4lcontrol_flags[i].product_id == + (product_id & ~v4lcontrol_flags[i].product_mask)) { + data->flags |= v4lcontrol_flags[i].flags; + data->controls = v4lcontrol_flags[i].controls; + break; + } } struct v4lcontrol_data *v4lcontrol_create(int fd) { int shm_fd; int init = 0; - char shm_name[256]; + char *s, shm_name[256]; struct v4l2_capability cap; struct v4lcontrol_data *data = calloc(1, sizeof(struct v4lcontrol_data)); @@ -89,10 +201,24 @@ struct v4lcontrol_data *v4lcontrol_create(int fd) if (data->shm_values == MAP_FAILED) goto error; - v4lcontrol_init(data, init); /* Set the driver defined fake controls */ + if (init) { + /* Initialize the new shm object we created */ + memset(data->shm_values, 0, sizeof(V4LCONTROL_SHM_SIZE)); + data->shm_values[V4LCONTROL_WHITEBALANCE] = 1; + data->shm_values[V4LCONTROL_NORM_HIGH_BOUND] = 255; + } data->fd = fd; + v4lcontrol_init_flags(data); + + /* Allow overriding through environment */ + if ((s = getenv("LIBV4LCONTROL_FLAGS"))) + data->flags = strtol(s, NULL, 0); + + if ((s = getenv("LIBV4LCONTROL_CONTROLS"))) + data->controls = strtol(s, NULL, 0); + return data; error: @@ -201,6 +327,11 @@ int v4lcontrol_vidioc_s_ctrl(struct v4lcontrol_data *data, void *arg) return syscall(SYS_ioctl, data->fd, VIDIOC_S_CTRL, arg); } +int v4lcontrol_get_flags(struct v4lcontrol_data *data) +{ + return data->flags; +} + int v4lcontrol_get_ctrl(struct v4lcontrol_data *data, int ctrl) { if (data->controls & (1 << ctrl)) diff --git a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.h b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.h index 3611304d6..344e68055 100644 --- a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.h +++ b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.h @@ -22,6 +22,12 @@ #ifndef __LIBV4LCONTROL_H #define __LIBV4LCONTROL_H +/* Flags */ +#define V4LCONTROL_HFLIPPED 0x01 +#define V4LCONTROL_VFLIPPED 0x02 +#define V4LCONTROL_ROTATED_90_JPEG 0x04 + +/* Controls */ enum { V4LCONTROL_WHITEBALANCE, V4LCONTROL_NORMALIZE, V4LCONTROL_NORM_LOW_BOUND, V4LCONTROL_NORM_HIGH_BOUND, V4LCONTROL_COUNT }; @@ -31,6 +37,7 @@ struct v4lcontrol_data* v4lcontrol_create(int fd); void v4lcontrol_destroy(struct v4lcontrol_data *data); /* Functions used by v4lprocessing to get the control state */ +int v4lcontrol_get_flags(struct v4lcontrol_data *data); int v4lcontrol_get_ctrl(struct v4lcontrol_data *data, int ctrl); /* Functions used by v4lconvert to pass vidioc calls from libv4l2 */ diff --git a/v4l2-apps/libv4l/libv4lconvert/flip.c b/v4l2-apps/libv4l/libv4lconvert/flip.c index 9835f045c..cc9526493 100644 --- a/v4l2-apps/libv4l/libv4lconvert/flip.c +++ b/v4l2-apps/libv4l/libv4lconvert/flip.c @@ -20,6 +20,7 @@ */ +#include <string.h> #include "libv4lconvert-priv.h" static void v4lconvert_rotate180_rgbbgr24(const unsigned char *src, @@ -134,7 +135,7 @@ void v4lconvert_flip(unsigned char *src, unsigned char *dest, { /* FIXME implement separate vflipping and hflipping, for now we always rotate 180 when vflip is selected! */ - if (flags & V4LCONVERT_VFLIP) { + if (flags & V4LCONTROL_VFLIPPED) { switch (fmt->fmt.pix.pixelformat) { case V4L2_PIX_FMT_RGB24: case V4L2_PIX_FMT_BGR24: @@ -148,4 +149,6 @@ void v4lconvert_flip(unsigned char *src, unsigned char *dest, break; } } + else /* FIXME and do nothing when only HFLIP is selected */ + memcpy(dest, src, fmt->fmt.pix.sizeimage); } diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index acf921a31..4a333d9a9 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -83,14 +83,6 @@ #define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') #endif -#ifndef V4L2_IN_ST_HFLIP -#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */ -#endif - -#ifndef V4L2_IN_ST_VFLIP -#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */ -#endif - #define V4LCONVERT_ERROR_MSG_SIZE 256 #define V4LCONVERT_MAX_FRAMESIZES 16 @@ -100,11 +92,8 @@ "v4l-convert: error " __VA_ARGS__) /* Card flags */ -#define V4LCONVERT_HFLIP 0x01 -#define V4LCONVERT_VFLIP 0x02 -#define V4LCONVERT_JPEG_ROTATE_90_HACK 0x04 -#define V4LCONVERT_IS_UVC 0x08 -#define V4LCONVERT_IS_SN9C20X 0x10 +#define V4LCONVERT_IS_UVC 0x01 +#define V4LCONVERT_IS_SN9C20X 0x02 /* Pixformat flags */ #define V4LCONVERT_COMPRESSED 0x01 @@ -112,6 +101,7 @@ struct v4lconvert_data { int fd; int flags; /* bitfield */ + int control_flags; /* bitfield */ int supported_src_formats; /* bitfield */ unsigned int no_formats; char error_msg[V4LCONVERT_ERROR_MSG_SIZE]; @@ -132,15 +122,6 @@ struct v4lconvert_data { struct v4lprocessing_data *processing; }; -struct v4lconvert_flags_info { - unsigned short vendor_id; - unsigned short product_id; -/* We could also use the USB manufacturer and product strings some devices have - const char *manufacturer; - const char *product; */ - int flags; -}; - struct v4lconvert_pixfmt { unsigned int fmt; int flags; diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c index 6fbc1affa..5ec85324e 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c @@ -70,14 +70,6 @@ static const struct v4lconvert_pixfmt supported_dst_pixfmts[] = { SUPPORTED_DST_PIXFMTS }; -/* List of cams which need special flags */ -static const struct v4lconvert_flags_info v4lconvert_flags[] = { - { 0x0471, 0x0325, V4LCONVERT_HFLIP|V4LCONVERT_VFLIP }, /* Philips SPC200NC */ - { 0x0471, 0x0326, V4LCONVERT_HFLIP|V4LCONVERT_VFLIP }, /* Philips SPC300NC */ - { 0x0471, 0x032d, V4LCONVERT_HFLIP|V4LCONVERT_VFLIP }, /* Philips SPC210NC */ - { 0x093a, 0x2476, V4LCONVERT_HFLIP|V4LCONVERT_VFLIP }, /* Genius E-M 112 */ -}; - /* List of well known resolutions which we can get by cropping somewhat larger resolutions */ static const int v4lconvert_crop_res[][2] = { @@ -91,95 +83,11 @@ static const int v4lconvert_crop_res[][2] = { { 176, 144 }, }; -static int v4lconvert_get_flags(int fd) -{ - struct stat st; - FILE *f; - char sysfs_name[512]; - unsigned short vendor_id = 0; - unsigned short product_id = 0; - int i, minor; - char c, *s, buf[32]; - - if (fstat(fd, &st) || !S_ISCHR(st.st_mode)) - return 0; /* Should never happen */ - - /* <Sigh> find ourselve in sysfs */ - for (i = 0; i < 256; i++) { - snprintf(sysfs_name, sizeof(sysfs_name), - "/sys/class/video4linux/video%d/dev", i); - f = fopen(sysfs_name, "r"); - if (!f) - continue; - - s = fgets(buf, sizeof(buf), f); - fclose(f); - - if (s && sscanf(buf, "%*d:%d%c", &minor, &c) == 2 && c == '\n' && - minor == minor(st.st_rdev)) - break; - } - if (i == 256) - return 0; /* Not found, sysfs not mounted? */ - - /* Get vendor and product ID */ - snprintf(sysfs_name, sizeof(sysfs_name), - "/sys/class/video4linux/video%d/device/modalias", i); - f = fopen(sysfs_name, "r"); - if (f) { - s = fgets(buf, sizeof(buf), f); - fclose(f); - - if (!s || - sscanf(s, "usb:v%4hxp%4hx%c", &vendor_id, &product_id, &c) != 3 || - c != 'd') - return 0; /* Not an USB device */ - } else { - /* Try again assuming the device link points to the usb - device instead of the usb interface (bug in older versions - of gspca) */ - - /* Get product ID */ - snprintf(sysfs_name, sizeof(sysfs_name), - "/sys/class/video4linux/video%d/device/idVendor", i); - f = fopen(sysfs_name, "r"); - if (!f) - return 0; /* Not an USB device (or no sysfs) */ - - s = fgets(buf, sizeof(buf), f); - fclose(f); - - if (!s || sscanf(s, "%04hx%c", &vendor_id, &c) != 2 || c != '\n') - return 0; /* Should never happen */ - - /* Get product ID */ - snprintf(sysfs_name, sizeof(sysfs_name), - "/sys/class/video4linux/video%d/device/idProduct", i); - f = fopen(sysfs_name, "r"); - if (!f) - return 0; /* Should never happen */ - - s = fgets(buf, sizeof(buf), f); - fclose(f); - - if (!s || sscanf(s, "%04hx%c", &product_id, &c) != 2 || c != '\n') - return 0; /* Should never happen */ - } - - for (i = 0; i < ARRAY_SIZE(v4lconvert_flags); i++) - if (v4lconvert_flags[i].vendor_id == vendor_id && - v4lconvert_flags[i].product_id == product_id) - return v4lconvert_flags[i].flags; - - return 0; -} - struct v4lconvert_data *v4lconvert_create(int fd) { int i, j; struct v4lconvert_data *data = calloc(1, sizeof(struct v4lconvert_data)); struct v4l2_capability cap; - struct v4l2_input input; if (!data) return NULL; @@ -206,14 +114,6 @@ struct v4lconvert_data *v4lconvert_create(int fd) data->no_formats = i; /* Check if this cam has any special flags */ - data->flags = v4lconvert_get_flags(data->fd); - if ((syscall(SYS_ioctl, fd, VIDIOC_G_INPUT, &input.index) == 0) && - (syscall(SYS_ioctl, fd, VIDIOC_ENUMINPUT, &input) == 0)) { - if (input.status & V4L2_IN_ST_HFLIP) - data->flags |= V4LCONVERT_HFLIP; - if (input.status & V4L2_IN_ST_VFLIP) - data->flags |= V4LCONVERT_VFLIP; - } if (syscall(SYS_ioctl, fd, VIDIOC_QUERYCAP, &cap) == 0) { if (!strcmp((char *)cap.driver, "uvcvideo")) data->flags |= V4LCONVERT_IS_UVC; @@ -226,6 +126,7 @@ struct v4lconvert_data *v4lconvert_create(int fd) free(data); return NULL; } + data->control_flags = v4lcontrol_get_flags(data->control); data->processing = v4lprocessing_create(data->control); if (!data->processing) { @@ -502,7 +403,7 @@ int v4lconvert_needs_conversion(struct v4lconvert_data *data, src_fmt->fmt.pix.pixelformat != dest_fmt->fmt.pix.pixelformat) return 1; /* Formats differ */ - if (!(data->flags & (V4LCONVERT_HFLIP|V4LCONVERT_VFLIP))) + if (!(data->control_flags & (V4LCONTROL_HFLIPPED|V4LCONTROL_VFLIPPED))) return 0; /* Formats identical and we don't need flip */ /* Formats are identical, but we need flip, do we support the dest_fmt? */ @@ -592,9 +493,12 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, if (header_width != width || header_height != height) { /* Check for (pixart) rotated JPEG */ if (header_width == height && header_height == width) { - if (!(data->flags & V4LCONVERT_JPEG_ROTATE_90_HACK)) { + if (!(data->control_flags & V4LCONTROL_ROTATED_90_JPEG)) { + fprintf(stderr, + "libv4lconvert: Unknown cam with 90° rotated JPEG, " + "please report this to <hdegoede@redhat.com>\n"); V4LCONVERT_ERR("JPEG needs 90 degree rotation\n"); - data->flags |= V4LCONVERT_JPEG_ROTATE_90_HACK; + data->control_flags |= V4LCONTROL_ROTATED_90_JPEG; errno = EAGAIN; return -1; } @@ -994,8 +898,8 @@ int v4lconvert_convert(struct v4lconvert_data *data, convert2_src = convert1_dest; } - if (convert && (data->flags & (V4LCONVERT_JPEG_ROTATE_90_HACK | - V4LCONVERT_VFLIP | V4LCONVERT_HFLIP) || crop)) { + if (convert && ((data->control_flags & (V4LCONTROL_ROTATED_90_JPEG | + V4LCONTROL_VFLIPPED | V4LCONTROL_HFLIPPED)) || crop)) { convert2_dest = v4lconvert_alloc_buffer(data, temp_needed, &data->convert2_buf, &data->convert2_buf_size); if (!convert2_dest) @@ -1004,8 +908,9 @@ int v4lconvert_convert(struct v4lconvert_data *data, rotate90_src = flip_src = crop_src = convert2_dest; } - if ((data->flags & V4LCONVERT_JPEG_ROTATE_90_HACK) && - ((data->flags & (V4LCONVERT_VFLIP | V4LCONVERT_HFLIP)) || crop)) { + if ((data->control_flags & V4LCONTROL_ROTATED_90_JPEG) && + ((data->control_flags & (V4LCONTROL_VFLIPPED | V4LCONTROL_HFLIPPED)) || + crop)) { rotate90_dest = v4lconvert_alloc_buffer(data, temp_needed, &data->rotate90_buf, &data->rotate90_buf_size); if (!rotate90_dest) @@ -1014,7 +919,8 @@ int v4lconvert_convert(struct v4lconvert_data *data, flip_src = crop_src = rotate90_dest; } - if ((data->flags & (V4LCONVERT_VFLIP | V4LCONVERT_HFLIP)) && crop) { + if ((data->control_flags & (V4LCONTROL_VFLIPPED | V4LCONTROL_HFLIPPED)) && + crop) { flip_dest = v4lconvert_alloc_buffer(data, temp_needed, &data->flip_buf, &data->flip_buf_size); if (!flip_dest) @@ -1054,11 +960,11 @@ int v4lconvert_convert(struct v4lconvert_data *data, if (processing) v4lprocessing_processing(data->processing, rotate90_src, &my_src_fmt); - if (data->flags & V4LCONVERT_JPEG_ROTATE_90_HACK) + if (data->control_flags & V4LCONTROL_ROTATED_90_JPEG) v4lconvert_rotate90(rotate90_src, rotate90_dest, &my_src_fmt); - if (data->flags & (V4LCONVERT_VFLIP | V4LCONVERT_HFLIP)) - v4lconvert_flip(flip_src, flip_dest, &my_src_fmt, data->flags); + if (data->control_flags & (V4LCONTROL_VFLIPPED | V4LCONTROL_HFLIPPED)) + v4lconvert_flip(flip_src, flip_dest, &my_src_fmt, data->control_flags); if (crop) v4lconvert_crop(crop_src, dest, &my_src_fmt, &my_dest_fmt); |