rhythmbox r5551 - in trunk: . backends/gstreamer



Author: jmatthew
Date: Sun Jan 20 14:11:19 2008
New Revision: 5551
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=5551&view=rev

Log:
2008-01-21  Jonathan Matthew  <jonathan d14n org>

	* backends/gstreamer/rb-player-gst-xfade.c: (start_stream_fade),
	Record the fade end point before touching the controller so if we're
	already fading, we don't misinterpret the resulting volume change.

	(rb_player_gst_xfade_pause):  If the stream is still fading in,
	calculate the fade start point and length based on its current volume.


Modified:
   trunk/ChangeLog
   trunk/backends/gstreamer/rb-player-gst-xfade.c

Modified: trunk/backends/gstreamer/rb-player-gst-xfade.c
==============================================================================
--- trunk/backends/gstreamer/rb-player-gst-xfade.c	(original)
+++ trunk/backends/gstreamer/rb-player-gst-xfade.c	Sun Jan 20 14:11:19 2008
@@ -986,6 +986,7 @@
 	}
 
 	/* apparently we need to set the starting volume, otherwise fading in doesn't work. */
+	stream->fade_end = end;
 	g_object_set (stream->volume, "volume", start, NULL);
 
 	gst_controller_unset_all (stream->fader, "volume");
@@ -1012,7 +1013,6 @@
 		g_object_unref (stream);
 	}
 
-	stream->fade_end = end;
 	stream->fading = TRUE;
 
 	/* tiny hack:  if the controlled element is in passthrough mode, the
@@ -3143,6 +3143,8 @@
 	RBPlayerGstXFade *player = RB_PLAYER_GST_XFADE (iplayer);
 	GList *l;
 	gboolean done = FALSE;
+	double fade_out_start = 1.0f;
+	gint64 fade_out_time = PAUSE_FADE_LENGTH;
 
 	g_static_rec_mutex_lock (&player->priv->stream_list_lock);
 
@@ -3171,12 +3173,14 @@
 			done = TRUE;
 			break;
 
-		case PLAYING:
 		case FADING_IN:
+			g_object_get (stream->volume, "volume", &fade_out_start, NULL);
+			fade_out_time = (gint64)(((double) PAUSE_FADE_LENGTH) * fade_out_start);
+		case PLAYING:
 			rb_debug ("pausing stream %s -> FADING_OUT_PAUSED", stream->uri);
 
 			stream->state = FADING_OUT_PAUSED;
-			start_stream_fade (stream, 1.0f, 0.0f, PAUSE_FADE_LENGTH, TRUE);
+			start_stream_fade (stream, fade_out_start, 0.0f, fade_out_time, TRUE);
 			done = TRUE;
 			break;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]