Index: gst/gstformat.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstformat.c,v
retrieving revision 1.19
diff -u -3 -p -b -B -d -r1.19 gstformat.c
--- gst/gstformat.c	14 Mar 2006 19:16:45 -0000	1.19
+++ gst/gstformat.c	2 Apr 2006 18:38:17 -0000
@@ -48,6 +48,7 @@ static GstFormatDefinition standard_defi
   {GST_FORMAT_TIME, "time", "Time", 0},
   {GST_FORMAT_BUFFERS, "buffers", "Buffers", 0},
   {GST_FORMAT_PERCENT, "percent", "Percent", 0},
+  {GST_FORMAT_STREAMS, "streams", "Streams", 0},
   {0, NULL, NULL, 0}
 };
 
Index: gst/gstformat.h
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstformat.h,v
retrieving revision 1.31
diff -u -3 -p -b -B -d -r1.31 gstformat.h
--- gst/gstformat.h	20 Nov 2005 14:50:43 -0000	1.31
+++ gst/gstformat.h	2 Apr 2006 18:38:17 -0000
@@ -40,6 +40,7 @@ G_BEGIN_DECLS
  * @GST_FORMAT_TIME: time in nanoseconds
  * @GST_FORMAT_BUFFERS: buffers
  * @GST_FORMAT_PERCENT: percentage of stream
+ * @GST_FORMAT_STREAMS: streams
  *
  * Standard predefined formats
  */
@@ -51,7 +52,8 @@ typedef enum {
   GST_FORMAT_BYTES   	=  2,
   GST_FORMAT_TIME 	=  3,
   GST_FORMAT_BUFFERS	=  4,
-  GST_FORMAT_PERCENT	=  5
+  GST_FORMAT_PERCENT	=  5,
+  GST_FORMAT_STREAMS     =  6
 } GstFormat;
 
 /* a percentage is always relative to 1000000 */
Index: gst/gstquery.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstquery.c,v
retrieving revision 1.29
diff -u -3 -p -b -B -d -r1.29 gstquery.c
--- gst/gstquery.c	14 Feb 2006 13:07:09 -0000	1.29
+++ gst/gstquery.c	2 Apr 2006 18:38:18 -0000
@@ -386,11 +386,45 @@ gst_query_new (GstQueryType type, GstStr
   } else {
     query->structure = NULL;
   }
+  gst_query_set_stream (query, -1);
 
   return query;
 }
 
 /**
+ * gst_query_set_stream:
+ * @query: a #GstQuery
+ * @stream: the number of a substream (-1 for the stream itself)
+ *
+ * Define the substream on which the query should be run.
+ */
+void
+gst_query_set_stream (GstQuery *query, gint stream)
+{
+  GstStructure *structure;
+
+  stream = MAX (-1, stream);
+  structure = gst_query_get_structure (query);
+  gst_structure_set (structure,
+      "stream", G_TYPE_INT, stream, NULL);
+}
+
+/**
+ * gst_query_get_stream:
+ * @query: a #GstQuery
+ *
+ * Get the number of the substream the query should be run on.
+ */
+gint
+gst_query_get_stream (GstQuery *query)
+{
+  GstStructure *structure;
+
+  structure = gst_query_get_structure (query);
+  return g_value_get_int (gst_structure_get_value (structure, "stream"));
+}
+
+/**
  * gst_query_new_position:
  * @format: the default #GstFormat for the new query
  *
Index: gst/gstquery.h
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstquery.h,v
retrieving revision 1.33
diff -u -3 -p -b -B -d -r1.33 gstquery.h
--- gst/gstquery.h	14 Feb 2006 12:07:16 -0000	1.33
+++ gst/gstquery.h	2 Apr 2006 18:38:18 -0000
@@ -202,6 +202,9 @@ GstIterator*    gst_query_type_iterate_d
  */
 #define         gst_query_make_writable(q)	GST_QUERY (gst_mini_object_make_writable (GST_MINI_OBJECT (q)))
 
+void  gst_query_set_stream (GstQuery *query, gint stream);
+gint gst_query_get_stream (GstQuery *query);
+
 /* position query */
 GstQuery*	gst_query_new_position		(GstFormat format);
 void		gst_query_set_position		(GstQuery *query, GstFormat format, gint64 cur);
