aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-04-13 23:24:25 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-04-13 23:24:25 +0000
commit4563cf247dfbe45ffe49f11dd97556ed4a8b2c1e (patch)
treedac97f7bf7a8dec17e2538816f5ed4d14de8553d
parent22b7b23c17bfca1be19e3f9004209ed0b82ddb37 (diff)
downloadffmpeg-4563cf247dfbe45ffe49f11dd97556ed4a8b2c1e.tar.gz
Factorize code in get_bit_rate().
Originally committed as revision 22879 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/utils.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8b4b363af4..fd6dc073e2 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -781,21 +781,15 @@ static int get_bit_rate(AVCodecContext *ctx)
switch(ctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
+ case AVMEDIA_TYPE_DATA:
+ case AVMEDIA_TYPE_SUBTITLE:
+ case AVMEDIA_TYPE_ATTACHMENT:
bit_rate = ctx->bit_rate;
break;
case AVMEDIA_TYPE_AUDIO:
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;
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:
bit_rate = 0;
break;