Added _length method for peer pads that can answer the query

Original commit message from CVS:
Added _length method for peer pads that can answer the query
This commit is contained in:
Wim Taymans 2002-06-07 21:52:16 +00:00
parent 7ae62fa9bf
commit 87b43f8aeb
2 changed files with 18 additions and 1 deletions

View 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)
{

View 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);