changeset 11629:251ce43203f6 libavcodec

Factorize code in get_bit_rate().
author stefano
date Tue, 13 Apr 2010 23:24:25 +0000
parents 48d8c672b2d8
children 02ad6bf427dc
files utils.c
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Tue Apr 13 22:52:14 2010 +0000
+++ b/utils.c	Tue Apr 13 23:24:25 2010 +0000
@@ -781,21 +781,15 @@
 
     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;