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:
Tim-Philipp Müller 2005-11-02 15:08:05 +00:00
parent c49861f331
commit 3e5676f6a8
4 changed files with 76 additions and 3 deletions

View file

@ -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>
* gst/elements/gsttypefindelement.c (gst_type_find_element_activate):

View file

@ -158,6 +158,7 @@ gst_collectpads_set_function (GstCollectPads * pads,
GstCollectPadsFunction func, gpointer user_data)
{
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECTPADS (pads));
GST_LOCK (pads);
pads->func = func;
@ -188,6 +189,7 @@ gst_collectpads_add_pad (GstCollectPads * pads, GstPad * pad, guint size)
GstCollectData *data;
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 (GST_PAD_IS_SINK (pad), NULL);
g_return_val_if_fail (size >= sizeof (GstCollectData), NULL);
@ -234,7 +236,9 @@ gst_collectpads_remove_pad (GstCollectPads * pads, GstPad * pad)
GSList *list;
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 (GST_IS_PAD (pad), FALSE);
GST_LOCK (pads);
list = g_slist_find_custom (pads->data, pad, (GCompareFunc) find_pad);
@ -264,7 +268,9 @@ gboolean
gst_collectpads_is_active (GstCollectPads * pads, GstPad * pad)
{
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 (GST_IS_PAD (pad), FALSE);
return FALSE;
}
@ -284,6 +290,7 @@ GstFlowReturn
gst_collectpads_collect (GstCollectPads * pads)
{
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;
}
@ -306,6 +313,7 @@ gst_collectpads_collect_range (GstCollectPads * pads, guint64 offset,
guint length)
{
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;
}
@ -322,6 +330,7 @@ void
gst_collectpads_start (GstCollectPads * pads)
{
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECTPADS (pads));
GST_LOCK (pads);
pads->started = TRUE;
@ -341,6 +350,7 @@ void
gst_collectpads_stop (GstCollectPads * pads)
{
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECTPADS (pads));
GST_LOCK (pads);
pads->started = FALSE;
@ -367,6 +377,10 @@ gst_collectpads_peek (GstCollectPads * pads, GstCollectData * data)
{
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;
if (result)
@ -394,6 +408,10 @@ gst_collectpads_pop (GstCollectPads * pads, GstCollectData * data)
{
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;
if (result) {
gst_buffer_replace (&data->buffer, NULL);
@ -429,6 +447,9 @@ gst_collectpads_available (GstCollectPads * pads)
GSList *collected;
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)) {
GstCollectData *pdata;
gint size;
@ -476,6 +497,11 @@ gst_collectpads_read (GstCollectPads * pads, GstCollectData * data,
{
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);
*bytes = GST_BUFFER_DATA (data->buffer) + data->pos;
@ -504,6 +530,10 @@ gst_collectpads_flush (GstCollectPads * pads, GstCollectData * data, guint size)
{
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);
data->pos += size;

View file

@ -1205,9 +1205,8 @@ gst_pad_set_internal_link_function (GstPad * pad, GstPadIntLinkFunction intlink)
* @pad: a #GstPad.
* @link: the #GstPadLinkFunction to set.
*
* Sets the given link function for the pad. It will be called when the pad is
* linked or relinked with caps. The caps passed to the link function is
* the caps for the connnection. It can contain a non fixed caps.
* Sets the given link function for the pad. It will be called when
* the pad is linked with another pad.
*
* The return value GST_PAD_LINK_OK should be used when the connection can be
* made.

View file

@ -158,6 +158,7 @@ gst_collectpads_set_function (GstCollectPads * pads,
GstCollectPadsFunction func, gpointer user_data)
{
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECTPADS (pads));
GST_LOCK (pads);
pads->func = func;
@ -188,6 +189,7 @@ gst_collectpads_add_pad (GstCollectPads * pads, GstPad * pad, guint size)
GstCollectData *data;
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 (GST_PAD_IS_SINK (pad), NULL);
g_return_val_if_fail (size >= sizeof (GstCollectData), NULL);
@ -234,7 +236,9 @@ gst_collectpads_remove_pad (GstCollectPads * pads, GstPad * pad)
GSList *list;
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 (GST_IS_PAD (pad), FALSE);
GST_LOCK (pads);
list = g_slist_find_custom (pads->data, pad, (GCompareFunc) find_pad);
@ -264,7 +268,9 @@ gboolean
gst_collectpads_is_active (GstCollectPads * pads, GstPad * pad)
{
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 (GST_IS_PAD (pad), FALSE);
return FALSE;
}
@ -284,6 +290,7 @@ GstFlowReturn
gst_collectpads_collect (GstCollectPads * pads)
{
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;
}
@ -306,6 +313,7 @@ gst_collectpads_collect_range (GstCollectPads * pads, guint64 offset,
guint length)
{
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;
}
@ -322,6 +330,7 @@ void
gst_collectpads_start (GstCollectPads * pads)
{
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECTPADS (pads));
GST_LOCK (pads);
pads->started = TRUE;
@ -341,6 +350,7 @@ void
gst_collectpads_stop (GstCollectPads * pads)
{
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECTPADS (pads));
GST_LOCK (pads);
pads->started = FALSE;
@ -367,6 +377,10 @@ gst_collectpads_peek (GstCollectPads * pads, GstCollectData * data)
{
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;
if (result)
@ -394,6 +408,10 @@ gst_collectpads_pop (GstCollectPads * pads, GstCollectData * data)
{
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;
if (result) {
gst_buffer_replace (&data->buffer, NULL);
@ -429,6 +447,9 @@ gst_collectpads_available (GstCollectPads * pads)
GSList *collected;
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)) {
GstCollectData *pdata;
gint size;
@ -476,6 +497,11 @@ gst_collectpads_read (GstCollectPads * pads, GstCollectData * data,
{
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);
*bytes = GST_BUFFER_DATA (data->buffer) + data->pos;
@ -504,6 +530,10 @@ gst_collectpads_flush (GstCollectPads * pads, GstCollectData * data, guint size)
{
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);
data->pos += size;