libv4l: Do not hide JPG / MJPG pixfmt from applications
authorhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>
Fri, 14 Aug 2009 07:57:02 +0000 (09:57 +0200)
committerhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>
Fri, 14 Aug 2009 07:57:02 +0000 (09:57 +0200)
From: Hans de Goede <hdegoede@redhat.com>

Some applications want to use jpg format if possible, so do not hide
it from the apps (do not assume it always needs conversion)

Priority: normal

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

index 93371a1..8614df1 100644 (file)
@@ -5,6 +5,8 @@ libv4l-0.6.1
 * Bugfix: fixup 320x240 output for pac7302 cameras
 * README improvements / clarifications (Bifferos)
 * Bugfix: fix reqbuf Device or Resource busy error when using v4l2_read()
+* Some applications want to use jpg format if possible, so do not hide
+  it from the apps (do not assume it always needs conversion)
 
 libv4l-0.6.0
 ------------
index a61a2ee..f10f3f6 100644 (file)
 /* Pixformat flags */
 #define V4LCONVERT_COMPRESSED            0x01 /* Compressed format */
 #define V4LCONVERT_NEEDS_CONVERSION      0x02 /* Apps likely wont know this */
+#define V4LCONVERT_COMPRESSED_AND_NEEDS_CONVERSION 0x03
 
 struct v4lconvert_data {
   int fd;
index fda9f8e..f5e9d97 100644 (file)
@@ -58,14 +58,14 @@ static const struct v4lconvert_pixfmt supported_src_pixfmts[] = {
   { V4L2_PIX_FMT_HM12,         V4LCONVERT_NEEDS_CONVERSION },
   { V4L2_PIX_FMT_MJPEG,        V4LCONVERT_COMPRESSED },
   { V4L2_PIX_FMT_JPEG,         V4LCONVERT_COMPRESSED },
-  { V4L2_PIX_FMT_SPCA561,      V4LCONVERT_COMPRESSED },
-  { V4L2_PIX_FMT_SN9C10X,      V4LCONVERT_COMPRESSED },
-  { V4L2_PIX_FMT_PAC207,       V4LCONVERT_COMPRESSED },
-  { V4L2_PIX_FMT_MR97310A,     V4LCONVERT_COMPRESSED },
-  { V4L2_PIX_FMT_SQ905C,       V4LCONVERT_COMPRESSED },
-  { V4L2_PIX_FMT_PJPG,         V4LCONVERT_COMPRESSED },
-  { V4L2_PIX_FMT_OV511,        V4LCONVERT_COMPRESSED },
-  { V4L2_PIX_FMT_OV518,        V4LCONVERT_COMPRESSED },
+  { V4L2_PIX_FMT_SPCA561,      V4LCONVERT_COMPRESSED_AND_NEEDS_CONVERSION },
+  { V4L2_PIX_FMT_SN9C10X,      V4LCONVERT_COMPRESSED_AND_NEEDS_CONVERSION },
+  { V4L2_PIX_FMT_PAC207,       V4LCONVERT_COMPRESSED_AND_NEEDS_CONVERSION },
+  { V4L2_PIX_FMT_MR97310A,     V4LCONVERT_COMPRESSED_AND_NEEDS_CONVERSION },
+  { V4L2_PIX_FMT_SQ905C,       V4LCONVERT_COMPRESSED_AND_NEEDS_CONVERSION },
+  { V4L2_PIX_FMT_PJPG,         V4LCONVERT_COMPRESSED_AND_NEEDS_CONVERSION },
+  { V4L2_PIX_FMT_OV511,        V4LCONVERT_COMPRESSED_AND_NEEDS_CONVERSION },
+  { V4L2_PIX_FMT_OV518,        V4LCONVERT_COMPRESSED_AND_NEEDS_CONVERSION },
 };
 
 static const struct v4lconvert_pixfmt supported_dst_pixfmts[] = {
@@ -114,7 +114,7 @@ struct v4lconvert_data *v4lconvert_create(int fd)
       if (fmt.pixelformat == supported_src_pixfmts[j].fmt) {
        data->supported_src_formats |= 1 << j;
        v4lconvert_get_framesizes(data, fmt.pixelformat, j);
-       if (!supported_src_pixfmts[j].flags)
+       if (!(supported_src_pixfmts[j].flags & V4LCONVERT_NEEDS_CONVERSION))
          always_needs_conversion = 0;
        break;
       }