From 36732e5e2f22e081e43f1a156b0143117d6a862b Mon Sep 17 00:00:00 2001 From: Alex Badea Date: Sun, 13 Jun 2010 13:15:26 +0300 Subject: [PATCH] Drop gst-play-event, as well as gstreamer and pulseaudio dependencies Instead, we can invoke play-sound from osso-af-utils and set PulseAudio properties via the PULSE_PROP env var. --- configure.ac | 8 ----- debian/control | 5 ++- debian/espeaktime-daemon.install | 1 - src/Makefile.am | 6 +--- src/espeaktime-now.sh | 5 ++- src/gst-play-event.c | 72 -------------------------------------- 6 files changed, 7 insertions(+), 90 deletions(-) delete mode 100644 src/gst-play-event.c diff --git a/configure.ac b/configure.ac index 95eb48c..57fb79b 100644 --- a/configure.ac +++ b/configure.ac @@ -21,14 +21,6 @@ PKG_CHECK_MODULES(HAL, [hal]) AC_SUBST(HAL_CFLAGS) AC_SUBST(HAL_LIBS) -PKG_CHECK_MODULES(GST, [gstreamer-0.10]) -AC_SUBST(GST_CFLAGS) -AC_SUBST(GST_LIBS) - -PKG_CHECK_MODULES(PA, [pulsecore]) -AC_SUBST(PA_CFLAGS) -AC_SUBST(PA_LIBS) - AC_OUTPUT([ Makefile src/Makefile diff --git a/debian/control b/debian/control index 9da5c35..c8efdfa 100644 --- a/debian/control +++ b/debian/control @@ -3,13 +3,12 @@ Section: user/multimedia Priority: extra Maintainer: Alex Badea Build-Depends: debhelper (>= 5), - libglib2.0-dev, libdbus-glib-1-dev, libhal-dev, mce-dev (>= 1.8.10), - pulseaudio-dev, libgstreamer0.10-dev + libglib2.0-dev, libdbus-glib-1-dev, libhal-dev, mce-dev (>= 1.8.10) Standards-Version: 3.7.2 Package: espeaktime-daemon Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, espeak +Depends: ${shlibs:Depends}, ${misc:Depends}, espeak, osso-af-utils Description: Talking clock based on eSpeak This is a simple talking clock daemon. Activate it by double-pressing the power button while the display is locked. diff --git a/debian/espeaktime-daemon.install b/debian/espeaktime-daemon.install index 816364a..74d5599 100644 --- a/debian/espeaktime-daemon.install +++ b/debian/espeaktime-daemon.install @@ -1,4 +1,3 @@ usr/bin/espeaktimed usr/bin/espeaktime-now.sh -usr/bin/gst-play-event etc/event.d/* diff --git a/src/Makefile.am b/src/Makefile.am index 0e0d50d..86908a2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,10 +1,6 @@ bin_SCRIPTS = espeaktime-now.sh -bin_PROGRAMS = espeaktimed gst-play-event +bin_PROGRAMS = espeaktimed espeaktimed_SOURCES = daemon.c espeaktimed_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS) $(MCE_CFLAGS) $(HAL_CFLAGS) espeaktimed_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) $(MCE_LIBS) $(HAL_LIBS) -gst_play_event_SOURCES = gst-play-event.c -gst_play_event_CFLAGS = $(GST_CFLAGS) $(PA_CFLAGS) -gst_play_event_LDADD = $(GST_LIBS) $(PA_LIBS) - diff --git a/src/espeaktime-now.sh b/src/espeaktime-now.sh index 39db02a..fe3c90a 100755 --- a/src/espeaktime-now.sh +++ b/src/espeaktime-now.sh @@ -2,5 +2,8 @@ fname=/tmp/espeaktime-$$.wav espeak -w $fname $(date "+%H:%M") -gst-play-event file://${fname} ringtone-preview + +export PULSE_PROP="module-stream-restore.id=x-maemo-applet-profiles event.id=ringtone-preview" +nice -n -5 play-sound $fname + rm -f $fname diff --git a/src/gst-play-event.c b/src/gst-play-event.c deleted file mode 100644 index 47265c3..0000000 --- a/src/gst-play-event.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Play media file via gstreamer, optionally setting pulseaudio - * properties on it. Inspired by qwerty12's code from: - * http://talk.maemo.org/showthread.php?t=50266&page=2 - */ - -#include -#include -#include - -static GMainLoop *loop; -static GstElement *sound_player, *pulsesink; - -static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data) -{ - GMainLoop *loop = data; - gchar *debug; - GError *error; - - switch (GST_MESSAGE_TYPE(msg)) { - case GST_MESSAGE_EOS: - g_main_loop_quit(loop); - break; - case GST_MESSAGE_ERROR: - gst_message_parse_error(msg, &error, &debug); - g_free (debug); - - g_printerr("Error: %s\n", error->message); - g_error_free(error); - g_main_loop_quit(loop); - break; - default: - break; - } - - return TRUE; -} - -int main(int argc, char *argv[]) -{ - GstBus *bus; - pa_proplist *proplist = NULL; - - if (argc < 2) { - g_printerr("Usage: %s []\n", argv[0]); - return 1; - } - - gst_init(&argc, &argv); - loop = g_main_loop_new(NULL, FALSE); - - if (argc > 2) { - proplist = pa_proplist_new(); - pa_proplist_sets(proplist, PA_PROP_EVENT_ID, argv[2]); - pa_proplist_sets(proplist, "module-stream-restore.id", "x-maemo-applet-profiles"); - } - - sound_player = gst_element_factory_make("playbin2", "eSpeakTime"); - pulsesink = gst_element_factory_make("pulsesink", NULL); - if (proplist) - g_object_set(G_OBJECT(pulsesink), "proplist", proplist, NULL); - - bus = gst_pipeline_get_bus(GST_PIPELINE(sound_player)); - gst_bus_add_watch(bus, bus_call, loop); - gst_object_unref(bus); - - g_object_set(sound_player, "audio-sink", pulsesink, "uri", argv[1], NULL); - gst_element_set_state(sound_player, GST_STATE_PLAYING); - - g_main_loop_run(loop); - return 0; -} -- 1.7.9.5