[vlc-commits] v4l2: only use bits mask controls where supported

Rémi Denis-Courmont git at videolan.org
Sat Apr 7 14:17:46 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr  7 15:09:54 2012 +0300| [94d47f83b3dbd4dde5b705db30b63d24b474fd0f] | committer: Rémi Denis-Courmont

v4l2: only use bits mask controls where supported

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

 configure.ac                   |    8 ++++++++
 modules/access/v4l2/controls.c |   10 ++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 91f2323..58149df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1830,6 +1830,14 @@ AS_IF([test "$enable_v4l2" != "no"], [
   AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
     have_v4l2="yes"
   ])
+  AC_CHECK_DECLS([V4L2_CTRL_TYPE_BITMASK],,, [
+#ifdef HAVE_LINUX_VIDEODEV2_H
+# include <linux/videodev2.h>
+#endif
+#ifdef HAVE_SYS_VIDEOIO_H
+# include <sys/videoio.h>
+#endif
+  ])
 ])
 AS_IF([test "$have_v4l2" = "yes"], [
   AS_IF([test "${enable_pvr}" = "yes"], [
diff --git a/modules/access/v4l2/controls.c b/modules/access/v4l2/controls.c
index a6f6333..bfa0e99 100644
--- a/modules/access/v4l2/controls.c
+++ b/modules/access/v4l2/controls.c
@@ -153,7 +153,9 @@ static int ControlSetCallback (vlc_object_t *obj, const char *var,
     {
         case V4L2_CTRL_TYPE_INTEGER:
         case V4L2_CTRL_TYPE_MENU:
+#if HAVE_DECL_V4L2_CTRL_TYPE_BITMASK
         case V4L2_CTRL_TYPE_BITMASK:
+#endif
             ret = ControlSet (ctrl, cur.i_int);
             break;
         case V4L2_CTRL_TYPE_BOOLEAN:
@@ -279,7 +281,7 @@ next:
                     case V4L2_CTRL_TYPE_STRING:
                         ControlSetStr (c, value);
                         break;
-
+#if HAVE_DECL_V4L2_CTRL_TYPE_BITMASK
                     case V4L2_CTRL_TYPE_BITMASK:
                     {
                         unsigned long val = strtoul (value, &end, 0);
@@ -292,7 +294,7 @@ next:
                         ControlSet (c, val);
                         break;
                     }
-
+#endif
                     default:
                         msg_Err (obj, "setting \"%s\" not supported", name);
                         goto next;
@@ -598,6 +600,7 @@ static vlc_v4l2_ctrl_t *ControlAddString (vlc_object_t *obj, int fd,
     return c;
 }
 
+#if HAVE_DECL_V4L2_CTRL_TYPE_BITMASK
 static vlc_v4l2_ctrl_t *ControlAddBitMask (vlc_object_t *obj, int fd,
                                            const struct v4l2_queryctrl *query)
 {
@@ -633,6 +636,7 @@ static vlc_v4l2_ctrl_t *ControlAddBitMask (vlc_object_t *obj, int fd,
     var_Change (obj, c->name, VLC_VAR_SETDEFAULT, &val, NULL);
     return c;
 }
+#endif
 
 static vlc_v4l2_ctrl_t *ControlAddUnknown (vlc_object_t *obj, int fd,
                                            const struct v4l2_queryctrl *query)
@@ -665,7 +669,9 @@ vlc_v4l2_ctrl_t *ControlsInit (vlc_object_t *obj, int fd)
         [V4L2_CTRL_TYPE_INTEGER64] = ControlAddInteger64,
         [V4L2_CTRL_TYPE_CTRL_CLASS] = ControlAddClass,
         [V4L2_CTRL_TYPE_STRING] = ControlAddString,
+#if HAVE_DECL_V4L2_CTRL_TYPE_BITMASK
         [V4L2_CTRL_TYPE_BITMASK] = ControlAddBitMask,
+#endif
     };
 
     vlc_v4l2_ctrl_t *list = NULL;



More information about the vlc-commits mailing list