[FFmpeg-devel] [PATCH] extract bit rate calculation into separate function
Thu Nov 12 10:07:34 CET 2009
On 12.11.2009, at 09:13, Robert Kr?ger wrote:
>> VIDEO, DATA, SUBTITLE, ATTACHMENT and default cases can be
>> Maybe it's simpler:
>> if (type == CODEC_AUDIO && (bits_per_sample = ...))
>> bitrate = ...
>> bitrate = ctx->bit_rate;
> hmm, I tried not to change the behaviour of the code I extracted as
> I only wanted to refactor and what you suggest would change the
> behaviour for CODEC_TYPE_UNKNOWN , CODEC_TYPE_ATTACHMENT and
> CODEC_TYPE_NB as it would no longer return 0 but return ctx-
> >bit_rate. If that makes sense, I cannot judge. I'll change it
> accordingly, if you say it does.
I have to correct myself. The code I extracted this from (function
avcodec_string) never uses the bit rate for CODEC_TYPE_UNKNOWN, so I
cannot even derive the correct behaviour of av_get_bit_rate from that
for those cases. The only thing I can say is that neither
implementation will change the behaviour of avcodec_string.
As far as CODEC_TYPE_NB is concerned, I just realized what that
is ..... so never mind
More information about the ffmpeg-devel