[vlc-commits] Enumerate V4L2 frame sizes only once

Rémi Denis-Courmont git at videolan.org
Tue Sep 6 22:53:19 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Sep  6 23:38:43 2011 +0300| [3b357566dc332c3043b2990cadc075f8910b4199] | committer: Rémi Denis-Courmont

Enumerate V4L2 frame sizes only once

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

 modules/access/v4l2/demux.c |   11 +++++++++++
 modules/access/v4l2/video.c |   41 -----------------------------------------
 2 files changed, 11 insertions(+), 41 deletions(-)

diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c
index f9c056a..658fa46 100644
--- a/modules/access/v4l2/demux.c
+++ b/modules/access/v4l2/demux.c
@@ -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;
diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c
index 5a1d022..67f3810 100644
--- a/modules/access/v4l2/video.c
+++ b/modules/access/v4l2/video.c
@@ -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 )



More information about the vlc-commits mailing list