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

git version control git at videolan.org
Sat Sep 12 15:00:51 CEST 2009


vlc | branch: 1.0-bugfix | Antoine Cellerier <dionoea at videolan.org> | Wed Jul 29 21:07:14 2009 +0200| [ea600ab0353d474fe8247269442216a5c4e51c9c] | 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.
(cherry picked from commit b5bcf711d298f4b097ce3a854e284a59debb849c)

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

 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 b2b2c15..f490b83 100644
--- a/modules/access/v4l2.c
+++ b/modules/access/v4l2.c
@@ -1936,7 +1936,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;
@@ -1951,9 +1964,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