--- a/src/demuxers/demux_matroska.c
+++ b/src/demuxers/demux_matroska.c
@@ -1846,7 +1846,7 @@
   uint64_t          track_num;
   uint8_t          *data;
   uint8_t           flags;
-  int               gap, lacing, num_len;
+  int               lacing, num_len;
   int16_t           timecode_diff;
   int64_t           pts, xduration;
   int               decoder_flags = 0;
@@ -1866,7 +1866,7 @@
 
   lprintf("track_num: %" PRIu64 ", timecode_diff: %d, flags: 0x%x\n", track_num, timecode_diff, flags);
 
-  gap = flags & 1;
+  /*gap = flags & 1;*/
   lacing = (flags >> 1) & 0x3;
 /*fprintf(stderr, "lacing: %x\n", lacing);*/
 
@@ -2049,6 +2049,13 @@
     }
     /* send each frame to the decoder */
     for (i = 0; i <= lace_num; i++) {
+
+      if (headers_len) {
+        data -= headers_len;
+        xine_fast_memcpy(data, track->compress_settings, headers_len);
+        frame[i] += headers_len;
+      }
+
       if (track->handle_content != NULL) {
         track->handle_content((demux_plugin_t *)this, track,
                                decoder_flags,
@@ -2070,7 +2077,6 @@
 
 static int parse_simpleblock(demux_matroska_t *this, size_t block_len, uint64_t cluster_timecode, uint64_t block_duration)
 {
-  int has_block           = 0;
   off_t block_pos         = 0;
   off_t file_len          = 0;
   int normpos             = 0;
@@ -2085,7 +2091,6 @@
   if (!read_block_data(this, block_len, this->compress_maxlen))
     return 0;
 
-  has_block = 1;
     /* we have the duration, we can parse the block now */
   if (!parse_block(this, block_len, cluster_timecode, block_duration,
                    normpos, is_key))