[FFmpeg-devel] [PATCH] lavfi/avfiltergraph: always reduce all_layouts to a single layout

Marton Balint cus at passwd.hu
Tue Nov 22 01:34:48 EET 2016


On Mon, 21 Nov 2016, Nicolas George wrote:

> Le primidi 1er frimaire, an CCXXV, Marton Balint a écrit :
>> This reverts d300f5f6f570659e4b58567b35c9e8600c9f2956.
>>
>> Further reference:
>> https://ffmpeg.org/pipermail/ffmpeg-devel/2013-October/149935.html
>>
>> I can't reproduce ticket #2899 so I am not sure the original patch is still
>> needed. Reverting it fixes unknown channel layout support for trivial
>> resamples, such as:
>>
>> ffmpeg -f lavfi -i "aevalsrc=0|0|0|0|0|0|0|0|0:d=1,asetnsamples" -f null none
>>
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>>  libavfilter/avfiltergraph.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
>> index 3af698d..379bc1a 100644
>> --- a/libavfilter/avfiltergraph.c
>> +++ b/libavfilter/avfiltergraph.c
>> @@ -802,8 +802,7 @@ static int reduce_formats_on_filter(AVFilterContext *filter)
>>              if (inlink->type != outlink->type || fmts->nb_channel_layouts == 1)
>>                  continue;
>>
>> -            if (fmts->all_layouts &&
>> -                (!FF_LAYOUT2COUNT(fmt) || fmts->all_counts)) {
>> +            if (fmts->all_layouts) {
>>                  /* Turn the infinite list into a singleton */
>>                  fmts->all_layouts = fmts->all_counts  = 0;
>>                  if (ff_add_channel_layout(&outlink->in_channel_layouts, fmt) < 0)
>
> This is not correct. It makes a difference if the condition you remove
> is false, i.e. if !fmts->all_counts && FF_LAYOUT2COUNT(fmt): the filter
> does not support unknown layouts, and you propose to give it one
> nonetheless.

Okay, so the proper fix would be to make asetnsamples support unknown 
channel layouts? I thought it does, but as far as I see, the default, 
if no query_formats callback is specified is to only allow known layouts.

Wouldn't it make sense to change the default to allow unknown channel 
layouts as well, if no query_formats is specified?

Thanks,
Marton


More information about the ffmpeg-devel mailing list