From 7eb5fdd4536019ac8afe50a23e96d9e56aa9c82d Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 2 Aug 2011 13:30:23 +0200 Subject: [PATCH] libv4l: Add a force tinyjpeg quirk for w996Xcf based cams 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 --- lib/libv4lconvert/control/libv4lcontrol.c | 3 +++ lib/libv4lconvert/control/libv4lcontrol.h | 1 + lib/libv4lconvert/libv4lconvert.c | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/libv4lconvert/control/libv4lcontrol.c b/lib/libv4lconvert/control/libv4lcontrol.c index ca6c798..5bbb42b 100644 --- a/lib/libv4lconvert/control/libv4lcontrol.c +++ b/lib/libv4lconvert/control/libv4lcontrol.c @@ -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[]; diff --git a/lib/libv4lconvert/control/libv4lcontrol.h b/lib/libv4lconvert/control/libv4lcontrol.h index 3d1a28d..00ffb34 100644 --- a/lib/libv4lconvert/control/libv4lcontrol.h +++ b/lib/libv4lconvert/control/libv4lcontrol.h @@ -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) diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c index cf0b0f1..6a6a5f5 100644 --- a/lib/libv4lconvert/libv4lconvert.c +++ b/lib/libv4lconvert/libv4lconvert.c @@ -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) { -- 2.7.4