[vlc-commits] Enumerate V4L2 frame intervals once fewer
Rémi Denis-Courmont
git at videolan.org
Tue Sep 6 22:53:20 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Sep 6 23:51:57 2011 +0300| [30ae318e67042c23baa30968ccbe80ca949da522] | committer: Rémi Denis-Courmont
Enumerate V4L2 frame intervals once fewer
They are still enumerated many times though...
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30ae318e67042c23baa30968ccbe80ca949da522
---
modules/access/v4l2/demux.c | 31 +++++++++++++++++++---------
modules/access/v4l2/video.c | 47 -------------------------------------------
2 files changed, 21 insertions(+), 57 deletions(-)
diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c
index edf77a2..0caea00 100644
--- a/modules/access/v4l2/demux.c
+++ b/modules/access/v4l2/demux.c
@@ -208,7 +208,7 @@ static int Demux( demux_t *demux )
return 1;
}
-static float GetMaxFPS( int fd, uint32_t pixel_format,
+static float GetMaxFPS( vlc_object_t *obj, int fd, uint32_t pixel_format,
uint32_t width, uint32_t height )
{
#ifdef VIDIOC_ENUM_FRAMEINTERVALS
@@ -233,6 +233,9 @@ static float GetMaxFPS( int fd, uint32_t pixel_format,
/ (float)fie.discrete.numerator;
if( fps > max )
max = fps;
+ msg_Dbg( obj, " discrete frame interval %"PRIu32"/%"PRIu32
+ " supported",
+ fie.discrete.numerator, fie.discrete.denominator );
fie.index++;
} while( v4l2_ioctl( fd, VIDIOC_ENUM_FRAMEINTERVALS, &fie ) >= 0 );
return max;
@@ -240,6 +243,14 @@ static float GetMaxFPS( int fd, uint32_t pixel_format,
case V4L2_FRMIVAL_TYPE_STEPWISE:
case V4L2_FRMIVAL_TYPE_CONTINUOUS:
+ msg_Dbg( obj, " frame intervals from %"PRIu32"/%"PRIu32
+ "to %"PRIu32"/%"PRIu32" supported",
+ fie.stepwise.min.numerator, fie.stepwise.min.denominator,
+ fie.stepwise.max.numerator, fie.stepwise.max.denominator );
+ if( fie.type == V4L2_FRMIVAL_TYPE_STEPWISE )
+ msg_Dbg( obj, " with %"PRIu32"/%"PRIu32" step",
+ fie.stepwise.step.numerator,
+ fie.stepwise.step.denominator );
return __MAX( (float)fie.stepwise.max.denominator
/ (float)fie.stepwise.max.numerator,
(float)fie.stepwise.min.denominator
@@ -267,8 +278,8 @@ float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd,
case V4L2_FRMSIZE_TYPE_DISCRETE:
do
{
- float fps = GetMaxFPS( fd, pixel_format, fse.discrete.width,
- fse.discrete.height );
+ float fps = GetMaxFPS( obj, fd, pixel_format,
+ fse.discrete.width, fse.discrete.height );
if( fps > max )
max = fps;
msg_Dbg( obj, " discrete size %"PRIu32"x%"PRIu32" supported",
@@ -285,7 +296,7 @@ float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd,
width += fse.stepwise.step_width,
height += fse.stepwise.step_height )
{
- float fps = GetMaxFPS( fd, pixel_format, width, height );
+ float fps = GetMaxFPS( obj, fd, pixel_format, width, height );
if( fps > max )
max = fps;
}
@@ -299,7 +310,7 @@ float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd,
case V4L2_FRMSIZE_TYPE_CONTINUOUS:
/* FIXME */
msg_Err( obj, "V4L2_FRMSIZE_TYPE_CONTINUOUS support incorrect" );
- max = GetMaxFPS( fd, pixel_format, fse.stepwise.max_width,
+ max = GetMaxFPS( obj, 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",
@@ -333,8 +344,8 @@ void GetMaxDimensions( vlc_object_t *obj, int fd, uint32_t pixel_format,
case V4L2_FRMSIZE_TYPE_DISCRETE:
do
{
- float fps = GetMaxFPS( fd, pixel_format, fse.discrete.width,
- fse.discrete.height );
+ float fps = GetMaxFPS( obj, fd, pixel_format,
+ fse.discrete.width, fse.discrete.height );
if( fps >= fps_min && fse.discrete.width > *pwidth )
{
*pwidth = fse.discrete.width;
@@ -352,7 +363,7 @@ void GetMaxDimensions( vlc_object_t *obj, int fd, uint32_t pixel_format,
width += fse.stepwise.step_width,
height += fse.stepwise.step_height )
{
- float fps = GetMaxFPS( fd, pixel_format, width, height );
+ float fps = GetMaxFPS( obj, fd, pixel_format, width, height );
if( fps >= fps_min && width > *pwidth )
{
*pwidth = width;
@@ -363,8 +374,8 @@ void GetMaxDimensions( vlc_object_t *obj, int fd, uint32_t pixel_format,
case V4L2_FRMSIZE_TYPE_CONTINUOUS:
{
- float fps = GetMaxFPS( fd, pixel_format, fse.stepwise.max_width,
- fse.stepwise.max_height );
+ float fps = GetMaxFPS( obj, fd, pixel_format,
+ fse.stepwise.max_width, fse.stepwise.max_height );
msg_Err( obj, "V4L2_FRMSIZE_TYPE_CONTINUOUS support incorrect" );
if( fps >= fps_min && fse.stepwise.max_width > *pwidth )
{
diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c
index 67f3810..ad7d6c8 100644
--- a/modules/access/v4l2/video.c
+++ b/modules/access/v4l2/video.c
@@ -1273,53 +1273,6 @@ static int InitVideo( vlc_object_t *p_obj, int i_fd, demux_sys_t *p_sys,
if( fmt.fmt.pix.sizeimage < i_min )
fmt.fmt.pix.sizeimage = i_min;
-#ifdef VIDIOC_ENUM_FRAMEINTERVALS
- /* This is new in Linux 2.6.19 */
- /* List supported frame rates */
- struct v4l2_frmivalenum frmival;
- memset( &frmival, 0, sizeof(frmival) );
- frmival.pixel_format = fmt.fmt.pix.pixelformat;
- frmival.width = width;
- frmival.height = height;
- if( v4l2_ioctl( i_fd, VIDIOC_ENUM_FRAMEINTERVALS, &frmival ) >= 0 )
- {
- char psz_fourcc[5];
- memset( &psz_fourcc, 0, sizeof( psz_fourcc ) );
- vlc_fourcc_to_char( p_sys->i_fourcc, &psz_fourcc );
- msg_Dbg( p_obj, "supported frame intervals for %4.4s, %dx%d:",
- psz_fourcc, frmival.width, frmival.height );
- switch( frmival.type )
- {
- case V4L2_FRMIVAL_TYPE_DISCRETE:
- do
- {
- msg_Dbg( p_obj, " supported frame interval: %d/%d",
- frmival.discrete.numerator,
- frmival.discrete.denominator );
- frmival.index++;
- } while( v4l2_ioctl( i_fd, VIDIOC_ENUM_FRAMEINTERVALS, &frmival ) >= 0 );
- break;
- case V4L2_FRMIVAL_TYPE_STEPWISE:
- msg_Dbg( p_obj, " supported frame intervals: %d/%d to "
- "%d/%d using %d/%d increments",
- frmival.stepwise.min.numerator,
- frmival.stepwise.min.denominator,
- frmival.stepwise.max.numerator,
- frmival.stepwise.max.denominator,
- frmival.stepwise.step.numerator,
- frmival.stepwise.step.denominator );
- break;
- case V4L2_FRMIVAL_TYPE_CONTINUOUS:
- msg_Dbg( p_obj, " supported frame intervals: %d/%d to %d/%d",
- frmival.stepwise.min.numerator,
- frmival.stepwise.min.denominator,
- frmival.stepwise.max.numerator,
- frmival.stepwise.max.denominator );
- break;
- }
- }
-#endif
-
/* Init I/O method */
switch( p_sys->io )
{
More information about the vlc-commits
mailing list