[FFmpeg-devel] [PATCH] lavfi: support unknown channel layouts.

Stefano Sabatini stefasab at gmail.com
Fri Jan 4 16:30:44 CET 2013


On date Friday 2013-01-04 15:48:17 +0100, Nicolas George encoded:
> Le quartidi 14 nivôse, an CCXXI, Stefano Sabatini a écrit :
> > > +                /* let the remaining computation run and get 0 */
> > confusing: what's the point of computing score if you already knows it
> > is 0?
> 
> It avoids gratuitous differences with the fork because of reindented or
> moved code, and it makes the patch more readable IMHO.

I mean: the comment is confusing

> 
> > this could be commented. Also the heuristics seems somehow arbitrary
> > (and I'd prefer the score to be computed in a separated function, but
> > this is unrelated).
> 
> I mostly agree, but as you say, this is unrelated.
> 
> > given the logic, naming this as "set_channel_layout()" maybe more
> > clear, but feel free to keep the current name for consistency with the
> > other misnamed functions.
> 
> I changed it like that:
> 
> int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
> {
>     av_assert1(!(*l && (*l)->all_layouts));
>     ADD_FORMAT(l, channel_layout, uint64_t, channel_layouts, nb_channel_layouts);
>     return 0;   
> }               
> 
> And changed the relevant calling site into that
> 
>             if (fmts->all_layouts) {
>                 /* Turn the infinite list into a singleton */
>                 fmts->all_layouts = fmts->all_counts  = 0;
>                 ff_add_channel_layout(&outlink->in_channel_layouts, fmt);
>                 break;
>             }
> 
> > alternatively this could be named COUNT2LAYOUT
> 
> Changed to FF_COUNT2LAYOUT and FF_LAYOUT2COUNT.
> 
> > > + * Decode a channel count encoded as a channel layout.
> > > + * Return 0 is the channel layout was a real one.
> > is -> if?
> 
> Fixed.
> 
> > also:
> > Return 0 is the channel layout was a real one, otherwise the number of
> > channels | channels count.
> 
> I find it gratuitously redundant with the introductory sentence, and
> therefore less readable.
> 

> Do you want the updated patch? The changes are pretty trivial since last
> round.

An updated patch may be useful.
-- 
FFmpeg = Fast and Fundamental Minimalistic Picky Enlightening Guru


More information about the ffmpeg-devel mailing list