]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/tta.c
cabac: Mark ff_h264_mps_state array as static, it is only used within cabac.c.
[ffmpeg] / libavcodec / tta.c
index 6b76f527c48635919a62dd08b168d2236a7be9dc..bc83bfdf1d3ba96999292694e8b3539bbac913a4 100644 (file)
@@ -27,7 +27,7 @@
  * @author Alex Beregszaszi
  */
 
-#define ALT_BITSTREAM_READER_LE
+#define BITSTREAM_READER_LE
 //#define DEBUG
 #include <limits.h>
 #include "avcodec.h"
@@ -221,6 +221,11 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
         s->data_length = get_bits_long(&s->gb, 32);
         skip_bits(&s->gb, 32); // CRC32 of header
 
+        if (s->channels == 0) {
+            av_log(s->avctx, AV_LOG_ERROR, "Invalid number of channels\n");
+            return AVERROR_INVALIDDATA;
+        }
+
         switch(s->bps) {
         case 2:
             avctx->sample_fmt = AV_SAMPLE_FMT_S16;
@@ -309,7 +314,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
 
     // decode directly to output buffer for 24-bit sample format
     if (s->bps == 3)
-        s->decode_buffer = data;
+        s->decode_buffer = s->frame.data[0];
 
     // init per channel states
     for (i = 0; i < s->channels; i++) {