1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Factorize code in get_bit_rate().

Originally committed as revision 22879 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Stefano Sabatini 2010-04-13 23:24:25 +00:00
parent 22b7b23c17
commit 4563cf247d

View File

@ -781,21 +781,15 @@ static int get_bit_rate(AVCodecContext *ctx)
switch(ctx->codec_type) { switch(ctx->codec_type) {
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
case AVMEDIA_TYPE_DATA:
case AVMEDIA_TYPE_SUBTITLE:
case AVMEDIA_TYPE_ATTACHMENT:
bit_rate = ctx->bit_rate; bit_rate = ctx->bit_rate;
break; break;
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
bits_per_sample = av_get_bits_per_sample(ctx->codec_id); bits_per_sample = av_get_bits_per_sample(ctx->codec_id);
bit_rate = bits_per_sample ? ctx->sample_rate * ctx->channels * bits_per_sample : ctx->bit_rate; bit_rate = bits_per_sample ? ctx->sample_rate * ctx->channels * bits_per_sample : ctx->bit_rate;
break; break;
case AVMEDIA_TYPE_DATA:
bit_rate = ctx->bit_rate;
break;
case AVMEDIA_TYPE_SUBTITLE:
bit_rate = ctx->bit_rate;
break;
case AVMEDIA_TYPE_ATTACHMENT:
bit_rate = ctx->bit_rate;
break;
default: default:
bit_rate = 0; bit_rate = 0;
break; break;