pad: fix default acceptcaps

Make the acceptcaps function behave like all the other functions with a default
implementation. Don't try to chain up to the default implementation when it was
set to NULL explicitly but return FALSE instead.
Fix some docs
This commit is contained in:
Wim Taymans 2011-08-15 14:17:39 +02:00
parent cbccf7d5bf
commit d12738b4fa

View file

@ -2350,7 +2350,7 @@ done:
* gst_pad_has_current_caps: * gst_pad_has_current_caps:
* @pad: a #GstPad to check * @pad: a #GstPad to check
* *
* Check if @pad has caps set on it with gst_pad_set_caps(). * Check if @pad has caps set on it with a #GST_EVENT_CAPS event.
* *
* Returns: TRUE when @pad has caps associated with it. * Returns: TRUE when @pad has caps associated with it.
*/ */
@ -2373,8 +2373,8 @@ gst_pad_has_current_caps (GstPad * pad)
* gst_pad_get_current_caps: * gst_pad_get_current_caps:
* @pad: a #GstPad to get the current capabilities of. * @pad: a #GstPad to get the current capabilities of.
* *
* Gets the capabilities currently configured on @pad with the last call to * Gets the capabilities currently configured on @pad with the last
* gst_pad_set_caps(). * #GST_EVENT_CAPS event.
* *
* Returns: the current caps of the pad with incremented ref-count. * Returns: the current caps of the pad with incremented ref-count.
*/ */
@ -2598,27 +2598,26 @@ gst_pad_accept_caps (GstPad * pad, GstCaps * caps)
return TRUE; return TRUE;
/* lock for checking the existing caps */ /* lock for checking the existing caps */
GST_OBJECT_LOCK (pad);
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "accept caps of %p", caps); GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "accept caps of %p", caps);
#if 0 #if 0
GST_OBJECT_LOCK (pad);
/* The current caps on a pad are trivially acceptable */ /* The current caps on a pad are trivially acceptable */
if (G_LIKELY ((existing = GST_PAD_CAPS (pad)))) { if (G_LIKELY ((existing = GST_PAD_CAPS (pad)))) {
if (caps == existing || gst_caps_is_equal (caps, existing)) if (caps == existing || gst_caps_is_equal (caps, existing))
goto is_same_caps; goto is_same_caps;
} }
GST_OBJECT_UNLOCK (pad);
#endif #endif
acceptfunc = GST_PAD_ACCEPTCAPSFUNC (pad); acceptfunc = GST_PAD_ACCEPTCAPSFUNC (pad);
GST_OBJECT_UNLOCK (pad);
if (G_LIKELY (acceptfunc)) { /* Only null if the element explicitly unset it */
/* we can call the function */ if (G_UNLIKELY (acceptfunc == NULL))
result = acceptfunc (pad, caps); goto no_func;
GST_DEBUG_OBJECT (pad, "acceptfunc returned %d", result);
} else { /* we can call the function */
/* Only null if the element explicitly unset it */ result = acceptfunc (pad, caps);
result = gst_pad_acceptcaps_default (pad, caps); GST_DEBUG_OBJECT (pad, "acceptfunc returned %d", result);
GST_DEBUG_OBJECT (pad, "default acceptcaps returned %d", result);
}
return result; return result;
#if 0 #if 0
@ -2629,6 +2628,11 @@ is_same_caps:
return TRUE; return TRUE;
} }
#endif #endif
no_func:
{
GST_DEBUG_OBJECT (pad, "no acceptcase function");
return FALSE;
}
} }
/** /**