summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2010-10-07 18:19:31 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2010-10-07 19:03:42 +0100
commitb5e8957bfe053e605feb497a46ab33a34e705f37 (patch)
tree8865a51fe1a802eda833fffba33c14502533d46a
parentcd3f4d7d92596f2e988a19e3637306e5b4c72fdc (diff)
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.
-rw-r--r--plugins/elements/gstfakesrc.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c
index e82bfb648b..712c2c269a 100644
--- a/plugins/elements/gstfakesrc.c
+++ b/plugins/elements/gstfakesrc.c
@@ -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) {