[FFmpeg-devel] [PATCH] make av_get_bit_rate part of public API

Michael Niedermayer michaelni
Fri Feb 5 20:59:39 CET 2010


On Sun, Nov 29, 2009 at 01:18:28PM +0100, Robert Kr?ger wrote:
>
> On 27.11.2009, at 19:39, Michael Niedermayer wrote:
>
>> On Fri, Nov 27, 2009 at 01:32:19PM +0100, Robert Kr?ger wrote:
>>>
>>> On 25.11.2009, at 01:28, Michael Niedermayer wrote:
>>>
>>>> On Sat, Nov 21, 2009 at 03:10:38PM +0100, Robert Kr?ger wrote:
>>>>> Hi,
>>>>>
>>>>> this patch adds a prototype for av_get_bit_rate (implemented in
>>>>> libavcodec/utils.c) to avcodec.h.
>>>>
>>>> why is AVCodecContext.bit_rate not set?
>>>>
>>>
>>> you mean instead of returning it or do both, return the value and set it 
>>> in
>>> AVCodecContext (in the audio case because in all others it is taken as 
>>> the
>>> source of this information)?
>>>
>>> The primary reason I didn't set it was that I attempted a refactoring, 
>>> i.e.
>>> didn't want to change behaviour. if you say it makes sense to set it 
>>> there,
>>> the next question would be, where it is called because it seems a bit
>>> strange to have the field set as a side effect of calling something like
>>> avcodec_string. I don't know enough about ffmpeg or libav yet to decide
>>> where that would make sense.
>>
>>> However, if it would happen in some
>>> initialization code which is typically called before someone obtains an
>>> AVCodecContext pointer, there would be no reason to have this function in
>>> the API (which I personally would also be OK with as my main motivation 
>>> for
>>> the changes is to have libav expose the same bit rate information via API
>>> that ffmpeg shows as output on the command line).
>>
>> yes, id like to have bit_rate set correctly instead of not and then have
>> a function that provides the correct value.
>>
>
> Would av_find_stream_info (around line 2276) be the proper place to set the 
> bit rate, i.e. see, if the audio decoder has set the bit rate to a non-zero 
> value and if not calculate it as sample_rate * channels * bits_per_sample?

if its a PCM like codec, yes


>
> If that were in place, would one still need a separate function or would if 
> be OK to remove it entirely and rely on AVCodecContext.bit_rate being set 
> correctly?

i think AVCodecContext.bit_rate should be set correctly

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100205/164b5be6/attachment.pgp>



More information about the ffmpeg-devel mailing list