--- /home/ensonic/projects/gstreamer/gst-plugins-good/gst/avi/gstavidemux.c	2008-12-09 19:09:20.000000000 +0200
+++ ./gst/avi/gstavidemux.c	2008-12-11 18:02:23.000000000 +0200
@@ -105,6 +138,23 @@ static GstElementClass *parent_class = N
 
 /* GObject methods */
 
+static void
+gst_avi_demux_tagreader_mode (GstTagReader *reader,
+                              GstTagReadingMode mode)
+{
+  GstAviDemux * avi;
+  avi = GST_AVI_DEMUX (reader);
+  GST_DEBUG_OBJECT (avi, "tag reading mode: %d", mode);
+  avi->tagread_mode = mode;
+}
+
+static void
+gst_avi_demux_tagreader_interface_init (GstTagReaderInterface * iface)
+{
+  /* set up the interface hooks */
+  iface->tag_reading_mode = gst_avi_demux_tagreader_mode;
+}
+
 GType
 gst_avi_demux_get_type (void)
 {
@@ -122,10 +172,18 @@ gst_avi_demux_get_type (void)
       0,
       (GInstanceInitFunc) gst_avi_demux_init,
     };
+    static const GInterfaceInfo tr_iface_info = {
+      (GInterfaceInitFunc) gst_avi_demux_tagreader_interface_init,
+       NULL,
+       NULL,
+    };
 
     avi_demux_type =
         g_type_register_static (GST_TYPE_ELEMENT,
         "GstAviDemux", &avi_demux_info, 0);
+
+    g_type_add_interface_static (avi_demux_type,
+                                 GST_TYPE_TAGREADER, &tr_iface_info);
   }
 
   return avi_demux_type;
@@ -4087,6 +4211,11 @@ push_tag_lists (GstAviDemux * avi)
     avi->globaltags = NULL;
   }
   avi->got_tags = FALSE;
+
+  if  (avi->tagread_mode == GST_TAGREAD_MODE_TAGS) {
+    gst_tagreader_done (GST_TAGREADER (avi));
+  }
+
   GST_DEBUG_OBJECT (avi, "Pushed tag lists");
 }
 
@@ -4230,7 +4359,11 @@ gst_avi_demux_chain (GstPad * pad, GstBu
 static gboolean
 gst_avi_demux_sink_activate (GstPad * sinkpad)
 {
-  if (gst_pad_check_pull_range (sinkpad)) {
+  GstAviDemux *avi = GST_AVI_DEMUX (GST_OBJECT_PARENT (sinkpad));
+
+  if (gst_pad_check_pull_range (sinkpad) &&
+      avi->tagread_mode != GST_TAGREAD_MODE_TAGS)
+  {
     GST_DEBUG ("going to pull mode");
     return gst_pad_activate_pull (sinkpad, TRUE);
   } else {
--- /home/ensonic/projects/gstreamer/gst-plugins-good/gst/avi/gstavidemux.h	2008-10-11 17:55:14.000000000 +0300
+++ ./gst/avi/gstavidemux.h	2008-08-11 15:57:10.000000000 +0300
@@ -27,6 +27,7 @@
 #include "gst/riff/riff-ids.h"
 #include "gst/riff/riff-read.h"
 #include <gst/base/gstadapter.h>
+#include <gst/interfaces/tagreader.h>
 
 G_BEGIN_DECLS
 
@@ -166,6 +173,9 @@ typedef struct _GstAviDemux {
   GstTagList	*globaltags;
   gboolean	got_tags;
 
+  /* tag reading mode */
+  GstTagReadingMode tagread_mode;
+
 } GstAviDemux;
 
 typedef struct _GstAviDemuxClass {
