[vlc-devel] YUY2 support in V4L

Mario Rossi mariofutire at googlemail.com
Sun Nov 26 23:06:43 CET 2006


I'm using the v4l module em28xx in vlc and I've found a couple of
issues which I've tried to fix with this patch

1) if no option v4l-chroma is specified, the access module sets
"fourcc" and "palette" to 0.
Later it tries to fallback to VIDEO_PALETTE_YUV422P or
VIDEO_PALETTE_YUV420P, but if the driver does not accept them (e.g.
em28xx) it fails.
IMHO if the user does not specify v4l-chroma, vlc should keep the
palette returned by VIDIOCGPICT

2) in the table v4lchroma_to_fourcc I think the pair
VIDEO_PALETTE_YUV422 <-> I422
should be
VIDEO_PALETTE_YUV422 <-> YUY2

3) in the same table the fourcc associated to VIDEO_PALETTE_YUYV (fourcc YUYV)
VIDEO_PALETTE_YUYV <-> YUYV
is apparently unknown to VLC (vout_initPicture does not know anything
about it) ending in the error "unsupported chroma". but it seems it is
equivalent to YUY2.
So I thought to change it to
VIDEO_PALETTE_YUYV <-> YUY2.
instead of adding support for YUYV everywhere.

This is the suggested patch

Index: modules/access/v4l/v4l.c
===================================================================
--- modules/access/v4l/v4l.c    (revision 18061)
+++ modules/access/v4l/v4l.c    (working copy)
@@ -234,8 +234,8 @@
     { VIDEO_PALETTE_RGB555, VLC_FOURCC( 'R', 'V', '1', '5' ) },
     { VIDEO_PALETTE_RGB24, VLC_FOURCC( 'R', 'V', '2', '4' ) },
     { VIDEO_PALETTE_RGB32, VLC_FOURCC( 'R', 'V', '3', '2' ) },
-    { VIDEO_PALETTE_YUV422, VLC_FOURCC( 'I', '4', '2', '2' ) },
-    { VIDEO_PALETTE_YUYV, VLC_FOURCC( 'Y', 'U', 'Y', 'V' ) },
+    { VIDEO_PALETTE_YUV422, VLC_FOURCC( 'Y', 'U', 'Y', '2' ) },
+    { VIDEO_PALETTE_YUYV, VLC_FOURCC( 'Y', 'U', 'Y', '2' ) },
     { VIDEO_PALETTE_UYVY, VLC_FOURCC( 'U', 'Y', 'V', 'Y' ) },
     { VIDEO_PALETTE_YUV420, VLC_FOURCC( 'I', '4', '2', 'N' ) },
     { VIDEO_PALETTE_YUV411, VLC_FOURCC( 'I', '4', '1', 'N' ) },
@@ -1170,12 +1170,12 @@
             char *psz;
             int i;

-            vid_picture.palette = 0;
-            p_sys->i_fourcc = 0;
-
             psz = var_CreateGetString( p_demux, "v4l-chroma" );
             if( strlen( psz ) >= 4 )
             {
+               vid_picture.palette = 0;
+               p_sys->i_fourcc = 0;
+
                 int i_chroma = VLC_FOURCC( psz[0], psz[1], psz[2], psz[3] );

                 /* Find out v4l chroma code */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v4l.diff
Type: text/x-patch
Size: 1310 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20061126/51091242/attachment.bin>


More information about the vlc-devel mailing list