2003-12-06 00:02:20 +00:00
|
|
|
/* ALSA mixer implementation.
|
2003-11-16 21:56:30 +00:00
|
|
|
* Copyright (C) 2003 Leif Johnson <leif@ambient.2y.net>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2006-03-01 18:25:18 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-alsamixer
|
|
|
|
* @short_description: control properties of an audio device
|
|
|
|
* @see_also: alsasink, alsasrc
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <para>
|
|
|
|
* This element controls various aspects such as the volume and balance
|
|
|
|
* of an audio device using the ALSA api.
|
|
|
|
* </para>
|
|
|
|
* <para>
|
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.
2007-05-25 10:07:26 +00:00
|
|
|
* The application should query and use the interfaces provided by this
|
2006-03-01 18:25:18 +00:00
|
|
|
* element to control the device.
|
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
|
|
|
*
|
|
|
|
* Last reviewed on 2006-03-01 (0.10.4)
|
|
|
|
*/
|
2005-08-19 16:13:54 +00:00
|
|
|
|
2003-11-16 21:56:30 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "gstalsamixer.h"
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
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 int gst_alsa_mixer_handle_callback (snd_mixer_t * handle,
|
|
|
|
unsigned int mask, snd_mixer_elem_t * elem);
|
2005-08-19 16:13:54 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
/* First some utils, then the mixer implementation */
|
2004-03-15 06:34:44 +00:00
|
|
|
static gboolean
|
|
|
|
gst_alsa_mixer_open (GstAlsaMixer * mixer)
|
|
|
|
{
|
2006-08-13 14:34:48 +00:00
|
|
|
gint err;
|
|
|
|
snd_ctl_t *ctl;
|
|
|
|
snd_ctl_card_info_t *card_info;
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_val_if_fail (mixer->handle == NULL, FALSE);
|
2003-12-06 00:02:20 +00:00
|
|
|
|
|
|
|
/* open and initialize the mixer device */
|
2005-08-22 15:11:31 +00:00
|
|
|
err = snd_mixer_open (&mixer->handle, 0);
|
2006-08-13 14:34:48 +00:00
|
|
|
if (err < 0 || mixer->handle == NULL)
|
|
|
|
goto open_failed;
|
2004-05-09 00:30:06 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
if ((err = snd_mixer_attach (mixer->handle, mixer->device)) < 0) {
|
2006-08-13 14:34:48 +00:00
|
|
|
GST_WARNING ("Cannot open mixer for sound device '%s': %s", mixer->device,
|
|
|
|
snd_strerror (err));
|
2003-12-06 00:02:20 +00:00
|
|
|
goto error;
|
2003-11-16 21:56:30 +00:00
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
if ((err = snd_mixer_selem_register (mixer->handle, NULL, NULL)) < 0) {
|
2006-08-13 14:34:48 +00:00
|
|
|
GST_WARNING ("Cannot register mixer elements: %s", snd_strerror (err));
|
2003-12-06 00:02:20 +00:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
if ((err = snd_mixer_load (mixer->handle)) < 0) {
|
2006-08-13 14:34:48 +00:00
|
|
|
GST_WARNING ("Cannot load mixer settings: %s", snd_strerror (err));
|
2003-12-06 00:02:20 +00:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
snd_mixer_set_callback_private (mixer->handle, mixer);
|
|
|
|
snd_mixer_set_callback (mixer->handle, gst_alsa_mixer_handle_callback);
|
2004-03-15 06:34:44 +00:00
|
|
|
|
2006-08-13 14:34:48 +00:00
|
|
|
/* now get the device name, any of this is not fatal */
|
|
|
|
g_free (mixer->cardname);
|
|
|
|
if ((err = snd_ctl_open (&ctl, mixer->device, 0)) < 0) {
|
|
|
|
GST_WARNING ("Cannot open CTL: %s", snd_strerror (err));
|
|
|
|
goto no_card_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
snd_ctl_card_info_alloca (&card_info);
|
|
|
|
if ((err = snd_ctl_card_info (ctl, card_info)) < 0) {
|
|
|
|
GST_WARNING ("Cannot get card info: %s", snd_strerror (err));
|
|
|
|
snd_ctl_close (ctl);
|
|
|
|
goto no_card_name;
|
2004-03-15 06:34:44 +00:00
|
|
|
}
|
|
|
|
|
2006-08-13 14:34:48 +00:00
|
|
|
mixer->cardname = g_strdup (snd_ctl_card_info_get_name (card_info));
|
|
|
|
GST_DEBUG ("Card name = %s", GST_STR_NULL (mixer->cardname));
|
|
|
|
snd_ctl_close (ctl);
|
|
|
|
|
2006-08-14 10:50:15 +00:00
|
|
|
no_card_name:
|
|
|
|
if (mixer->cardname == NULL) {
|
2006-08-13 14:34:48 +00:00
|
|
|
mixer->cardname = g_strdup ("Unknown");
|
|
|
|
GST_DEBUG ("Cannot find card name");
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_INFO ("Successfully opened mixer for device '%s'.", mixer->device);
|
2004-05-09 00:30:06 +00:00
|
|
|
|
2004-03-15 06:34:44 +00:00
|
|
|
return TRUE;
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2006-08-13 14:34:48 +00:00
|
|
|
/* ERROR */
|
|
|
|
open_failed:
|
|
|
|
{
|
|
|
|
GST_WARNING ("Cannot open mixer: %s", snd_strerror (err));
|
|
|
|
mixer->handle = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
error:
|
2006-08-13 14:34:48 +00:00
|
|
|
{
|
|
|
|
snd_mixer_close (mixer->handle);
|
|
|
|
mixer->handle = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-11-16 21:56:30 +00:00
|
|
|
}
|
|
|
|
|
2006-09-17 20:14:43 +00:00
|
|
|
static snd_mixer_elem_t *
|
|
|
|
gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
|
|
|
|
{
|
|
|
|
snd_mixer_elem_t *element;
|
|
|
|
gint i, count;
|
|
|
|
|
|
|
|
count = snd_mixer_get_count (handle);
|
|
|
|
|
|
|
|
/* Check if we have a playback mixer labelled as 'Master' */
|
|
|
|
element = snd_mixer_first_elem (handle);
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
if (snd_mixer_selem_has_playback_volume (element) &&
|
|
|
|
strcmp (snd_mixer_selem_get_name (element), "Master") == 0) {
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
element = snd_mixer_elem_next (element);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If not, check if we have a playback mixer labelled as 'Front' */
|
|
|
|
element = snd_mixer_first_elem (handle);
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
if (snd_mixer_selem_has_playback_volume (element) &&
|
|
|
|
strcmp (snd_mixer_selem_get_name (element), "Front") == 0) {
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
element = snd_mixer_elem_next (element);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If not, check if we have a playback mixer with both volume and switch */
|
|
|
|
element = snd_mixer_first_elem (handle);
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
if (snd_mixer_selem_has_playback_volume (element) &&
|
|
|
|
snd_mixer_selem_has_playback_switch (element)) {
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
element = snd_mixer_elem_next (element);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If not, take any playback mixer with a volume control */
|
|
|
|
element = snd_mixer_first_elem (handle);
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
if (snd_mixer_selem_has_playback_volume (element)) {
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
element = snd_mixer_elem_next (element);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Looks like we're out of luck ... */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
static void
|
|
|
|
gst_alsa_mixer_update (GstAlsaMixer * mixer, snd_mixer_elem_t * elem)
|
|
|
|
{
|
|
|
|
GList *item;
|
|
|
|
|
|
|
|
g_return_if_fail (mixer != NULL);
|
|
|
|
|
|
|
|
g_static_rec_mutex_lock (mixer->rec_mutex);
|
|
|
|
|
|
|
|
for (item = mixer->tracklist; item != NULL; item = item->next) {
|
|
|
|
if (GST_IS_ALSA_MIXER_TRACK (item->data)) {
|
|
|
|
if (elem && (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 (elem && (GST_ALSA_MIXER_OPTIONS (item->data)->element != elem))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
gst_alsa_mixer_update_option (mixer, GST_ALSA_MIXER_OPTIONS (item->data));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_static_rec_mutex_unlock (mixer->rec_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
static 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);
|
|
|
|
|
|
|
|
GST_LOG ("ALSA elem cb");
|
|
|
|
|
|
|
|
g_return_val_if_fail (mixer != NULL, 1);
|
|
|
|
|
|
|
|
gst_alsa_mixer_update (mixer, elem);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
GST_LOG ("ALSA cb");
|
|
|
|
|
|
|
|
g_return_val_if_fail (mixer != NULL, 1);
|
|
|
|
|
|
|
|
/* Hopefully won't be call recursively and will handle pending elem events */
|
|
|
|
snd_mixer_handle_events (mixer->handle);
|
|
|
|
|
|
|
|
gst_alsa_mixer_update (mixer, elem);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-12-06 00:02:20 +00:00
|
|
|
static void
|
2005-08-22 15:11:31 +00:00
|
|
|
gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer)
|
2003-12-06 00:02:20 +00:00
|
|
|
{
|
|
|
|
gint i, count;
|
2006-09-17 20:14:43 +00:00
|
|
|
snd_mixer_elem_t *element, *master;
|
2007-07-21 09:21:12 +00:00
|
|
|
GList *item;
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_if_fail (mixer->handle != NULL);
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
if (mixer->tracklist)
|
|
|
|
return;
|
2004-05-07 04:56:56 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
g_static_rec_mutex_lock (mixer->rec_mutex);
|
|
|
|
|
2006-09-17 20:14:43 +00:00
|
|
|
master = gst_alsa_mixer_find_master_mixer (mixer, mixer->handle);
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
count = snd_mixer_get_count (mixer->handle);
|
|
|
|
element = snd_mixer_first_elem (mixer->handle);
|
2003-12-06 00:02:20 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
/* build track list
|
|
|
|
*
|
|
|
|
* Some ALSA tracks may have playback and capture capabilities.
|
|
|
|
* Here we model them as two separate GStreamer tracks.
|
|
|
|
*/
|
|
|
|
|
2003-12-06 00:02:20 +00:00
|
|
|
for (i = 0; i < count; i++) {
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
GstMixerTrack *play_track = NULL;
|
|
|
|
GstMixerTrack *cap_track = NULL;
|
|
|
|
const gchar *name;
|
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.
2007-05-25 10:07:26 +00:00
|
|
|
GList *item;
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
gint samename = 0;
|
|
|
|
|
|
|
|
name = snd_mixer_selem_get_name (element);
|
2004-10-25 13:51:41 +00:00
|
|
|
|
|
|
|
/* prevent dup names */
|
|
|
|
for (item = mixer->tracklist; item != NULL; item = item->next) {
|
2004-10-27 09:21:25 +00:00
|
|
|
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;
|
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if (strcmp (name, snd_mixer_selem_get_name (temp)) == 0)
|
2004-10-25 13:51:41 +00:00
|
|
|
samename++;
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
}
|
2003-12-06 00:02:20 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
GST_LOG ("[%s] probing element #%u, mixer->dir=%u", name, i, mixer->dir);
|
|
|
|
|
|
|
|
if (mixer->dir & GST_ALSA_MIXER_PLAYBACK) {
|
|
|
|
gboolean has_playback_switch, has_playback_volume;
|
|
|
|
|
|
|
|
has_playback_switch = snd_mixer_selem_has_playback_switch (element);
|
|
|
|
has_playback_volume = snd_mixer_selem_has_playback_volume (element);
|
|
|
|
|
2006-09-17 20:14:43 +00:00
|
|
|
GST_LOG ("[%s] PLAYBACK: has_playback_volume=%d, has_playback_switch=%d"
|
|
|
|
"%s", name, has_playback_volume, has_playback_switch,
|
|
|
|
(element == master) ? " MASTER" : "");
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
|
|
|
|
if (has_playback_volume) {
|
|
|
|
gint flags = GST_MIXER_TRACK_OUTPUT;
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2006-09-17 20:14:43 +00:00
|
|
|
if (element == master)
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
flags |= GST_MIXER_TRACK_MASTER;
|
2006-09-17 20:14:43 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
play_track = gst_alsa_mixer_track_new (element, samename, i,
|
|
|
|
flags, FALSE, NULL, FALSE);
|
|
|
|
|
|
|
|
} else if (has_playback_switch) {
|
|
|
|
/* simple mute switch */
|
|
|
|
play_track = gst_alsa_mixer_track_new (element, samename, i,
|
|
|
|
GST_MIXER_TRACK_OUTPUT, TRUE, NULL, FALSE);
|
2004-05-27 12:15:04 +00:00
|
|
|
}
|
2003-12-06 00:02:20 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if (snd_mixer_selem_is_enumerated (element)) {
|
|
|
|
GstMixerOptions *opts = gst_alsa_mixer_options_new (element, i);
|
|
|
|
|
|
|
|
GST_LOG ("[%s] is enumerated (%d)", name, i);
|
|
|
|
mixer->tracklist = g_list_append (mixer->tracklist, opts);
|
|
|
|
}
|
2004-08-31 14:12:49 +00:00
|
|
|
}
|
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if (mixer->dir & GST_ALSA_MIXER_CAPTURE) {
|
|
|
|
gboolean has_capture_switch, has_common_switch;
|
|
|
|
gboolean has_capture_volume, has_common_volume;
|
|
|
|
|
|
|
|
has_capture_switch = snd_mixer_selem_has_capture_switch (element);
|
|
|
|
has_common_switch = snd_mixer_selem_has_common_switch (element);
|
|
|
|
has_capture_volume = snd_mixer_selem_has_capture_volume (element);
|
|
|
|
has_common_volume = snd_mixer_selem_has_common_volume (element);
|
|
|
|
|
|
|
|
GST_LOG ("[%s] CAPTURE: has_capture_volume=%d, has_common_volume=%d, "
|
|
|
|
"has_capture_switch=%d, has_common_switch=%d, play_track=%p", name,
|
|
|
|
has_capture_volume, has_common_volume, has_capture_switch,
|
|
|
|
has_common_switch, play_track);
|
|
|
|
|
|
|
|
if (has_capture_volume && !(play_track && has_common_volume)) {
|
|
|
|
cap_track = gst_alsa_mixer_track_new (element, samename, i,
|
|
|
|
GST_MIXER_TRACK_INPUT, FALSE, NULL, play_track != NULL);
|
|
|
|
} else if (has_capture_switch && !(play_track && has_common_switch)) {
|
|
|
|
cap_track = gst_alsa_mixer_track_new (element, samename, i,
|
|
|
|
GST_MIXER_TRACK_INPUT, TRUE, NULL, play_track != NULL);
|
2004-08-31 14:12:49 +00:00
|
|
|
}
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
}
|
|
|
|
|
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.
2007-05-25 10:07:26 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if (play_track && cap_track) {
|
|
|
|
GST_ALSA_MIXER_TRACK (play_track)->shared_mute =
|
|
|
|
GST_ALSA_MIXER_TRACK (cap_track);
|
|
|
|
GST_ALSA_MIXER_TRACK (cap_track)->shared_mute =
|
|
|
|
GST_ALSA_MIXER_TRACK (play_track);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (play_track)
|
|
|
|
mixer->tracklist = g_list_append (mixer->tracklist, play_track);
|
|
|
|
|
|
|
|
if (cap_track)
|
|
|
|
mixer->tracklist = g_list_append (mixer->tracklist, cap_track);
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
element = snd_mixer_elem_next (element);
|
2003-12-06 00:02:20 +00:00
|
|
|
}
|
2007-07-21 09:21:12 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_static_rec_mutex_unlock (mixer->rec_mutex);
|
2003-12-06 00:02:20 +00:00
|
|
|
}
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
static void
|
|
|
|
task_monitor_alsa (gpointer data)
|
|
|
|
{
|
|
|
|
struct pollfd *pfds;
|
|
|
|
unsigned int nfds, rnfds;
|
|
|
|
unsigned short revents;
|
|
|
|
GstAlsaMixer *mixer = (GstAlsaMixer *) data;
|
|
|
|
|
|
|
|
g_static_rec_mutex_lock (mixer->rec_mutex);
|
|
|
|
|
|
|
|
nfds = snd_mixer_poll_descriptors_count (mixer->handle);
|
|
|
|
if (nfds <= 0) {
|
|
|
|
GST_ERROR ("snd_mixer_poll_descriptors_count <= 0: %d", nfds);
|
|
|
|
/* FIXME: sleep ? stop monitoring ? */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pfds = g_newa (struct pollfd, nfds + 1);
|
|
|
|
rnfds = snd_mixer_poll_descriptors (mixer->handle, pfds, nfds);
|
|
|
|
g_assert (rnfds <= nfds);
|
|
|
|
|
|
|
|
pfds[rnfds].fd = mixer->pfd[0];
|
|
|
|
pfds[rnfds].events = POLLIN | POLLPRI | POLLHUP | POLLERR;
|
|
|
|
pfds[rnfds].revents = 0;
|
|
|
|
|
|
|
|
g_static_rec_mutex_unlock (mixer->rec_mutex);
|
|
|
|
|
|
|
|
GST_LOG ("task loop");
|
|
|
|
poll (pfds, rnfds + 1, -1);
|
|
|
|
|
|
|
|
g_static_rec_mutex_lock (mixer->rec_mutex);
|
|
|
|
|
|
|
|
snd_mixer_poll_descriptors_revents (mixer->handle, pfds, nfds, &revents);
|
|
|
|
if (revents & POLLIN || revents & POLLPRI) {
|
|
|
|
GST_DEBUG ("Handling events");
|
|
|
|
snd_mixer_handle_events (mixer->handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_static_rec_mutex_unlock (mixer->rec_mutex);
|
|
|
|
}
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
/* API */
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
GstAlsaMixer *
|
|
|
|
gst_alsa_mixer_new (const char *device, GstAlsaMixerDirection dir)
|
2003-12-06 00:02:20 +00:00
|
|
|
{
|
2005-08-22 15:11:31 +00:00
|
|
|
GstAlsaMixer *ret = NULL;
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_val_if_fail (device != NULL, NULL);
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
ret = g_new0 (GstAlsaMixer, 1);
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
if (pipe (ret->pfd) == -1)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
ret->rec_mutex = g_new (GStaticRecMutex, 1);
|
|
|
|
g_static_rec_mutex_init (ret->rec_mutex);
|
|
|
|
|
|
|
|
ret->task_mutex = g_new (GStaticRecMutex, 1);
|
|
|
|
g_static_rec_mutex_init (ret->task_mutex);
|
|
|
|
|
|
|
|
ret->task = gst_task_create (task_monitor_alsa, ret);
|
|
|
|
gst_task_set_lock (ret->task, ret->task_mutex);
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
ret->device = g_strdup (device);
|
|
|
|
ret->dir = dir;
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
if (!gst_alsa_mixer_open (ret))
|
|
|
|
goto error;
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
if (gst_task_start (ret->task) == FALSE) {
|
|
|
|
GST_WARNING ("Could not start alsamixer task");
|
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
return ret;
|
2003-12-06 00:02:20 +00:00
|
|
|
|
2006-08-13 14:34:48 +00:00
|
|
|
/* ERRORS */
|
2005-08-22 15:11:31 +00:00
|
|
|
error:
|
2006-08-13 14:34:48 +00:00
|
|
|
{
|
2005-08-22 15:11:31 +00:00
|
|
|
gst_alsa_mixer_free (ret);
|
2006-08-13 14:34:48 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2005-08-19 16:13:54 +00:00
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
void
|
|
|
|
gst_alsa_mixer_free (GstAlsaMixer * mixer)
|
2005-08-19 16:13:54 +00:00
|
|
|
{
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_if_fail (mixer != NULL);
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
if (mixer->task) {
|
|
|
|
if (write (mixer->pfd[1], "stop", 5) <= 0) {
|
|
|
|
GST_ERROR ("Cannot send " "stop" " to alsamixer task");
|
|
|
|
close (mixer->pfd[1]);
|
|
|
|
mixer->pfd[1] = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gst_task_join (mixer->task) == FALSE) {
|
|
|
|
GST_ERROR ("Cannot join alsamixer task");
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (mixer->task);
|
|
|
|
mixer->task = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_static_rec_mutex_free (mixer->task_mutex);
|
|
|
|
g_free (mixer->task_mutex);
|
|
|
|
mixer->task_mutex = NULL;
|
|
|
|
|
|
|
|
if (mixer->pfd[0] > 0) {
|
|
|
|
close (mixer->pfd[0]);
|
|
|
|
mixer->pfd[0] = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mixer->pfd[1] > 0) {
|
|
|
|
close (mixer->pfd[1]);
|
|
|
|
mixer->pfd[1] = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mixer->interface) {
|
|
|
|
g_object_unref (G_OBJECT (mixer->interface));
|
|
|
|
mixer->interface = NULL;
|
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
if (mixer->device) {
|
|
|
|
g_free (mixer->device);
|
|
|
|
mixer->device = NULL;
|
|
|
|
}
|
2005-08-19 16:13:54 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
if (mixer->cardname) {
|
|
|
|
g_free (mixer->cardname);
|
|
|
|
mixer->cardname = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mixer->tracklist) {
|
|
|
|
g_list_foreach (mixer->tracklist, (GFunc) g_object_unref, NULL);
|
|
|
|
g_list_free (mixer->tracklist);
|
|
|
|
mixer->tracklist = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mixer->handle) {
|
|
|
|
snd_mixer_close (mixer->handle);
|
|
|
|
mixer->handle = NULL;
|
|
|
|
}
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
g_static_rec_mutex_free (mixer->rec_mutex);
|
|
|
|
g_free (mixer->rec_mutex);
|
|
|
|
mixer->rec_mutex = NULL;
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
g_free (mixer);
|
2005-08-19 16:13:54 +00:00
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
const GList *
|
|
|
|
gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer)
|
2003-11-16 21:56:30 +00:00
|
|
|
{
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_val_if_fail (mixer->handle != NULL, NULL);
|
2003-11-16 21:56:30 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
gst_alsa_mixer_ensure_track_list (mixer);
|
2003-11-16 21:56:30 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
return (const GList *) mixer->tracklist;
|
2003-11-16 21:56:30 +00:00
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
void
|
|
|
|
gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
|
|
|
|
gint * volumes)
|
2003-11-16 21:56:30 +00:00
|
|
|
{
|
|
|
|
gint i;
|
2005-08-22 15:11:31 +00:00
|
|
|
GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
|
2003-11-16 21:56:30 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_if_fail (mixer->handle != NULL);
|
2003-11-16 21:56:30 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
gst_alsa_mixer_track_update (alsa_track);
|
ext/alsa/gstalsamixer.c: Update mixer (to sync with other sessions) if we try to obtain a new value. This makes alsam...
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (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):
Update mixer (to sync with other sessions) if we try to obtain
a new value. This makes alsamixer work accross applications.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_get_time):
Only call sync functions if we're running, else alsalib asserts.
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_src_query):
Sometimes fails to compile. Possibly a gcc bug.
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
Add a reference to an application-provided object, because we lose
this same reference if we add it to the bin. If we don't do this,
we can only use this object once and thus crash if we go from
ready to playing, back to ready and back to playing again.
Also add an audioscale element because several cheap soundcards -
like mine - don't support all samplerates.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_xcontext_clear), (gst_ximagesink_change_state):
Fix wrong order or PAR calls. Makes automatically obtained PAR
from the X server atually being used.
2004-09-13 09:24:00 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if (track->flags & GST_MIXER_TRACK_OUTPUT) { /* return playback volume */
|
|
|
|
|
|
|
|
/* Is emulated mute flag activated? */
|
|
|
|
if (track->flags & GST_MIXER_TRACK_MUTE &&
|
|
|
|
!(alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_PSWITCH)) {
|
|
|
|
for (i = 0; i < track->num_channels; i++)
|
|
|
|
volumes[i] = alsa_track->volumes[i];
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < track->num_channels; i++) {
|
|
|
|
long tmp = 0;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-03-15 19:32:28 +00:00
|
|
|
snd_mixer_selem_get_playback_volume (alsa_track->element, i, &tmp);
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
alsa_track->volumes[i] = volumes[i] = (gint) tmp;
|
2003-11-16 21:56:30 +00:00
|
|
|
}
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} else if (track->flags & GST_MIXER_TRACK_INPUT) { /* return capture volume */
|
|
|
|
|
|
|
|
/* Is emulated record flag activated? */
|
|
|
|
if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH ||
|
|
|
|
track->flags & GST_MIXER_TRACK_RECORD) {
|
|
|
|
for (i = 0; i < track->num_channels; i++) {
|
|
|
|
long tmp = 0;
|
2006-02-21 12:05:18 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
snd_mixer_selem_get_capture_volume (alsa_track->element, i, &tmp);
|
|
|
|
alsa_track->volumes[i] = volumes[i] = (gint) tmp;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < track->num_channels; i++)
|
|
|
|
volumes[i] = alsa_track->volumes[i];
|
2003-11-16 21:56:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
void
|
|
|
|
gst_alsa_mixer_set_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
|
|
|
|
gint * volumes)
|
2003-11-16 21:56:30 +00:00
|
|
|
{
|
2005-08-22 15:11:31 +00:00
|
|
|
GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
gint i;
|
2003-11-16 21:56:30 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_if_fail (mixer->handle != NULL);
|
2003-11-16 21:56:30 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
gst_alsa_mixer_track_update (alsa_track);
|
ext/alsa/gstalsamixer.c: Update mixer (to sync with other sessions) if we try to obtain a new value. This makes alsam...
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (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):
Update mixer (to sync with other sessions) if we try to obtain
a new value. This makes alsamixer work accross applications.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_get_time):
Only call sync functions if we're running, else alsalib asserts.
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_src_query):
Sometimes fails to compile. Possibly a gcc bug.
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
Add a reference to an application-provided object, because we lose
this same reference if we add it to the bin. If we don't do this,
we can only use this object once and thus crash if we go from
ready to playing, back to ready and back to playing again.
Also add an audioscale element because several cheap soundcards -
like mine - don't support all samplerates.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_xcontext_clear), (gst_ximagesink_change_state):
Fix wrong order or PAR calls. Makes automatically obtained PAR
from the X server atually being used.
2004-09-13 09:24:00 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if (track->flags & GST_MIXER_TRACK_OUTPUT) {
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
/* Is emulated mute flag activated? */
|
|
|
|
if (track->flags & GST_MIXER_TRACK_MUTE &&
|
|
|
|
!(alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_PSWITCH)) {
|
|
|
|
for (i = 0; i < track->num_channels; i++)
|
|
|
|
alsa_track->volumes[i] = volumes[i];
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < track->num_channels; i++) {
|
|
|
|
alsa_track->volumes[i] = volumes[i];
|
2004-03-15 19:32:28 +00:00
|
|
|
snd_mixer_selem_set_playback_volume (alsa_track->element, i,
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
volumes[i]);
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
}
|
2003-11-16 21:56:30 +00:00
|
|
|
}
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
|
|
|
|
} else if (track->flags & GST_MIXER_TRACK_INPUT) {
|
|
|
|
|
|
|
|
/* Is emulated record flag activated? */
|
|
|
|
if (track->flags & GST_MIXER_TRACK_RECORD ||
|
|
|
|
alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH) {
|
|
|
|
for (i = 0; i < track->num_channels; i++) {
|
|
|
|
alsa_track->volumes[i] = volumes[i];
|
|
|
|
snd_mixer_selem_set_capture_volume (alsa_track->element, i, volumes[i]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < track->num_channels; i++)
|
|
|
|
alsa_track->volumes[i] = volumes[i];
|
|
|
|
}
|
2003-11-16 21:56:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
void
|
|
|
|
gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track,
|
|
|
|
gboolean mute)
|
2003-11-16 21:56:30 +00:00
|
|
|
{
|
2005-08-22 15:11:31 +00:00
|
|
|
GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
|
2003-11-16 21:56:30 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_if_fail (mixer->handle != NULL);
|
2003-11-16 21:56:30 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
gst_alsa_mixer_track_update (alsa_track);
|
ext/alsa/gstalsamixer.c: Update mixer (to sync with other sessions) if we try to obtain a new value. This makes alsam...
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (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):
Update mixer (to sync with other sessions) if we try to obtain
a new value. This makes alsamixer work accross applications.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_get_time):
Only call sync functions if we're running, else alsalib asserts.
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_src_query):
Sometimes fails to compile. Possibly a gcc bug.
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
Add a reference to an application-provided object, because we lose
this same reference if we add it to the bin. If we don't do this,
we can only use this object once and thus crash if we go from
ready to playing, back to ready and back to playing again.
Also add an audioscale element because several cheap soundcards -
like mine - don't support all samplerates.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_xcontext_clear), (gst_ximagesink_change_state):
Fix wrong order or PAR calls. Makes automatically obtained PAR
from the X server atually being used.
2004-09-13 09:24:00 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if (!!(mute) == !!(track->flags & GST_MIXER_TRACK_MUTE))
|
|
|
|
return;
|
|
|
|
|
2003-11-16 21:56:30 +00:00
|
|
|
if (mute) {
|
|
|
|
track->flags |= GST_MIXER_TRACK_MUTE;
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
|
|
|
|
if (alsa_track->shared_mute)
|
|
|
|
((GstMixerTrack *) (alsa_track->shared_mute))->flags |=
|
|
|
|
GST_MIXER_TRACK_MUTE;
|
2003-11-16 21:56:30 +00:00
|
|
|
} else {
|
|
|
|
track->flags &= ~GST_MIXER_TRACK_MUTE;
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
|
|
|
|
if (alsa_track->shared_mute)
|
|
|
|
((GstMixerTrack *) (alsa_track->shared_mute))->flags &=
|
|
|
|
~GST_MIXER_TRACK_MUTE;
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
}
|
2003-11-16 21:56:30 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_PSWITCH) {
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
snd_mixer_selem_set_playback_switch_all (alsa_track->element, mute ? 0 : 1);
|
|
|
|
} else {
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
gint i;
|
|
|
|
GstAlsaMixerTrack *ctrl_track;
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if ((track->flags & GST_MIXER_TRACK_INPUT)
|
|
|
|
&& alsa_track->shared_mute != NULL)
|
|
|
|
ctrl_track = alsa_track->shared_mute;
|
|
|
|
else
|
|
|
|
ctrl_track = alsa_track;
|
|
|
|
|
|
|
|
for (i = 0; i < ((GstMixerTrack *) ctrl_track)->num_channels; i++) {
|
|
|
|
long vol =
|
|
|
|
mute ? ((GstMixerTrack *) ctrl_track)->min_volume : ctrl_track->
|
|
|
|
volumes[i];
|
|
|
|
snd_mixer_selem_set_playback_volume (ctrl_track->element, i, vol);
|
2003-11-16 21:56:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
void
|
|
|
|
gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
|
2004-03-14 22:34:34 +00:00
|
|
|
GstMixerTrack * track, gboolean record)
|
2003-11-16 21:56:30 +00:00
|
|
|
{
|
2005-08-22 15:11:31 +00:00
|
|
|
GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
|
2003-11-16 21:56:30 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_if_fail (mixer->handle != NULL);
|
2003-11-16 21:56:30 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
gst_alsa_mixer_track_update (alsa_track);
|
ext/alsa/gstalsamixer.c: Update mixer (to sync with other sessions) if we try to obtain a new value. This makes alsam...
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (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):
Update mixer (to sync with other sessions) if we try to obtain
a new value. This makes alsamixer work accross applications.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_get_time):
Only call sync functions if we're running, else alsalib asserts.
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_src_query):
Sometimes fails to compile. Possibly a gcc bug.
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
Add a reference to an application-provided object, because we lose
this same reference if we add it to the bin. If we don't do this,
we can only use this object once and thus crash if we go from
ready to playing, back to ready and back to playing again.
Also add an audioscale element because several cheap soundcards -
like mine - don't support all samplerates.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_xcontext_clear), (gst_ximagesink_change_state):
Fix wrong order or PAR calls. Makes automatically obtained PAR
from the X server atually being used.
2004-09-13 09:24:00 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if (!!(record) == !!(track->flags & GST_MIXER_TRACK_RECORD))
|
|
|
|
return;
|
|
|
|
|
2003-11-16 21:56:30 +00:00
|
|
|
if (record) {
|
|
|
|
track->flags |= GST_MIXER_TRACK_RECORD;
|
|
|
|
} else {
|
|
|
|
track->flags &= ~GST_MIXER_TRACK_RECORD;
|
|
|
|
}
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH) {
|
|
|
|
snd_mixer_selem_set_capture_switch_all (alsa_track->element,
|
|
|
|
record ? 1 : 0);
|
|
|
|
|
|
|
|
/* update all tracks in same exlusive cswitch group */
|
|
|
|
if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH_EXCL) {
|
|
|
|
GList *item;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (item_alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH_EXCL &&
|
|
|
|
item_alsa_track->capture_group == alsa_track->capture_group) {
|
2007-07-21 09:21:12 +00:00
|
|
|
gst_alsa_mixer_track_update (item_alsa_track);
|
ext/alsa/: Improve and fix mixer track handling, in particular better handling of alsa's pvolume/pswitch/cvolume/cswi...
Original commit message from CVS:
Patch by: Viktor Peters <viktor dot peters at gmail dot com>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_update), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record):
* ext/alsa/gstalsamixertrack.c:
(gst_alsa_mixer_track_update_alsa_capabilities),
(alsa_track_has_cap), (gst_alsa_mixer_track_new),
(gst_alsa_mixer_track_update):
* ext/alsa/gstalsamixertrack.h:
Improve and fix mixer track handling, in particular better handling
of alsa's pvolume/pswitch/cvolume/cswitch capabilities; create separate
track objects for tracks that have both capture and playback volume
(and label them differently as well so they're not mistakenly
assumed to be duplicates); classify mixer tracks that only affect
the audible volume of something (rather than the capture volume)
as playback tracks. Redefine/fix meaning of RECORD and MUTE flags
for capture tracks to correspond to alsa-pswitch alsa-cswitch
(following the meaning documented in the mixer interface header
file); add support for alsa's exclusive cswitch groups; update/sync
state/flags better if mixer settings are changed by another
application. Fixes #336075.
2006-08-29 11:50:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < track->num_channels; i++) {
|
|
|
|
long vol = record ? alsa_track->volumes[i] : track->min_volume;
|
|
|
|
|
|
|
|
snd_mixer_selem_set_capture_volume (alsa_track->element, i, vol);
|
|
|
|
}
|
|
|
|
}
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
void
|
|
|
|
gst_alsa_mixer_set_option (GstAlsaMixer * mixer,
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
GstMixerOptions * opts, gchar * value)
|
|
|
|
{
|
|
|
|
gint idx = -1, n = 0;
|
|
|
|
GList *item;
|
2005-08-22 15:11:31 +00:00
|
|
|
GstAlsaMixerOptions *alsa_opts = GST_ALSA_MIXER_OPTIONS (opts);
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_if_fail (mixer->handle != NULL);
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
|
|
|
|
for (item = opts->values; item != NULL; item = item->next, n++) {
|
|
|
|
if (!strcmp (item->data, value)) {
|
|
|
|
idx = n;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (idx == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
snd_mixer_selem_set_enum_item (alsa_opts->element, 0, idx);
|
|
|
|
}
|
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
const gchar *
|
|
|
|
gst_alsa_mixer_get_option (GstAlsaMixer * mixer, GstMixerOptions * opts)
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
{
|
2005-08-19 16:13:54 +00:00
|
|
|
gint ret;
|
|
|
|
guint idx;
|
2005-08-22 15:11:31 +00:00
|
|
|
GstAlsaMixerOptions *alsa_opts = GST_ALSA_MIXER_OPTIONS (opts);
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
|
2005-08-22 15:11:31 +00:00
|
|
|
g_return_val_if_fail (mixer->handle != NULL, NULL);
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (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/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
|
2005-08-19 16:13:54 +00:00
|
|
|
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 */
|
2003-11-16 21:56:30 +00:00
|
|
|
}
|
2007-07-21 09:21:12 +00:00
|
|
|
|
|
|
|
GstMixerFlags
|
|
|
|
gst_alsa_mixer_get_mixer_flags (GstAlsaMixer * mixer)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (mixer != NULL, GST_MIXER_FLAG_NONE);
|
|
|
|
|
|
|
|
return GST_MIXER_FLAG_AUTO_NOTIFICATIONS;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
gboolean old_mute;
|
|
|
|
gboolean old_record;
|
|
|
|
gint i, n_channels;
|
|
|
|
gint *old_volumes;
|
|
|
|
|
|
|
|
GST_DEBUG ("Updating track %" GST_PTR_FORMAT, alsa_track);
|
|
|
|
|
|
|
|
if (mixer->interface == NULL) {
|
|
|
|
GST_WARNING ("Cannot send update notifications, no GstMixer * given");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
old_mute = !!(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE));
|
|
|
|
old_record = !!(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD));
|
|
|
|
old_volumes = g_new (gint, track->num_channels);
|
|
|
|
n_channels = track->num_channels;
|
|
|
|
memcpy (old_volumes, alsa_track->volumes,
|
|
|
|
sizeof (gint) * track->num_channels);
|
|
|
|
|
|
|
|
gst_alsa_mixer_track_update (alsa_track);
|
|
|
|
|
|
|
|
if (old_record !=
|
|
|
|
!!(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD))) {
|
|
|
|
gst_mixer_record_toggled (mixer->interface, track,
|
|
|
|
!!GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD));
|
|
|
|
}
|
|
|
|
if (old_mute != !!(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE))) {
|
|
|
|
gst_mixer_mute_toggled (mixer->interface, track,
|
|
|
|
!!GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE));
|
|
|
|
}
|
|
|
|
|
|
|
|
n_channels = MIN (n_channels, track->num_channels);
|
|
|
|
for (i = 0; i < n_channels; i++) {
|
|
|
|
if (old_volumes[i] != alsa_track->volumes[i]) {
|
|
|
|
gst_mixer_volume_changed (mixer->interface, track, alsa_track->volumes);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_free (old_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));
|
|
|
|
}
|