[rhythmbox] remove old replaygain playback code
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox] remove old replaygain playback code
- Date: Sun, 7 Feb 2010 09:36:01 +0000 (UTC)
commit 04fdcb9013a0543dab01b5bf0b2b5b4b28eedb55
Author: Jonathan Matthew <jonathan d14n org>
Date: Sun Feb 7 10:46:44 2010 +1000
remove old replaygain playback code
It didn't work very well, and we can do much better by just inserting a
GStreamer rgvolume element into the playback pipeline.
backends/gstreamer/rb-player-gst-xfade.c | 108 +-----------------------------
backends/gstreamer/rb-player-gst.c | 56 +---------------
backends/rb-player.c | 24 +------
backends/rb-player.h | 10 ---
bindings/python/rb.defs | 13 ----
data/rhythmbox.schemas | 11 ---
doc/reference/rhythmbox-sections.txt | 1 -
lib/rb-preferences.h | 1 -
shell/rb-shell-player.c | 28 --------
9 files changed, 5 insertions(+), 247 deletions(-)
---
diff --git a/backends/gstreamer/rb-player-gst-xfade.c b/backends/gstreamer/rb-player-gst-xfade.c
index 17a789b..f6cc49f 100644
--- a/backends/gstreamer/rb-player-gst-xfade.c
+++ b/backends/gstreamer/rb-player-gst-xfade.c
@@ -32,20 +32,6 @@
*/
/*
- * not yet implemented:
- * - replaygain (need to figure out what to do if we set_replaygain gets
- * called while fading in)
- * - implement RBPlayerGstTee (maybe not entirely working?)
- * - implement RBPlayerGstFilter (sort of works?)
- *
- * things that need to be fixed:
- * - error reporting is abysmal
- *
- * crack:
- * - use more interesting transition effects - filter sweeps, reverb, etc.
- */
-
-/*
* basic design:
*
* we have a single output bin, beginning with an adder.
@@ -194,10 +180,6 @@ static void rb_player_gst_xfade_set_time (RBPlayer *player, gint64 time);
static gint64 rb_player_gst_xfade_get_time (RBPlayer *player);
static void rb_player_gst_xfade_set_volume (RBPlayer *player, float volume);
static float rb_player_gst_xfade_get_volume (RBPlayer *player);
-static void rb_player_gst_xfade_set_replaygain (RBPlayer *player,
- const char *uri,
- double track_gain, double track_peak,
- double album_gain, double album_peak);
static gboolean rb_player_gst_xfade_add_tee (RBPlayerGstTee *player, GstElement *element);
static gboolean rb_player_gst_xfade_add_filter (RBPlayerGstFilter *player, GstElement *element);
static gboolean rb_player_gst_xfade_remove_tee (RBPlayerGstTee *player, GstElement *element);
@@ -369,7 +351,6 @@ typedef struct
gulong adjust_probe_id;
- float replaygain_scale;
double fade_end;
gboolean emitted_error;
@@ -414,7 +395,6 @@ rb_xfade_stream_send_event (GstElement *element, GstEvent *event)
static void
rb_xfade_stream_init (RBXFadeStream *stream)
{
- stream->replaygain_scale = 1.0;
stream->lock = g_mutex_new ();
}
@@ -726,7 +706,6 @@ rb_player_init (RBPlayerIface *iface)
iface->playing = rb_player_gst_xfade_playing;
iface->set_volume = rb_player_gst_xfade_set_volume;
iface->get_volume = rb_player_gst_xfade_get_volume;
- iface->set_replaygain = rb_player_gst_xfade_set_replaygain;
iface->seekable = rb_player_gst_xfade_seekable;
iface->set_time = rb_player_gst_xfade_set_time;
iface->get_time = rb_player_gst_xfade_get_time;
@@ -1024,8 +1003,6 @@ start_stream_fade (RBXFadeStream *stream, double start, double end, gint64 time)
/* hmm, can we take the stream lock safely here? probably should.. */
- /* should this take replaygain scaling into account? */
-
gst_element_query_position (stream->volume, &format, &pos);
if (pos < 0) {
/* probably means we haven't actually started the stream yet.
@@ -1041,15 +1018,11 @@ start_stream_fade (RBXFadeStream *stream, double start, double end, gint64 time)
pos = 0;
}
- /* apply replaygain scaling */
- start *= stream->replaygain_scale;
- end *= stream->replaygain_scale;
rb_debug ("fading stream %s: [%f, %" G_GINT64_FORMAT "] to [%f, %" G_GINT64_FORMAT "]",
stream->uri,
(float)start, pos,
(float)end, pos + time);
-
g_signal_handlers_block_by_func (stream->volume, volume_changed_cb, stream->player);
/* apparently we need to set the starting volume, otherwise fading in doesn't work. */
@@ -2000,8 +1973,7 @@ stream_src_event_cb (GstPad *pad, GstEvent *event, RBXFadeStream *stream)
* since people seem to get all whiny if they don't have a buffer
* size slider to play with.
*
- * the volume element is used for crossfading and probably replaygain
- * somehow.
+ * the volume element is used for crossfading.
*/
static RBXFadeStream *
create_stream (RBPlayerGstXFade *player, const char *uri, gpointer stream_data, GDestroyNotify stream_data_destroy)
@@ -3631,84 +3603,6 @@ rb_player_gst_xfade_playing (RBPlayer *iplayer)
static void
-rb_player_gst_xfade_set_replaygain (RBPlayer *iplayer,
- const char *uri,
- double track_gain, double track_peak,
- double album_gain, double album_peak)
-{
- RBPlayerGstXFade *player = RB_PLAYER_GST_XFADE (iplayer);
- RBXFadeStream *stream;
- double scale;
- double gain = 0;
- double peak = 0;
-
- g_static_rec_mutex_lock (&player->priv->stream_list_lock);
- stream = find_stream_by_uri (player, uri);
- g_static_rec_mutex_unlock (&player->priv->stream_list_lock);
-
- if (stream == NULL) {
- rb_debug ("can't find stream for %s", uri);
- return;
- }
-
- if (album_gain != 0)
- gain = album_gain;
- else
- gain = track_gain;
-
- if (gain == 0)
- return;
-
- scale = pow (10., gain / 20);
-
- /* anti clip */
- if (album_peak != 0)
- peak = album_peak;
- else
- peak = track_peak;
-
- if (peak != 0 && (scale * peak) > 1)
- scale = 1.0 / peak;
-
- /* For security */
- if (scale > 15)
- scale = 15;
-
- stream->replaygain_scale = scale;
-
- /* update the stream volume if we can */
- switch (stream->state) {
- case PLAYING:
- case PAUSED:
- case SEEKING:
- case SEEKING_PAUSED:
- case SEEKING_EOS:
- case REUSING:
- case WAITING:
- case WAITING_EOS:
- case PREROLLING:
- case PREROLL_PLAY:
- case FADING_OUT_PAUSED:
- g_object_set (stream->volume, "volume", stream->replaygain_scale, NULL);
- break;
-
- case FADING_IN:
- /* hmm.. need to reset the fade?
- * this probably shouldn't happen anyway..
- */
- break;
-
- case FADING_OUT:
- case PENDING_REMOVE:
- /* not much point doing anything here */
- break;
- }
-
- g_object_unref (stream);
-}
-
-
-static void
rb_player_gst_xfade_set_volume (RBPlayer *iplayer, float volume)
{
RBPlayerGstXFade *player = RB_PLAYER_GST_XFADE (iplayer);
diff --git a/backends/gstreamer/rb-player-gst.c b/backends/gstreamer/rb-player-gst.c
index 0bad85a..f64eb14 100644
--- a/backends/gstreamer/rb-player-gst.c
+++ b/backends/gstreamer/rb-player-gst.c
@@ -112,7 +112,6 @@ struct _RBPlayerGstPrivate
gint volume_changed;
gint volume_applied;
float cur_volume;
- float replaygain_scale;
guint tick_timeout_id;
@@ -535,7 +534,6 @@ construct_pipeline (RBPlayerGst *mp, GError **error)
mp->priv->cur_volume = 1.0;
if (mp->priv->cur_volume < 0.0)
mp->priv->cur_volume = 0;
- mp->priv->replaygain_scale = 1.0f;
rb_debug ("pipeline construction complete");
return TRUE;
@@ -731,8 +729,6 @@ impl_close (RBPlayer *player, const char *uri, GError **error)
mp->priv->uri = NULL;
mp->priv->prev_uri = NULL;
- mp->priv->replaygain_scale = 1.0f;
-
if (mp->priv->tick_timeout_id != 0) {
g_source_remove (mp->priv->tick_timeout_id);
mp->priv->tick_timeout_id = 0;
@@ -888,9 +884,8 @@ impl_play (RBPlayer *player, RBPlayerPlayType play_type, gint64 crossfade, GErro
}
if (mp->priv->volume_applied < mp->priv->volume_changed) {
- float volume = mp->priv->cur_volume * mp->priv->replaygain_scale;
- rb_debug ("applying initial volume: %f", volume);
- set_playbin_volume (mp, volume);
+ rb_debug ("applying initial volume: %f", mp->priv->cur_volume);
+ set_playbin_volume (mp, mp->priv->cur_volume);
}
mp->priv->volume_applied = mp->priv->volume_changed;
@@ -933,50 +928,6 @@ impl_playing (RBPlayer *player)
}
static void
-impl_set_replaygain (RBPlayer *player,
- const char *uri,
- double track_gain,
- double track_peak,
- double album_gain,
- double album_peak)
-{
- RBPlayerGst *mp = RB_PLAYER_GST (player);
- double scale;
- double gain = 0;
- double peak = 0;
-
- if (album_gain != 0)
- gain = album_gain;
- else
- gain = track_gain;
-
- if (gain == 0)
- return;
-
- scale = pow (10., gain / 20);
-
- /* anti clip */
- if (album_peak != 0)
- peak = album_peak;
- else
- peak = track_peak;
-
- if (peak != 0 && (scale * peak) > 1)
- scale = 1.0 / peak;
-
- /* For security */
- if (scale > 15)
- scale = 15;
-
- rb_debug ("Scale : %f New volume : %f", scale, mp->priv->cur_volume * scale);
- mp->priv->replaygain_scale = scale;
-
- if (mp->priv->playbin != NULL) {
- set_playbin_volume (mp, mp->priv->cur_volume * scale);
- }
-}
-
-static void
impl_set_volume (RBPlayer *player,
float volume)
{
@@ -985,7 +936,7 @@ impl_set_volume (RBPlayer *player,
mp->priv->volume_changed++;
if (mp->priv->volume_applied > 0) {
- set_playbin_volume (mp, volume * mp->priv->replaygain_scale);
+ set_playbin_volume (mp, volume);
mp->priv->volume_applied = mp->priv->volume_changed;
} else {
/* volume will be applied in the first call to impl_play */
@@ -1258,7 +1209,6 @@ rb_player_init (RBPlayerIface *iface)
iface->playing = impl_playing;
iface->set_volume = impl_set_volume;
iface->get_volume = impl_get_volume;
- iface->set_replaygain = impl_set_replaygain;
iface->seekable = impl_seekable;
iface->set_time = impl_set_time;
iface->get_time = impl_get_time;
diff --git a/backends/rb-player.c b/backends/rb-player.c
index 3583d56..ecd3fa5 100644
--- a/backends/rb-player.c
+++ b/backends/rb-player.c
@@ -56,7 +56,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
*
* This is the interface implemented by the rhythmbox playback backends.
* It allows the caller to control playback (open, play, pause, close),
- * seek (set_time), control volume (get_volume, set_volume, set_replaygain)
+ * seek (set_time), control volume (get_volume, set_volume)
* and receive playback state information (get_time, various signals).
*
* The playback interface allows for multiple streams to be playing (or at
@@ -460,28 +460,6 @@ rb_player_get_volume (RBPlayer *player)
}
/**
- * rb_player_set_replaygain:
- * @player: a #RBPlayer
- * @uri: URI of stream to adjust
- * @track_gain: ReplayGain track gain level
- * @track_peak: ReplayGain track peak level
- * @album_gain: ReplayGain album gain level
- * @album_peak: ReplayGain album peak level
- *
- * Sets ReplayGain values for a stream
- */
-void
-rb_player_set_replaygain (RBPlayer *player,
- const char *uri,
- double track_gain, double track_peak,
- double album_gain, double album_peak)
-{
- RBPlayerIface *iface = RB_PLAYER_GET_IFACE (player);
-
- iface->set_replaygain (player, uri, track_gain, track_peak, album_gain, album_peak);
-}
-
-/**
* rb_player_seekable:
* @player: a #RBPlayer
*
diff --git a/backends/rb-player.h b/backends/rb-player.h
index ac25360..c88d3c9 100644
--- a/backends/rb-player.h
+++ b/backends/rb-player.h
@@ -94,12 +94,6 @@ struct _RBPlayerIface
void (*set_volume) (RBPlayer *player,
float volume);
float (*get_volume) (RBPlayer *player);
- void (*set_replaygain) (RBPlayer *player,
- const char *uri,
- double track_gain,
- double track_peak,
- double album_gain,
- double album_peak);
gboolean (*seekable) (RBPlayer *player);
void (*set_time) (RBPlayer *player,
@@ -161,10 +155,6 @@ gboolean rb_player_playing (RBPlayer *player);
void rb_player_set_volume (RBPlayer *player, float volume);
float rb_player_get_volume (RBPlayer *player);
-void rb_player_set_replaygain (RBPlayer *player,
- const char *uri,
- double track_gain, double track_peak,
- double album_gain, double album_peak);
gboolean rb_player_seekable (RBPlayer *player);
void rb_player_set_time (RBPlayer *player, gint64 newtime);
diff --git a/bindings/python/rb.defs b/bindings/python/rb.defs
index 750c11e..bdf3062 100644
--- a/bindings/python/rb.defs
+++ b/bindings/python/rb.defs
@@ -2449,19 +2449,6 @@
(return-type "float")
)
-(define-method set_replaygain
- (of-object "RBPlayer")
- (c-name "rb_player_set_replaygain")
- (return-type "none")
- (parameters
- '("const-char*" "uri")
- '("double" "track_gain")
- '("double" "track_peak")
- '("double" "album_gain")
- '("double" "album_peak")
- )
-)
-
(define-method seekable
(of-object "RBPlayer")
(c-name "rb_player_seekable")
diff --git a/data/rhythmbox.schemas b/data/rhythmbox.schemas
index 68eeb62..f8bb356 100644
--- a/data/rhythmbox.schemas
+++ b/data/rhythmbox.schemas
@@ -111,17 +111,6 @@
<long>If true, the locations listed in /apps/rhythmbox/library_locations are monitored for new files</long>
</locale>
</schema>
- <schema>
- <key>/schemas/apps/rhythmbox/use_replaygain</key>
- <applyto>/apps/rhythmbox/use_replaygain</applyto>
- <owner>rhythmbox</owner>
- <type>bool</type>
- <default>0</default>
- <locale name="C">
- <short>Whether to use replay gain</short>
- <long>If true, the replay gain will be used</long>
- </locale>
- </schema>
<schema>
<key>/schemas/apps/rhythmbox/state/paned_position</key>
diff --git a/doc/reference/rhythmbox-sections.txt b/doc/reference/rhythmbox-sections.txt
index 4e472f9..4419be2 100644
--- a/doc/reference/rhythmbox-sections.txt
+++ b/doc/reference/rhythmbox-sections.txt
@@ -568,7 +568,6 @@ rb_player_pause
rb_player_playing
rb_player_set_volume
rb_player_get_volume
-rb_player_set_replaygain
rb_player_seekable
rb_player_set_time
rb_player_get_time
diff --git a/lib/rb-preferences.h b/lib/rb-preferences.h
index e2c977c..a123aab 100644
--- a/lib/rb-preferences.h
+++ b/lib/rb-preferences.h
@@ -68,7 +68,6 @@ G_BEGIN_DECLS
#define CONF_LIBRARY_LAYOUT_PATH CONF_PREFIX "/library_layout_path"
#define CONF_LIBRARY_LAYOUT_FILENAME CONF_PREFIX "/library_layout_filename"
#define CONF_LIBRARY_PREFERRED_FORMAT CONF_PREFIX "/library_preferred_format"
-#define CONF_USE_REPLAYGAIN CONF_PREFIX "/use_replaygain"
#define CONF_PLUGINS_PREFIX CONF_PREFIX "/plugins"
#define CONF_PLUGIN_DISABLE_USER CONF_PLUGINS_PREFIX "/no_user_plugins"
diff --git a/shell/rb-shell-player.c b/shell/rb-shell-player.c
index 4374de5..6a7e0c8 100644
--- a/shell/rb-shell-player.c
+++ b/shell/rb-shell-player.c
@@ -147,8 +147,6 @@ static void rb_shell_player_property_row_activated_cb (RBPropertyView *view,
const char *name,
RBShellPlayer *player);
static void rb_shell_player_sync_volume (RBShellPlayer *player, gboolean notify, gboolean set_volume);
-static void rb_shell_player_sync_replaygain (RBShellPlayer *player,
- RhythmDBEntry *entry);
static void tick_cb (RBPlayer *player, RhythmDBEntry *entry, gint64 elapsed, gint64 duration, gpointer data);
static void error_cb (RBPlayer *player, RhythmDBEntry *entry, const GError *err, gpointer data);
static void missing_plugins_cb (RBPlayer *player, RhythmDBEntry *entry, const char **details, const char **descriptions, RBShellPlayer *sp);
@@ -1670,8 +1668,6 @@ rb_shell_player_set_playing_entry (RBShellPlayer *player,
goto lose;
}
- rb_shell_player_sync_replaygain (player, entry);
-
rb_debug ("Success!");
/* clear error on successful playback */
g_value_init (&val, G_TYPE_STRING);
@@ -2430,7 +2426,6 @@ rb_shell_player_sync_volume (RBShellPlayer *player,
entry = rb_shell_player_get_playing_entry (player);
- rb_shell_player_sync_replaygain (player, entry);
if (entry != NULL) {
rhythmdb_entry_unref (entry);
}
@@ -2452,29 +2447,6 @@ rb_shell_player_toggle_mute (RBShellPlayer *player)
rb_shell_player_sync_volume (player, FALSE, TRUE);
}
-static void
-rb_shell_player_sync_replaygain (RBShellPlayer *player,
- RhythmDBEntry *entry)
-{
- double entry_track_gain = 0;
- double entry_track_peak = 0;
- double entry_album_gain = 0;
- double entry_album_peak = 0;
-
- if (entry != NULL) {
- entry_track_gain = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_TRACK_GAIN);
- entry_track_peak = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_TRACK_PEAK);
- entry_album_gain = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_ALBUM_GAIN);
- entry_album_peak = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_ALBUM_PEAK);
- }
-
- if (eel_gconf_get_boolean (CONF_USE_REPLAYGAIN)) {
- rb_player_set_replaygain (player->priv->mmplayer, NULL,
- entry_track_gain, entry_track_peak,
- entry_album_gain, entry_album_peak);
- }
-}
-
/**
* rb_shell_player_set_volume:
* @player: the #RBShellPlayer
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]