mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 19:20:35 +00:00
pads: use new g_object_notify_by_pspec() for caps notifies if available
If we're building against GLib >= 2.26.0, we can use the more efficient g_object_notify_by_caps(), which avoids the param spec lookup.
This commit is contained in:
parent
ca607d99b2
commit
fd6334cb7c
2 changed files with 30 additions and 9 deletions
|
@ -88,7 +88,7 @@ static xmlNodePtr gst_proxy_pad_save_thyself (GstObject * object,
|
|||
static void on_src_target_notify (GstPad * target,
|
||||
GParamSpec * unused, gpointer user_data);
|
||||
|
||||
|
||||
static GParamSpec *pspec_caps = NULL;
|
||||
|
||||
static const GstQueryType *
|
||||
gst_proxy_pad_do_query_type (GstPad * pad)
|
||||
|
@ -702,8 +702,13 @@ on_int_notify (GstPad * internal, GParamSpec * unused, GstGhostPad * pad)
|
|||
gst_caps_replace (&(GST_PAD_CAPS (pad)), caps);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
|
||||
if (changed)
|
||||
g_object_notify (G_OBJECT (pad), "caps");
|
||||
if (changed) {
|
||||
#if GLIB_CHECK_VERSION(2,26,0)
|
||||
g_object_notify_by_pspec ((GObject *) pad, pspec_caps);
|
||||
#else
|
||||
g_object_notify ((GObject *) pad, "caps");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (caps)
|
||||
gst_caps_unref (caps);
|
||||
|
@ -749,8 +754,14 @@ on_src_target_notify (GstPad * target, GParamSpec * unused, gpointer user_data)
|
|||
if (changed)
|
||||
gst_caps_replace (&(GST_PAD_CAPS (gpad)), caps);
|
||||
GST_OBJECT_UNLOCK (gpad);
|
||||
if (changed)
|
||||
g_object_notify (G_OBJECT (gpad), "caps");
|
||||
|
||||
if (changed) {
|
||||
#if GLIB_CHECK_VERSION(2,26,0)
|
||||
g_object_notify_by_pspec ((GObject *) gpad, pspec_caps);
|
||||
#else
|
||||
g_object_notify ((GObject *) gpad, "caps");
|
||||
#endif
|
||||
}
|
||||
|
||||
g_object_unref (gpad);
|
||||
|
||||
|
@ -790,6 +801,8 @@ gst_ghost_pad_class_init (GstGhostPadClass * klass)
|
|||
|
||||
g_type_class_add_private (klass, sizeof (GstGhostPadPrivate));
|
||||
|
||||
pspec_caps = g_object_class_find_property (gobject_class, "caps");
|
||||
|
||||
gobject_class->dispose = gst_ghost_pad_dispose;
|
||||
|
||||
GST_DEBUG_REGISTER_FUNCPTR (gst_ghost_pad_do_setcaps);
|
||||
|
|
16
gst/gstpad.c
16
gst/gstpad.c
|
@ -138,6 +138,8 @@ GList *gst_pad_get_internal_links_default (GstPad * pad);
|
|||
static GstObjectClass *parent_class = NULL;
|
||||
static guint gst_pad_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GParamSpec *pspec_caps = NULL;
|
||||
|
||||
/* quarks for probe signals */
|
||||
static GQuark buffer_quark;
|
||||
static GQuark event_quark;
|
||||
|
@ -313,9 +315,11 @@ gst_pad_class_init (GstPadClass * klass)
|
|||
NULL, gst_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1,
|
||||
GST_TYPE_MINI_OBJECT);
|
||||
|
||||
g_object_class_install_property (gobject_class, PAD_PROP_CAPS,
|
||||
g_param_spec_boxed ("caps", "Caps", "The capabilities of the pad",
|
||||
GST_TYPE_CAPS, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
pspec_caps = g_param_spec_boxed ("caps", "Caps",
|
||||
"The capabilities of the pad", GST_TYPE_CAPS,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (gobject_class, PAD_PROP_CAPS, pspec_caps);
|
||||
|
||||
g_object_class_install_property (gobject_class, PAD_PROP_DIRECTION,
|
||||
g_param_spec_enum ("direction", "Direction", "The direction of the pad",
|
||||
GST_TYPE_PAD_DIRECTION, GST_PAD_UNKNOWN,
|
||||
|
@ -2674,7 +2678,11 @@ gst_pad_set_caps (GstPad * pad, GstCaps * caps)
|
|||
caps);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
|
||||
g_object_notify (G_OBJECT (pad), "caps");
|
||||
#if GLIB_CHECK_VERSION(2,26,0)
|
||||
g_object_notify_by_pspec ((GObject *) pad, pspec_caps);
|
||||
#else
|
||||
g_object_notify ((GObject *) pad, "caps");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue