~ubuntu-branches/ubuntu/utopic/awn-extras-applets/utopic

« back to all changes in this revision

Viewing changes to applets/maintained/notification-daemon/sound.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-01-13 21:50:33 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100113215033-kd9otcdjrajmiag0
Tags: 0.3.9~bzr1944-0ubuntu1
* New upstream snapshot.
 - Catch error in weather applet (LP: #359668)
* debian/patches: Refresh.
* debian/*.install: 
 - Update to new location and new applets.
 - Disable dialect applet until python-xklavier is in the archive.
 - Disable MiMenu and Pandora applets, there are unmaintained and not stable.
* debian/awn-applets-c-core: Dropped, not needed.
* debian/control:
 - Update description with new applets.
 - Remove libawn-extras and python-awnlib, all merged in python-awn-extras.
 - Replace awn-manager by awn-settings.
 - Drop build-depends on libgnome-desktop-dev, python*-dev, python2.5,
   awn-manager, libglade2-dev and libgnomeui-dev.
 - Add build-depends on libdesktop-agnostic-bin and vala-awn.
 - Bump build-depends of libawn-dev (>= 0.3.9~bzr1890), valac (>= 0.7.7) and
   debhelper (>= 7.0.50~).
 - Bump Standards-Version to 3.8.3 (no change needed).
 - Demote gconf-editor to Suggest, it's only needed for very advanced
   settings.
 - Update Recommends for python applets with new applets.
 - Suggest python-gconf for notification-area and alacarte for YAMA.
 - Add a debug package for C applets.
* debian/libawn-extras*: Removed, libawn-extras was removed upstream.
* debian/python-awnlib*: Merged with python-awn-extras.
* debian/rules:
 - Rewrite to use overrides.
* debian/copyright:
 - Update copyright and licenses.
* debian/README.source: Added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * sound.c - Sound support portion of the destop notification spec
 
3
 *
 
4
 * Copyright (C) 2007 Jim Ramsay <i.am@jimramsay.com>
 
5
 *
 
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)
 
9
 * any later version.
 
10
 *
 
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.
 
15
 *
 
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
 
19
 * 02111-1307, USA.
 
20
 */
 
21
#include "config.h"
 
22
 
 
23
#include "sound.h"
 
24
 
 
25
#ifdef HAVE_GSTREAMER
 
26
#include <gst/gst.h>
 
27
 
 
28
static GstElement *player;
 
29
 
 
30
static void
 
31
sound_play_uri(const gchar* uri)
 
32
{
 
33
  if (player == NULL)
 
34
    return;
 
35
  /*
 
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
 
38
   *       abrupt
 
39
   */
 
40
 
 
41
  /* Stop the pipeline */
 
42
  gst_element_set_state(player, GST_STATE_NULL);
 
43
 
 
44
  /* Set the input to a local file uri */
 
45
  g_object_set(G_OBJECT(player), "uri", uri, NULL);
 
46
 
 
47
  /* Start the pipeline again */
 
48
  gst_element_set_state(player, GST_STATE_PLAYING);
 
49
}
 
50
 
 
51
#endif /* HAVE_GSTREAMER */
 
52
 
 
53
void
 
54
sound_init(void)
 
55
{
 
56
#ifdef HAVE_GSTREAMER
 
57
  gst_init(NULL, NULL);
 
58
 
 
59
  player = gst_element_factory_make("playbin", "Notification Player");
 
60
 
 
61
  if (player != NULL)
 
62
  {
 
63
    /*
 
64
     * Instead of using the default audiosink, use the gconfaudiosink,
 
65
     * which will respect the defaults in gstreamer-properties
 
66
     */
 
67
    g_object_set(G_OBJECT(player), "audio-sink",
 
68
                 gst_element_factory_make("gconfaudiosink", "GconfAudioSink"),
 
69
                 NULL);
 
70
  }
 
71
 
 
72
#endif /* HAVE_GSTREAMER */
 
73
}
 
74
 
 
75
void
 
76
sound_play(const gchar* filename)
 
77
{
 
78
  /* We are guaranteed here that the file exists */
 
79
#ifdef HAVE_GSTREAMER
 
80
  /* gstreamer's playbin takes uris, so make a file:// uri */
 
81
  gchar* uri = g_strdup_printf("file://%s", filename);
 
82
  sound_play_uri(uri);
 
83
  g_free(uri);
 
84
#endif /* HAVE_GSTREAMER */
 
85
}
 
86