[gnome-games] Make libcanberra the default sound backend and remove gstreamer backend
- From: Christian Persch <chpe src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games] Make libcanberra the default sound backend and remove gstreamer backend
- Date: Mon, 4 May 2009 15:52:27 -0400 (EDT)
commit 3d3b11fa2e3f33bafbd68658830607fe124cc8b9
Author: Christian Persch <chpe gnome org>
Date: Mon May 4 21:29:41 2009 +0200
Make libcanberra the default sound backend and remove gstreamer backend
This also make games_sound_add_option_group() obsolete.
---
aisleriot/sol.c | 1 -
configure.in | 28 +---------
gnect/src/main.c | 1 -
gnibbles/main.c | 2 -
gnobots2/gnobots.c | 2 -
gnometris/main.cpp | 2 -
gnomine/gnomine.c | 2 -
iagno/gnothello.c | 2 -
libgames-support/Makefile.am | 5 --
libgames-support/games-sound.c | 114 ++-------------------------------------
libgames-support/games-sound.h | 2 -
11 files changed, 9 insertions(+), 152 deletions(-)
diff --git a/aisleriot/sol.c b/aisleriot/sol.c
index e92886c..983a08b 100644
--- a/aisleriot/sol.c
+++ b/aisleriot/sol.c
@@ -547,7 +547,6 @@ main_prog (void *closure, int argc, char *argv[])
add_main_options (option_context, &data);
games_sound_enable (FALSE);
- games_sound_add_option_group (option_context);
g_option_context_add_group (option_context, gtk_get_option_group (TRUE));
#ifdef WITH_SMCLIENT
diff --git a/configure.in b/configure.in
index 07988b4..8aab3e0 100644
--- a/configure.in
+++ b/configure.in
@@ -308,9 +308,9 @@ fi
AC_MSG_CHECKING([for which sound library to use])
AC_ARG_WITH([sound],
- [AS_HELP_STRING([--with-sound=libcanberra|gstreamer|sdl_mixer (default: sdl_mixer)])],
+ [AS_HELP_STRING([--with-sound=libcanberra|sdl_mixer (default: libcanberra)])],
[with_sound="$withval"],
- [with_sound=sdl_mixer])
+ [with_sound=libcanberra])
AC_MSG_RESULT([$with_sound])
# Clutter
@@ -630,34 +630,13 @@ if test "$enable_sound" = "yes" -a "$with_sound" = "libcanberra"; then
have_libcanberra=yes
fi
-have_gstreamer=no
if test "$enable_sound" = "yes" -a "$with_sound" = "sdl_mixer"; then
# Check for SDL_Mixer sound support, sets SDL_MIXER_CFLAGS, SDL_MIXER_LIBS, AUDIO_SDL
GAMES_CHECK_SOUND()
if test "$SDL_mixer" = "no"; then
- with_sound=gstreamer
- echo "SDL_Mixer not found, fallback to GStreamer."
+ AC_MSG_ERROR([Sound support using SDL-Mixer was requested, but SDL-Mixer not found.])
fi
-
-fi
-
-if test "$enable_sound" = "yes" -a "$with_sound" = "gstreamer"; then
- # Check for GStreamer
- PKG_CHECK_MODULES([GSTREAMER],
- [gstreamer-0.10 >= $GSTREAMER_REQUIRED],
- [have_gstreamer=yes],[have_gstreamer=no])
- # SDL_mixer is default, while GStreamer is a required dependency if SDL_mixer isn't found.
- if test "$enable_sound" = "yes" -a "$have_gstreamer" = "no" -a "$SDL_mixer" = "no"; then
- AC_MSG_ERROR([Sound enabled but GStreamer or SDL_Mixer not found])
- fi
-fi
-
-if test "$have_gstreamer" = "yes"; then
- AC_SUBST([GSTREAMER_CFLAGS])
- AC_SUBST([GSTREAMER_LIBS])
-
- AC_DEFINE([HAVE_GSTREAMER],[1],[Define if GStreamer is available])
fi
if test "x$SDL_mixer" = "xyes"; then
@@ -668,7 +647,6 @@ if test "x$SDL_mixer" = "xyes"; then
fi
AM_CONDITIONAL([HAVE_CANBERRA_GTK],[test "$have_libcanberra" = "yes"])
-AM_CONDITIONAL([HAVE_GSTREAMER],[test "$have_gstreamer" = "yes"])
AM_CONDITIONAL([HAVE_SDL_MIXER],[test "x$SDL_mixer" = "xyes"])
AM_CONDITIONAL([ENABLE_SOUND],[test "$enable_sound" = "yes"])
diff --git a/gnect/src/main.c b/gnect/src/main.c
index ae90073..ceaf357 100644
--- a/gnect/src/main.c
+++ b/gnect/src/main.c
@@ -1494,7 +1494,6 @@ main (int argc, char *argv[])
context = g_option_context_new (NULL);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
- games_sound_add_option_group (context);
retval = g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
if (!retval) {
diff --git a/gnibbles/main.c b/gnibbles/main.c
index 6454e08..f93e767 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -34,7 +34,6 @@
#include <libgames-support/games-help.h>
#include <libgames-support/games-runtime.h>
#include <libgames-support/games-scores.h>
-#include <libgames-support/games-sound.h>
#include <libgames-support/games-stock.h>
#include "main.h"
@@ -1040,7 +1039,6 @@ main (int argc, char **argv)
#endif
g_option_context_add_group (context, gtk_get_option_group (TRUE));
- games_sound_add_option_group (context);
retval = g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
diff --git a/gnobots2/gnobots.c b/gnobots2/gnobots.c
index 914032e..85e0a56 100644
--- a/gnobots2/gnobots.c
+++ b/gnobots2/gnobots.c
@@ -33,7 +33,6 @@
#include <libgames-support/games-runtime.h>
#include <libgames-support/games-scores.h>
#include <libgames-support/games-scores-dialog.h>
-#include <libgames-support/games-sound.h>
#include <libgames-support/games-stock.h>
#ifdef WITH_SMCLIENT
@@ -226,7 +225,6 @@ main (int argc, char *argv[])
#endif /* WITH_SMCLIENT */
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
- games_sound_add_option_group (context);
retval = g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
diff --git a/gnometris/main.cpp b/gnometris/main.cpp
index 78e18db..fb82c48 100644
--- a/gnometris/main.cpp
+++ b/gnometris/main.cpp
@@ -22,7 +22,6 @@
#include <config.h>
#include <libgames-support/games-scores.h>
-#include <libgames-support/games-sound.h>
#include <libgames-support/games-conf.h>
#include <libgames-support/games-runtime.h>
#include <clutter-gtk/clutter-gtk.h>
@@ -53,7 +52,6 @@ main(int argc, char *argv[])
g_option_context_add_group (context, gtk_get_option_group (TRUE));
g_option_context_add_group (context, clutter_get_option_group_without_init ());
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
- games_sound_add_option_group (context);
retval = g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
diff --git a/gnomine/gnomine.c b/gnomine/gnomine.c
index 158a123..79c1061 100644
--- a/gnomine/gnomine.c
+++ b/gnomine/gnomine.c
@@ -39,7 +39,6 @@
#include <libgames-support/games-runtime.h>
#include <libgames-support/games-scores.c>
#include <libgames-support/games-scores-dialog.h>
-#include <libgames-support/games-sound.h>
#include <libgames-support/games-stock.h>
#ifdef WITH_SMCLIENT
@@ -1009,7 +1008,6 @@ main (int argc, char *argv[])
#ifdef WITH_SMCLIENT
g_option_context_add_group (context, egg_sm_client_get_option_group ());
#endif /* WITH_SMCLIENT */
- games_sound_add_option_group (context);
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
retval = g_option_context_parse (context, &argc, &argv, &error);
diff --git a/iagno/gnothello.c b/iagno/gnothello.c
index f210065..3f1838c 100644
--- a/iagno/gnothello.c
+++ b/iagno/gnothello.c
@@ -34,7 +34,6 @@
#include <libgames-support/games-conf.h>
#include <libgames-support/games-help.h>
#include <libgames-support/games-runtime.h>
-#include <libgames-support/games-sound.h>
#include <libgames-support/games-stock.h>
#ifdef WITH_SMCLIENT
@@ -1002,7 +1001,6 @@ main (int argc, char **argv)
g_option_context_add_group (context, egg_sm_client_get_option_group ());
#endif /* WITH_SMCLIENT */
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
- games_sound_add_option_group (context);
retval = g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
diff --git a/libgames-support/Makefile.am b/libgames-support/Makefile.am
index bcf93b7..9f63e7f 100644
--- a/libgames-support/Makefile.am
+++ b/libgames-support/Makefile.am
@@ -206,11 +206,6 @@ libgames_support_la_CFLAGS += $(CANBERRA_GTK_CFLAGS)
libgames_support_la_LIBADD += $(CANBERRA_GTK_LIBS)
endif
-if HAVE_GSTREAMER
-libgames_support_la_CFLAGS += $(GSTREAMER_CFLAGS)
-libgames_support_la_LIBADD += $(GSTREAMER_LIBS)
-endif
-
if HAVE_SDL_MIXER
libgames_support_la_CFLAGS += $(SDL_MIXER_CFLAGS)
libgames_support_la_LIBADD += $(SDL_MIXER_LIBS)
diff --git a/libgames-support/games-sound.c b/libgames-support/games-sound.c
index 996e28e..d5502f7 100644
--- a/libgames-support/games-sound.c
+++ b/libgames-support/games-sound.c
@@ -2,6 +2,7 @@
* games-sound.c: common sound player for gnome-games
*
* Copyright © 2007-2008 Andreas Røsdal
+ * Copyright © 2009 Christian Persch
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,8 +27,6 @@
#if defined(HAVE_CANBERRA_GTK)
#include <canberra-gtk.h>
-#elif defined(HAVE_GSTREAMER)
-#include <gst/gst.h>
#elif defined(HAVE_SDL_MIXER)
#include "SDL.h"
#include "SDL_mixer.h"
@@ -43,67 +42,8 @@
static gboolean sound_enabled = FALSE;
static gboolean sound_init = FALSE;
-#ifdef HAVE_GSTREAMER
-static GstElement *pipeline;
-static GThreadPool *threads;
-
-/* This function is called as a separate thread, playing the sound. */
-static void
-games_sound_thread_run (gchar * data, gchar * user_data)
-{
- const char *dir;
- char *uri;
- gboolean done = FALSE;
- GstBus *bus;
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- /* Set URL for sound to play. */
- dir = games_runtime_get_directory (GAMES_RUNTIME_SOUND_DIRECTORY);
- uri = g_strdup_printf ("file:///%s/%s.ogg", dir, (char *) data);
- g_object_set (G_OBJECT (pipeline), "uri", uri, NULL);
- g_free (uri);
-
- /* Set playbin to playing state. */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- do {
- GstMessage *message;
-
- /* wait for message on the bus */
- message = gst_bus_timed_pop (bus, GST_CLOCK_TIME_NONE);
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_EOS:
- done = TRUE;
- break;
- case GST_MESSAGE_ERROR:{
- GError *err;
- gchar *debug;
-
- gst_message_parse_error (message, &err, &debug);
- _games_debug_print (GAMES_DEBUG_SOUND,
- "Error playing sound: %s\n", err->message);
-
- g_error_free (err);
- g_free (debug);
-
- done = TRUE;
- break;
- }
- default:
- break;
- }
- gst_message_unref (message);
- }
- while (!done);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-}
-
-#endif /* HAVE_GSTREAMER */
-
-
#ifdef HAVE_SDL_MIXER
+
static void
games_sound_sdl_play (const gchar *filename)
{
@@ -123,8 +63,8 @@ games_sound_sdl_play (const gchar *filename)
Mix_PlayChannel (-1, wave, 0);
g_free (path);
}
-#endif /* HAVE_SDL_MIXER */
+#endif /* HAVE_SDL_MIXER */
#ifdef HAVE_CANBERRA_GTK
@@ -196,28 +136,12 @@ games_sound_canberra_play (const char *sound_name,
#endif /* HAVE_CANBERRA_GTK */
-#if defined(HAVE_GSTREAMER) || defined(HAVE_SDL_MIXER)
+#ifdef HAVE_SDL_MIXER
/* Initializes the games-sound support */
static void
games_sound_init (void)
{
-#if defined(HAVE_CANBERRA_GTK)
-#elif defined(HAVE_GSTREAMER)
- GError *err = NULL;
-
- g_assert (g_thread_supported ());
-
- pipeline = gst_element_factory_make ("playbin", "playbin");
- if (pipeline == NULL)
- return;
-
- threads = g_thread_pool_new ((GFunc) games_sound_thread_run,
- NULL, 10, FALSE, &err);
- sound_init = TRUE;
-
-#elif defined(HAVE_SDL_MIXER)
-
const int audio_rate = MIX_DEFAULT_FREQUENCY;
const int audio_format = MIX_DEFAULT_FORMAT;
const int audio_channels = 2;
@@ -239,28 +163,13 @@ games_sound_init (void)
"Error calling Mix_OpenAudio\n");
return;
}
-#endif /* HAVE_SDL_MIXER */
}
-#endif /* HAVE_GSTREAMER || HAVE_SDL_MIXER */
+#endif /* HAVE_SDL_MIXER */
#endif /* ENABLE_SOUND */
/**
- * games_sound_add_option_group:
- * @context: a #GOptionContext
- *
- * Adds the GStreamer option group to @context.
- */
-void
-games_sound_add_option_group (GOptionContext *context)
-{
-#ifdef HAVE_GSTREAMER
- g_option_context_add_group (context, gst_init_get_option_group ());
-#endif /* HAVE_GSTREAMER */
-}
-
-/**
* games_sound_play:
* @filename: the sound file to player
*
@@ -278,17 +187,6 @@ games_sound_play (const gchar * sound_name)
#if defined(HAVE_CANBERRA_GTK)
games_sound_canberra_play (sound_name, GAMES_SOUND_PLAIN, NULL);
-#elif defined(HAVE_GSTREAMER)
- GError *err = NULL;
-
- if (!sound_enabled)
- return;
- if (!sound_init)
- games_sound_init ();
-
- if (sound_init)
- g_thread_pool_push (threads, (gchar *) sound_name, &err);
-
#elif defined(HAVE_SDL_MIXER)
if (!sound_enabled)
@@ -297,7 +195,7 @@ games_sound_play (const gchar * sound_name)
games_sound_init ();
games_sound_sdl_play (sound_name);
-#endif /* HAVE_GSTREAMER */
+#endif
}
/**
diff --git a/libgames-support/games-sound.h b/libgames-support/games-sound.h
index 1069020..edfce23 100644
--- a/libgames-support/games-sound.h
+++ b/libgames-support/games-sound.h
@@ -28,8 +28,6 @@ G_BEGIN_DECLS
gboolean games_sound_is_available (void);
-void games_sound_add_option_group (GOptionContext *context);
-
void games_sound_play (const gchar *sound_name);
void games_sound_play_for_event (const gchar *sound_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]