gst/gstghostpad.c (on_int_notify): Catches notify::caps on the internal pad, and hacks accordingly. Doesn't do it on ...

Original commit message from CVS:
2005-06-23  Andy Wingo  <wingo@pobox.com>

* gst/gstghostpad.c (on_int_notify): Catches notify::caps on the
internal pad, and hacks accordingly. Doesn't do it on the target
pad because we change its caps. Probably catches all cases of
interest tho.
(gst_ghost_pad_set_property): Connect to notify::caps as
appropritate.
This commit is contained in:
Andy Wingo 2005-06-23 14:18:15 +00:00
parent 3433bdcf17
commit 57bfdb30e4
2 changed files with 35 additions and 2 deletions

View file

@ -1,5 +1,12 @@
2005-06-23 Andy Wingo <wingo@pobox.com>
* gst/gstghostpad.c (on_int_notify): Catches notify::caps on the
internal pad, and hacks accordingly. Doesn't do it on the target
pad because we change its caps. Probably catches all cases of
interest tho.
(gst_ghost_pad_set_property): Connect to notify::caps as
appropritate.
* tests/network-clock.scm (plot-simulation): Pipe data to the
elite python skript.

View file

@ -386,9 +386,10 @@ struct _GstGhostPad
GstProxyPad pad;
GstPad *internal;
gulong notify_id;
/*< private > */
gpointer _gst_reserved[1];
gpointer _gst_reserved[GST_PADDING];
};
struct _GstGhostPadClass
@ -396,7 +397,7 @@ struct _GstGhostPadClass
GstProxyPadClass parent_class;
/*< private > */
gpointer _gst_reserved[1];
gpointer _gst_reserved[GST_PADDING];
};
@ -477,6 +478,22 @@ gst_ghost_pad_do_unlink (GstPad * pad)
/* g_object_set (pad, "internal", NULL, NULL); */
}
static void
on_int_notify (GstPad * internal, GParamSpec * unused, GstGhostPad * pad)
{
GstCaps *caps;
g_object_get (internal, "caps", &caps, NULL);
GST_LOCK (pad);
gst_caps_replace (&(GST_PAD_CAPS (pad)), caps);
GST_UNLOCK (pad);
g_object_notify (G_OBJECT (pad), "caps");
if (caps)
gst_caps_unref (caps);
}
static void
gst_ghost_pad_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
@ -492,6 +509,8 @@ gst_ghost_pad_set_property (GObject * object, guint prop_id,
if (pad->internal) {
GstPad *intpeer;
g_signal_handler_disconnect (pad->internal, pad->notify_id);
intpeer = gst_pad_get_peer (pad->internal);
if (intpeer) {
if (GST_PAD_IS_SRC (pad->internal)) {
@ -521,6 +540,13 @@ gst_ghost_pad_set_property (GObject * object, guint prop_id,
g_mutex_unlock (GST_PROXY_PAD (pad)->property_lock);
return;
}
/* could be more general here, iterating over all writable properties...
* taking the short road for now tho */
pad->notify_id = g_signal_connect (internal, "notify::caps",
G_CALLBACK (on_int_notify), pad);
on_int_notify (internal, NULL, pad);
/* a ref was taken by set_parent */
}