summaryrefslogtreecommitdiffstats
path: root/gst/spectrum
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-09-11 13:28:35 +0200
committerWim Taymans <wim@metal.(none)>2009-09-11 13:28:35 +0200
commit445236a7690caeaac9595d8f7b6b08e3c0e758c6 (patch)
tree8241e5f9388de20c5be06be47c668bc7d6063b4e /gst/spectrum
parent9fb92af2df544ff6a58da9f74a2fbb1d9485309e (diff)
spectrum: add post-messages property
Add a post-messages property and deprecate the less descriptive message property.
Diffstat (limited to 'gst/spectrum')
-rw-r--r--gst/spectrum/gstspectrum.c31
-rw-r--r--gst/spectrum/gstspectrum.h2
2 files changed, 25 insertions, 8 deletions
diff --git a/gst/spectrum/gstspectrum.c b/gst/spectrum/gstspectrum.c
index 63675c17..fca937a4 100644
--- a/gst/spectrum/gstspectrum.c
+++ b/gst/spectrum/gstspectrum.c
@@ -22,8 +22,8 @@
* SECTION:element-spectrum
*
* The Spectrum element analyzes the frequency spectrum of an audio signal.
- * If the #GstSpectrum:message property is #TRUE, it sends analysis results as
- * application messages named
+ * If the #GstSpectrum:post-messages property is #TRUE, it sends analysis results
+ * as application messages named
* <classname>&quot;spectrum&quot;</classname> after each interval of time given
* by the #GstSpectrum:interval property.
*
@@ -130,6 +130,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_spectrum_debug);
/* Spectrum properties */
#define DEFAULT_MESSAGE TRUE
+#define DEFAULT_POST_MESSAGES TRUE
#define DEFAULT_MESSAGE_MAGNITUDE TRUE
#define DEFAULT_MESSAGE_PHASE FALSE
#define DEFAULT_INTERVAL (GST_SECOND / 10)
@@ -140,6 +141,7 @@ enum
{
PROP_0,
PROP_MESSAGE,
+ PROP_POST_MESSAGES,
PROP_MESSAGE_MAGNITUDE,
PROP_MESSAGE_PHASE,
PROP_INTERVAL,
@@ -199,10 +201,23 @@ gst_spectrum_class_init (GstSpectrumClass * klass)
filter_class->setup = GST_DEBUG_FUNCPTR (gst_spectrum_setup);
+ /* FIXME 0.11, remove in favour of post-messages */
g_object_class_install_property (gobject_class, PROP_MESSAGE,
g_param_spec_boolean ("message", "Message",
"Whether to post a 'spectrum' element message on the bus for each "
- "passed interval", DEFAULT_MESSAGE,
+ "passed interval (deprecated, use post-messages)", DEFAULT_MESSAGE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * GstSpectrum:post-messages
+ *
+ * Post messages on the bus with spectrum information.
+ *
+ * Since: 0.10.17
+ */
+ g_object_class_install_property (gobject_class, PROP_POST_MESSAGES,
+ g_param_spec_boolean ("post-messages", "Post Messages",
+ "Whether to post a 'spectrum' element message on the bus for each "
+ "passed interval", DEFAULT_POST_MESSAGES,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MESSAGE_MAGNITUDE,
@@ -242,7 +257,7 @@ gst_spectrum_class_init (GstSpectrumClass * klass)
static void
gst_spectrum_init (GstSpectrum * spectrum, GstSpectrumClass * g_class)
{
- spectrum->message = DEFAULT_MESSAGE;
+ spectrum->post_messages = DEFAULT_POST_MESSAGES;
spectrum->message_magnitude = DEFAULT_MESSAGE_MAGNITUDE;
spectrum->message_phase = DEFAULT_MESSAGE_PHASE;
spectrum->interval = DEFAULT_INTERVAL;
@@ -292,7 +307,8 @@ gst_spectrum_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_MESSAGE:
- filter->message = g_value_get_boolean (value);
+ case PROP_POST_MESSAGES:
+ filter->post_messages = g_value_get_boolean (value);
break;
case PROP_MESSAGE_MAGNITUDE:
filter->message_magnitude = g_value_get_boolean (value);
@@ -340,7 +356,8 @@ gst_spectrum_get_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_MESSAGE:
- g_value_set_boolean (value, filter->message);
+ case PROP_POST_MESSAGES:
+ g_value_set_boolean (value, filter->post_messages);
break;
case PROP_MESSAGE_MAGNITUDE:
g_value_set_boolean (value, filter->message_magnitude);
@@ -597,7 +614,7 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
else
spectrum->accumulated_error += spectrum->error_per_interval;
- if (spectrum->message) {
+ if (spectrum->post_messages) {
GstMessage *m;
/* Calculate average */
diff --git a/gst/spectrum/gstspectrum.h b/gst/spectrum/gstspectrum.h
index 28cbb09a..e676fd2d 100644
--- a/gst/spectrum/gstspectrum.h
+++ b/gst/spectrum/gstspectrum.h
@@ -41,7 +41,7 @@ struct _GstSpectrum
GstAudioFilter parent;
/* properties */
- gboolean message; /* whether or not to post messages */
+ gboolean post_messages; /* whether or not to post messages */
gboolean message_magnitude;
gboolean message_phase;
guint64 interval; /* how many nanoseconds between emits */