libv4l: Add a force tinyjpeg quirk for w996Xcf based cams
authorHans de Goede <hdegoede@redhat.com>
Tue, 2 Aug 2011 11:30:23 +0000 (13:30 +0200)
committerHans de Goede <hdegoede@redhat.com>
Tue, 2 Aug 2011 11:32:09 +0000 (13:32 +0200)
These cams produce non standard JPEG data which our embedded tinyjpeg
copy has been patched to handle, but regular libjpeg cannot handle,
so force the use of our embedded tinyjpeg for these cams.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
lib/libv4lconvert/control/libv4lcontrol.c
lib/libv4lconvert/control/libv4lcontrol.h
lib/libv4lconvert/libv4lconvert.c

index ca6c798..5bbb42b 100644 (file)
@@ -640,6 +640,9 @@ static const struct v4lcontrol_flags_info v4lcontrol_flags[] = {
                V4LCONTROL_HFLIPPED | V4LCONTROL_WANTS_WB_AUTOGAIN },
        { 0x047d, 0x5003, 0,    NULL, NULL,
                V4LCONTROL_HFLIPPED | V4LCONTROL_WANTS_WB_AUTOGAIN },
+       /* W996xCF based cams, must use jpeglite because of funky JPEG fmt */
+       { 0x041e, 0x4003, 0,    NULL, NULL, V4LCONTROL_FORCE_TINYJPEG },
+       { 0x1046, 0x9967, 0,    NULL, NULL, V4LCONTROL_FORCE_TINYJPEG },
 };
 
 static const struct v4l2_queryctrl fake_controls[];
index 3d1a28d..00ffb34 100644 (file)
@@ -30,6 +30,7 @@
 #define V4LCONTROL_ROTATED_90_JPEG       0x04
 #define V4LCONTROL_WANTS_WB              0x08
 #define V4LCONTROL_WANTS_AUTOGAIN        0x10
+#define V4LCONTROL_FORCE_TINYJPEG        0x20
 
 /* Masks */
 #define V4LCONTROL_WANTS_WB_AUTOGAIN     (V4LCONTROL_WANTS_WB | V4LCONTROL_WANTS_AUTOGAIN)
index cf0b0f1..6a6a5f5 100644 (file)
@@ -166,8 +166,10 @@ struct v4lconvert_data *v4lconvert_create(int fd, void *dev_ops_priv,
                free(data);
                return NULL;
        }
-       data->control_flags = v4lcontrol_get_flags(data->control);
        data->bandwidth = v4lcontrol_get_bandwidth(data->control);
+       data->control_flags = v4lcontrol_get_flags(data->control);
+       if (data->control_flags & V4LCONTROL_FORCE_TINYJPEG)
+               data->flags |= V4LCONVERT_USE_TINYJPEG;
 
        data->processing = v4lprocessing_create(fd, data->control);
        if (!data->processing) {