[totem] screensaver: Don't wrongly use _can_get_frames()



commit 30c1d6b31ec09dfad39aab2c909904b58afa2efd
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jun 27 23:47:38 2012 +0100

    screensaver: Don't wrongly use _can_get_frames()
    
    Make sure we don't act as if the stream had a video track
    when we're actually checking whether we can take a screenshot.

 src/plugins/screensaver/totem-screensaver.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/screensaver/totem-screensaver.c b/src/plugins/screensaver/totem-screensaver.c
index c577b9c..adb7b51 100644
--- a/src/plugins/screensaver/totem-screensaver.c
+++ b/src/plugins/screensaver/totem-screensaver.c
@@ -60,19 +60,32 @@ TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_SCREENSAVER_PLUGIN,
 		      TotemScreensaverPlugin,
 		      totem_screensaver_plugin)
 
+static gboolean
+has_video (BaconVideoWidget *bvw)
+{
+	GValue value = { 0, };
+	gboolean ret;
+
+	bacon_video_widget_get_metadata (bvw, BVW_INFO_HAS_VIDEO, &value);
+	ret = g_value_get_boolean (&value);
+	g_value_unset (&value);
+
+	return ret;
+}
+
 static void
 totem_screensaver_update_from_state (TotemObject *totem,
 				     TotemScreensaverPlugin *pi)
 {
-	gboolean lock_screensaver_on_audio, can_get_frames;
+	gboolean lock_screensaver_on_audio, has_video_frames;
 	BaconVideoWidget *bvw;
 
 	bvw = BACON_VIDEO_WIDGET (totem_get_video_widget ((Totem *)(totem)));
 
 	lock_screensaver_on_audio = g_settings_get_boolean (pi->priv->settings, "lock-screensaver-on-audio");
-	can_get_frames = bacon_video_widget_can_get_frames (bvw, NULL);
+	has_video_frames = has_video (bvw);
 
-	if ((totem_is_playing (totem) != FALSE && can_get_frames) ||
+	if ((totem_is_playing (totem) != FALSE && has_video_frames) ||
 	    (totem_is_playing (totem) != FALSE && !lock_screensaver_on_audio)) {
 		if (pi->priv->handler_id_inhibit == 0) {
 			GtkWindow *window;



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