~ubuntu-branches/ubuntu/dapper/gst-plugins-good0.10/dapper-security

« back to all changes in this revision

Viewing changes to ext/gconf/gstgconfaudiosink.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-05-05 19:10:19 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060505191019-mge3njl5173jfldb
Tags: 0.10.3-0ubuntu1
* New upstream version (Ubuntu: #43135):
  Changes since 0.10.2:
  - Annodex/CMML support
  - RTSP and RTP enhancements
  - HAL configured audio device support
  - FLAC, Matroska, AVI, WAV, ID3, APE, DV and JPEG plugin improvements
  - Recognise SSA/ASS and USF subtitles in Matroska files
  - Fixes for ESD and SunAudio output plugins
  - More uniform plugin descriptions
  - IceCast metadata reading plugin added
  - New plugins ported from 0.8: OSX audio, AVI muxer, X-Windows input,
    WAV encoder, Gdk-Pixbuf image decoder, Smoke decoder,
    Video colour balance
  - Lots of bug fixes
  Bugs fixed since 0.10.2:
  - RTSP src not working with WMServer servers
  - Replacing icy demuxing in gnomevfssrc
  - HAL sound device wrapper plugins
  - totem (gstreamer) crashes when playing an avi file (Ubuntu: #38800)
  - avidemux does not handle eos at end of seek-region
  - faulty GObject macros
  - [patch] Streaming support for wavparse
  - [pngdec] doesn't handle grayscale or paletted
  - Time slider does not work with avi videos from Cannon SD100
  - [auparse] .au files don't play in playbin
  - [wavparse] will not play DTS stream in malformed WAV
  - rtspsrc filter sometimes uses an odd port for rtp
  - annodex decoding and encoding support
  - [id3demux] read in replaygain information from RVA2 frame...
  - " Seek in ready " for dvdemux
  - problem with auparse or mulawdec, choppy esd playback
  - videobalance not ported to new GstVideoFilter
  - " Seek in ready " support for wavparse plugin
  - gst-plugins-good fail to compile with gcc 4.1
  - Profile support for gconfaudiosink
  - Crash playing any song from a particular album over rhyth...
  - Unable to play .fli files
  - Critical warnings when using cddacdiosrc
  - Gstreamer doesn't recognise tags
  - [alpha] state change function returns a constant
  - Another file that gstreamer can't read the tags on
  - [jpeg] smokedec not ported
  - [pngdec] does not support files with png streams
  - [PATCH] avimux ported to 0.10
  - [wavparse] does not support multichannel wavs
  - [id3demux] reads unicode tags incorrectly where .8 did it...
  - [apedemux] some WavPack files with APE tags fail to play ...
  - [sunaudio] unused variables break CVS build with -Werror
  - [PATCH] Fix gst_pad_new_from_template (gst_static_pad_tem...
  - invalid get_times implementation in gstdynudpsink
  - [patch] unref the result of gst_pad_get_parent
  - [jpegdec] wrong durations set on buffers after seeking in...
  - avi of mpeg4 video and adpcm audio from digital camera re...
  - [id3demux] mp3 fails to play because typefinding thinks i...
  - [goom] zoom filter leaked
  - [wavparse] incorrect way to calculate seek position with ...
  - rhythmbox import crasher - png?
  - Video playback out of sync (Ubuntu: #33073)
  - [speexenc] doesn't work (Ubuntu: #34904)
  - move taglib-based ID3 muxer to -good
  - plugins need better/univied descriptions
  - move ximagesrc to gst-plugins-good
  - index creation might fail with some non-indexe...
  - Problem playing some AVI file when splitting large chunks...
  - [speex] can't seek in speex-encoded audio (Ubuntu: #37552)
  - [matroska] " caps not real subset " when playing audio files
  - AVI files downloaded from vidoe.google.com won't play (Ubuntu: #30031)
  - [sunaudiosink] some fixes
  - [flacdec] can't play .flac files where header says total_...
  - [flacdec] segment seek not supported
  - [id3demux] TCO genre tags (id3v2.2) don't get read by gst...
  - [shout2send] fix crash on error and tags received before ...
  - [wavenc] " not negotiated " error with CVS core
  - [matroskademux] blocks on segmenting seek (and other seek...
  - [matroska] can't play file if details come before type in...
  - [matroska] enhancement for VfW compatibility cases
  - [matroskamux] wrong timestamps of B-frames
  - [matroskamux] blocks upon muxing video and vorbis-audio
  - rtpamrdec discards non-transmitted frames
  - use a duration based on the index if available (Ubuntu: #29962)
* debian/build-deps.in:
  - Build-Depends on libgtk2.0-dev libhal-dev libtag1-dev libxml2-dev
  - updated libgstreamer-plugins-base0.10-dev requirement
* debian/control.in:
  - gstreamer0.10-plugins-good Replaces gstreamer0.10-plugins-bad (<< 0.10.3)
* debian/gstreamer-plugins-good.install:
  - list new elements to install
* debian/rules:
  - updated libgstreamer0.10-dev requirement

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GStreamer
2
2
 * (c) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
 
3
 * (c) 2006 Jürg Billeter <j@bitron.ch>
3
4
 *
4
5
 * This library is free software; you can redistribute it and/or
5
6
 * modify it under the terms of the GNU Library General Public
33
34
gst_gconf_audio_sink_change_state (GstElement * element,
34
35
    GstStateChange transition);
35
36
 
 
37
enum
 
38
{
 
39
  PROP_0,
 
40
  PROP_PROFILE
 
41
};
 
42
 
36
43
GST_BOILERPLATE (GstGConfAudioSink, gst_gconf_audio_sink, GstBin, GST_TYPE_BIN);
37
44
 
 
45
static void gst_gconf_audio_sink_set_property (GObject * object, guint prop_id,
 
46
    const GValue * value, GParamSpec * pspec);
 
47
static void gst_gconf_audio_sink_get_property (GObject * object, guint prop_id,
 
48
    GValue * value, GParamSpec * pspec);
 
49
 
38
50
static void
39
51
gst_gconf_audio_sink_base_init (gpointer klass)
40
52
{
41
53
  GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
42
 
  GstElementDetails gst_gconf_audio_sink_details = {
43
 
    "GConf audio sink",
44
 
    "Sink/Audio",
45
 
    "Audio sink embedding the GConf-settings for audio output",
46
 
    "Ronald Bultje <rbultje@ronald.bitfreak.net>"
47
 
  };
 
54
  static const GstElementDetails gst_gconf_audio_sink_details =
 
55
      GST_ELEMENT_DETAILS ("GConf audio sink",
 
56
      "Sink/Audio",
 
57
      "Audio sink embedding the GConf-settings for audio output",
 
58
      "Ronald Bultje <rbultje@ronald.bitfreak.net>");
48
59
  GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
49
60
      GST_PAD_SINK,
50
61
      GST_PAD_ALWAYS,
55
66
  gst_element_class_set_details (eklass, &gst_gconf_audio_sink_details);
56
67
}
57
68
 
 
69
#define GST_TYPE_GCONF_PROFILE (gst_gconf_profile_get_type())
 
70
static GType
 
71
gst_gconf_profile_get_type (void)
 
72
{
 
73
  static GType gconf_profile_type = 0;
 
74
  static GEnumValue gconf_profiles[] = {
 
75
    {GCONF_PROFILE_SOUNDS, "Sound Events", "sounds"},
 
76
    {GCONF_PROFILE_MUSIC, "Music and Movies", "music"},
 
77
    {GCONF_PROFILE_CHAT, "Audio/Video Conferencing", "chat"},
 
78
    {0, NULL, NULL}
 
79
  };
 
80
 
 
81
  if (!gconf_profile_type) {
 
82
    gconf_profile_type =
 
83
        g_enum_register_static ("GstGConfProfile", gconf_profiles);
 
84
  }
 
85
  return gconf_profile_type;
 
86
}
 
87
 
58
88
static void
59
89
gst_gconf_audio_sink_class_init (GstGConfAudioSinkClass * klass)
60
90
{
61
91
  GObjectClass *oklass = G_OBJECT_CLASS (klass);
62
92
  GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
63
93
 
 
94
  oklass->set_property = gst_gconf_audio_sink_set_property;
 
95
  oklass->get_property = gst_gconf_audio_sink_get_property;
64
96
  oklass->dispose = gst_gconf_audio_sink_dispose;
65
97
  eklass->change_state = gst_gconf_audio_sink_change_state;
 
98
 
 
99
  g_object_class_install_property (oklass, PROP_PROFILE,
 
100
      g_param_spec_enum ("profile", "Profile", "Profile",
 
101
          GST_TYPE_GCONF_PROFILE, GCONF_PROFILE_SOUNDS, G_PARAM_READWRITE));
66
102
}
67
103
 
68
104
/*
88
124
 
89
125
  g_free (sink->gconf_str);
90
126
  sink->gconf_str = NULL;
 
127
 
 
128
  if (sink->connection) {
 
129
    gconf_client_notify_remove (sink->client, sink->connection);
 
130
    sink->connection = 0;
 
131
  }
 
132
}
 
133
 
 
134
static const gchar *
 
135
get_gconf_key_for_profile (int profile)
 
136
{
 
137
  switch (profile) {
 
138
    case GCONF_PROFILE_SOUNDS:
 
139
      return GST_GCONF_DIR "/default/audiosink";
 
140
    case GCONF_PROFILE_MUSIC:
 
141
      return GST_GCONF_DIR "/default/musicaudiosink";
 
142
    case GCONF_PROFILE_CHAT:
 
143
      return GST_GCONF_DIR "/default/chataudiosink";
 
144
    default:
 
145
      g_return_val_if_reached (NULL);
 
146
  }
91
147
}
92
148
 
93
149
static void
102
158
  sink->client = gconf_client_get_default ();
103
159
  gconf_client_add_dir (sink->client, GST_GCONF_DIR,
104
160
      GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
105
 
  gconf_client_notify_add (sink->client, 
106
 
      GST_GCONF_DIR "/" GST_GCONF_AUDIOSINK_KEY,
107
 
      cb_toggle_element, sink, NULL, NULL);
 
161
 
 
162
  sink->profile = GCONF_PROFILE_SOUNDS;
 
163
  sink->connection = gconf_client_notify_add (sink->client,
 
164
      get_gconf_key_for_profile (sink->profile), cb_toggle_element,
 
165
      sink, NULL, NULL);
108
166
}
109
167
 
110
168
static void
113
171
  GstGConfAudioSink *sink = GST_GCONF_AUDIO_SINK (object);
114
172
 
115
173
  if (sink->client) {
 
174
    if (sink->connection) {
 
175
      gconf_client_notify_remove (sink->client, sink->connection);
 
176
      sink->connection = 0;
 
177
    }
 
178
 
116
179
    g_object_unref (G_OBJECT (sink->client));
117
180
    sink->client = NULL;
118
181
  }
129
192
  GstPad *targetpad;
130
193
  gchar *new_gconf_str;
131
194
  GstState cur, next;
132
 
  
 
195
 
133
196
  new_gconf_str = gst_gconf_get_string (GST_GCONF_AUDIOSINK_KEY);
134
197
  if (new_gconf_str != NULL && sink->gconf_str != NULL &&
135
198
      (strlen (new_gconf_str) == 0 ||
136
 
      strcmp (sink->gconf_str, new_gconf_str) == 0)) {
 
199
          strcmp (sink->gconf_str, new_gconf_str) == 0)) {
137
200
    g_free (new_gconf_str);
138
201
    GST_DEBUG_OBJECT (sink, "GConf key was updated, but it didn't change");
139
202
    return TRUE;
148
211
  GST_OBJECT_UNLOCK (sink);
149
212
 
150
213
  if (cur > GST_STATE_READY || next == GST_STATE_PAUSED) {
151
 
    GST_DEBUG_OBJECT (sink, 
 
214
    GST_DEBUG_OBJECT (sink,
152
215
        "Auto-sink is already running. Ignoring GConf change");
153
216
    return TRUE;
154
217
  }
155
218
 
156
219
  GST_DEBUG_OBJECT (sink, "GConf key changed: '%s' to '%s'",
157
 
     GST_STR_NULL (sink->gconf_str), GST_STR_NULL (new_gconf_str));
 
220
      GST_STR_NULL (sink->gconf_str), GST_STR_NULL (new_gconf_str));
158
221
 
159
222
  g_free (sink->gconf_str);
160
223
  sink->gconf_str = new_gconf_str;
168
231
  }
169
232
 
170
233
  GST_DEBUG_OBJECT (sink, "Creating new kid");
171
 
  if (!(sink->kid = gst_gconf_get_default_audio_sink ())) {
 
234
  if (!(sink->kid = gst_gconf_get_default_audio_sink (sink->profile))) {
172
235
    GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL),
173
236
        ("Failed to render audio sink from GConf"));
174
237
    g_free (sink->gconf_str);
189
252
}
190
253
 
191
254
static void
 
255
gst_gconf_audio_sink_set_property (GObject * object, guint prop_id,
 
256
    const GValue * value, GParamSpec * pspec)
 
257
{
 
258
  GstGConfAudioSink *sink;
 
259
 
 
260
  g_return_if_fail (GST_IS_GCONF_AUDIO_SINK (object));
 
261
 
 
262
  sink = GST_GCONF_AUDIO_SINK (object);
 
263
 
 
264
  switch (prop_id) {
 
265
    case PROP_PROFILE:
 
266
      sink->profile = g_value_get_enum (value);
 
267
      if (sink->connection) {
 
268
        gconf_client_notify_remove (sink->client, sink->connection);
 
269
      }
 
270
      sink->connection = gconf_client_notify_add (sink->client,
 
271
          get_gconf_key_for_profile (sink->profile), cb_toggle_element,
 
272
          sink, NULL, NULL);
 
273
      break;
 
274
    default:
 
275
      break;
 
276
  }
 
277
}
 
278
 
 
279
static void
 
280
gst_gconf_audio_sink_get_property (GObject * object, guint prop_id,
 
281
    GValue * value, GParamSpec * pspec)
 
282
{
 
283
  GstGConfAudioSink *sink;
 
284
 
 
285
  g_return_if_fail (GST_IS_GCONF_AUDIO_SINK (object));
 
286
 
 
287
  sink = GST_GCONF_AUDIO_SINK (object);
 
288
 
 
289
  switch (prop_id) {
 
290
    case PROP_PROFILE:
 
291
      g_value_set_enum (value, sink->profile);
 
292
      break;
 
293
    default:
 
294
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 
295
      break;
 
296
  }
 
297
}
 
298
 
 
299
static void
192
300
cb_toggle_element (GConfClient * client,
193
301
    guint connection_id, GConfEntry * entry, gpointer data)
194
302
{