--- /home/ensonic/projects/gstreamer/gst-plugins-base/docs/libs/gst-plugins-base-libs-docs.sgml	2008-10-17 15:22:46.000000000 +0300
+++ ./docs/libs/gst-plugins-base-libs-docs.sgml	2008-10-23 16:11:54.000000000 +0300
@@ -89,6 +89,7 @@
       <xi:include href="xml/gstmixertrack.xml" />
       <xi:include href="xml/gstnavigation.xml" />
       <xi:include href="xml/gstpropertyprobe.xml" />
+      <xi:include href="xml/gsttagreader.xml" />
       <xi:include href="xml/gsttuner.xml" />
       <xi:include href="xml/gsttunerchannel.xml" />
       <xi:include href="xml/gsttunernorm.xml" />
--- /home/ensonic/projects/gstreamer/gst-plugins-base/docs/libs/gst-plugins-base-libs-sections.txt	2008-10-28 09:47:00.000000000 +0200
+++ ./docs/libs/gst-plugins-base-libs-sections.txt	2008-12-11 16:48:43.000000000 +0200
@@ -470,6 +474,22 @@ gst_property_probe_get_type
 </SECTION>
 
 <SECTION>
+<FILE>gsttagreader</FILE>
+<INCLUDE>gst/interfaces/tagreader.h</INCLUDE>
+GstTagReader
+gst_tagreader_set_mode
+gst_tagreader_done
+gst_is_tagreading_done_message
+<SUBSECTION Standard>
+GstTagReaderInterface
+GST_TYPE_TAGREADER
+GST_TAGREADER
+GST_IS_TAGREADER
+GST_TAGREADER_GET_IFACE
+gst_tagreader_get_type
+</SECTION>
+
+<SECTION>
 <FILE>gsttuner</FILE>
 <INCLUDE>gst/interfaces/tuner.h</INCLUDE>
 GstTuner
--- /home/ensonic/projects/gstreamer/gst-plugins-base/docs/libs/gst-plugins-base-libs.types	2007-04-24 08:58:30.000000000 +0300
+++ ./docs/libs/gst-plugins-base-libs.types	2008-10-23 16:11:54.000000000 +0300
@@ -32,6 +32,8 @@ gst_mixer_track_get_type
 gst_navigation_get_type
 #include <gst/interfaces/propertyprobe.h>
 gst_property_probe_get_type
+#include <gst/interfaces/tagreader.h>
+gst_tagreader_get_type
 #include <gst/interfaces/tuner.h>
 gst_tuner_get_type
 gst_tuner_channel_get_type
--- /home/ensonic/projects/gstreamer/gst-plugins-base/gst-libs/gst/interfaces/Makefile.am	2007-12-19 11:54:57.000000000 +0200
+++ ./gst-libs/gst/interfaces/Makefile.am	2008-11-04 09:07:07.000000000 +0200
@@ -14,6 +14,7 @@ headers_interfaces = 		\
 	tunernorm.h		\
 	tunerchannel.h		\
 	videoorientation.h	\
+	tagreader.h		\
 	xoverlay.h
 
 # variables used for enum/marshal generation
@@ -47,6 +48,7 @@ libgstinterfaces_@GST_MAJORMINOR@_la_SOU
 	tunernorm.c		\
 	tunerchannel.c		\
 	videoorientation.c	\
+	tagreader.c		\
 	xoverlay.c
 
 nodist_libgstinterfaces_@GST_MAJORMINOR@_la_SOURCES = 	\
--- /dev/null	2008-11-17 13:44:35.000000000 +0200
+++ gst-libs/gst/interfaces/tagreader.c	2008-12-11 16:26:35.000000000 +0200
@@ -0,0 +1,203 @@
+/* GStreamer Tag Reader interface
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Stefan Kost <stefan.kost@nokia.com>
+ *
+ * tagreader.c: Tag Reader interface design
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:gsttagreader
+ * @short_description: Interface for setting a tag reading mode on elements
+ * supporting it
+ *
+ * <refsect2>
+ * <para>
+ * TagReader interface is used to implement elements that can provide a
+ * fast way of reading metadata information from media clips. The element
+ * implementing this interface can be set into a special mode, which will
+ * bypass some time-consuming operations in preroll phase, and thus speed
+ * up the tag reading process.
+ * </para>
+ * <para>
+ * The element that implements this interface can be put into tag reading
+ * mode by using GST_TAGREAD_MODE_TAGS parameter with #gst_tagreader_set_mode
+ * function. This causes the element to only concentrate on the metadata
+ * information of the media. When all metadata is processed, element posts
+ * "tag-reading-done" #GstMessage to the bus to inform that its work is done
+ * and no more tags will be sent. This kind of messages can be checked by
+ * using #gst_is_tagreading_done_message function. Instead, if application
+ * wants the element to totally skip all tag-related information (and thus
+ * speed up the data processing), it can use GST_TAGREAD_MODE_DATA parameter.
+ * </para>
+ * <para>
+ * TagReader interface will be mainly used by #GstTagReaderBin element that
+ * has autoplugging capabilities similar to decodebin.
+ * </para>
+ * <para>
+ * Here is an example on how to use the interface:
+ * <programlisting>
+ * static gboolean
+ * handle_msg (GstBus * bus, GstMessage * message, gpointer unused)
+ * {
+ *   if (gst_is_tagreading_done_message (message)) {
+ *     // A parser has finished parsing the tags. If there are many elements
+ *     // that implement TagReader interface, we need to wait as many
+ *     // messages, too. In this example we have one, so we can disconnect
+ *     // the handler.
+ *     return FALSE;
+ *   }
+ *   else if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG) {
+ *     // We got a tag from some tag parsing element. Handle it here.
+ *   }
+ *   return TRUE;
+ * }
+ * ...
+ * int
+ * main (int argc, char **argv)
+ * {
+ * ...
+ *  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+ *  gst_bus_add_watch (bus, handle_msg, NULL);
+ *  
+ *  // Create our own parser element that implements tag reader iface
+ *  elem = gst_element_factory_make ("myparser", "parser");
+ *  gst_tagreader_set_mode (GST_TAGREADER (elem), GST_TAGREAD_MODE_TAGS);
+ * ...
+ * }
+ * </programlisting>
+ * </para>
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tagreader.h"
+
+#define GST_TAGREADER_READING_DONE "tag-reading-done"
+
+static void gst_tagreader_base_init (gpointer g_class);
+
+GType
+gst_tagreader_get_type (void)
+{
+  static GType gst_tagreader_type = 0;
+
+  if (!gst_tagreader_type) {
+    static const GTypeInfo gst_tagreader_info = {
+      sizeof (GstTagReaderInterface),
+      (GBaseInitFunc) gst_tagreader_base_init,
+      NULL,
+      NULL,
+      NULL,
+      NULL,
+      0,
+      0,
+      NULL,
+    };
+
+    gst_tagreader_type = g_type_register_static (G_TYPE_INTERFACE,
+        "GstTagReader", &gst_tagreader_info, 0);
+  }
+
+  return gst_tagreader_type;
+}
+
+static void
+gst_tagreader_base_init (gpointer g_class)
+{
+  GstTagReaderInterface *reader_class = (GstTagReaderInterface *) g_class;
+
+  reader_class->tag_reading_mode = NULL;
+}
+
+/**
+ * gst_tagreader_set_mode:
+ * @reader: a #GstTagReader to set the tag reading mode on.
+ * @mode: tag reading mode to operate on.
+ *
+ * This will call the tag reader's tag_reading_mode method. You should
+ * use this method to tell tag reader capable element in which
+ * #GstTagReadingMode the reader should operate on.
+ */
+void
+gst_tagreader_set_mode (GstTagReader * reader, GstTagReadingMode mode)
+{
+  GstTagReaderInterface *iface;
+
+  g_return_if_fail (reader != NULL);
+  g_return_if_fail (GST_IS_TAGREADER (reader));
+
+  iface = GST_TAGREADER_GET_IFACE (reader);
+
+  if (iface->tag_reading_mode) {
+    iface->tag_reading_mode (reader, mode);
+  }
+}
+
+/**
+ * gst_tagreader_done:
+ * @reader: a #GstTagReader which finished its operation.
+ *
+ * This will post a "tag-reading-done" element message on the bus.
+ *
+ * This function should only be used by tag reader plugin developers.
+ */
+void
+gst_tagreader_done (GstTagReader * reader)
+{
+  GstStructure *s;
+  GstMessage *msg;
+
+  g_return_if_fail (reader != NULL);
+  g_return_if_fail (GST_IS_TAGREADER (reader));
+
+  s = gst_structure_new (GST_TAGREADER_READING_DONE, NULL);
+  msg = gst_message_new_element (GST_OBJECT (reader), s);
+  if (gst_element_post_message (GST_ELEMENT (reader), msg) == FALSE) {
+    GST_WARNING ("This element has no bus, therefore no message sent!");
+  }
+}
+
+
+/**
+ * gst_is_tagreading_done_message:
+ * @message: A GstMessage to inspect.
+ *
+ * Check a bus message to see if it is a GstTagReader notification
+ * message about tag reading process being finished.
+ *
+ * Returns: TRUE, if the message is "tag-reading-done" message.
+ *
+ * Since: 0.10.x
+ */
+gboolean
+gst_is_tagreading_done_message (GstMessage *message)
+{
+  const GstStructure *s;
+
+  if (message == NULL)
+    return FALSE;
+  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
+    return FALSE;
+
+  s = gst_message_get_structure (message);
+  return gst_structure_has_name (s, GST_TAGREADER_READING_DONE);
+}
--- /dev/null	2008-11-17 13:44:35.000000000 +0200
+++ gst-libs/gst/interfaces/tagreader.h	2008-12-11 16:26:40.000000000 +0200
@@ -0,0 +1,82 @@
+/* GStreamer Tag Reader interface
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Stefan Kost <stefan.kost@nokia.com>
+ *
+ * tagreader.h: Tag Reader interface design
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_TAGREADER_H__
+#define __GST_TAGREADER_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstTagReadingMode:
+ * @GST_TAGREAD_MODE_OFF: default - parse tags and process data normally
+ * @GST_TAGREAD_MODE_TAGS: speed up tag reading process
+ * @GST_TAGREAD_MODE_DATA: skip tag reading in favour of data reading speed
+ *
+ * available tag reading modes.
+ */
+typedef enum {
+  GST_TAGREAD_MODE_OFF,
+  GST_TAGREAD_MODE_TAGS,
+  GST_TAGREAD_MODE_DATA
+} GstTagReadingMode;
+
+
+#define GST_TYPE_TAGREADER \
+  (gst_tagreader_get_type ())
+#define GST_TAGREADER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TAGREADER, GstTagReader))
+#define GST_IS_TAGREADER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TAGREADER))
+#define GST_TAGREADER_GET_IFACE(inst) \
+  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_TAGREADER, \
+      GstTagReaderInterface))
+
+typedef struct _GstTagReader GstTagReader;
+typedef struct _GstTagReaderInterface GstTagReaderInterface;
+
+typedef struct _GstTagReaderInterface {
+  GTypeInterface klass;
+
+  /* virtual functions */
+  void (* tag_reading_mode) (GstTagReader *reader, GstTagReadingMode mode);
+
+  /*< private >*/
+  gpointer                 _gst_reserved[GST_PADDING];
+};
+
+GType   gst_tagreader_get_type          (void);
+
+/* virtual class function wrappers */
+void gst_tagreader_set_mode (GstTagReader *reader, GstTagReadingMode mode);
+
+/* public methods to dispatch bus messages */
+void gst_tagreader_done (GstTagReader *reader);
+
+/* message handling functions */
+gboolean gst_is_tagreading_done_message (GstMessage *message);
+
+G_END_DECLS
+
+#endif /* __GST_TAGREADER_H__ */
