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

Luca Abeni lucabe72
Mon Apr 26 00:14:49 CEST 2010


On Sun, 2010-04-25 at 20:01 +0200, Stefano Sabatini wrote:
> On date Sunday 2010-04-25 10:52:41 +0200, Luca Abeni encoded:
> > Hi,
> > 
> > On Sat, 2010-04-24 at 20:53 +0200, Stefano Sabatini wrote:
> > [...] 
> > > +#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);
> > 
> > I am not sure if this kind of changes really improve the readability.
> 
> I generalized the previous patch, now we have a log_errno() function
> which is used whenever we need to print the string corresponding to an
> errno.

If we really want to have a log_errno(), then I think it should not be
private to v4l2.c (I expect that libav* contains some other code that
want to print error messages followed by an errno description).

I suspect it could go to libavutil/log.c... If Michael approves it, then
I am ok with the av_log() -> log_errno() contained in this patch.


				Luca




More information about the ffmpeg-devel mailing list