? aviindexpatch.txt
? originallibs
? sk.wma
? gst/apetag/libgstapetag_la-gsttagdemux.loT
? tests/examples/level/level-example
Index: gst/avi/gstavidemux.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/gst/avi/gstavidemux.c,v
retrieving revision 1.173
diff -u -r1.173 gstavidemux.c
--- gst/avi/gstavidemux.c	24 Mar 2006 18:56:16 -0000	1.173
+++ gst/avi/gstavidemux.c	1 Apr 2006 23:52:21 -0000
@@ -1599,7 +1599,7 @@
 
   GST_LOG_OBJECT (avi,
       "Tag[%" GST_FOURCC_FORMAT "] (size:%d) %lld -- %lld",
-      GST_FOURCC_ARGS (*tag), *size, offset, offset + (guint64) * size);
+      GST_FOURCC_ARGS (*tag), *size, offset + 8, offset + 8 + (guint64) * size);
 beach:
   return res;
 }
@@ -1623,9 +1623,7 @@
     if ((res = gst_avi_demux_peek_tag (avi, off, tag, &siz)) != GST_FLOW_OK)
       break;
     if (*tag == GST_RIFF_TAG_LIST)
-      off += 8;
-    else if (*tag == GST_RIFF_LIST_movi)
-      off += 4;
+      off += 12;
     else {
       *offset = off + 8;
       *size = siz;
@@ -1698,56 +1696,56 @@
                 &size)) != GST_FLOW_OK)
       break;
     stream_nr = CHUNKID_TO_STREAMNR (tag);
-    if (stream_nr < 0 || stream_nr >= avi->num_streams)
-      continue;
-    stream = &avi->stream[stream_nr];
+    if (stream_nr >= 0 && stream_nr < avi->num_streams) {
+      stream = &avi->stream[stream_nr];
 
-    /* pre-allocate */
-    if (index_size % 1024 == 0) {
-      entries = g_new (gst_avi_index_entry, 1024);
-      *alloc_list = g_list_prepend (*alloc_list, entries);
-    }
-    entry = &entries[index_size % 1024];
+      /* pre-allocate */
+      if (index_size % 1024 == 0) {
+        entries = g_new (gst_avi_index_entry, 1024);
+        *alloc_list = g_list_prepend (*alloc_list, entries);
+      }
+      entry = &entries[index_size % 1024];
 
-    entry->index_nr = index_size++;
-    entry->stream_nr = stream_nr;
-    entry->flags = GST_RIFF_IF_KEYFRAME;
-    entry->offset = pos - avi->index_offset;
-    entry->size = size;
+      entry->index_nr = index_size++;
+      entry->stream_nr = stream_nr;
+      entry->flags = GST_RIFF_IF_KEYFRAME;
+      entry->offset = pos - avi->index_offset;
+      entry->size = size;
+
+      /* timestamps */
+      if (stream->strh->samplesize && stream->strh->type == GST_RIFF_FCC_auds) {
+        format = GST_FORMAT_TIME;
+        /* constant rate stream */
+        gst_avi_demux_src_convert (stream->pad, GST_FORMAT_BYTES,
+            stream->total_bytes, &format, &tmpts);
+        entry->ts = tmpts;
+        gst_avi_demux_src_convert (stream->pad, GST_FORMAT_BYTES,
+            stream->total_bytes + entry->size, &format, &tmpdur);
+        entry->dur = tmpdur;
+      } else {
+        format = GST_FORMAT_TIME;
+        /* VBR stream */
+        gst_avi_demux_src_convert (stream->pad, GST_FORMAT_DEFAULT,
+            stream->total_frames, &format, &tmpts);
+        entry->ts = tmpts;
+        gst_avi_demux_src_convert (stream->pad, GST_FORMAT_DEFAULT,
+            stream->total_frames + 1, &format, &tmpdur);
+        entry->dur = tmpdur;
+      }
+      entry->dur -= entry->ts;
 
-    /* timestamps */
-    if (stream->strh->samplesize && stream->strh->type == GST_RIFF_FCC_auds) {
-      format = GST_FORMAT_TIME;
-      /* constant rate stream */
-      gst_avi_demux_src_convert (stream->pad, GST_FORMAT_BYTES,
-          stream->total_bytes, &format, &tmpts);
-      entry->ts = tmpts;
-      gst_avi_demux_src_convert (stream->pad, GST_FORMAT_BYTES,
-          stream->total_bytes + entry->size, &format, &tmpdur);
-      entry->dur = tmpdur;
-    } else {
-      format = GST_FORMAT_TIME;
-      /* VBR stream */
-      gst_avi_demux_src_convert (stream->pad, GST_FORMAT_DEFAULT,
-          stream->total_frames, &format, &tmpts);
-      entry->ts = tmpts;
-      gst_avi_demux_src_convert (stream->pad, GST_FORMAT_DEFAULT,
-          stream->total_frames + 1, &format, &tmpdur);
-      entry->dur = tmpdur;
+      /* stream position */
+      entry->bytes_before = stream->total_bytes;
+      stream->total_bytes += entry->size;
+      entry->frames_before = stream->total_frames;
+      stream->total_frames++;
+
+      list = g_list_prepend (list, entry);
+      GST_DEBUG_OBJECT (avi, "Added index entry %d (in stream: %d), offset %"
+          G_GUINT64_FORMAT ", time %" GST_TIME_FORMAT " for stream %d",
+          index_size - 1, entry->frames_before, entry->offset,
+          GST_TIME_ARGS (entry->ts), entry->stream_nr);
     }
-    entry->dur -= entry->ts;
-
-    /* stream position */
-    entry->bytes_before = stream->total_bytes;
-    stream->total_bytes += entry->size;
-    entry->frames_before = stream->total_frames;
-    stream->total_frames++;
-
-    list = g_list_prepend (list, entry);
-    GST_DEBUG_OBJECT (avi, "Added index entry %d (in stream: %d), offset %"
-        G_GUINT64_FORMAT ", time %" GST_TIME_FORMAT " for stream %d",
-        index_size - 1, entry->frames_before, entry->offset,
-        GST_TIME_ARGS (entry->ts), entry->stream_nr);
 
     /* update position */
     pos += ((size + 1) & ~1);
