linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rémi Denis-Courmont" <remi@remlab.net>
To: linux-media@vger.kernel.org
Subject: Re: [yavta PATCH 1/3] Support integer menus.
Date: Fri, 13 Apr 2012 22:57:53 +0300	[thread overview]
Message-ID: <201204132257.53893.remi@remlab.net> (raw)
In-Reply-To: <2967674.Tm7K8VO7YX@avalon>

Le vendredi 13 avril 2012 22:47:14 Laurent Pinchart, vous avez écrit :
> Hi Sakari,
> 
> Thanks for the patch.
> 
> The code looks fine, but unfortunately breaks compilation when using kernel
> headers < v3.5 (which is a pretty common case as of today ;-)).
> 
> V4L2_CTRL_TYPE_INTEGER_MENU is an enumerated value, not a pre-processor
> #define, so it's difficult to test for it using conditional compilation.

Same problem with BITMASK already.

The most common solution to this problem, although not found in V4L consists 
of defining the enumeration members in the header <linux/videodev2.h>:

#define V4L2_CTRL_TYPE_INTEGER_MENU V4L2_CTRL_TYPE_INTEGER_MENU

Then #ifdef works fine. libc has plenty of these, e.g. <bits/socket.h>. Or per 
package, autoconf can be used:

AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h])
AC_CHECK_DECLS([V4L2_CTRL_TYPE_INTEGER_MENU],,, [
#ifdef HAVE_LINUX_VIDEODEV2_H
# include <linux/videodev2.h>
#endif
#ifdef HAVE_SYS_VIDEOIO_H
# include <sys/videoio.h>
#endif
])

Then this works:

#if HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU



-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis

  reply	other threads:[~2012-04-13 19:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12  8:41 [yavta PATCH 1/3] Support integer menus Sakari Ailus
2012-04-12  8:41 ` [yavta PATCH 2/3] Support extended controls, including 64-bit integers Sakari Ailus
2012-04-12  8:41 ` [yavta PATCH 3/3] Support additional dpcm compressed bayer formats Sakari Ailus
2012-04-13 19:17   ` Laurent Pinchart
2012-04-13 20:14     ` Sakari Ailus
2012-04-13 19:47 ` [yavta PATCH 1/3] Support integer menus Laurent Pinchart
2012-04-13 19:57   ` Rémi Denis-Courmont [this message]
2012-04-13 20:13   ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201204132257.53893.remi@remlab.net \
    --to=remi@remlab.net \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).