mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
Implement size_hint on bytestream so that plugins can give a hint about the number of bytes they are going to read.
Original commit message from CVS: Implement size_hint on bytestream so that plugins can give a hint about the number of bytes they are going to read.
This commit is contained in:
parent
9286f126e2
commit
2a01bdbe56
2 changed files with 23 additions and 0 deletions
|
@ -496,6 +496,8 @@ guint32
|
||||||
gst_bytestream_read (GstByteStream * bs, GstBuffer** buf, guint32 len)
|
gst_bytestream_read (GstByteStream * bs, GstBuffer** buf, guint32 len)
|
||||||
{
|
{
|
||||||
guint32 len_peeked;
|
guint32 len_peeked;
|
||||||
|
|
||||||
|
g_return_val_if_fail (bs != NULL, -1);
|
||||||
|
|
||||||
len_peeked = gst_bytestream_peek (bs, buf, len);
|
len_peeked = gst_bytestream_peek (bs, buf, len);
|
||||||
if (len_peeked == 0)
|
if (len_peeked == 0)
|
||||||
|
@ -506,6 +508,26 @@ gst_bytestream_read (GstByteStream * bs, GstBuffer** buf, guint32 len)
|
||||||
return len_peeked;
|
return len_peeked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_bytestream_size_hint
|
||||||
|
* @bs: a bytestream
|
||||||
|
* @size: the size to hint
|
||||||
|
*
|
||||||
|
* Give a hint that we are going to read chunks of the given size
|
||||||
|
*
|
||||||
|
* Returns: TRUE if the hint was accepted
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_bytestream_size_hint (GstByteStream *bs, guint32 size)
|
||||||
|
{
|
||||||
|
GstEvent *event;
|
||||||
|
|
||||||
|
g_return_val_if_fail (bs != NULL, FALSE);
|
||||||
|
|
||||||
|
event = gst_event_new_size (GST_FORMAT_BYTES, size);
|
||||||
|
|
||||||
|
return gst_pad_send_event (GST_PAD_PEER (bs->pad), event);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_bytestream_get_status
|
* gst_bytestream_get_status
|
||||||
|
|
|
@ -55,6 +55,7 @@ void gst_bytestream_destroy (GstByteStream *bs);
|
||||||
guint32 gst_bytestream_read (GstByteStream *bs, GstBuffer** buf, guint32 len);
|
guint32 gst_bytestream_read (GstByteStream *bs, GstBuffer** buf, guint32 len);
|
||||||
guint64 gst_bytestream_tell (GstByteStream *bs);
|
guint64 gst_bytestream_tell (GstByteStream *bs);
|
||||||
guint64 gst_bytestream_length (GstByteStream *bs);
|
guint64 gst_bytestream_length (GstByteStream *bs);
|
||||||
|
gboolean gst_bytestream_size_hint (GstByteStream *bs, guint32 size);
|
||||||
gboolean gst_bytestream_seek (GstByteStream *bs, gint64 offset, GstSeekType type);
|
gboolean gst_bytestream_seek (GstByteStream *bs, gint64 offset, GstSeekType type);
|
||||||
guint32 gst_bytestream_peek (GstByteStream *bs, GstBuffer** buf, guint32 len);
|
guint32 gst_bytestream_peek (GstByteStream *bs, GstBuffer** buf, guint32 len);
|
||||||
guint32 gst_bytestream_peek_bytes (GstByteStream *bs, guint8** data, guint32 len);
|
guint32 gst_bytestream_peek_bytes (GstByteStream *bs, guint8** data, guint32 len);
|
||||||
|
|
Loading…
Reference in a new issue