]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/flacdec.c
Merge commit 'b9ba5253dd1232be4b48cfe61c31ff4b3de3d10a'
[ffmpeg] / libavcodec / flacdec.c
index 9d5ecd04cfe572c8ae434240da77e1461301118e..56249729bfe7e9ab61af77b38988763edcad400c 100644 (file)
@@ -254,7 +254,7 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
                                  int pred_order, int bps)
 {
     const int blocksize = s->blocksize;
-    int a, b, c, d, i;
+    int av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d), i;
 
     /* warm up samples */
     for (i = 0; i < pred_order; i++) {
@@ -424,7 +424,7 @@ static int decode_frame(FLACContext *s)
             return ret;
     }
     s->channels = s->avctx->channels = fi.channels;
-    if (!s->avctx->channel_layout && s->channels <= 6)
+    if (!s->avctx->channel_layout)
         ff_flac_set_channel_layout(s->avctx);
     s->ch_mode = fi.ch_mode;
 
@@ -505,6 +505,16 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
                                        FLAC_MAX_CHANNELS, 32);
     }
 
+    if (buf_size > 5 && !memcmp(buf, "\177FLAC", 5)) {
+        av_log(s->avctx, AV_LOG_DEBUG, "skiping flac header packet 1\n");
+        return buf_size;
+    }
+
+    if (buf_size > 0 && (*buf & 0x7F) == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
+        av_log(s->avctx, AV_LOG_DEBUG, "skiping vorbis comment\n");
+        return buf_size;
+    }
+
     /* check that there is at least the smallest decodable amount of data.
        this amount corresponds to the smallest valid FLAC frame possible.
        FF F8 69 02 00 00 9A 00 00 34 46 */