fakesrc: use g_object_notify_by_pspec() if possible

Use more efficient g_object_notify_by_pspec() if we're compiling against
GLib >= 2.26.
This commit is contained in:
Tim-Philipp Müller 2010-10-07 18:19:31 +01:00
parent cd3f4d7d92
commit b5e8957bfe

View file

@ -62,7 +62,6 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_DEBUG_CATEGORY_STATIC (gst_fake_src_debug);
#define GST_CAT_DEFAULT gst_fake_src_debug
/* FakeSrc signals and args */
enum
{
@ -226,6 +225,8 @@ static GstFlowReturn gst_fake_src_create (GstBaseSrc * src, guint64 offset,
static guint gst_fake_src_signals[LAST_SIGNAL] = { 0 };
static GParamSpec *pspec_last_message = NULL;
static void
marshal_VOID__MINIOBJECT_OBJECT (GClosure * closure, GValue * return_value,
guint n_param_values, const GValue * param_values, gpointer invocation_hint,
@ -324,10 +325,11 @@ gst_fake_src_class_init (GstFakeSrcClass * klass)
g_object_class_install_property (gobject_class, PROP_PATTERN,
g_param_spec_string ("pattern", "pattern", "pattern", DEFAULT_PATTERN,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
pspec_last_message = g_param_spec_string ("last-message", "last-message",
"The last status message", NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gobject_class, PROP_LAST_MESSAGE,
g_param_spec_string ("last-message", "last-message",
"The last status message", NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
pspec_last_message);
g_object_class_install_property (gobject_class, PROP_SILENT,
g_param_spec_boolean ("silent", "Silent",
"Don't produce last_message events", DEFAULT_SILENT,
@ -448,7 +450,11 @@ gst_fake_src_event_handler (GstBaseSrc * basesrc, GstEvent * event)
g_free (sstr);
GST_OBJECT_UNLOCK (src);
g_object_notify (G_OBJECT (src), "last_message");
#if !GLIB_CHECK_VERSION(2,26,0)
g_object_notify ((GObject *) src, "last_message");
#else
g_object_notify_by_pspec ((GObject *) src, pspec_last_message);
#endif
}
return GST_BASE_SRC_CLASS (parent_class)->event (basesrc, event);
@ -847,7 +853,11 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
GST_MINI_OBJECT (buf)->flags, buf);
GST_OBJECT_UNLOCK (src);
g_object_notify (G_OBJECT (src), "last_message");
#if !GLIB_CHECK_VERSION(2,26,0)
g_object_notify ((GObject *) src, "last_message");
#else
g_object_notify_by_pspec ((GObject *) src, pspec_last_message);
#endif
}
if (src->signal_handoffs) {