]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ac3dec.c
well that does not need to be there anymore
[ffmpeg] / libavcodec / ac3dec.c
index 6352f55c7a5516a2f69ee89cbb9225709adeb5ef..fcfb3147a11233263ebdf14656487ffb92853a08 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
+/**
+ * @file ac3dec.c
+ * AC3 decoder.
+ */
+
+//#define DEBUG
+
 #include "avcodec.h"
 #include "libac3/ac3.h"
 
 /* currently, I use libac3 which is Copyright (C) Aaron Holtzman and
    released under the GPL license. I may reimplement it someday... */
 typedef struct AC3DecodeState {
-    UINT8 inbuf[4096]; /* input buffer */
-    UINT8 *inbuf_ptr;
+    uint8_t inbuf[4096]; /* input buffer */
+    uint8_t *inbuf_ptr;
     int frame_size;
     int flags;
     int channels;
@@ -53,7 +61,7 @@ static inline int blah (int32_t i)
        return i - 0x43c00000;
 }
 
-static inline void float_to_int (float * _f, INT16 * s16, int nchannels)
+static inline void float_to_int (float * _f, int16_t * s16, int nchannels)
 {
     int i, j, c;
     int32_t * f = (int32_t *) _f;      // XXX assumes IEEE float format
@@ -72,10 +80,10 @@ static inline void float_to_int (float * _f, INT16 * s16, int nchannels)
 
 static int ac3_decode_frame(AVCodecContext *avctx, 
                             void *data, int *data_size,
-                            UINT8 *buf, int buf_size)
+                            uint8_t *buf, int buf_size)
 {
     AC3DecodeState *s = avctx->priv_data;
-    UINT8 *buf_ptr;
+    uint8_t *buf_ptr;
     int flags, i, len;
     int sample_rate, bit_rate;
     short *out_samples = data;
@@ -84,7 +92,6 @@ static int ac3_decode_frame(AVCodecContext *avctx,
        2, 1, 2, 3, 3, 4, 4, 5
     };
 
-    *data_size = 0;
     buf_ptr = buf;
     while (buf_size > 0) {
         len = s->inbuf_ptr - s->inbuf;
@@ -151,7 +158,7 @@ static int ac3_decode_frame(AVCodecContext *avctx,
             }
             s->inbuf_ptr = s->inbuf;
             s->frame_size = 0;
-            *data_size = 6 * avctx->channels * 256 * sizeof(INT16);
+            *data_size = 6 * avctx->channels * 256 * sizeof(int16_t);
             break;
         }
     }