]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
Added _length method for peer pads that can answer the query
authorWim Taymans <wim.taymans@gmail.com>
Fri, 7 Jun 2002 21:52:16 +0000 (21:52 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 7 Jun 2002 21:52:16 +0000 (21:52 +0000)
Original commit message from CVS:
Added _length method for peer pads that can answer the query

libs/gst/bytestream/bytestream.c
libs/gst/bytestream/bytestream.h

index 91265777fe8d83d5d25f712c6ffe530601bb8343..00ba66f9c46f9d38bcc0588bdabab808df3544a7 100644 (file)
@@ -466,7 +466,7 @@ gst_bytestream_tell (GstByteStream *bs)
   GstFormat format;
   gint64 value;
   
-  g_return_val_if_fail (bs != NULL, 0);
+  g_return_val_if_fail (bs != NULL, -1);
 
   format = GST_FORMAT_BYTES;
 
@@ -476,6 +476,22 @@ gst_bytestream_tell (GstByteStream *bs)
   return -1;
 }
 
+guint64
+gst_bytestream_length (GstByteStream *bs)
+{
+  GstFormat format;
+  gint64 value;
+  
+  g_return_val_if_fail (bs != NULL, -1);
+
+  format = GST_FORMAT_BYTES;
+
+  if (gst_pad_query (GST_PAD_PEER (bs->pad), GST_PAD_QUERY_TOTAL, &format, &value)) 
+    return value;
+  
+  return -1;
+}
+
 guint32
 gst_bytestream_read (GstByteStream * bs, GstBuffer** buf, guint32 len)
 {
index cbc88946caf5598725f866d39d2dbca7671ee4f6..380c18829bf98737dc3cf16d11c4ad80f7e298e9 100644 (file)
@@ -54,6 +54,7 @@ void                  gst_bytestream_destroy          (GstByteStream *bs);
 
 guint32                        gst_bytestream_read             (GstByteStream *bs, GstBuffer** buf, guint32 len);
 guint64                        gst_bytestream_tell             (GstByteStream *bs);
+guint64                        gst_bytestream_length           (GstByteStream *bs);
 gboolean               gst_bytestream_seek             (GstByteStream *bs, gint64 offset, GstSeekType type);
 guint32                        gst_bytestream_peek             (GstByteStream *bs, GstBuffer** buf, guint32 len);
 guint32                        gst_bytestream_peek_bytes       (GstByteStream *bs, guint8** data, guint32 len);