[FFmpeg-devel] [PATCH 2/6] Implement IOCTL_ERROR macro and use it.

Michael Niedermayer michaelni
Sat Apr 24 23:54:05 CEST 2010


On Sat, Apr 24, 2010 at 08:53:21PM +0200, Stefano Sabatini wrote:
> Provide consistency and slightly improve readability.
> ---
>  libavdevice/v4l2.c |   17 +++++++++--------
>  1 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
> index ce339a6..c5b1768 100644
> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -149,6 +149,8 @@ static struct fmt_map fmt_conversion_table[] = {
>      },
>  };
>  
> +#define IOCTL_ERROR(ctx__, ioctl__) av_log(ctx__, AV_LOG_ERROR, "ioctl(" #ioctl__ "): %s\n", strerror(errno))
> +
>  static int device_open(AVFormatContext *ctx, uint32_t *capabilities)
>  {
>      struct v4l2_capability cap;
> @@ -177,8 +179,7 @@ static int device_open(AVFormatContext *ctx, uint32_t *capabilities)
>          return AVERROR(errno);
>      }
>      if (res < 0) {
> -        av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n",
> -                 strerror(errno));
> +        IOCTL_ERROR(ctx, VIDIOC_QUERYCAP);
>          close(fd);
>  
>          return AVERROR(errno);
> @@ -296,7 +297,7 @@ static int mmap_init(AVFormatContext *ctx)
>          if (errno == EINVAL) {
>              av_log(ctx, AV_LOG_ERROR, "Device does not support mmap\n");
>          } else {
> -            av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_REQBUFS)\n");
> +            IOCTL_ERROR(ctx, VIDIOC_REQBUFS);

iam against this patch
it obfuscates the code and misuses a macro
a function could do this as well

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

> ... defining _GNU_SOURCE...
For the love of all that is holy, and some that is not, don't do that.
-- Luca & Mans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100424/9ba1fff9/attachment.pgp>



More information about the ffmpeg-devel mailing list