[FFmpeg-soc] [soc]: r1703 - in eac3: eac3.h eac3dec.c

jbr subversion at mplayerhq.hu
Sun Dec 30 06:58:07 CET 2007


Author: jbr
Date: Sun Dec 30 06:58:07 2007
New Revision: 1703

Log:
calculate sample rate and bit rate while parsing bitstream info

Modified:
   eac3/eac3.h
   eac3/eac3dec.c

Modified: eac3/eac3.h
==============================================================================
--- eac3/eac3.h	(original)
+++ eac3/eac3.h	Sun Dec 30 06:58:07 2007
@@ -47,8 +47,10 @@ typedef struct EAC3Context{
     int stream_type;    ///< Stream type (strmtyp)
     int substreamid;    ///< Substream identification
     int frame_size;     ///< Frame size, in bytes
+    int bit_rate;       ///< Bitrate, in bits-per-second
     int sr_code;        ///< Sample rate code (fscod)
     int sr_code2;       ///< Sample rate code 2 (fscod2)
+    int sample_rate;    ///< Sample rate, in Hz
     int num_blocks;     ///< Number of audio blocks
     int channel_mode;   ///< Channel mode (acmod)
     int lfe_on;         ///< Low frequency effect channel on (lfeon)

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Sun Dec 30 06:58:07 2007
@@ -341,6 +341,8 @@ static int parse_bsi(EAC3Context *s){
     } else {
         s->num_blocks = ff_eac3_blocks[get_bits(gbc, 2)];
     }
+    s->sample_rate = ff_ac3_sample_rate_tab[s->sr_code];
+    s->bit_rate = s->frame_size * s->sample_rate * 8 / (s->num_blocks * 256);
     s->channel_mode = get_bits(gbc, 3);
     s->lfe_on = get_bits1(gbc);
 
@@ -1233,13 +1235,8 @@ static int eac3_decode_frame(AVCodecCont
         return -1;
     }
 
-    if (c->sr_code == EAC3_SR_CODE_REDUCED) {
-        avctx->sample_rate = ff_ac3_sample_rate_tab[c->sr_code2] / 2;
-    } else {
-        avctx->sample_rate = ff_ac3_sample_rate_tab[c->sr_code];
-    }
-
-    avctx->bit_rate = (c->frame_size * avctx->sample_rate * 8 / (c->num_blocks * 256)) / 1000;
+    avctx->sample_rate = c->sample_rate;
+    avctx->bit_rate = c->bit_rate;
 
     /* channel config */
     if (!avctx->request_channels && !avctx->channels) {



More information about the FFmpeg-soc mailing list