Commit f2df2a69 authored by Marc-Andre Lureau's avatar Marc-Andre Lureau Committed by Stefan Kost
Browse files

ext/alsa/gstalsamixer.c (main_context, GstAlsaMixerWatch, _GstAlsaMixerWatch,...

ext/alsa/gstalsamixer.c (main_context, GstAlsaMixerWatch, _GstAlsaMixerWatch, source, n_poll_fds, poll_fds, gst_alsa_...

Original commit message from CVS:
patch by: Marc-Andre Lureau <marcandre.lureau@gmail.com>
* ext/alsa/gstalsamixer.c (main_context, GstAlsaMixerWatch,
_GstAlsaMixerWatch, source, n_poll_fds, poll_fds,
gst_alsa_mixer_watch_funcs, gst_alsa_mixer_prepare,
gst_alsa_mixer_check, gst_alsa_mixer_dispatch,
gst_alsa_mixer_finalize, gst_alsa_mixer_find_master_mixer,
gst_alsa_mixer_handle_source_callback,
gst_alsa_mixer_handle_callback, gst_alsa_mixer_elem_handle_callback,
gst_alsa_mixer_ensure_track_list, gst_alsa_mixer_free,
gst_alsa_mixer_get_volume, gst_alsa_mixer_set_volume,
gst_alsa_mixer_set_mute, gst_alsa_mixer_set_record,
gst_alsa_mixer_get_option, gst_alsa_mixer_update_option,
gst_alsa_mixer_update_track, _gst_alsa_mixer_set_interface):
* ext/alsa/gstalsamixer.h (handle_source, interface, dir):
* ext/alsa/gstalsamixerelement.c (gst_alsa_mixer_element_details,
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 (set_option, get_option,
volume_changed, option_changed, _gst_reserved):
Implement notification for alsamixer. Fixes #152864
parent c655a27a
2007-05-15 Stefan Kost <ensonic@users.sf.net>
patch by: Marc-Andre Lureau <marcandre.lureau@gmail.com>
* ext/alsa/gstalsamixer.c (main_context, GstAlsaMixerWatch,
_GstAlsaMixerWatch, source, n_poll_fds, poll_fds,
gst_alsa_mixer_watch_funcs, gst_alsa_mixer_prepare,
gst_alsa_mixer_check, gst_alsa_mixer_dispatch,
gst_alsa_mixer_finalize, gst_alsa_mixer_find_master_mixer,
gst_alsa_mixer_handle_source_callback,
gst_alsa_mixer_handle_callback, gst_alsa_mixer_elem_handle_callback,
gst_alsa_mixer_ensure_track_list, gst_alsa_mixer_free,
gst_alsa_mixer_get_volume, gst_alsa_mixer_set_volume,
gst_alsa_mixer_set_mute, gst_alsa_mixer_set_record,
gst_alsa_mixer_get_option, gst_alsa_mixer_update_option,
gst_alsa_mixer_update_track, _gst_alsa_mixer_set_interface):
* ext/alsa/gstalsamixer.h (handle_source, interface, dir):
* ext/alsa/gstalsamixerelement.c (gst_alsa_mixer_element_details,
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 (set_option, get_option,
volume_changed, option_changed, _gst_reserved):
Implement notification for alsamixer. Fixes #152864
2007-05-14 David Schleef <ds@schleef.org> 2007-05-14 David Schleef <ds@schleef.org>
* gst/videotestsrc/videotestsrc.c: * gst/videotestsrc/videotestsrc.c:
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* of an audio device using the ALSA api. * of an audio device using the ALSA api.
* </para> * </para>
* <para> * <para>
* 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. * element to control the device.
* </para> * </para>
* </refsect2> * </refsect2>
...@@ -42,6 +42,85 @@ ...@@ -42,6 +42,85 @@
#include "gstalsamixer.h" #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_WARNING ("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)
{
if (!callback) {
GST_WARNING ("Cannot get callback from ALSA mixer watcher");
}
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 */ /* First some utils, then the mixer implementation */
static gboolean static gboolean
...@@ -169,11 +248,77 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle) ...@@ -169,11 +248,77 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
return NULL; return NULL;
} }
static gboolean
gst_alsa_mixer_handle_source_callback (gpointer data)
{
GstAlsaMixer *mixer = (GstAlsaMixer *) data;
GST_WARNING ("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_WARNING ("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_WARNING ("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 static void
gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer) gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer)
{ {
gint i, count; gint i, count;
snd_mixer_elem_t *element, *master; snd_mixer_elem_t *element, *master;
struct pollfd *pfds;
GstAlsaMixerWatch *watch;
GList *item;
g_return_if_fail (mixer->handle != NULL); g_return_if_fail (mixer->handle != NULL);
...@@ -195,7 +340,6 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer) ...@@ -195,7 +340,6 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer)
GstMixerTrack *play_track = NULL; GstMixerTrack *play_track = NULL;
GstMixerTrack *cap_track = NULL; GstMixerTrack *cap_track = NULL;
const gchar *name; const gchar *name;
GList *item;
gint samename = 0; gint samename = 0;
name = snd_mixer_selem_get_name (element); name = snd_mixer_selem_get_name (element);
...@@ -287,6 +431,63 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer) ...@@ -287,6 +431,63 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer)
element = snd_mixer_elem_next (element); 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);
watch = (GstAlsaMixerWatch *) mixer->handle_source;
count = snd_mixer_poll_descriptors_count (mixer->handle);
pfds = g_newa (struct pollfd, count);
watch->n_poll_fds = snd_mixer_poll_descriptors (mixer->handle, pfds, count);;
watch->poll_fds = g_new0 (GPollFD, count);
if (watch->poll_fds == NULL) {
GST_WARNING ("Cannot allocate poll descriptors");
g_source_destroy (mixer->handle_source);
mixer->handle_source = NULL;
return;
}
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);
}
} }
...@@ -322,6 +523,16 @@ gst_alsa_mixer_free (GstAlsaMixer * mixer) ...@@ -322,6 +523,16 @@ gst_alsa_mixer_free (GstAlsaMixer * mixer)
{ {
g_return_if_fail (mixer != NULL); 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) { if (mixer->device) {
g_free (mixer->device); g_free (mixer->device);
mixer->device = NULL; mixer->device = NULL;
...@@ -356,16 +567,6 @@ gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer) ...@@ -356,16 +567,6 @@ gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer)
return (const GList *) mixer->tracklist; 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 void
gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track, gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
gint * volumes) gint * volumes)
...@@ -375,7 +576,7 @@ gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track, ...@@ -375,7 +576,7 @@ gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
g_return_if_fail (mixer->handle != NULL); g_return_if_fail (mixer->handle != NULL);
gst_alsa_mixer_update (mixer, alsa_track); gst_alsa_mixer_track_update (alsa_track);
if (track->flags & GST_MIXER_TRACK_OUTPUT) { /* return playback volume */ if (track->flags & GST_MIXER_TRACK_OUTPUT) { /* return playback volume */
...@@ -420,7 +621,7 @@ gst_alsa_mixer_set_volume (GstAlsaMixer * mixer, GstMixerTrack * track, ...@@ -420,7 +621,7 @@ gst_alsa_mixer_set_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
g_return_if_fail (mixer->handle != NULL); g_return_if_fail (mixer->handle != NULL);
gst_alsa_mixer_update (mixer, alsa_track); gst_alsa_mixer_track_update (alsa_track);
if (track->flags & GST_MIXER_TRACK_OUTPUT) { if (track->flags & GST_MIXER_TRACK_OUTPUT) {
...@@ -461,7 +662,7 @@ gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track, ...@@ -461,7 +662,7 @@ gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track,
g_return_if_fail (mixer->handle != NULL); g_return_if_fail (mixer->handle != NULL);
gst_alsa_mixer_update (mixer, alsa_track); gst_alsa_mixer_track_update (alsa_track);
if (!!(mute) == !!(track->flags & GST_MIXER_TRACK_MUTE)) if (!!(mute) == !!(track->flags & GST_MIXER_TRACK_MUTE))
return; return;
...@@ -509,7 +710,7 @@ gst_alsa_mixer_set_record (GstAlsaMixer * mixer, ...@@ -509,7 +710,7 @@ gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
g_return_if_fail (mixer->handle != NULL); g_return_if_fail (mixer->handle != NULL);
gst_alsa_mixer_update (mixer, alsa_track); gst_alsa_mixer_track_update (alsa_track);
if (!!(record) == !!(track->flags & GST_MIXER_TRACK_RECORD)) if (!!(record) == !!(track->flags & GST_MIXER_TRACK_RECORD))
return; return;
...@@ -536,7 +737,7 @@ gst_alsa_mixer_set_record (GstAlsaMixer * mixer, ...@@ -536,7 +737,7 @@ gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
if (item_alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH_EXCL && if (item_alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH_EXCL &&
item_alsa_track->capture_group == alsa_track->capture_group) { item_alsa_track->capture_group == alsa_track->capture_group) {
gst_alsa_mixer_update (mixer, item_alsa_track); gst_alsa_mixer_track_update (item_alsa_track);
} }
} }
} }
...@@ -562,8 +763,6 @@ gst_alsa_mixer_set_option (GstAlsaMixer * mixer, ...@@ -562,8 +763,6 @@ gst_alsa_mixer_set_option (GstAlsaMixer * mixer,
g_return_if_fail (mixer->handle != NULL); g_return_if_fail (mixer->handle != NULL);
gst_alsa_mixer_update (mixer, NULL);
for (item = opts->values; item != NULL; item = item->next, n++) { for (item = opts->values; item != NULL; item = item->next, n++) {
if (!strcmp (item->data, value)) { if (!strcmp (item->data, value)) {
idx = n; idx = n;
...@@ -585,11 +784,60 @@ gst_alsa_mixer_get_option (GstAlsaMixer * mixer, GstMixerOptions * opts) ...@@ -585,11 +784,60 @@ gst_alsa_mixer_get_option (GstAlsaMixer * mixer, GstMixerOptions * opts)
g_return_val_if_fail (mixer->handle != NULL, NULL); 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); ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
if (ret == 0) if (ret == 0)
return g_list_nth_data (opts->values, idx); return g_list_nth_data (opts->values, idx);
else else
return snd_strerror (ret); /* feeble attempt at error handling */ 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));
}
...@@ -51,7 +51,9 @@ struct _GstAlsaMixer ...@@ -51,7 +51,9 @@ struct _GstAlsaMixer
GList * tracklist; /* list of available tracks */ GList * tracklist; /* list of available tracks */
snd_mixer_t * handle; snd_mixer_t * handle;
GSource * handle_source;
GstMixer * interface;
gchar * device; gchar * device;
gchar * cardname; gchar * cardname;
...@@ -61,6 +63,8 @@ struct _GstAlsaMixer ...@@ -61,6 +63,8 @@ struct _GstAlsaMixer
GstAlsaMixer* gst_alsa_mixer_new (const gchar *device, GstAlsaMixer* gst_alsa_mixer_new (const gchar *device,
GstAlsaMixerDirection dir); GstAlsaMixerDirection dir);
void _gst_alsa_mixer_set_interface (GstAlsaMixer * mixer,
GstMixer * interface);
void gst_alsa_mixer_free (GstAlsaMixer *mixer); void gst_alsa_mixer_free (GstAlsaMixer *mixer);
const GList* gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer); const GList* gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer);
...@@ -82,7 +86,6 @@ void gst_alsa_mixer_set_option (GstAlsaMixer * mixer, ...@@ -82,7 +86,6 @@ void gst_alsa_mixer_set_option (GstAlsaMixer * mixer,
const gchar* gst_alsa_mixer_get_option (GstAlsaMixer * mixer, const gchar* gst_alsa_mixer_get_option (GstAlsaMixer * mixer,
GstMixerOptions * opts); GstMixerOptions * opts);
#define GST_IMPLEMENT_ALSA_MIXER_METHODS(Type, interface_as_function) \ #define GST_IMPLEMENT_ALSA_MIXER_METHODS(Type, interface_as_function) \
static gboolean \ static gboolean \
interface_as_function ## _supported (Type *this, GType iface_type) \ interface_as_function ## _supported (Type *this, GType iface_type) \
......
...@@ -44,26 +44,26 @@ GST_ELEMENT_DETAILS ("Alsa mixer", ...@@ -44,26 +44,26 @@ GST_ELEMENT_DETAILS ("Alsa mixer",
static void gst_alsa_mixer_element_init_interfaces (GType type); static void gst_alsa_mixer_element_init_interfaces (GType type);
GST_BOILERPLATE_FULL (GstAlsaMixerElement, gst_alsa_mixer_element, 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 */ /* 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); 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); 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); * element, GstStateChange transition);
static gboolean static gboolean
gst_alsa_mixer_element_interface_supported (GstAlsaMixerElement * this, gst_alsa_mixer_element_interface_supported (GstAlsaMixerElement * self,
GType interface_type) GType interface_type)
{ {
if (interface_type == GST_TYPE_MIXER) { if (interface_type == GST_TYPE_MIXER) {
return gst_alsa_mixer_element_supported (this, interface_type); return gst_alsa_mixer_element_supported (self, interface_type);
} }
g_return_val_if_reached (FALSE); g_return_val_if_reached (FALSE);
...@@ -133,37 +133,37 @@ gst_alsa_mixer_element_class_init (GstAlsaMixerElementClass * klass) ...@@ -133,37 +133,37 @@ gst_alsa_mixer_element_class_init (GstAlsaMixerElementClass * klass)
static void static void
gst_alsa_mixer_element_finalize (GObject * obj) gst_alsa_mixer_element_finalize (GObject * obj)
{ {
GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (obj); GstAlsaMixerElement *self = GST_ALSA_MIXER_ELEMENT (obj);
g_free (this->device); g_free (self->device);
G_OBJECT_CLASS (parent_class)->finalize (obj); G_OBJECT_CLASS (parent_class)->finalize (obj);
} }
static void static void
gst_alsa_mixer_element_init (GstAlsaMixerElement * this, gst_alsa_mixer_element_init (GstAlsaMixerElement * self,
GstAlsaMixerElementClass * klass) GstAlsaMixerElementClass * klass)
{ {
this->mixer = NULL; self->mixer = NULL;
this->device = g_strdup (DEFAULT_PROP_DEVICE); self->device = g_strdup (DEFAULT_PROP_DEVICE);
} }
static void static void
gst_alsa_mixer_element_set_property (GObject * object, guint prop_id, gst_alsa_mixer_element_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstAlsaMixerElement *this