2
* sound.c - Sound support portion of the destop notification spec
4
* Copyright (C) 2007 Jim Ramsay <i.am@jimramsay.com>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28
static GstElement *player;
31
sound_play_uri(const gchar* uri)
36
* TODO: Fade out the current sound and then start the new sound?
37
* Right now we just cut off the existing sound, which is kind of
41
/* Stop the pipeline */
42
gst_element_set_state(player, GST_STATE_NULL);
44
/* Set the input to a local file uri */
45
g_object_set(G_OBJECT(player), "uri", uri, NULL);
47
/* Start the pipeline again */
48
gst_element_set_state(player, GST_STATE_PLAYING);
51
#endif /* HAVE_GSTREAMER */
59
player = gst_element_factory_make("playbin", "Notification Player");
64
* Instead of using the default audiosink, use the gconfaudiosink,
65
* which will respect the defaults in gstreamer-properties
67
g_object_set(G_OBJECT(player), "audio-sink",
68
gst_element_factory_make("gconfaudiosink", "GconfAudioSink"),
72
#endif /* HAVE_GSTREAMER */
76
sound_play(const gchar* filename)
78
/* We are guaranteed here that the file exists */
80
/* gstreamer's playbin takes uris, so make a file:// uri */
81
gchar* uri = g_strdup_printf("file://%s", filename);
84
#endif /* HAVE_GSTREAMER */