[vlc-commits] Use ifndef for V4L2 hacks

Rémi Denis-Courmont git at videolan.org
Mon Oct 3 17:57:46 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Oct  3 18:56:52 2011 +0300| [15f6be5d84ab788c38313811de76b8a963db78bc] | committer: Rémi Denis-Courmont

Use ifndef for V4L2 hacks

This should make life easier for *BSD support, and less error-prone on
Linux. Unfortunately, this does not work for enumerations.

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

 modules/access/v4l2/v4l2.h |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/modules/access/v4l2/v4l2.h b/modules/access/v4l2/v4l2.h
index f86e3be..7fed7b7 100644
--- a/modules/access/v4l2/v4l2.h
+++ b/modules/access/v4l2/v4l2.h
@@ -29,23 +29,28 @@
 #endif
 
 /* Hacks to compile with old headers */
+#ifndef V4L2_CTRL_FLAG_VOLATILE /* 3.2 */
+# warning Please update Video4Linux2 headers!
+# define V4L2_CTRL_FLAG_VOLATILE 0x0080
+#endif
 #ifdef __linux__
 # include <linux/version.h>
-# if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
-#  warning Please update Video4Linux2 headers!
-#  define V4L2_CTRL_FLAG_VOLATILE 0x0080
-# endif
 # if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
 #  define V4L2_CTRL_TYPE_BITMASK 8
 # endif
-# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
-#  define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
-# endif
-# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
-#  define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
-#  define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
-# endif
 #endif
+#ifndef V4L2_CID_ILLUMINATORS_1 /* 2.6.37 */
+# define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+38)
+# define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+37)
+#endif
+#ifndef V4L2_CID_CHROMA_GAIN /* 2.6.35 */
+# define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
+#endif
+#ifndef V4L2_CID_ROTATE /* 2.6.33 */
+# define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
+# define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
+#endif
+
 
 #ifdef HAVE_LIBV4L2
 #   include <libv4l2.h>



More information about the vlc-commits mailing list