static GstPad *gst_proxy_pad_get_target (GstPad * pad);
- static void gst_proxy_pad_dispose (GObject * object);
- static void gst_proxy_pad_finalize (GObject * object);
-#if !defined(GST_DISABLE_LOADSAVE) && !defined(GST_REMOVE_DEPRECATED)
-#ifdef GST_DISABLE_DEPRECATED
-#include <libxml/parser.h>
-#endif
-static xmlNodePtr gst_proxy_pad_save_thyself (GstObject * object,
- xmlNodePtr parent);
-#endif
-
-static void on_src_target_notify (GstPad * target,
- GParamSpec * unused, gpointer user_data);
-
-static GParamSpec *pspec_caps = NULL;
--
/**
* gst_proxy_pad_query_type_default:
* @pad: a #GstPad.
g_return_if_fail (GST_IS_PROXY_PAD (pad));
g_return_if_fail (GST_IS_CAPS (caps));
- target = gst_proxy_pad_get_target (pad);
- if (target) {
- gst_pad_fixate_caps (target, caps);
- gst_object_unref (target);
- }
-}
+ if (!(target = gst_proxy_pad_get_target (pad)))
+ goto no_target;
-/**
- * gst_proxy_pad_setcaps_default:
- * @pad: a #GstPad to set the capabilities of.
- * @caps: (transfer none): a #GstCaps to set.
- *
- * Invoke the default setcaps function of the proxy pad.
- *
- * Returns: TRUE if the caps could be set. FALSE if the caps were not fixed
- * or bad parameters were provided to this function.
- *
- * Since: 0.10.35
- */
-gboolean
-gst_proxy_pad_setcaps_default (GstPad * pad, GstCaps * caps)
-{
- GstPad *target;
- gboolean res;
+ gst_pad_fixate_caps (target, caps);
+ gst_object_unref (target);
- g_return_val_if_fail (GST_IS_PROXY_PAD (pad), FALSE);
- g_return_val_if_fail (caps == NULL || GST_IS_CAPS (caps), FALSE);
+ return;
- target = gst_proxy_pad_get_target (pad);
- if (target) {
- res = gst_pad_set_caps (target, caps);
- gst_object_unref (target);
- } else {
- /* We don't have any target, but we shouldn't return FALSE since this
- * would stop the actual push of a buffer (which might trigger a pad block
- * or probe, or properly return GST_FLOW_NOT_LINKED.
- */
- res = TRUE;
+ /* ERRORS */
+no_target:
+ {
+ GST_DEBUG_OBJECT (pad, "no target");
+ return;
}
- return res;
}
- static gboolean
- gst_proxy_pad_set_target_unlocked (GstPad * pad, GstPad * target)
- {
- GstPad *oldtarget;
-
- if (target) {
- GST_LOG_OBJECT (pad, "setting target %s:%s", GST_DEBUG_PAD_NAME (target));
-
- if (G_UNLIKELY (GST_PAD_DIRECTION (pad) != GST_PAD_DIRECTION (target)))
- goto wrong_direction;
- } else
- GST_LOG_OBJECT (pad, "clearing target");
-
- /* clear old target */
- if ((oldtarget = GST_PROXY_PAD_TARGET (pad)))
- gst_object_unref (oldtarget);
-
- /* set and ref new target if any */
- if (target)
- GST_PROXY_PAD_TARGET (pad) = gst_object_ref (target);
- else
- GST_PROXY_PAD_TARGET (pad) = NULL;
-
- return TRUE;
-
- /* ERRORS */
- wrong_direction:
- {
- GST_ERROR_OBJECT (pad,
- "target pad doesn't have the same direction as ourself");
- return FALSE;
- }
- }
-
- static gboolean
- gst_proxy_pad_set_target (GstPad * pad, GstPad * target)
- {
- gboolean result;
-
- GST_PROXY_LOCK (pad);
- result = gst_proxy_pad_set_target_unlocked (pad, target);
- GST_PROXY_UNLOCK (pad);
-
- return result;
- }
-
static GstPad *
gst_proxy_pad_get_target (GstPad * pad)
{
static void
gst_proxy_pad_class_init (GstProxyPadClass * klass)
{
- GObjectClass *gobject_class = (GObjectClass *) klass;
-
g_type_class_add_private (klass, sizeof (GstProxyPadPrivate));
- gobject_class->dispose = gst_proxy_pad_dispose;
- gobject_class->finalize = gst_proxy_pad_finalize;
-#if !defined(GST_DISABLE_LOADSAVE) && !defined(GST_REMOVE_DEPRECATED)
- {
- GstObjectClass *gstobject_class = (GstObjectClass *) klass;
--
- gstobject_class->save_thyself =
- ((gpointer (*)(GstObject * object,
- gpointer self)) *
- GST_DEBUG_FUNCPTR (gst_proxy_pad_save_thyself));
- }
-#endif
/* Register common function pointer descriptions */
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_query_type_default);
GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_event_default);
gst_proxy_pad_chain_list_default);
} else {
gst_pad_set_getrange_function (internal, gst_proxy_pad_getrange_default);
- gst_pad_set_checkgetrange_function (internal,
- gst_proxy_pad_checkgetrange_default);
}
- GST_PROXY_LOCK (pad);
+ GST_OBJECT_LOCK (pad);
/* now make the ghostpad a parent of the internal pad */
if (!gst_object_set_parent (GST_OBJECT_CAST (internal),
gst_pad_set_activatepush_function (internal,
gst_ghost_pad_internal_activate_push_default);
- GST_PROXY_UNLOCK (pad);
+ GST_OBJECT_UNLOCK (pad);
- /* call function to init values of the pad caps */
- on_int_notify (internal, NULL, GST_GHOST_PAD_CAST (pad));
-
GST_GHOST_PAD_PRIVATE (gpad)->constructed = TRUE;
return TRUE;
gst_pad_unlink (internal, oldtarget);
else
gst_pad_unlink (oldtarget, internal);
-
- GST_PROXY_PAD_RETARGET (internal) = FALSE;
+ } else {
+ GST_OBJECT_UNLOCK (gpad);
}
- result = gst_proxy_pad_set_target_unlocked (GST_PAD_CAST (gpad), newtarget);
- GST_PROXY_UNLOCK (gpad);
-
- if (result && newtarget) {
+ if (newtarget) {
- if (GST_PAD_IS_SRC (newtarget)) {
- g_signal_connect (newtarget, "notify::caps",
- G_CALLBACK (on_src_target_notify), NULL);
- g_signal_connect (newtarget, "unlinked",
- G_CALLBACK (on_src_target_unlinked), NULL);
- }
-
/* and link to internal pad without any checks */
GST_DEBUG_OBJECT (gpad, "connecting internal pad to target");