int eol, void *userdata)
{
GstPulseMixerCtrl *c = userdata;
+ gboolean vol_chg = FALSE;
+ gboolean old_mute;
/* Called from the background thread! */
c->description = g_strdup (i->description);
c->index = i->index;
c->channel_map = i->channel_map;
+ vol_chg = !pa_cvolume_equal (&c->volume, &i->volume);
c->volume = i->volume;
- c->muted = ! !i->mute;
+ old_mute = c->muted;
+ c->muted = !!i->mute;
c->type = GST_PULSEMIXER_SINK;
if (c->track) {
c->operation_success = TRUE;
pa_threaded_mainloop_signal (c->mainloop, 0);
+
+ if (vol_chg && c->track) {
+ gint volumes[PA_CHANNELS_MAX];
+ gint i;
+ for (i = 0; i < c->volume.channels; i++)
+ volumes[i] = (gint) (c->volume.values[i]);
+ GST_LOG_OBJECT (c->object, "Sending volume change notification");
+ gst_mixer_volume_changed (GST_MIXER (c->object), c->track, volumes);
+ }
+ if ((c->muted != old_mute) && c->track) {
+ GST_LOG_OBJECT (c->object, "Sending mute toggled notification");
+ gst_mixer_mute_toggled (GST_MIXER (c->object), c->track, c->muted);
+ }
}
static void
const pa_source_info * i, int eol, void *userdata)
{
GstPulseMixerCtrl *c = userdata;
+ gboolean vol_chg = FALSE;
+ gboolean old_mute;
/* Called from the background thread! */
c->description = g_strdup (i->description);
c->index = i->index;
c->channel_map = i->channel_map;
+ vol_chg = !pa_cvolume_equal (&c->volume, &i->volume);
c->volume = i->volume;
- c->muted = ! !i->mute;
+ old_mute = c->muted;
+ c->muted = !!i->mute;
c->type = GST_PULSEMIXER_SOURCE;
if (c->track) {
c->operation_success = TRUE;
pa_threaded_mainloop_signal (c->mainloop, 0);
+
+ if (vol_chg && c->track) {
+ gint volumes[PA_CHANNELS_MAX];
+ gint i;
+ for (i = 0; i < c->volume.channels; i++)
+ volumes[i] = (gint) (c->volume.values[i]);
+ GST_LOG_OBJECT (c->object, "Sending volume change notification");
+ gst_mixer_volume_changed (GST_MIXER (c->object), c->track, volumes);
+ }
+ if ((c->muted != old_mute) && c->track) {
+ GST_LOG_OBJECT (c->object, "Sending mute toggled notification");
+ gst_mixer_mute_toggled (GST_MIXER (c->object), c->track, c->muted);
+ }
}
static void
{
GstPulseMixerCtrl *c = (GstPulseMixerCtrl *) userdata;
- c->operation_success = ! !success;
+ c->operation_success = !!success;
pa_threaded_mainloop_signal (c->mainloop, 0);
}
const gchar * device, GstPulseMixerType type)
{
GstPulseMixerCtrl *c = NULL;
+ g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE ((object),
+ GST_TYPE_MIXER), c);
GST_DEBUG_OBJECT (object, "new mixer ctrl for %s", device);
c = g_new (GstPulseMixerCtrl, 1);
pa_threaded_mainloop_unlock (c->mainloop);
}
+
+GstMixerFlags
+gst_pulsemixer_ctrl_get_mixer_flags (GstPulseMixerCtrl * mixer)
+{
+ return GST_MIXER_FLAG_AUTO_NOTIFICATIONS;
+}
GstMixerTrack * track, gboolean mute);
void gst_pulsemixer_ctrl_set_record (GstPulseMixerCtrl * mixer,
GstMixerTrack * track, gboolean record);
+GstMixerFlags gst_pulsemixer_ctrl_get_mixer_flags (GstPulseMixerCtrl * mixer);
#define GST_IMPLEMENT_PULSEMIXER_CTRL_METHODS(Type, interface_as_function) \
static const GList* \
\
gst_pulsemixer_ctrl_set_mute (this->mixer, track, mute); \
} \
+static GstMixerFlags \
+interface_as_function ## _get_mixer_flags (GstMixer * mixer) \
+{ \
+ Type *this = (Type*) mixer; \
+ \
+ g_return_val_if_fail (this != NULL, GST_MIXER_FLAG_NONE); \
+ g_return_val_if_fail (this->mixer != NULL, GST_MIXER_FLAG_NONE); \
+ \
+ return gst_pulsemixer_ctrl_get_mixer_flags (this->mixer); \
+} \
static void \
interface_as_function ## _mixer_interface_init (GstMixerClass * klass) \
{ \
klass->get_volume = interface_as_function ## _get_volume; \
klass->set_mute = interface_as_function ## _set_mute; \
klass->set_record = interface_as_function ## _set_record; \
+ klass->get_mixer_flags = interface_as_function ## _get_mixer_flags; \
}
G_END_DECLS