[FFmpeg-devel] [PATCH]Always accept concatenating a stream without SAR with a stream with SAR defined

Nicolas George nicolas.george at normalesup.org
Wed Jul 17 10:26:00 CEST 2013


Le nonidi 29 messidor, an CCXXI, Carl Eugen Hoyos a écrit :
> Hi!
> 
> If the user tries to concatenate a stream with defined SAR with a stream that 
> has no SAR defined, I don't think it makes sense to abort.
> Fixes ticket #2456.
> 
> Please comment, Carl Eugen

> diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c
> index 4534102..943404a 100644
> --- a/libavfilter/avf_concat.c
> +++ b/libavfilter/avf_concat.c
> @@ -134,10 +134,13 @@ static int config_output(AVFilterLink *outlink)
>      outlink->format              = inlink->format;
>      for (seg = 1; seg < cat->nb_segments; seg++) {
>          inlink = ctx->inputs[in_no += ctx->nb_outputs];
> +        if (!outlink->sample_aspect_ratio.num)
> +            outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
>          /* possible enhancement: unsafe mode, do not check */
>          if (outlink->w                       != inlink->w                       ||
>              outlink->h                       != inlink->h                       ||
> -            outlink->sample_aspect_ratio.num != inlink->sample_aspect_ratio.num ||

> +            outlink->sample_aspect_ratio.num != inlink->sample_aspect_ratio.num &&
> +            inlink->sample_aspect_ratio.num ||

I would be slightly happier with parentheses to show that && has precedence
over || (not every reader of the code knows the exact order of precedence,
and relying on it is fragile).

And maybe keep the || aligned with the other ||.

>              outlink->sample_aspect_ratio.den != inlink->sample_aspect_ratio.den) {
>              av_log(ctx, AV_LOG_ERROR, "Input link %s parameters "
>                     "(size %dx%d, SAR %d:%d) do not match the corresponding "

Apart from that minor wish, looks good, thanks.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130717/51319a1c/attachment.asc>


More information about the ffmpeg-devel mailing list