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

Erik Slagter erik at slagter.name
Wed Jun 22 20:58:44 CEST 2011


>> 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.

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...

> You didn't understand.
> The goal is to have presets sets some values, and override them only if
> they are specified. That's what the 'if (param&&' in OPT_STR does now.

Yes, clear. I'll change that. Stupid of me.

If you guys are really serious about every line, I'll change the layout of
the switch to be more compact (and less "overly correct").

New patch coming shortly, testing at the moment...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5110 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110622/50a054c9/attachment.p7s>


More information about the ffmpeg-devel mailing list