[FFmpeg-devel] [PATCHv2] lavf: add av_guess_frame_sample_aspect_ratio function

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat May 5 19:42:08 CEST 2012

On 5 May 2012, at 19:30, Marton Balint <cus at passwd.hu> wrote:
> On Mon, 30 Apr 2012, Marton Balint wrote:
>> Guesses the sample aspect ratio of a frame, based on both the stream and the
>> frame aspect ratio.
>> Since the frame aspect ratio is set by the codec but the stream aspect ratio
>> is set by the demuxer, these two may not be equal. This function tries to
>> return the value that you should use if you would like to display the frame.
>> Basic logic is to use the stream aspect ratio if it is set to something sane
>> otherwise use the frame aspect ratio. This way a container setting, which is
>> usually easy to modify can override the coded value in the frames.
> What do you think guys, is this ready to be part of the API? I have some pending ffplay patches which depend on this functionality.

Not sure, will this function be able to survive adding e.g. code to detect aspect changes and switch to the AVFrame on for example?
Or some codec-dependant stuff, will all necessary information likely be available like this or might we want to have a codec and/or format context?
And since it is in libavformat, should the second parameter be an AVFrame or should it maybe rather just be the frame aspect so it can be more easily used with codecs other than libavcodec?

More information about the ffmpeg-devel mailing list