[vlc-commits] v4l2: non-video capture devices cannot currently be used

Rémi Denis-Courmont git at videolan.org
Thu Mar 15 18:21:20 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Mar 15 19:08:10 2012 +0200| [0d8ccdcd96994f6cddeb8318c6a27e247f0f16f1] | committer: Rémi Denis-Courmont

v4l2: non-video capture devices cannot currently be used

This is not to say that devices of some other types should not be
supported. But none of them currently are really supported.
(Also I think a different MRL scheme would be preferable for some.)

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

 modules/access/v4l2/video.c |   43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c
index 2bccf59..2f8dc55 100644
--- a/modules/access/v4l2/video.c
+++ b/modules/access/v4l2/video.c
@@ -809,6 +809,12 @@ int InitVideo( vlc_object_t *p_obj, int i_fd, demux_sys_t *p_sys,
             ( cap.capabilities & V4L2_CAP_STREAMING ? 'X':' ' ),
             ( cap.capabilities & V4L2_CAP_ASYNCIO ? 'X':' ' ) );
 
+    if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE))
+    {
+        msg_Err (p_obj, "not a video capture device");
+        return -1;
+    }
+
     if( cap.capabilities & V4L2_CAP_STREAMING )
         p_sys->io = IO_METHOD_MMAP;
     else if( cap.capabilities & V4L2_CAP_READWRITE )
@@ -822,30 +828,27 @@ int InitVideo( vlc_object_t *p_obj, int i_fd, demux_sys_t *p_sys,
     /* Now, enumerate all the video inputs. This is useless at the moment
        since we have no way to present that info to the user except with
        debug messages */
-    if( cap.capabilities & V4L2_CAP_VIDEO_CAPTURE )
-    {
-        struct v4l2_input input;
-        unsigned index = var_InheritInteger( p_obj, CFG_PREFIX"input" );
+    struct v4l2_input input;
+    unsigned index = var_InheritInteger( p_obj, CFG_PREFIX"input" );
 
-        input.index = 0;
-        while( v4l2_ioctl( i_fd, VIDIOC_ENUMINPUT, &input ) >= 0 )
-        {
-            msg_Dbg( p_obj, "video input %u (%s) has type: %s %c",
-                     input.index, input.name,
-                     input.type == V4L2_INPUT_TYPE_TUNER
+    input.index = 0;
+    while( v4l2_ioctl( i_fd, VIDIOC_ENUMINPUT, &input ) >= 0 )
+    {
+        msg_Dbg( p_obj, "video input %u (%s) has type: %s %c",
+                 input.index, input.name,
+                 input.type == V4L2_INPUT_TYPE_TUNER
                           ? "Tuner adapter" : "External analog input",
-                     input.index == index ? '*' : ' ' );
-            input.index++;
-        }
+                 input.index == index ? '*' : ' ' );
+        input.index++;
+    }
 
-        /* Select input */
-        if( v4l2_ioctl( i_fd, VIDIOC_S_INPUT, &index ) < 0 )
-        {
-            msg_Err( p_obj, "cannot set input %u: %m", index );
-            return -1;
-        }
-        msg_Dbg( p_obj, "input set to %u", index );
+    /* Select input */
+    if( v4l2_ioctl( i_fd, VIDIOC_S_INPUT, &index ) < 0 )
+    {
+        msg_Err( p_obj, "cannot set input %u: %m", index );
+        return -1;
     }
+    msg_Dbg( p_obj, "input set to %u", index );
 
     /* Select standard */
     bool bottom_first;



More information about the vlc-commits mailing list