Commit b5bcf711 authored by Antoine Cellerier's avatar 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.
parent 64964519
......@@ -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 ) )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment