/* GStreamer ReplayGain volume adjustment
*
* Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- *
+ *
* gstrgvolume.c: Element to apply ReplayGain volume adjustment
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* The information carried by these tags must have been calculated beforehand by
* performing the ReplayGain analysis. This is implemented by the <link
* linkend="GstRgAnalysis">rganalysis</link> element.
- *
+ *
* The signal compression/limiting recommendations outlined in the proposed
* standard are not implemented by this element. This has to be handled by
* separate elements because applications might want to have additional filters
* between the volume adjustment and the limiting stage. A basic limiter is
* included with this plugin: The <link linkend="GstRgLimiter">rglimiter</link>
* element applies -6 dB hard limiting as mentioned in the ReplayGain standard.
- *
+ *
* <refsect2>
* <title>Example launch line</title>
* |[
enum
{
PROP_0,
+#ifdef TIZEN_FEATURE_RGVOLUME_MODIFICATION
+ PROP_ENABLE_RGVOLUME,
+#endif
PROP_ALBUM_MODE,
PROP_HEADROOM,
PROP_PRE_AMP,
PROP_RESULT_GAIN
};
+#ifdef TIZEN_FEATURE_RGVOLUME_MODIFICATION
+#define DEFAULT_ENABLE_RGVOLUME TRUE
+#endif
#define DEFAULT_ALBUM_MODE TRUE
#define DEFAULT_HEADROOM 0.0
#define DEFAULT_PRE_AMP 0.0
gobject_class->get_property = gst_rg_volume_get_property;
gobject_class->dispose = gst_rg_volume_dispose;
+#ifdef TIZEN_FEATURE_RGVOLUME_MODIFICATION
+ /**
+ * GstRgVolume:enable-rgvolume:
+ *
+ * Whether to enable replaygain volume.
+ *
+ * If rgvulme is disabled, the rgvolume isn't affected by tag and properties.
+ */
+ g_object_class_install_property (gobject_class, PROP_ENABLE_RGVOLUME,
+ g_param_spec_boolean ("enable-rgvolume", "Enable rg volume",
+ "Whether to enable replaygain volume", DEFAULT_ENABLE_RGVOLUME,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+#endif
+
/**
* GstRgVolume:album-mode:
*
GObjectClass *volume_class;
GstPad *volume_pad, *ghost_pad;
+#ifdef TIZEN_FEATURE_RGVOLUME_MODIFICATION
+ self->enable_rgvolume = DEFAULT_ENABLE_RGVOLUME;
+#endif
self->album_mode = DEFAULT_ALBUM_MODE;
self->headroom = DEFAULT_HEADROOM;
self->pre_amp = DEFAULT_PRE_AMP;
GstRgVolume *self = GST_RG_VOLUME (object);
switch (prop_id) {
+#ifdef TIZEN_FEATURE_RGVOLUME_MODIFICATION
+ case PROP_ENABLE_RGVOLUME:
+ self->enable_rgvolume = g_value_get_boolean (value);
+ break;
+#endif
case PROP_ALBUM_MODE:
self->album_mode = g_value_get_boolean (value);
break;
GstRgVolume *self = GST_RG_VOLUME (object);
switch (prop_id) {
+#ifdef TIZEN_FEATURE_RGVOLUME_MODIFICATION
+ case PROP_ENABLE_RGVOLUME:
+ g_value_set_boolean (value, self->enable_rgvolume);
+ break;
+#endif
case PROP_ALBUM_MODE:
g_value_set_boolean (value, self->album_mode);
break;
break;
case PROP_TARGET_GAIN:
g_value_set_double (value, self->target_gain);
+#ifdef TIZEN_FEATURE_RGVOLUME_MODIFICATION
+ if (!self->enable_rgvolume)
+ g_value_set_double (value, 0.0);
+#endif
break;
case PROP_RESULT_GAIN:
g_value_set_double (value, self->result_gain);
+#ifdef TIZEN_FEATURE_RGVOLUME_MODIFICATION
+ if (!self->enable_rgvolume)
+ g_value_set_double (value, 0.0);
+#endif
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
gdouble target_gain, result_gain, result_volume;
gboolean target_gain_changed, result_gain_changed;
+#ifdef TIZEN_FEATURE_RGVOLUME_MODIFICATION
+ if (!self->enable_rgvolume) {
+ g_object_set (self->volume_element, "volume", 1.0, NULL);
+ return;
+ }
+#endif
gst_rg_volume_determine_gain (self, &target_gain, &result_gain);
result_volume = DB_TO_LINEAR (result_gain);