static void
on_got_metadata_event (BaconVideoWidget *bvw, callback_data *data)
{
	GValue value = { 0, };
	GdkPixbuf *pixbuf;

	PROGRESS_DEBUG("Got metadata, checking if we have a cover");
	bacon_video_widget_get_metadata (bvw, BVW_INFO_COVER, &value);
	pixbuf = g_value_dup_object (&value);
	g_value_unset (&value);

	if (pixbuf) {
		PROGRESS_DEBUG("Saving cover image");

		bacon_video_widget_close (bvw);
		totem_resources_monitor_stop ();
		gtk_widget_destroy (GTK_WIDGET (bvw));

		save_pixbuf (pixbuf, data->output, data->input, output_size, TRUE);
		g_object_unref (pixbuf);

		exit (0);
	} else if (has_video (bvw) == FALSE) {
		PROGRESS_DEBUG("No covers, and no video, exiting");
		exit (0);
	}
}
Example #2
0
static void
xplayer_screensaver_update_from_state (XplayerObject *xplayer,
				     XplayerScreensaverPlugin *pi)
{
	gboolean lock_screensaver_on_audio, has_video_frames;
	BaconVideoWidget *bvw;

	bvw = BACON_VIDEO_WIDGET (xplayer_get_video_widget ((Xplayer *)(xplayer)));

	lock_screensaver_on_audio = g_settings_get_boolean (pi->priv->settings, "lock-screensaver-on-audio");
	has_video_frames = has_video (bvw);

	if ((xplayer_is_playing (xplayer) != FALSE && has_video_frames) ||
	    (xplayer_is_playing (xplayer) != FALSE && !lock_screensaver_on_audio)) {
		if (pi->priv->inhibit_cookie == 0) {
			GtkWindow *window;

			window = xplayer_get_main_window (xplayer);
			pi->priv->inhibit_cookie = gtk_application_inhibit (GTK_APPLICATION (xplayer),
										window,
										GTK_APPLICATION_INHIBIT_IDLE,
										_("Playing a movie"));
			g_object_unref (window);
		}
	} else {
		if (pi->priv->inhibit_cookie != 0) {
			gtk_application_uninhibit (GTK_APPLICATION (pi->priv->xplayer), pi->priv->inhibit_cookie);
			pi->priv->inhibit_cookie = 0;
		}
	}
}