From 588bc09c33a3acfe502e316b6f48a877b6d5fafe Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 25 May 2007 10:07:26 +0000 Subject: [PATCH] Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release. Original commit message from CVS: * ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list), (gst_alsa_mixer_free), (gst_alsa_mixer_update), (gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option): * ext/alsa/gstalsamixer.h: * ext/alsa/gstalsamixerelement.c: (gst_alsa_mixer_element_interface_supported), (gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init), (gst_alsa_mixer_element_set_property), (gst_alsa_mixer_element_get_property), (gst_alsa_mixer_element_change_state): * ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update): * gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed), (gst_mixer_option_changed): * gst-libs/gst/interfaces/mixer.h: Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release. --- ChangeLog | 21 +++ ext/alsa/gstalsamixer.c | 287 +++----------------------------- ext/alsa/gstalsamixer.h | 5 +- ext/alsa/gstalsamixerelement.c | 75 ++++----- ext/alsa/gstalsamixertrack.c | 20 --- gst-libs/gst/interfaces/mixer.c | 6 +- gst-libs/gst/interfaces/mixer.h | 19 +-- 7 files changed, 93 insertions(+), 340 deletions(-) diff --git a/ChangeLog b/ChangeLog index b573be519b..6b8be9de6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2007-05-25 Jan Schmidt + + * ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list), + (gst_alsa_mixer_free), (gst_alsa_mixer_update), + (gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume), + (gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record), + (gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option): + * ext/alsa/gstalsamixer.h: + * ext/alsa/gstalsamixerelement.c: + (gst_alsa_mixer_element_interface_supported), + (gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init), + (gst_alsa_mixer_element_set_property), + (gst_alsa_mixer_element_get_property), + (gst_alsa_mixer_element_change_state): + * ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update): + * gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed), + (gst_mixer_option_changed): + * gst-libs/gst/interfaces/mixer.h: + Revert commits towards #152864 made so far. We'll pick it up again + after the 0.10.13 release. + 2007-05-24 Wim Taymans * gst-libs/gst/audio/gstbaseaudiosink.c: diff --git a/ext/alsa/gstalsamixer.c b/ext/alsa/gstalsamixer.c index b6a1f09915..931d98f346 100644 --- a/ext/alsa/gstalsamixer.c +++ b/ext/alsa/gstalsamixer.c @@ -28,7 +28,7 @@ * of an audio device using the ALSA api. * * - * The application should query and use the interfaces provided by this + * The application should query and use the interfaces provided by this * element to control the device. * * @@ -42,82 +42,6 @@ #include "gstalsamixer.h" -static void gst_alsa_mixer_update_option (GstAlsaMixer * mixer, - GstAlsaMixerOptions * alsa_opts); -static void gst_alsa_mixer_update_track (GstAlsaMixer * mixer, - GstAlsaMixerTrack * alsa_track); - -static gboolean gst_alsa_mixer_prepare (GSource * source, gint * timeout); -static gboolean gst_alsa_mixer_check (GSource * source); -static gboolean gst_alsa_mixer_dispatch (GSource * source, GSourceFunc callback, - gpointer user_data); -static void gst_alsa_mixer_finalize (GSource * source); - -static GMainContext *main_context; - -typedef struct _GstAlsaMixerWatch GstAlsaMixerWatch; -struct _GstAlsaMixerWatch -{ - GSource source; - gint n_poll_fds; - GPollFD *poll_fds; -}; - -GSourceFuncs gst_alsa_mixer_watch_funcs = { - gst_alsa_mixer_prepare, - gst_alsa_mixer_check, - gst_alsa_mixer_dispatch, - gst_alsa_mixer_finalize -}; - -static gboolean -gst_alsa_mixer_prepare (GSource * source, gint * timeout) -{ - *timeout = -1; - return FALSE; -} - -static gboolean -gst_alsa_mixer_check (GSource * source) -{ - GstAlsaMixerWatch *watch = (GstAlsaMixerWatch *) source; - gint i; - gushort revents; - - /* Code based on snd_mixer_poll_descriptors_revents() adapted for glib */ - revents = 0; - for (i = 0; i < watch->n_poll_fds; ++i) { - revents |= watch->poll_fds[i].revents & (G_IO_IN | G_IO_ERR | G_IO_HUP); - } - - if (revents & G_IO_ERR || revents & G_IO_HUP) { - GST_DEBUG ("ALSA poll fds returned ERR or HUP"); - return FALSE; - } - - return (revents & G_IO_IN); -} - -static gboolean -gst_alsa_mixer_dispatch (GSource * source, GSourceFunc callback, - gpointer user_data) -{ - g_return_val_if_fail (callback, FALSE); - return (*callback) (user_data); -} - -static void -gst_alsa_mixer_finalize (GSource * source) -{ - GstAlsaMixerWatch *watch = (GstAlsaMixerWatch *) source; - - if (watch->poll_fds != NULL) { - g_free (watch->poll_fds); - watch->poll_fds = NULL; - } - - watch->n_poll_fds = 0; -} /* First some utils, then the mixer implementation */ static gboolean @@ -245,77 +169,11 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle) return NULL; } -static gboolean -gst_alsa_mixer_handle_source_callback (gpointer data) -{ - GstAlsaMixer *mixer = (GstAlsaMixer *) data; - - GST_LOG ("Source cb"); - snd_mixer_handle_events (mixer->handle); - - return TRUE; -} - -static int -gst_alsa_mixer_handle_callback (snd_mixer_t * handle, unsigned int mask, - snd_mixer_elem_t * elem) -{ - GstAlsaMixer *mixer = - (GstAlsaMixer *) snd_mixer_get_callback_private (handle); - GList *item; - - GST_LOG ("ALSA cb"); - snd_mixer_handle_events (mixer->handle); - - for (item = mixer->tracklist; item != NULL; item = item->next) { - if (GST_IS_ALSA_MIXER_TRACK (item->data)) { - GstAlsaMixerTrack *item_alsa_track = GST_ALSA_MIXER_TRACK (item->data); - - gst_alsa_mixer_update_track (mixer, item_alsa_track); - } else { - GstAlsaMixerOptions *item_alsa_options = - GST_ALSA_MIXER_OPTIONS (item->data); - gst_alsa_mixer_update_option (mixer, item_alsa_options); - } - } - - return 0; -} - -int -gst_alsa_mixer_elem_handle_callback (snd_mixer_elem_t * elem, unsigned int mask) -{ - GstAlsaMixer *mixer = - (GstAlsaMixer *) snd_mixer_elem_get_callback_private (elem); - GList *item; - - GST_LOG ("ALSA elem cb"); - - for (item = mixer->tracklist; item != NULL; item = item->next) { - if (GST_IS_ALSA_MIXER_TRACK (item->data)) { - if (GST_ALSA_MIXER_TRACK (item->data)->element != elem) - continue; - - gst_alsa_mixer_update_track (mixer, GST_ALSA_MIXER_TRACK (item->data)); - } else if (GST_IS_ALSA_MIXER_OPTIONS (item->data)) { - if (GST_ALSA_MIXER_OPTIONS (item->data)->element != elem) - continue; - - gst_alsa_mixer_update_option (mixer, GST_ALSA_MIXER_OPTIONS (item->data)); - } - } - - return 0; -} - static void gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer) { gint i, count; snd_mixer_elem_t *element, *master; - struct pollfd *pfds; - GstAlsaMixerWatch *watch; - GList *item; g_return_if_fail (mixer->handle != NULL); @@ -337,6 +195,7 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer) GstMixerTrack *play_track = NULL; GstMixerTrack *cap_track = NULL; const gchar *name; + GList *item; gint samename = 0; name = snd_mixer_selem_get_name (element); @@ -412,6 +271,7 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer) } } + if (play_track && cap_track) { GST_ALSA_MIXER_TRACK (play_track)->shared_mute = GST_ALSA_MIXER_TRACK (cap_track); @@ -427,62 +287,6 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer) element = snd_mixer_elem_next (element); } - - if (mixer->handle_source != NULL) - return; - - snd_mixer_set_callback_private (mixer->handle, mixer); - snd_mixer_set_callback (mixer->handle, gst_alsa_mixer_handle_callback); - - main_context = g_main_context_default (); - - mixer->handle_source = - g_source_new (&gst_alsa_mixer_watch_funcs, sizeof (GstAlsaMixerWatch)); - g_return_if_fail (main_context != NULL && mixer->handle_source != NULL); - - count = snd_mixer_poll_descriptors_count (mixer->handle); - if (count < 1) { - GST_WARNING ("Poll descriptors count < 0: %d", count); - g_source_destroy (mixer->handle_source); - mixer->handle_source = NULL; - return; - } - - pfds = g_newa (struct pollfd, count); - - watch = (GstAlsaMixerWatch *) mixer->handle_source; - watch->n_poll_fds = snd_mixer_poll_descriptors (mixer->handle, pfds, count);; - watch->poll_fds = g_new0 (GPollFD, count); - - for (i = 0; i < watch->n_poll_fds; ++i) { - watch->poll_fds[i].fd = pfds[i].fd; - - if (pfds[i].events & POLLIN) - watch->poll_fds[i].events |= G_IO_IN; - if (pfds[i].events & POLLOUT) - watch->poll_fds[i].events |= G_IO_OUT; - if (pfds[i].events & POLLPRI) - watch->poll_fds[i].events |= G_IO_PRI; - - g_source_add_poll (mixer->handle_source, &watch->poll_fds[i]); - } - - /* FIXME mixer has to be protected, since cb could be made from different thread ? */ - g_source_set_callback (mixer->handle_source, - gst_alsa_mixer_handle_source_callback, mixer, NULL); - g_source_attach (mixer->handle_source, main_context); - - for (item = mixer->tracklist; item != NULL; item = item->next) { - snd_mixer_elem_t *temp; - - if (GST_IS_ALSA_MIXER_OPTIONS (item->data)) - temp = GST_ALSA_MIXER_OPTIONS (item->data)->element; - else - temp = GST_ALSA_MIXER_TRACK (item->data)->element; - - snd_mixer_elem_set_callback (temp, gst_alsa_mixer_elem_handle_callback); - snd_mixer_elem_set_callback_private (temp, mixer); - } } @@ -518,16 +322,6 @@ gst_alsa_mixer_free (GstAlsaMixer * mixer) { g_return_if_fail (mixer != NULL); - if (mixer->interface) { - g_object_unref (G_OBJECT (mixer->interface)); - mixer->interface = NULL; - } - - if (mixer->handle_source) { - g_source_destroy (mixer->handle_source); - mixer->handle_source = NULL; - } - if (mixer->device) { g_free (mixer->device); mixer->device = NULL; @@ -562,6 +356,16 @@ gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer) return (const GList *) mixer->tracklist; } +static void +gst_alsa_mixer_update (GstAlsaMixer * mixer, GstAlsaMixerTrack * alsa_track) +{ + snd_mixer_handle_events (mixer->handle); + + if (alsa_track) + gst_alsa_mixer_track_update (alsa_track); +} + + void gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track, gint * volumes) @@ -571,7 +375,7 @@ gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track, g_return_if_fail (mixer->handle != NULL); - gst_alsa_mixer_track_update (alsa_track); + gst_alsa_mixer_update (mixer, alsa_track); if (track->flags & GST_MIXER_TRACK_OUTPUT) { /* return playback volume */ @@ -616,7 +420,7 @@ gst_alsa_mixer_set_volume (GstAlsaMixer * mixer, GstMixerTrack * track, g_return_if_fail (mixer->handle != NULL); - gst_alsa_mixer_track_update (alsa_track); + gst_alsa_mixer_update (mixer, alsa_track); if (track->flags & GST_MIXER_TRACK_OUTPUT) { @@ -657,7 +461,7 @@ gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track, g_return_if_fail (mixer->handle != NULL); - gst_alsa_mixer_track_update (alsa_track); + gst_alsa_mixer_update (mixer, alsa_track); if (!!(mute) == !!(track->flags & GST_MIXER_TRACK_MUTE)) return; @@ -705,7 +509,7 @@ gst_alsa_mixer_set_record (GstAlsaMixer * mixer, g_return_if_fail (mixer->handle != NULL); - gst_alsa_mixer_track_update (alsa_track); + gst_alsa_mixer_update (mixer, alsa_track); if (!!(record) == !!(track->flags & GST_MIXER_TRACK_RECORD)) return; @@ -732,7 +536,7 @@ gst_alsa_mixer_set_record (GstAlsaMixer * mixer, if (item_alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH_EXCL && item_alsa_track->capture_group == alsa_track->capture_group) { - gst_alsa_mixer_track_update (item_alsa_track); + gst_alsa_mixer_update (mixer, item_alsa_track); } } } @@ -758,6 +562,8 @@ gst_alsa_mixer_set_option (GstAlsaMixer * mixer, g_return_if_fail (mixer->handle != NULL); + gst_alsa_mixer_update (mixer, NULL); + for (item = opts->values; item != NULL; item = item->next, n++) { if (!strcmp (item->data, value)) { idx = n; @@ -779,60 +585,11 @@ gst_alsa_mixer_get_option (GstAlsaMixer * mixer, GstMixerOptions * opts) g_return_val_if_fail (mixer->handle != NULL, NULL); + gst_alsa_mixer_update (mixer, NULL); + ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx); if (ret == 0) return g_list_nth_data (opts->values, idx); else return snd_strerror (ret); /* feeble attempt at error handling */ } - -static void -gst_alsa_mixer_update_option (GstAlsaMixer * mixer, - GstAlsaMixerOptions * alsa_opts) -{ - gint ret; - guint idx; - const gchar *option; - - if (mixer->interface == NULL) { - GST_WARNING ("Cannot send update notifications, no GstMixer * given"); - return; - } - - ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx); - if (ret == 0) { - option = g_list_nth_data (GST_MIXER_OPTIONS (alsa_opts)->values, idx); - gst_mixer_option_changed (mixer->interface, GST_MIXER_OPTIONS (alsa_opts), - option); - } -} - -static void -gst_alsa_mixer_update_track (GstAlsaMixer * mixer, - GstAlsaMixerTrack * alsa_track) -{ - GstMixerTrack *track = (GstMixerTrack *) alsa_track; - - if (mixer->interface == NULL) { - GST_WARNING ("Cannot send update notifications, no GstMixer * given"); - return; - } - - gst_alsa_mixer_track_update (alsa_track); - - gst_mixer_record_toggled (mixer->interface, track, - GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD)); - gst_mixer_mute_toggled (mixer->interface, track, - GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE)); - gst_mixer_volume_changed (mixer->interface, track, alsa_track->volumes); -} - -/* utility function for gstalsamixerelement to set the interface */ -void -_gst_alsa_mixer_set_interface (GstAlsaMixer * mixer, GstMixer * interface) -{ - g_return_if_fail (mixer != NULL && mixer->interface == NULL); - g_return_if_fail (interface != NULL); - - mixer->interface = g_object_ref (G_OBJECT (interface)); -} diff --git a/ext/alsa/gstalsamixer.h b/ext/alsa/gstalsamixer.h index bf6457a0d7..6c9eb1e7ca 100644 --- a/ext/alsa/gstalsamixer.h +++ b/ext/alsa/gstalsamixer.h @@ -51,9 +51,7 @@ struct _GstAlsaMixer GList * tracklist; /* list of available tracks */ snd_mixer_t * handle; - GSource * handle_source; - GstMixer * interface; gchar * device; gchar * cardname; @@ -63,8 +61,6 @@ struct _GstAlsaMixer GstAlsaMixer* gst_alsa_mixer_new (const gchar *device, GstAlsaMixerDirection dir); -void _gst_alsa_mixer_set_interface (GstAlsaMixer * mixer, - GstMixer * interface); void gst_alsa_mixer_free (GstAlsaMixer *mixer); const GList* gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer); @@ -86,6 +82,7 @@ void gst_alsa_mixer_set_option (GstAlsaMixer * mixer, const gchar* gst_alsa_mixer_get_option (GstAlsaMixer * mixer, GstMixerOptions * opts); + #define GST_IMPLEMENT_ALSA_MIXER_METHODS(Type, interface_as_function) \ static gboolean \ interface_as_function ## _supported (Type *this, GType iface_type) \ diff --git a/ext/alsa/gstalsamixerelement.c b/ext/alsa/gstalsamixerelement.c index b30d56ebe2..75d5b4a49c 100644 --- a/ext/alsa/gstalsamixerelement.c +++ b/ext/alsa/gstalsamixerelement.c @@ -44,26 +44,26 @@ GST_ELEMENT_DETAILS ("Alsa mixer", static void gst_alsa_mixer_element_init_interfaces (GType type); GST_BOILERPLATE_FULL (GstAlsaMixerElement, gst_alsa_mixer_element, - GstElement, GST_TYPE_ELEMENT, gst_alsa_mixer_element_init_interfaces); + GstElement, GST_TYPE_ELEMENT, gst_alsa_mixer_element_init_interfaces) /* massive macro that takes care of all the GstMixer stuff */ -GST_IMPLEMENT_ALSA_MIXER_METHODS (GstAlsaMixerElement, gst_alsa_mixer_element); + GST_IMPLEMENT_ALSA_MIXER_METHODS (GstAlsaMixerElement, gst_alsa_mixer_element); -static void gst_alsa_mixer_element_get_property (GObject * object, + static void gst_alsa_mixer_element_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static void gst_alsa_mixer_element_set_property (GObject * object, + static void gst_alsa_mixer_element_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); -static void gst_alsa_mixer_element_finalize (GObject * object); + static void gst_alsa_mixer_element_finalize (GObject * object); -static GstStateChangeReturn gst_alsa_mixer_element_change_state (GstElement + static GstStateChangeReturn gst_alsa_mixer_element_change_state (GstElement * element, GstStateChange transition); -static gboolean -gst_alsa_mixer_element_interface_supported (GstAlsaMixerElement * self, + static gboolean + gst_alsa_mixer_element_interface_supported (GstAlsaMixerElement * this, GType interface_type) { if (interface_type == GST_TYPE_MIXER) { - return gst_alsa_mixer_element_supported (self, interface_type); + return gst_alsa_mixer_element_supported (this, interface_type); } g_return_val_if_reached (FALSE); @@ -133,37 +133,37 @@ gst_alsa_mixer_element_class_init (GstAlsaMixerElementClass * klass) static void gst_alsa_mixer_element_finalize (GObject * obj) { - GstAlsaMixerElement *self = GST_ALSA_MIXER_ELEMENT (obj); + GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (obj); - g_free (self->device); + g_free (this->device); G_OBJECT_CLASS (parent_class)->finalize (obj); } static void -gst_alsa_mixer_element_init (GstAlsaMixerElement * self, +gst_alsa_mixer_element_init (GstAlsaMixerElement * this, GstAlsaMixerElementClass * klass) { - self->mixer = NULL; - self->device = g_strdup (DEFAULT_PROP_DEVICE); + this->mixer = NULL; + this->device = g_strdup (DEFAULT_PROP_DEVICE); } static void gst_alsa_mixer_element_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { - GstAlsaMixerElement *self = GST_ALSA_MIXER_ELEMENT (object); + GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (object); switch (prop_id) { case PROP_DEVICE:{ - GST_OBJECT_LOCK (self); - g_free (self->device); - self->device = g_value_dup_string (value); + GST_OBJECT_LOCK (this); + g_free (this->device); + this->device = g_value_dup_string (value); /* make sure we never set NULL, this is nice when we want to open the * device. */ - if (self->device == NULL) - self->device = g_strdup (DEFAULT_PROP_DEVICE); - GST_OBJECT_UNLOCK (self); + if (this->device == NULL) + this->device = g_strdup (DEFAULT_PROP_DEVICE); + GST_OBJECT_UNLOCK (this); break; } default: @@ -176,23 +176,23 @@ static void gst_alsa_mixer_element_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - GstAlsaMixerElement *self = GST_ALSA_MIXER_ELEMENT (object); + GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (object); switch (prop_id) { case PROP_DEVICE:{ - GST_OBJECT_LOCK (self); - g_value_set_string (value, self->device); - GST_OBJECT_UNLOCK (self); + GST_OBJECT_LOCK (this); + g_value_set_string (value, this->device); + GST_OBJECT_UNLOCK (this); break; } case PROP_DEVICE_NAME:{ - GST_OBJECT_LOCK (self); - if (self->mixer) { - g_value_set_string (value, self->mixer->cardname); + GST_OBJECT_LOCK (this); + if (this->mixer) { + g_value_set_string (value, this->mixer->cardname); } else { g_value_set_string (value, NULL); } - GST_OBJECT_UNLOCK (self); + GST_OBJECT_UNLOCK (this); break; } default: @@ -206,15 +206,14 @@ gst_alsa_mixer_element_change_state (GstElement * element, GstStateChange transition) { GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; - GstAlsaMixerElement *self = GST_ALSA_MIXER_ELEMENT (element); + GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (element); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: - if (!self->mixer) { - self->mixer = gst_alsa_mixer_new (self->device, GST_ALSA_MIXER_ALL); - if (!self->mixer) + if (!this->mixer) { + this->mixer = gst_alsa_mixer_new (this->device, GST_ALSA_MIXER_ALL); + if (!this->mixer) goto open_failed; - _gst_alsa_mixer_set_interface (self->mixer, GST_MIXER (element)); } break; default: @@ -227,9 +226,9 @@ gst_alsa_mixer_element_change_state (GstElement * element, switch (transition) { case GST_STATE_CHANGE_READY_TO_NULL: - if (self->mixer) { - gst_alsa_mixer_free (self->mixer); - self->mixer = NULL; + if (this->mixer) { + gst_alsa_mixer_free (this->mixer); + this->mixer = NULL; } break; default: @@ -242,7 +241,7 @@ gst_alsa_mixer_element_change_state (GstElement * element, open_failed: { GST_ELEMENT_ERROR (element, RESOURCE, OPEN_READ_WRITE, (NULL), - ("Failed to open alsa mixer device '%s'", self->device)); + ("Failed to open alsa mixer device '%s'", this->device)); return GST_STATE_CHANGE_FAILURE; } } diff --git a/ext/alsa/gstalsamixertrack.c b/ext/alsa/gstalsamixertrack.c index 10e6dff45c..d7b8a931b9 100644 --- a/ext/alsa/gstalsamixertrack.c +++ b/ext/alsa/gstalsamixertrack.c @@ -239,26 +239,6 @@ gst_alsa_mixer_track_update (GstAlsaMixerTrack * alsa_track) gint i; gint audible = !(track->flags & GST_MIXER_TRACK_MUTE); - if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PVOLUME)) { - /* update playback volume */ - for (i = 0; i < track->num_channels; i++) { - long vol = 0; - - snd_mixer_selem_get_playback_volume (alsa_track->element, i, &vol); - alsa_track->volumes[i] = (gint) vol; - } - } - - if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_CVOLUME)) { - /* update capture volume */ - for (i = 0; i < track->num_channels; i++) { - long vol = 0; - - snd_mixer_selem_get_capture_volume (alsa_track->element, i, &vol); - alsa_track->volumes[i] = (gint) vol; - } - } - /* Any updates in flags? */ if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PSWITCH)) { int v = 0; diff --git a/gst-libs/gst/interfaces/mixer.c b/gst-libs/gst/interfaces/mixer.c index 6058b9fcf6..116bab23bb 100644 --- a/gst-libs/gst/interfaces/mixer.c +++ b/gst-libs/gst/interfaces/mixer.c @@ -340,7 +340,7 @@ gst_mixer_record_toggled (GstMixer * mixer, void gst_mixer_volume_changed (GstMixer * mixer, - GstMixerTrack * track, const gint * volumes) + GstMixerTrack * track, gint * volumes) { g_return_if_fail (mixer != NULL); g_return_if_fail (track != NULL); @@ -353,7 +353,7 @@ gst_mixer_volume_changed (GstMixer * mixer, void gst_mixer_option_changed (GstMixer * mixer, - GstMixerOptions * opts, const gchar * value) + GstMixerOptions * opts, gchar * value) { g_return_if_fail (mixer != NULL); g_return_if_fail (opts != NULL); @@ -361,5 +361,5 @@ gst_mixer_option_changed (GstMixer * mixer, g_signal_emit (G_OBJECT (mixer), gst_mixer_signals[SIGNAL_OPTION_CHANGED], 0, opts, value); - g_signal_emit_by_name (G_OBJECT (opts), "option_changed", value); + g_signal_emit_by_name (G_OBJECT (opts), "value_changed", value); } diff --git a/gst-libs/gst/interfaces/mixer.h b/gst-libs/gst/interfaces/mixer.h index 8c6bf6edbe..dde73ab485 100644 --- a/gst-libs/gst/interfaces/mixer.h +++ b/gst-libs/gst/interfaces/mixer.h @@ -57,7 +57,7 @@ struct _GstMixerClass { GTypeInterface klass; GstMixerType mixer_type; - + /* virtual functions */ const GList * (* list_tracks) (GstMixer *mixer); @@ -74,6 +74,7 @@ struct _GstMixerClass { void (* set_record) (GstMixer *mixer, GstMixerTrack *track, gboolean record); + /* signals */ void (* mute_toggled) (GstMixer *mixer, GstMixerTrack *channel, @@ -83,19 +84,18 @@ struct _GstMixerClass { gboolean record); void (* volume_changed) (GstMixer *mixer, GstMixerTrack *channel, - const gint *volumes); + gint *volumes); - void (* option_changed) (GstMixer *mixer, - GstMixerOptions *opts, - const gchar *option); - - /* FIXME 0.11: move set/get function to virtual functions part */ void (* set_option) (GstMixer *mixer, GstMixerOptions *opts, gchar *value); const gchar * (* get_option) (GstMixer *mixer, GstMixerOptions *opts); + void (* option_changed) (GstMixer *mixer, + GstMixerOptions *opts, + gchar *option); + /*< private >*/ gpointer _gst_reserved[GST_PADDING]; }; @@ -129,13 +129,12 @@ void gst_mixer_mute_toggled (GstMixer *mixer, void gst_mixer_record_toggled (GstMixer *mixer, GstMixerTrack *track, gboolean record); - void gst_mixer_volume_changed (GstMixer *mixer, GstMixerTrack *track, - const gint *volumes); + gint *volumes); void gst_mixer_option_changed (GstMixer *mixer, GstMixerOptions *opts, - const gchar *value); + gchar *value); G_END_DECLS