gstreamer/ext/alsa/gstalsamixertrack.c

339 lines
9.8 KiB
C
Raw Normal View History

/* ALSA mixer track implementation.
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst-i18n-plugin.h>
#include "gstalsamixertrack.h"
static void gst_alsa_mixer_track_init (GstAlsaMixerTrack * alsa_track);
static void gst_alsa_mixer_track_class_init (gpointer g_class,
gpointer class_data);
static GstMixerTrackClass *parent_class = NULL;
GType
gst_alsa_mixer_track_get_type (void)
{
static GType track_type = 0;
if (!track_type) {
static const GTypeInfo track_info = {
sizeof (GstAlsaMixerTrackClass),
NULL,
NULL,
gst_alsa_mixer_track_class_init,
NULL,
NULL,
sizeof (GstAlsaMixerTrack),
0,
(GInstanceInitFunc) gst_alsa_mixer_track_init,
};
track_type =
g_type_register_static (GST_TYPE_MIXER_TRACK, "GstAlsaMixerTrack",
&track_info, 0);
}
return track_type;
}
static void
gst_alsa_mixer_track_class_init (gpointer g_class, gpointer class_data)
{
Fix #337365 (g_type_class_ref <-> g_type_class_peek_parent) Original commit message from CVS: * ext/alsa/gstalsamixeroptions.c: (gst_alsa_mixer_options_class_init): * ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_class_init): * ext/ogg/gstoggdemux.c: (gst_ogg_pad_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/ogg/gstoggparse.c: (gst_ogg_parse_class_init): * gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_class_init): * gst-libs/gst/audio/gstaudiofilter.c: (gst_audio_filter_class_init): * gst-libs/gst/audio/gstaudiosink.c: (gst_audioringbuffer_class_init): * gst-libs/gst/audio/gstaudiosrc.c: (gst_audioringbuffer_class_init): * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_class_init): * gst-libs/gst/interfaces/colorbalancechannel.c: (gst_color_balance_channel_class_init): * gst-libs/gst/interfaces/mixeroptions.c: (gst_mixer_options_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/interfaces/tunerchannel.c: (gst_tuner_channel_class_init): * gst-libs/gst/interfaces/tunernorm.c: (gst_tuner_norm_class_init): * gst-libs/gst/netbuffer/gstnetbuffer.c: (gst_netbuffer_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/playback/gstdecodebin.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_stream_selector_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * sys/v4l/gstv4lcolorbalance.c: (gst_v4l_color_balance_channel_class_init): * sys/v4l/gstv4ljpegsrc.c: (gst_v4ljpegsrc_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4ltuner.c: (gst_v4l_tuner_channel_class_init), (gst_v4l_tuner_norm_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): * tests/old/testsuite/alsa/sinesrc.c: (sinesrc_class_init): Fix #337365 (g_type_class_ref <-> g_type_class_peek_parent)
2006-04-08 21:02:53 +00:00
parent_class = g_type_class_peek_parent (g_class);
}
static void
gst_alsa_mixer_track_init (GstAlsaMixerTrack * alsa_track)
{
}
static void
gst_alsa_mixer_track_update_alsa_capabilities (GstAlsaMixerTrack * alsa_track)
{
alsa_track->alsa_flags = 0;
alsa_track->capture_group = -1;
if (snd_mixer_selem_has_common_volume (alsa_track->element))
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_VOLUME;
if (snd_mixer_selem_has_playback_volume (alsa_track->element))
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_PVOLUME;
if (snd_mixer_selem_has_capture_volume (alsa_track->element))
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_CVOLUME;
if (snd_mixer_selem_has_common_switch (alsa_track->element))
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_SWITCH;
if (snd_mixer_selem_has_playback_switch (alsa_track->element))
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_PSWITCH;
if (snd_mixer_selem_has_capture_switch (alsa_track->element)) {
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_CSWITCH;
if (snd_mixer_selem_has_capture_switch_exclusive (alsa_track->element)) {
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_CSWITCH_EXCL;
alsa_track->capture_group =
snd_mixer_selem_get_capture_group (alsa_track->element);
}
}
GST_LOG ("[%s] alsa_flags=0x%08x, capture_group=%d",
snd_mixer_selem_get_name (alsa_track->element),
alsa_track->alsa_flags, alsa_track->capture_group);
}
inline static gboolean
alsa_track_has_cap (GstAlsaMixerTrack * alsa_track, guint32 flag)
{
return ((alsa_track->alsa_flags & flag) != 0);
}
GstMixerTrack *
gst_alsa_mixer_track_new (snd_mixer_elem_t * element,
gint num, gint track_num, gint flags, gboolean sw,
GstAlsaMixerTrack * shared_mute_track, gboolean append_capture)
{
GstAlsaMixerTrack *alsa_track;
GstMixerTrack *track;
const gchar *name;
const gchar *label;
gint 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
long min = 0, max = 0;
const struct
{
const gchar orig[12];
const gchar trans[12];
} alsa_track_labels[] = {
{
"Master", N_("Master")}, {
"Bass", N_("Bass")}, {
"Treble", N_("Treble")}, {
"PCM", N_("PCM")}, {
"Synth", N_("Synth")}, {
"Line", N_("Line-in")}, {
"CD", N_("CD")}, {
"Mic", N_("Microphone")}, {
"PC Speaker", N_("PC Speaker")}, {
"Playback", N_("Playback")}, {
"Capture", N_("Capture")}
};
name = snd_mixer_selem_get_name (element);
GST_LOG ("[%s] num=%d,track_num=%d,flags=0x%08x,sw=%s,shared_mute_track=%p",
name, num, track_num, flags, (sw) ? "true" : "false", shared_mute_track);
track = (GstMixerTrack *) g_object_new (GST_ALSA_MIXER_TRACK_TYPE,
"untranslated-label", name, NULL);
alsa_track = (GstAlsaMixerTrack *) track;
GST_LOG ("[%s] created new mixer track %p", name, track);
/* This reflects the assumptions used for GstAlsaMixerTrack */
if (!(!!(flags & GST_MIXER_TRACK_OUTPUT) ^ !!(flags & GST_MIXER_TRACK_INPUT))) {
GST_ERROR ("Mixer track must be either output or input!");
g_return_val_if_reached (NULL);
}
track->flags = flags;
alsa_track->element = element;
alsa_track->shared_mute = shared_mute_track;
alsa_track->track_num = track_num;
alsa_track->alsa_channels = 0;
gst_alsa_mixer_track_update_alsa_capabilities (alsa_track);
if (flags & GST_MIXER_TRACK_OUTPUT) {
while (alsa_track->alsa_channels < GST_ALSA_MAX_CHANNELS &&
snd_mixer_selem_has_playback_channel (element,
alsa_track->alsa_channels)) {
alsa_track->alsa_channels++;
}
GST_LOG ("[%s] %d output channels", name, alsa_track->alsa_channels);
} else if (flags & GST_MIXER_TRACK_INPUT) {
while (alsa_track->alsa_channels < GST_ALSA_MAX_CHANNELS &&
snd_mixer_selem_has_capture_channel (element,
alsa_track->alsa_channels)) {
alsa_track->alsa_channels++;
}
GST_LOG ("[%s] %d input channels", name, alsa_track->alsa_channels);
} else {
g_assert_not_reached ();
}
if (sw)
track->num_channels = 0;
else
track->num_channels = alsa_track->alsa_channels;
/* translate the name if we can */
label = name;
for (i = 0; i < G_N_ELEMENTS (alsa_track_labels); ++i) {
if (g_utf8_collate (label, alsa_track_labels[i].orig) == 0) {
label = _(alsa_track_labels[i].trans);
break;
}
}
if (num == 0) {
track->label = g_strdup_printf ("%s%s%s", label,
append_capture ? " " : "", append_capture ? _("Capture") : "");
} else {
track->label = g_strdup_printf ("%s%s%s %d", label,
append_capture ? " " : "", append_capture ? _("Capture") : "", num);
}
/* set volume information */
if (track->num_channels > 0) {
if ((flags & GST_MIXER_TRACK_OUTPUT))
snd_mixer_selem_get_playback_volume_range (element, &min, &max);
else
snd_mixer_selem_get_capture_volume_range (element, &min, &max);
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
}
track->min_volume = (gint) min;
track->max_volume = (gint) max;
for (i = 0; i < track->num_channels; 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
long tmp = 0;
if (flags & GST_MIXER_TRACK_OUTPUT)
snd_mixer_selem_get_playback_volume (element, i, &tmp);
else
snd_mixer_selem_get_capture_volume (element, i, &tmp);
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
alsa_track->volumes[i] = (gint) tmp;
}
gst_alsa_mixer_track_update (alsa_track);
return track;
}
void
gst_alsa_mixer_track_update (GstAlsaMixerTrack * alsa_track)
{
GstMixerTrack *track = (GstMixerTrack *) alsa_track;
gint i;
gint audible = !(track->flags & GST_MIXER_TRACK_MUTE);
ext/alsa/gstalsamixer.c (main_context, GstAlsaMixerWatch, _GstAlsaMixerWatch, source, n_poll_fds, poll_fds, gst_alsa_... Original commit message from CVS: patch by: Marc-Andre Lureau <marcandre.lureau@gmail.com> * ext/alsa/gstalsamixer.c (main_context, GstAlsaMixerWatch, _GstAlsaMixerWatch, source, n_poll_fds, poll_fds, gst_alsa_mixer_watch_funcs, gst_alsa_mixer_prepare, gst_alsa_mixer_check, gst_alsa_mixer_dispatch, gst_alsa_mixer_finalize, gst_alsa_mixer_find_master_mixer, gst_alsa_mixer_handle_source_callback, gst_alsa_mixer_handle_callback, gst_alsa_mixer_elem_handle_callback, gst_alsa_mixer_ensure_track_list, gst_alsa_mixer_free, gst_alsa_mixer_get_volume, gst_alsa_mixer_set_volume, gst_alsa_mixer_set_mute, gst_alsa_mixer_set_record, gst_alsa_mixer_get_option, gst_alsa_mixer_update_option, gst_alsa_mixer_update_track, _gst_alsa_mixer_set_interface): * ext/alsa/gstalsamixer.h (handle_source, interface, dir): * ext/alsa/gstalsamixerelement.c (gst_alsa_mixer_element_details, gst_alsa_mixer_element_interface_supported, gst_alsa_mixer_element_finalize, gst_alsa_mixer_element_init, gst_alsa_mixer_element_set_property, gst_alsa_mixer_element_get_property, gst_alsa_mixer_element_change_state): * ext/alsa/gstalsamixertrack.c (gst_alsa_mixer_track_update): * gst-libs/gst/interfaces/mixer.c (gst_mixer_volume_changed, gst_mixer_option_changed): * gst-libs/gst/interfaces/mixer.h (set_option, get_option, volume_changed, option_changed, _gst_reserved): Implement notification for alsamixer. Fixes #152864
2007-05-15 14:01:26 +00:00
if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PVOLUME)) {
/* update playback volume */
for (i = 0; i < track->num_channels; i++) {
long vol = 0;
snd_mixer_selem_get_playback_volume (alsa_track->element, i, &vol);
alsa_track->volumes[i] = (gint) vol;
}
}
if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_CVOLUME)) {
/* update capture volume */
for (i = 0; i < track->num_channels; i++) {
long vol = 0;
snd_mixer_selem_get_capture_volume (alsa_track->element, i, &vol);
alsa_track->volumes[i] = (gint) vol;
}
}
/* Any updates in flags? */
if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PSWITCH)) {
int v = 0;
audible = 0;
for (i = 0; i < alsa_track->alsa_channels; ++i) {
snd_mixer_selem_get_playback_switch (alsa_track->element, i, &v);
audible += v;
}
} else if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PVOLUME) &&
track->flags & GST_MIXER_TRACK_MUTE) {
/* check if user has raised volume with a parallel running application */
for (i = 0; i < track->num_channels; i++) {
long vol = 0;
snd_mixer_selem_get_playback_volume (alsa_track->element, i, &vol);
if (vol > track->min_volume) {
audible = 1;
break;
}
}
}
if (!!(audible) != !(track->flags & GST_MIXER_TRACK_MUTE)) {
if (audible) {
track->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
if (alsa_track->shared_mute)
((GstMixerTrack *) (alsa_track->shared_mute))->flags &=
~GST_MIXER_TRACK_MUTE;
} else {
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
track->flags |= GST_MIXER_TRACK_MUTE;
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
}
if (track->flags & GST_MIXER_TRACK_INPUT) {
gint recording = 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
if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_CSWITCH)) {
int v = 0;
recording = 0;
for (i = 0; i < alsa_track->alsa_channels; ++i) {
snd_mixer_selem_get_capture_switch (alsa_track->element, i, &v);
recording += v;
}
} else if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_CVOLUME) &&
!(track->flags & GST_MIXER_TRACK_RECORD)) {
/* check if user has raised volume with a parallel running application */
for (i = 0; i < track->num_channels; i++) {
long vol = 0;
snd_mixer_selem_get_capture_volume (alsa_track->element, i, &vol);
if (vol > track->min_volume) {
recording = 1;
break;
}
}
}
if (recording)
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
track->flags |= GST_MIXER_TRACK_RECORD;
else
track->flags &= ~GST_MIXER_TRACK_RECORD;
}
}