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

jbr subversion at mplayerhq.hu
Thu Dec 13 03:36:06 CET 2007


Author: jbr
Date: Thu Dec 13 03:36:06 2007
New Revision: 1553

Log:
use enum for stream type values and a better variable name

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

Modified: eac3/eac3.h
==============================================================================
--- eac3/eac3.h	(original)
+++ eac3/eac3.h	Thu Dec 13 03:36:06 2007
@@ -42,7 +42,7 @@ typedef struct EAC3Context{
     int syncword;
 ///@name Bit stream information
 ///@{
-    int strmtyp;                     ///< Stream type
+    int stream_type;                 ///< Stream type
     int substreamid;                 ///< Substream identification
     int frame_size;                  ///< Frame size, in bytes
     int fscod;                       ///< Sample rate code
@@ -205,4 +205,12 @@ typedef enum {
     EAC3_GAQ_124
 } EAC3GaqMode;
 
+/** Stream Type */
+typedef enum {
+    EAC3_STREAM_TYPE_INDEPENDENT = 0,
+    EAC3_STREAM_TYPE_DEPENDENT,
+    EAC3_STREAM_TYPE_AC3_CONVERT,
+    EAC3_STREAM_TYPE_RESERVED
+} EAC3StreamType;
+
 #endif

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Thu Dec 13 03:36:06 2007
@@ -333,10 +333,13 @@ static void get_eac3_transform_coeffs_ch
 static int parse_bsi(GetBitContext *gbc, EAC3Context *s){
     int i, blk;
 
-    s->strmtyp = get_bits(gbc, 2);
-    if (s->strmtyp) {
+    s->stream_type = get_bits(gbc, 2);
+    if (s->stream_type == EAC3_STREAM_TYPE_DEPENDENT) {
         log_missing_feature(s->avctx, "Dependent substream");
         return -1;
+    } else if (s->stream_type == EAC3_STREAM_TYPE_RESERVED) {
+        av_log(s->avctx, AV_LOG_ERROR, "Reserved stream type\n");
+        return -1;
     }
     s->substreamid = get_bits(gbc, 3);
     s->frame_size = (get_bits(gbc, 11) + 1) * 2;
@@ -378,7 +381,7 @@ static int parse_bsi(GetBitContext *gbc,
             skip_bits(gbc, 8); //skip Compression gain word
         }
     }
-    if (s->strmtyp == 1) {
+    if (s->stream_type == EAC3_STREAM_TYPE_DEPENDENT) {
         /* if dependent stream */
         if (get_bits1(gbc)) {
             s->chanmap = get_bits(gbc, 16);
@@ -427,8 +430,7 @@ static int parse_bsi(GetBitContext *gbc,
                 s->lfemixlevcod = get_bits(gbc, 5);
             }
         }
-        if (!s->strmtyp) {
-            /* if independent stream */
+        if (s->stream_type == EAC3_STREAM_TYPE_INDEPENDENT) {
             for (i = 0; i < (s->acmod ? 1 : 2); i++) {
                 if (get_bits1(gbc)) {
                     s->pgmscl[i] = get_bits(gbc, 6);
@@ -502,10 +504,10 @@ static int parse_bsi(GetBitContext *gbc,
             skip_bits1(gbc); //skip Source sample rate code
         }
     }
-    if ((!s->strmtyp) && s->num_blocks != 6) {
+    if (s->stream_type == EAC3_STREAM_TYPE_INDEPENDENT && s->num_blocks != 6) {
         skip_bits1(gbc); //converter synchronization flag
     }
-    if (s->strmtyp == 2) {
+    if (s->stream_type == EAC3_STREAM_TYPE_AC3_CONVERT) {
         /* if bit stream converted from AC-3 */
         if (s->num_blocks == 6 || get_bits1(gbc)) {
             /* 6 blocks per frame */
@@ -601,7 +603,7 @@ static int parse_audfrm(GetBitContext *g
         }
     }
     /* Converter exponent strategy data */
-    if (!s->strmtyp) {
+    if (s->stream_type == EAC3_STREAM_TYPE_INDEPENDENT) {
         if (s->num_blocks == 6 || get_bits1(gbc)) {
             for (ch = 1; ch <= s->nfchans; ch++) {
                 skip_bits(gbc, 5); //skip Converter channel exponent strategy
@@ -1113,7 +1115,7 @@ static int parse_audblk(GetBitContext *g
                 s->fgain[ch] = ff_ac3_fast_gain_tab[4];
         }
     }
-    if (!s->strmtyp) {
+    if (s->stream_type == EAC3_STREAM_TYPE_INDEPENDENT) {
         if (get_bits1(gbc)) {
             skip_bits(gbc, 10); //Converter SNR offset
         }



More information about the FFmpeg-soc mailing list