Commit 3b357566 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Enumerate V4L2 frame sizes only once

parent ff039349
......@@ -271,6 +271,8 @@ float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd,
fse.discrete.height );
if( fps > max )
max = fps;
msg_Dbg( obj, " discrete size %"PRIu32"x%"PRIu32" supported",
fse.discrete.width, fse.discrete.height );
fse.index++;
} while( v4l2_ioctl( fd, VIDIOC_ENUM_FRAMESIZES, &fse ) >= 0 );
break;
......@@ -287,6 +289,11 @@ float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd,
if( fps > max )
max = fps;
}
msg_Dbg( obj, " sizes from %"PRIu32"x%"PRIu32" to %"PRIu32
"x%"PRIu32" supported with %"PRIu32"x%"PRIu32" steps",
fse.stepwise.min_width, fse.stepwise.min_height,
fse.stepwise.max_width, fse.stepwise.max_height,
fse.stepwise.step_width, fse.stepwise.step_height );
break;
case V4L2_FRMSIZE_TYPE_CONTINUOUS:
......@@ -294,6 +301,10 @@ float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd,
msg_Err( obj, "V4L2_FRMSIZE_TYPE_CONTINUOUS support incorrect" );
max = GetMaxFPS( fd, pixel_format, fse.stepwise.max_width,
fse.stepwise.max_height );
msg_Dbg( obj, " sizes from %"PRIu32"x%"PRIu32" to %"PRIu32
"x%"PRIu32" all supported",
fse.stepwise.min_width, fse.stepwise.min_height,
fse.stepwise.max_width, fse.stepwise.max_height );
break;
}
return max;
......
......@@ -1024,47 +1024,6 @@ static int InitVideo( vlc_object_t *p_obj, int i_fd, demux_sys_t *p_sys,
msg_Dbg( p_obj, "device supports chroma %4.4s [%s, %s]",
fourcc, codecs[i].description, fourcc_v4l2 );
b_codec_supported = true;
#ifdef VIDIOC_ENUM_FRAMESIZES
/* This is new in Linux 2.6.19 */
/* List valid frame sizes for this format */
struct v4l2_frmsizeenum frmsize;
memset( &frmsize, 0, sizeof(frmsize) );
frmsize.pixel_format = codecs[i].pixelformat;
if( v4l2_ioctl( i_fd, VIDIOC_ENUM_FRAMESIZES, &frmsize ) < 0 )
{
/* Not all devices support this ioctl */
msg_Warn( p_obj, "Unable to query for frame sizes" );
}
else
{
switch( frmsize.type )
{
case V4L2_FRMSIZE_TYPE_DISCRETE:
do
{
msg_Dbg( p_obj,
" device supports size %dx%d",
frmsize.discrete.width, frmsize.discrete.height );
frmsize.index++;
} while( v4l2_ioctl( i_fd, VIDIOC_ENUM_FRAMESIZES, &frmsize ) >= 0 );
break;
case V4L2_FRMSIZE_TYPE_STEPWISE:
msg_Dbg( p_obj,
" device supports sizes %dx%d to %dx%d using %dx%d increments",
frmsize.stepwise.min_width, frmsize.stepwise.min_height,
frmsize.stepwise.max_width, frmsize.stepwise.max_height,
frmsize.stepwise.step_width, frmsize.stepwise.step_height );
break;
case V4L2_FRMSIZE_TYPE_CONTINUOUS:
msg_Dbg( p_obj,
" device supports all sizes %dx%d to %dx%d",
frmsize.stepwise.min_width, frmsize.stepwise.min_height,
frmsize.stepwise.max_width, frmsize.stepwise.max_height );
break;
}
}
#endif
}
}
if( !b_codec_supported )
......
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