[gstreamer-bugs] [Bug 545033] New: PATCH: use libv4l in v4l2 plugin, adding support for many cam specific formats

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Sun Jul 27 13:40:56 PDT 2008


If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=545033

  GStreamer | gst-plugins-good | Ver: 0.10.8
           Summary: PATCH: use libv4l in v4l2 plugin, adding support for
                    many cam specific formats
           Product: GStreamer
           Version: 0.10.8
          Platform: Other
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-good
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: j.w.r.degoede at hhs.nl
         QAContact: gstreamer-bugs at lists.sourceforge.net
     GNOME version: Unspecified
   GNOME milestone: Unspecified


Short intro: I'm a long time Linux developer currently working on improving
webcam support in Linux, see:
http://fedoraproject.org/wiki/Features/BetterWebcamSupport

I'm one of the authors of the v4l2 rewrite of the gspca usb webcam driver
framework (which supports more then 100 different cams), this v4l2 rewrite has
been merged into the 2.6.27 kernel and thus will become available in the
official Linux kernel soon.

One of the parts of the v4l2 rewrite has been removing conversion from various
manufacturer cam specific video formats to more normal videoformats from the
drivers, as this really does not belong in userspace.

As a result of this the gspca subdrivers can generate raw video frames in the
following formats:

#define V4L2_PIX_FMT_SN9C10X  v4l2_fourcc('S', '9', '1', '0') /* SN9C10x
compressed bayer
#define V4L2_PIX_FMT_SPCA501  v4l2_fourcc('S', '5', '0', '1') /* YUYV per line 
#define V4L2_PIX_FMT_SPCA505  v4l2_fourcc('S', '5', '0', '5') /* YYUV per line 
#define V4L2_PIX_FMT_SPCA508  v4l2_fourcc('S', '5', '0', '8') /* YUVY per line 
#define V4L2_PIX_FMT_SPCA561  v4l2_fourcc('S', '5', '6', '1') /* compressed
GBRG bayer
#define V4L2_PIX_FMT_PAC207   v4l2_fourcc('P', '2', '0', '7') /* compressed
BGGR bayer

As we do not want to see each application implement (nor having to implement)
support for these various formats, as we like to have one code base and only
one code base for these formats. A library has been written (with me as the
main author) to convert from these formats to BGR24 or YUV420. For more on this
library see:
http://hansdegoede.livejournal.com/3636.html

The attached patch adds support to the gstreamer v4l2 plugin to use this
library if available on the system.

Note that currently there is an ifdef to handle compilation with/without the
library but this is hard defined in the header file. I've done it this way as
my autoconf skills are almost non existent so I thought it would be good to let
someone else write the autoconf detection of libv4l.

You can get the latest version of libv4l here:
http://people.atrpms.net/~hdegoede/libv4l-0.3.7.tar.gz

Note that this library is an official part of the v4l-dvb project, we just
haven't gotten around yet to making a homepage for it at linuxtv.org, but if
you look for example at the official v4l-dvb mercurial tree:
http://linuxtv.org/hg/v4l-dvb
Under v4l2-apps/lib/libv4l you will find libv4l there, a proper homepage is on
my todo.

A note about the patch, the patch is actually quite simple, as libv4l has been
designed for quick porting of existing apps to libv4l, for this reason libv4l
fully mimicks the raw /dev/video interface (and if no conversion is needed and
for non relevant calls like setting ctrl's, passes through all calls
unmodified).

All that the patch does and all that needs to be changed to use libv4l is
replace the relevant xxx calls on /dev/video with v4l2_xxx calls.

The only special thing about the patch is that it passes the
V4L2_ENABLE_ENUM_FMT_EMULATION flag to libv4l2 on open, this patch tells
libv4l2 to report the "emulated" formats in the ENUM_FMT ioctl results. Which
libv4l2 does not do be default so that ENUM_FMT only reports the really
supported formats (a TRY_FMT with one of the 2 supported emulated formats can
then be done to see if conversion is supported for the specific device). Given
the working of the v4l2 plugin, enabling the ENUM_FMT emulation is needed.

I've successfully tested this patch with cheese and 2 spca561 cams (quite
popular IC, used by both logitech and creative), 2 pac207 cams (another quite
popular IC), 3 SN9C10X cams (also very popular) and 1 spca501 cam. All of which
do not work without this patch, as gstreamer does not support their proprietary
video formats (and rightfully so).


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=545033.




More information about the Gstreamer-bugs mailing list