[FFmpeg-devel] [PATCH] libavcodec/libx264.c: distinguish between x264 parameter errors

Etienne Buira etienne.buira.lists at free.fr
Fri Jun 24 10:54:59 CEST 2011


On Wed, Jun 22, 2011 at 08:58:44PM +0200, Erik Slagter wrote:
> >> Personally I don't mind having a few lines of code extra if it means
> >> the purpose of the code is clear at a glance. But I assume the ffmpeg
> >> devels try to squeeze out as much lines as possible ;-)
> >
> > The purpose was actually to have fewer lines, such as keeping OPT_STR,
> > changing it to call opt_str which would look like
> > static int opt_str(...)
> > {
> >      int ret = x264_param_parse(...)
> >      switch(ret) {
> >      case X264_PARAM_BAD_NAME: av_log(...); break;
> >      case X264_PARAM_BAD_VALUE: av_log(...); break;
> >      default: av_log(...); break;
> >      }
> >      return ret;
> > }
> 
> I don't understand what you're trying to say here. The function you're
> describing here is functionally equivalent to my version.

No, the one I describe doesn't (almost) invert x264_param_parse return
value.

> And yes, the goal of having fewer lines was clear to me, sorry if I
> didn't phrase it clearly. I just don't understand why lesser lines should
> always be a goal, especially when the source starts to look like assembly
> and the generated code is the same...

I suggested to keep a wrapper macro (that handles the return on error)
to have less and cleaner lines, but I understand if a wrapper macro
calling an helper function would shock some people here, every tastes
are in the world.


More information about the ffmpeg-devel mailing list