mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
Add sub-buffer functions to collectpads. Fixes #516187.
Original commit message from CVS: * docs/libs/gstreamer-libs-sections.txt: * libs/gst/base/gstcollectpads.c: * libs/gst/base/gstcollectpads.h: Add sub-buffer functions to collectpads. Fixes #516187. API: gst_collect_pads_take_buffer(), gst_collect_pads_read_buffer()
This commit is contained in:
parent
f09aa1dd08
commit
b1a800fa5f
4 changed files with 85 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2008-02-15 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
|
* docs/libs/gstreamer-libs-sections.txt:
|
||||||
|
* libs/gst/base/gstcollectpads.c:
|
||||||
|
* libs/gst/base/gstcollectpads.h:
|
||||||
|
Add sub-buffer functions to collectpads. Fixes #516187.
|
||||||
|
API: gst_collect_pads_take_buffer(), gst_collect_pads_read_buffer()
|
||||||
|
|
||||||
2008-02-15 Stefan Kost <ensonic@users.sf.net>
|
2008-02-15 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* gst/gstbuffer.c:
|
* gst/gstbuffer.c:
|
||||||
|
|
|
@ -352,6 +352,8 @@ gst_collect_pads_peek
|
||||||
gst_collect_pads_pop
|
gst_collect_pads_pop
|
||||||
gst_collect_pads_available
|
gst_collect_pads_available
|
||||||
gst_collect_pads_read
|
gst_collect_pads_read
|
||||||
|
gst_collect_pads_read_buffer
|
||||||
|
gst_collect_pads_take_buffer
|
||||||
gst_collect_pads_flush
|
gst_collect_pads_flush
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GstCollectPadsClass
|
GstCollectPadsClass
|
||||||
|
|
|
@ -806,7 +806,7 @@ not_filled:
|
||||||
* @size: the number of bytes to read
|
* @size: the number of bytes to read
|
||||||
*
|
*
|
||||||
* Get a pointer in @bytes where @size bytes can be read from the
|
* Get a pointer in @bytes where @size bytes can be read from the
|
||||||
* given pad data.
|
* given pad @data.
|
||||||
*
|
*
|
||||||
* This function should be called with @pads LOCK held, such as
|
* This function should be called with @pads LOCK held, such as
|
||||||
* in the callback.
|
* in the callback.
|
||||||
|
@ -840,6 +840,75 @@ gst_collect_pads_read (GstCollectPads * pads, GstCollectData * data,
|
||||||
return readsize;
|
return readsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_collect_pads_read_buffer:
|
||||||
|
* @pads: the collectspads to query
|
||||||
|
* @data: the data to use
|
||||||
|
* @size: the number of bytes to read
|
||||||
|
*
|
||||||
|
* Get a subbuffer of @size bytes from the given pad @data.
|
||||||
|
*
|
||||||
|
* This function should be called with @pads LOCK held, such as in the callback.
|
||||||
|
*
|
||||||
|
* Since: 0.10.18
|
||||||
|
*
|
||||||
|
* Returns: A sub buffer. The size of the buffer can be less that requested.
|
||||||
|
* A return of NULL signals that the pad is end-of-stream.
|
||||||
|
* Unref the buffer after use.
|
||||||
|
*
|
||||||
|
* MT safe.
|
||||||
|
*/
|
||||||
|
GstBuffer *
|
||||||
|
gst_collect_pads_read_buffer (GstCollectPads * pads, GstCollectData * data,
|
||||||
|
guint size)
|
||||||
|
{
|
||||||
|
guint readsize;
|
||||||
|
GstBuffer *buffer;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, 0);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), 0);
|
||||||
|
g_return_val_if_fail (data != NULL, 0);
|
||||||
|
|
||||||
|
/* no buffer, must be EOS */
|
||||||
|
if ((buffer = data->buffer) == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
readsize = MIN (size, GST_BUFFER_SIZE (buffer) - data->pos);
|
||||||
|
|
||||||
|
return gst_buffer_create_sub (buffer, data->pos, readsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_collect_pads_take_buffer:
|
||||||
|
* @pads: the collectspads to query
|
||||||
|
* @data: the data to use
|
||||||
|
* @size: the number of bytes to read
|
||||||
|
*
|
||||||
|
* Get a subbuffer of @size bytes from the given pad @data. Flushes the amount
|
||||||
|
* of read bytes.
|
||||||
|
*
|
||||||
|
* This function should be called with @pads LOCK held, such as in the callback.
|
||||||
|
*
|
||||||
|
* Since: 0.10.18
|
||||||
|
*
|
||||||
|
* Returns: A sub buffer. The size of the buffer can be less that requested.
|
||||||
|
* A return of NULL signals that the pad is end-of-stream.
|
||||||
|
* Unref the buffer after use.
|
||||||
|
*
|
||||||
|
* MT safe.
|
||||||
|
*/
|
||||||
|
GstBuffer *
|
||||||
|
gst_collect_pads_take_buffer (GstCollectPads * pads, GstCollectData * data,
|
||||||
|
guint size)
|
||||||
|
{
|
||||||
|
GstBuffer *buffer = gst_collect_pads_read_buffer (pads, data, size);
|
||||||
|
|
||||||
|
if (buffer) {
|
||||||
|
gst_collect_pads_flush (pads, data, GST_BUFFER_SIZE (buffer));
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_collect_pads_flush:
|
* gst_collect_pads_flush:
|
||||||
* @pads: the collectspads to query
|
* @pads: the collectspads to query
|
||||||
|
@ -851,7 +920,7 @@ gst_collect_pads_read (GstCollectPads * pads, GstCollectData * data,
|
||||||
* This function should be called with @pads LOCK held, such as
|
* This function should be called with @pads LOCK held, such as
|
||||||
* in the callback.
|
* in the callback.
|
||||||
*
|
*
|
||||||
* Returns: The number of bytes flushed This can be less than @size and
|
* Returns: The number of bytes flushed. This can be less than @size and
|
||||||
* is 0 if the pad was end-of-stream.
|
* is 0 if the pad was end-of-stream.
|
||||||
*
|
*
|
||||||
* MT safe.
|
* MT safe.
|
||||||
|
|
|
@ -180,6 +180,10 @@ GstBuffer* gst_collect_pads_pop (GstCollectPads *pads, GstCollectData *data);
|
||||||
guint gst_collect_pads_available (GstCollectPads *pads);
|
guint gst_collect_pads_available (GstCollectPads *pads);
|
||||||
guint gst_collect_pads_read (GstCollectPads *pads, GstCollectData *data,
|
guint gst_collect_pads_read (GstCollectPads *pads, GstCollectData *data,
|
||||||
guint8 **bytes, guint size);
|
guint8 **bytes, guint size);
|
||||||
|
GstBuffer * gst_collect_pads_read_buffer (GstCollectPads * pads, GstCollectData * data,
|
||||||
|
guint size);
|
||||||
|
GstBuffer * gst_collect_pads_take_buffer (GstCollectPads * pads, GstCollectData * data,
|
||||||
|
guint size);
|
||||||
guint gst_collect_pads_flush (GstCollectPads *pads, GstCollectData *data,
|
guint gst_collect_pads_flush (GstCollectPads *pads, GstCollectData *data,
|
||||||
guint size);
|
guint size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue