[vlc-devel] commit: Partial attempt at fixing interlacing support. (Antoine Cellerier )

git version control git at videolan.org
Wed Jul 29 21:08:18 CEST 2009


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Wed Jul 29 21:07:14 2009 +0200| [b5bcf711d298f4b097ce3a854e284a59debb849c] | committer: Antoine Cellerier 

Partial attempt at fixing interlacing support.

First try using no interlacing and fallback to driver's default if it
isn't possible. Might fix some issues. We still need to declare images
as interlaced to VLC afterwards, but that's another problem.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b5bcf711d298f4b097ce3a854e284a59debb849c
---

 modules/access/v4l2.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/modules/access/v4l2.c b/modules/access/v4l2.c
index b9b44d5..8ba191a 100644
--- a/modules/access/v4l2.c
+++ b/modules/access/v4l2.c
@@ -1917,7 +1917,20 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
                 }
             }
             /* Try and set user chroma */
-            if( !IsPixelFormatSupported( p_demux, fmt.fmt.pix.pixelformat ) || ( fmt.fmt.pix.pixelformat && v4l2_ioctl( i_fd, VIDIOC_S_FMT, &fmt ) < 0 ) )
+            bool b_error = !IsPixelFormatSupported( p_demux, fmt.fmt.pix.pixelformat );
+            if( !b_error && fmt.fmt.pix.pixelformat )
+            {
+                if( v4l2_ioctl( i_fd, VIDIOC_S_FMT, &fmt ) < 0 )
+                {
+                    fmt.fmt.pix.field = V4L2_FIELD_ANY;
+                    if( v4l2_ioctl( i_fd, VIDIOC_S_FMT, &fmt ) < 0 )
+                    {
+                        fmt.fmt.pix.field = V4L2_FIELD_NONE;
+                        b_error = true;
+                    }
+                }
+            }
+            if( b_error )
             {
                 msg_Warn( p_demux, "Driver is unable to use specified chroma %s. Trying defaults.", p_sys->psz_requested_chroma );
                 fmt.fmt.pix.pixelformat = 0;
@@ -1932,9 +1945,15 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
             for( i = 0; i < ARRAY_SIZE( p_chroma_fallbacks ); i++ )
             {
                 fmt.fmt.pix.pixelformat = p_chroma_fallbacks[i];
-                if( IsPixelFormatSupported( p_demux, fmt.fmt.pix.pixelformat )
-                 && v4l2_ioctl( i_fd, VIDIOC_S_FMT, &fmt ) >= 0 )
-                    break;
+                if( IsPixelFormatSupported( p_demux, fmt.fmt.pix.pixelformat ) )
+                {
+                    if( v4l2_ioctl( i_fd, VIDIOC_S_FMT, &fmt ) >= 0 )
+                        break;
+                    fmt.fmt.pix.field = V4L2_FIELD_ANY;
+                    if( v4l2_ioctl( i_fd, VIDIOC_S_FMT, &fmt ) < 0 )
+                        break;
+                    fmt.fmt.pix.field = V4L2_FIELD_NONE;
+                }
             }
             if( i == ARRAY_SIZE( p_chroma_fallbacks ) )
             {




More information about the vlc-devel mailing list