mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-25 16:48:11 +00:00
gst/base/gstcollectpads.c: Guard public API with assertions.
Original commit message from CVS: * gst/base/gstcollectpads.c: (gst_collectpads_set_function), (gst_collectpads_add_pad), (gst_collectpads_remove_pad), (gst_collectpads_is_active), (gst_collectpads_collect), (gst_collectpads_collect_range), (gst_collectpads_start), (gst_collectpads_stop), (gst_collectpads_peek), (gst_collectpads_pop), (gst_collectpads_available), (gst_collectpads_read), (gst_collectpads_flush): Guard public API with assertions. * gst/gstpad.c: Fix docs for gst_pad_set_link_function().
This commit is contained in:
parent
c49861f331
commit
3e5676f6a8
4 changed files with 76 additions and 3 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2005-11-02 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst/base/gstcollectpads.c: (gst_collectpads_set_function),
|
||||||
|
(gst_collectpads_add_pad), (gst_collectpads_remove_pad),
|
||||||
|
(gst_collectpads_is_active), (gst_collectpads_collect),
|
||||||
|
(gst_collectpads_collect_range), (gst_collectpads_start),
|
||||||
|
(gst_collectpads_stop), (gst_collectpads_peek),
|
||||||
|
(gst_collectpads_pop), (gst_collectpads_available),
|
||||||
|
(gst_collectpads_read), (gst_collectpads_flush):
|
||||||
|
Guard public API with assertions.
|
||||||
|
|
||||||
|
* gst/gstpad.c:
|
||||||
|
Fix docs for gst_pad_set_link_function().
|
||||||
|
|
||||||
2005-11-02 Johan Dahlin <johan@gnome.org>
|
2005-11-02 Johan Dahlin <johan@gnome.org>
|
||||||
|
|
||||||
* gst/elements/gsttypefindelement.c (gst_type_find_element_activate):
|
* gst/elements/gsttypefindelement.c (gst_type_find_element_activate):
|
||||||
|
|
|
@ -158,6 +158,7 @@ gst_collectpads_set_function (GstCollectPads * pads,
|
||||||
GstCollectPadsFunction func, gpointer user_data)
|
GstCollectPadsFunction func, gpointer user_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (pads != NULL);
|
g_return_if_fail (pads != NULL);
|
||||||
|
g_return_if_fail (GST_IS_COLLECTPADS (pads));
|
||||||
|
|
||||||
GST_LOCK (pads);
|
GST_LOCK (pads);
|
||||||
pads->func = func;
|
pads->func = func;
|
||||||
|
@ -188,6 +189,7 @@ gst_collectpads_add_pad (GstCollectPads * pads, GstPad * pad, guint size)
|
||||||
GstCollectData *data;
|
GstCollectData *data;
|
||||||
|
|
||||||
g_return_val_if_fail (pads != NULL, NULL);
|
g_return_val_if_fail (pads != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), NULL);
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
g_return_val_if_fail (pad != NULL, NULL);
|
||||||
g_return_val_if_fail (GST_PAD_IS_SINK (pad), NULL);
|
g_return_val_if_fail (GST_PAD_IS_SINK (pad), NULL);
|
||||||
g_return_val_if_fail (size >= sizeof (GstCollectData), NULL);
|
g_return_val_if_fail (size >= sizeof (GstCollectData), NULL);
|
||||||
|
@ -234,7 +236,9 @@ gst_collectpads_remove_pad (GstCollectPads * pads, GstPad * pad)
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_return_val_if_fail (pads != NULL, FALSE);
|
g_return_val_if_fail (pads != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), FALSE);
|
||||||
g_return_val_if_fail (pad != NULL, FALSE);
|
g_return_val_if_fail (pad != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
||||||
|
|
||||||
GST_LOCK (pads);
|
GST_LOCK (pads);
|
||||||
list = g_slist_find_custom (pads->data, pad, (GCompareFunc) find_pad);
|
list = g_slist_find_custom (pads->data, pad, (GCompareFunc) find_pad);
|
||||||
|
@ -264,7 +268,9 @@ gboolean
|
||||||
gst_collectpads_is_active (GstCollectPads * pads, GstPad * pad)
|
gst_collectpads_is_active (GstCollectPads * pads, GstPad * pad)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (pads != NULL, FALSE);
|
g_return_val_if_fail (pads != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), FALSE);
|
||||||
g_return_val_if_fail (pad != NULL, FALSE);
|
g_return_val_if_fail (pad != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -284,6 +290,7 @@ GstFlowReturn
|
||||||
gst_collectpads_collect (GstCollectPads * pads)
|
gst_collectpads_collect (GstCollectPads * pads)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
|
g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), GST_FLOW_ERROR);
|
||||||
|
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -306,6 +313,7 @@ gst_collectpads_collect_range (GstCollectPads * pads, guint64 offset,
|
||||||
guint length)
|
guint length)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
|
g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), GST_FLOW_ERROR);
|
||||||
|
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -322,6 +330,7 @@ void
|
||||||
gst_collectpads_start (GstCollectPads * pads)
|
gst_collectpads_start (GstCollectPads * pads)
|
||||||
{
|
{
|
||||||
g_return_if_fail (pads != NULL);
|
g_return_if_fail (pads != NULL);
|
||||||
|
g_return_if_fail (GST_IS_COLLECTPADS (pads));
|
||||||
|
|
||||||
GST_LOCK (pads);
|
GST_LOCK (pads);
|
||||||
pads->started = TRUE;
|
pads->started = TRUE;
|
||||||
|
@ -341,6 +350,7 @@ void
|
||||||
gst_collectpads_stop (GstCollectPads * pads)
|
gst_collectpads_stop (GstCollectPads * pads)
|
||||||
{
|
{
|
||||||
g_return_if_fail (pads != NULL);
|
g_return_if_fail (pads != NULL);
|
||||||
|
g_return_if_fail (GST_IS_COLLECTPADS (pads));
|
||||||
|
|
||||||
GST_LOCK (pads);
|
GST_LOCK (pads);
|
||||||
pads->started = FALSE;
|
pads->started = FALSE;
|
||||||
|
@ -367,6 +377,10 @@ gst_collectpads_peek (GstCollectPads * pads, GstCollectData * data)
|
||||||
{
|
{
|
||||||
GstBuffer *result;
|
GstBuffer *result;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), NULL);
|
||||||
|
g_return_val_if_fail (data != NULL, NULL);
|
||||||
|
|
||||||
result = data->buffer;
|
result = data->buffer;
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
|
@ -394,6 +408,10 @@ gst_collectpads_pop (GstCollectPads * pads, GstCollectData * data)
|
||||||
{
|
{
|
||||||
GstBuffer *result;
|
GstBuffer *result;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), NULL);
|
||||||
|
g_return_val_if_fail (data != NULL, NULL);
|
||||||
|
|
||||||
result = data->buffer;
|
result = data->buffer;
|
||||||
if (result) {
|
if (result) {
|
||||||
gst_buffer_replace (&data->buffer, NULL);
|
gst_buffer_replace (&data->buffer, NULL);
|
||||||
|
@ -429,6 +447,9 @@ gst_collectpads_available (GstCollectPads * pads)
|
||||||
GSList *collected;
|
GSList *collected;
|
||||||
guint result = G_MAXUINT;
|
guint result = G_MAXUINT;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, 0);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), 0);
|
||||||
|
|
||||||
for (collected = pads->data; collected; collected = g_slist_next (collected)) {
|
for (collected = pads->data; collected; collected = g_slist_next (collected)) {
|
||||||
GstCollectData *pdata;
|
GstCollectData *pdata;
|
||||||
gint size;
|
gint size;
|
||||||
|
@ -476,6 +497,11 @@ gst_collectpads_read (GstCollectPads * pads, GstCollectData * data,
|
||||||
{
|
{
|
||||||
guint readsize;
|
guint readsize;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, 0);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), 0);
|
||||||
|
g_return_val_if_fail (data != NULL, 0);
|
||||||
|
g_return_val_if_fail (bytes != NULL, 0);
|
||||||
|
|
||||||
readsize = MIN (size, GST_BUFFER_SIZE (data->buffer) - data->pos);
|
readsize = MIN (size, GST_BUFFER_SIZE (data->buffer) - data->pos);
|
||||||
|
|
||||||
*bytes = GST_BUFFER_DATA (data->buffer) + data->pos;
|
*bytes = GST_BUFFER_DATA (data->buffer) + data->pos;
|
||||||
|
@ -504,6 +530,10 @@ gst_collectpads_flush (GstCollectPads * pads, GstCollectData * data, guint size)
|
||||||
{
|
{
|
||||||
guint flushsize;
|
guint flushsize;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, 0);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), 0);
|
||||||
|
g_return_val_if_fail (data != NULL, 0);
|
||||||
|
|
||||||
flushsize = MIN (size, GST_BUFFER_SIZE (data->buffer) - data->pos);
|
flushsize = MIN (size, GST_BUFFER_SIZE (data->buffer) - data->pos);
|
||||||
|
|
||||||
data->pos += size;
|
data->pos += size;
|
||||||
|
|
|
@ -1205,9 +1205,8 @@ gst_pad_set_internal_link_function (GstPad * pad, GstPadIntLinkFunction intlink)
|
||||||
* @pad: a #GstPad.
|
* @pad: a #GstPad.
|
||||||
* @link: the #GstPadLinkFunction to set.
|
* @link: the #GstPadLinkFunction to set.
|
||||||
*
|
*
|
||||||
* Sets the given link function for the pad. It will be called when the pad is
|
* Sets the given link function for the pad. It will be called when
|
||||||
* linked or relinked with caps. The caps passed to the link function is
|
* the pad is linked with another pad.
|
||||||
* the caps for the connnection. It can contain a non fixed caps.
|
|
||||||
*
|
*
|
||||||
* The return value GST_PAD_LINK_OK should be used when the connection can be
|
* The return value GST_PAD_LINK_OK should be used when the connection can be
|
||||||
* made.
|
* made.
|
||||||
|
|
|
@ -158,6 +158,7 @@ gst_collectpads_set_function (GstCollectPads * pads,
|
||||||
GstCollectPadsFunction func, gpointer user_data)
|
GstCollectPadsFunction func, gpointer user_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (pads != NULL);
|
g_return_if_fail (pads != NULL);
|
||||||
|
g_return_if_fail (GST_IS_COLLECTPADS (pads));
|
||||||
|
|
||||||
GST_LOCK (pads);
|
GST_LOCK (pads);
|
||||||
pads->func = func;
|
pads->func = func;
|
||||||
|
@ -188,6 +189,7 @@ gst_collectpads_add_pad (GstCollectPads * pads, GstPad * pad, guint size)
|
||||||
GstCollectData *data;
|
GstCollectData *data;
|
||||||
|
|
||||||
g_return_val_if_fail (pads != NULL, NULL);
|
g_return_val_if_fail (pads != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), NULL);
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
g_return_val_if_fail (pad != NULL, NULL);
|
||||||
g_return_val_if_fail (GST_PAD_IS_SINK (pad), NULL);
|
g_return_val_if_fail (GST_PAD_IS_SINK (pad), NULL);
|
||||||
g_return_val_if_fail (size >= sizeof (GstCollectData), NULL);
|
g_return_val_if_fail (size >= sizeof (GstCollectData), NULL);
|
||||||
|
@ -234,7 +236,9 @@ gst_collectpads_remove_pad (GstCollectPads * pads, GstPad * pad)
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_return_val_if_fail (pads != NULL, FALSE);
|
g_return_val_if_fail (pads != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), FALSE);
|
||||||
g_return_val_if_fail (pad != NULL, FALSE);
|
g_return_val_if_fail (pad != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
||||||
|
|
||||||
GST_LOCK (pads);
|
GST_LOCK (pads);
|
||||||
list = g_slist_find_custom (pads->data, pad, (GCompareFunc) find_pad);
|
list = g_slist_find_custom (pads->data, pad, (GCompareFunc) find_pad);
|
||||||
|
@ -264,7 +268,9 @@ gboolean
|
||||||
gst_collectpads_is_active (GstCollectPads * pads, GstPad * pad)
|
gst_collectpads_is_active (GstCollectPads * pads, GstPad * pad)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (pads != NULL, FALSE);
|
g_return_val_if_fail (pads != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), FALSE);
|
||||||
g_return_val_if_fail (pad != NULL, FALSE);
|
g_return_val_if_fail (pad != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -284,6 +290,7 @@ GstFlowReturn
|
||||||
gst_collectpads_collect (GstCollectPads * pads)
|
gst_collectpads_collect (GstCollectPads * pads)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
|
g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), GST_FLOW_ERROR);
|
||||||
|
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -306,6 +313,7 @@ gst_collectpads_collect_range (GstCollectPads * pads, guint64 offset,
|
||||||
guint length)
|
guint length)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
|
g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), GST_FLOW_ERROR);
|
||||||
|
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -322,6 +330,7 @@ void
|
||||||
gst_collectpads_start (GstCollectPads * pads)
|
gst_collectpads_start (GstCollectPads * pads)
|
||||||
{
|
{
|
||||||
g_return_if_fail (pads != NULL);
|
g_return_if_fail (pads != NULL);
|
||||||
|
g_return_if_fail (GST_IS_COLLECTPADS (pads));
|
||||||
|
|
||||||
GST_LOCK (pads);
|
GST_LOCK (pads);
|
||||||
pads->started = TRUE;
|
pads->started = TRUE;
|
||||||
|
@ -341,6 +350,7 @@ void
|
||||||
gst_collectpads_stop (GstCollectPads * pads)
|
gst_collectpads_stop (GstCollectPads * pads)
|
||||||
{
|
{
|
||||||
g_return_if_fail (pads != NULL);
|
g_return_if_fail (pads != NULL);
|
||||||
|
g_return_if_fail (GST_IS_COLLECTPADS (pads));
|
||||||
|
|
||||||
GST_LOCK (pads);
|
GST_LOCK (pads);
|
||||||
pads->started = FALSE;
|
pads->started = FALSE;
|
||||||
|
@ -367,6 +377,10 @@ gst_collectpads_peek (GstCollectPads * pads, GstCollectData * data)
|
||||||
{
|
{
|
||||||
GstBuffer *result;
|
GstBuffer *result;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), NULL);
|
||||||
|
g_return_val_if_fail (data != NULL, NULL);
|
||||||
|
|
||||||
result = data->buffer;
|
result = data->buffer;
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
|
@ -394,6 +408,10 @@ gst_collectpads_pop (GstCollectPads * pads, GstCollectData * data)
|
||||||
{
|
{
|
||||||
GstBuffer *result;
|
GstBuffer *result;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), NULL);
|
||||||
|
g_return_val_if_fail (data != NULL, NULL);
|
||||||
|
|
||||||
result = data->buffer;
|
result = data->buffer;
|
||||||
if (result) {
|
if (result) {
|
||||||
gst_buffer_replace (&data->buffer, NULL);
|
gst_buffer_replace (&data->buffer, NULL);
|
||||||
|
@ -429,6 +447,9 @@ gst_collectpads_available (GstCollectPads * pads)
|
||||||
GSList *collected;
|
GSList *collected;
|
||||||
guint result = G_MAXUINT;
|
guint result = G_MAXUINT;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, 0);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), 0);
|
||||||
|
|
||||||
for (collected = pads->data; collected; collected = g_slist_next (collected)) {
|
for (collected = pads->data; collected; collected = g_slist_next (collected)) {
|
||||||
GstCollectData *pdata;
|
GstCollectData *pdata;
|
||||||
gint size;
|
gint size;
|
||||||
|
@ -476,6 +497,11 @@ gst_collectpads_read (GstCollectPads * pads, GstCollectData * data,
|
||||||
{
|
{
|
||||||
guint readsize;
|
guint readsize;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, 0);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), 0);
|
||||||
|
g_return_val_if_fail (data != NULL, 0);
|
||||||
|
g_return_val_if_fail (bytes != NULL, 0);
|
||||||
|
|
||||||
readsize = MIN (size, GST_BUFFER_SIZE (data->buffer) - data->pos);
|
readsize = MIN (size, GST_BUFFER_SIZE (data->buffer) - data->pos);
|
||||||
|
|
||||||
*bytes = GST_BUFFER_DATA (data->buffer) + data->pos;
|
*bytes = GST_BUFFER_DATA (data->buffer) + data->pos;
|
||||||
|
@ -504,6 +530,10 @@ gst_collectpads_flush (GstCollectPads * pads, GstCollectData * data, guint size)
|
||||||
{
|
{
|
||||||
guint flushsize;
|
guint flushsize;
|
||||||
|
|
||||||
|
g_return_val_if_fail (pads != NULL, 0);
|
||||||
|
g_return_val_if_fail (GST_IS_COLLECTPADS (pads), 0);
|
||||||
|
g_return_val_if_fail (data != NULL, 0);
|
||||||
|
|
||||||
flushsize = MIN (size, GST_BUFFER_SIZE (data->buffer) - data->pos);
|
flushsize = MIN (size, GST_BUFFER_SIZE (data->buffer) - data->pos);
|
||||||
|
|
||||||
data->pos += size;
|
data->pos += size;
|
||||||
|
|
Loading…
Reference in a new issue