[FFmpeg-devel] [ffmpeg-devel] [PATCH 1/2] lavfi: make AVFilteFormats use int64_t lists to support channel layouts.

Mina Nagy Zaki mnzaki at gmail.com
Thu Jun 9 18:28:06 CEST 2011


On Thursday 09 June 2011 18:58:19 Mike Scheutzow wrote:
> Stefano Sabatini wrote:
> > On date Thursday 2011-06-09 13:25:25 +0300, Mina Nagy Zaki encoded:
> >> The list type was changed to int64_t to be able to hold
> >> channel layouts.
> >> 
> >> Usage of avfilter_make_format_list for PixelFromats/[AV]SampleFormats
> >> had to be changed to use int64_t[] instead of enums, as they are 32bit.
> > 
> > I discussed this with Mina and this looked like the best solution for
> > avoiding separate int/int64_t functions. If you have reasons to think
> > there are better solutions, please comment.
> 
> This change appears to make things much less type-safe.
> 
> What was the original reason to change 'enum SampleFormat' to int64_t?

This change is to facilitate adding channel layout negotiation between 
different filters to do some auto-conversions when need. To do that, I reused 
the sample format negotiation code along with the AVFilterFormats struct. Now 
for some reason, channel layouts in ffmpeg are stored as int64_t and changing 
that to int32 would break the api all over the place (though frankly I don't 
really see the reason it's int64_t in the first place). Now enums are 32bit, 
and passing in an array of enums to avfilter_make_format_list() wouldn't work 
anymore, and so here we are.

The other option was to duplicate the avfilter_make_formats function and create 
a 64bit version and a 32bit version. 

-- 
Mina


More information about the ffmpeg-devel mailing list