From 2fa68fce077a738821373ec8c16d90485ff4d697 Mon Sep 17 00:00:00 2001 From: Bernhard Miller Date: Wed, 28 Aug 2013 07:15:00 +0200 Subject: [PATCH] autoaudiosink: introduce sync property https://bugzilla.gnome.org/show_bug.cgi?id=706955 --- gst/autodetect/gstautoaudiosink.c | 17 +++++++++++++++++ gst/autodetect/gstautoaudiosink.h | 1 + 2 files changed, 18 insertions(+) diff --git a/gst/autodetect/gstautoaudiosink.c b/gst/autodetect/gstautoaudiosink.c index 340e9a2382..09306b49e0 100644 --- a/gst/autodetect/gstautoaudiosink.c +++ b/gst/autodetect/gstautoaudiosink.c @@ -45,6 +45,7 @@ #include "gstautodetect.h" #define DEFAULT_TS_OFFSET 0 +#define DEFAULT_SYNC TRUE /* Properties */ enum @@ -52,6 +53,7 @@ enum PROP_0, PROP_CAPS, PROP_TS_OFFSET, + PROP_SYNC, }; static GstStateChangeReturn @@ -108,6 +110,11 @@ gst_auto_audio_sink_class_init (GstAutoAudioSinkClass * klass) "Timestamp offset in nanoseconds", G_MININT64, G_MAXINT64, DEFAULT_TS_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_SYNC, + g_param_spec_boolean ("sync", "Sync", + "Sync on the clock", DEFAULT_SYNC, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gst_element_class_add_pad_template (eklass, gst_static_pad_template_get (&sink_template)); @@ -175,6 +182,7 @@ gst_auto_audio_sink_init (GstAutoAudioSink * sink) /* set the default raw audio caps */ sink->filter_caps = gst_static_caps_get (&raw_caps); sink->ts_offset = DEFAULT_TS_OFFSET; + sink->sync = DEFAULT_SYNC; /* mark as sink */ GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_FLAG_SINK); @@ -336,6 +344,7 @@ gst_auto_audio_sink_detect (GstAutoAudioSink * sink) goto no_sink; g_object_set (G_OBJECT (esink), "ts-offset", sink->ts_offset, NULL); + g_object_set (G_OBJECT (esink), "sync", sink->sync, NULL); sink->kid = esink; /* Ensure the child is brought up to the right state to match the parent @@ -421,6 +430,11 @@ gst_auto_audio_sink_set_property (GObject * object, guint prop_id, if (sink->kid) g_object_set_property (G_OBJECT (sink->kid), pspec->name, value); break; + case PROP_SYNC: + sink->sync = g_value_get_boolean (value); + if (sink->kid) + g_object_set_property (G_OBJECT (sink->kid), pspec->name, value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -441,6 +455,9 @@ gst_auto_audio_sink_get_property (GObject * object, guint prop_id, case PROP_TS_OFFSET: g_value_set_int64 (value, sink->ts_offset); break; + case PROP_SYNC: + g_value_set_boolean (value, sink->sync); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/gst/autodetect/gstautoaudiosink.h b/gst/autodetect/gstautoaudiosink.h index 3435a9b319..6a049aee3f 100644 --- a/gst/autodetect/gstautoaudiosink.h +++ b/gst/autodetect/gstautoaudiosink.h @@ -45,6 +45,7 @@ typedef struct _GstAutoAudioSink { GstElement *kid; GstCaps *filter_caps; GstClockTimeDiff ts_offset; + gboolean sync; } GstAutoAudioSink; typedef struct _GstAutoAudioSinkClass {