2003-09-13 13:42:09 +00:00
|
|
|
/* GStreamer OSS Mixer implementation
|
|
|
|
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2003-09-13 01:22:59 +00:00
|
|
|
*
|
2003-10-10 12:24:20 +00:00
|
|
|
* gstossmixer.c: mixer interface implementation for OSS
|
2003-09-13 01:22:59 +00:00
|
|
|
*
|
|
|
|
* 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 <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/ioctl.h>
|
2005-12-10 14:57:48 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_OSS_INCLUDE_IN_SYS
|
|
|
|
# include <sys/soundcard.h>
|
|
|
|
#else
|
|
|
|
# ifdef HAVE_OSS_INCLUDE_IN_ROOT
|
|
|
|
# include <soundcard.h>
|
|
|
|
# else
|
|
|
|
# ifdef HAVE_OSS_INCLUDE_IN_MACHINE
|
|
|
|
# include <machine/soundcard.h>
|
|
|
|
# else
|
|
|
|
# error "What to include?"
|
|
|
|
# endif /* HAVE_OSS_INCLUDE_IN_MACHINE */
|
|
|
|
# endif /* HAVE_OSS_INCLUDE_IN_ROOT */
|
|
|
|
#endif /* HAVE_OSS_INCLUDE_IN_SYS */
|
2004-06-07 13:40:08 +00:00
|
|
|
|
2005-07-08 11:19:19 +00:00
|
|
|
#include <gst/gst-i18n-plugin.h>
|
2004-07-15 23:56:05 +00:00
|
|
|
|
2003-09-13 01:22:59 +00:00
|
|
|
#include "gstossmixer.h"
|
2005-08-23 13:26:21 +00:00
|
|
|
#include "gstossmixertrack.h"
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-10-26 11:12:34 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (oss_debug);
|
|
|
|
#define GST_CAT_DEFAULT oss_debug
|
|
|
|
|
2003-09-13 01:22:59 +00:00
|
|
|
#define MASK_BIT_IS_SET(mask, bit) \
|
|
|
|
(mask & (1 << bit))
|
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ossmixer_open (GstOssMixer * mixer)
|
|
|
|
{
|
|
|
|
#ifdef SOUND_MIXER_INFO
|
|
|
|
struct mixer_info minfo;
|
|
|
|
#endif
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
g_return_val_if_fail (mixer->mixer_fd == -1, FALSE);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
mixer->mixer_fd = open (mixer->device, O_RDWR);
|
|
|
|
if (mixer->mixer_fd == -1) {
|
|
|
|
/* this is valid. OSS devices don't need to expose a mixer */
|
|
|
|
GST_DEBUG ("Failed to open mixer device %s, mixing disabled: %s",
|
|
|
|
mixer->device, strerror (errno));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
/* get masks */
|
|
|
|
if (ioctl (mixer->mixer_fd, SOUND_MIXER_READ_RECMASK, &mixer->recmask) < 0
|
|
|
|
|| ioctl (mixer->mixer_fd, SOUND_MIXER_READ_RECSRC, &mixer->recdevs) < 0
|
|
|
|
|| ioctl (mixer->mixer_fd, SOUND_MIXER_READ_STEREODEVS,
|
|
|
|
&mixer->stereomask) < 0
|
|
|
|
|| ioctl (mixer->mixer_fd, SOUND_MIXER_READ_DEVMASK, &mixer->devmask) < 0
|
|
|
|
|| ioctl (mixer->mixer_fd, SOUND_MIXER_READ_CAPS, &mixer->mixcaps) < 0) {
|
|
|
|
GST_DEBUG ("Failed to get device masks");
|
|
|
|
close (mixer->mixer_fd);
|
|
|
|
mixer->mixer_fd = -1;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
/* get name */
|
|
|
|
#ifdef SOUND_MIXER_INFO
|
|
|
|
if (ioctl (mixer->mixer_fd, SOUND_MIXER_INFO, &minfo) == 0) {
|
|
|
|
mixer->cardname = g_strdup (minfo.name);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
oss->cardname = g_strdup ("Unknown");
|
|
|
|
#endif
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2003-10-14 10:11:14 +00:00
|
|
|
|
|
|
|
static void
|
2005-08-23 13:26:21 +00:00
|
|
|
gst_ossmixer_ensure_track_list (GstOssMixer * mixer)
|
2003-10-14 10:11:14 +00:00
|
|
|
{
|
2005-08-23 13:26:21 +00:00
|
|
|
gint i, master = -1;
|
|
|
|
|
|
|
|
g_return_if_fail (mixer->mixer_fd != -1);
|
2003-10-14 10:11:14 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
if (mixer->tracklist)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* find master volume */
|
|
|
|
if (mixer->devmask & SOUND_MASK_VOLUME)
|
|
|
|
master = SOUND_MIXER_VOLUME;
|
|
|
|
else if (mixer->devmask & SOUND_MASK_PCM)
|
|
|
|
master = SOUND_MIXER_PCM;
|
|
|
|
else if (mixer->devmask & SOUND_MASK_SPEAKER)
|
|
|
|
master = SOUND_MIXER_SPEAKER; /* doubtful... */
|
|
|
|
/* else: no master, so we won't set any */
|
|
|
|
|
|
|
|
/* build track list */
|
2003-10-14 10:11:14 +00:00
|
|
|
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
|
2005-08-23 13:26:21 +00:00
|
|
|
if (mixer->devmask & (1 << i)) {
|
|
|
|
GstMixerTrack *track;
|
|
|
|
gboolean input = FALSE, stereo = FALSE, record = FALSE;
|
|
|
|
|
|
|
|
/* track exists, make up capabilities */
|
|
|
|
if (MASK_BIT_IS_SET (mixer->stereomask, i))
|
|
|
|
stereo = TRUE;
|
|
|
|
if (MASK_BIT_IS_SET (mixer->recmask, i))
|
|
|
|
input = TRUE;
|
|
|
|
if (MASK_BIT_IS_SET (mixer->recdevs, i))
|
|
|
|
record = TRUE;
|
|
|
|
|
|
|
|
/* do we want this in our list? */
|
|
|
|
if (!((mixer->dir & GST_OSS_MIXER_CAPTURE && input == TRUE) ||
|
|
|
|
(mixer->dir & GST_OSS_MIXER_PLAYBACK && i != SOUND_MIXER_PCM)))
|
|
|
|
/* the PLAYBACK case seems hacky, but that's how 0.8 had it */
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* add track to list */
|
|
|
|
track = gst_ossmixer_track_new (mixer->mixer_fd, i, stereo ? 2 : 1,
|
|
|
|
(record ? GST_MIXER_TRACK_RECORD : 0) |
|
|
|
|
(input ? GST_MIXER_TRACK_INPUT :
|
|
|
|
GST_MIXER_TRACK_OUTPUT) |
|
|
|
|
((master != i) ? 0 : GST_MIXER_TRACK_MASTER));
|
|
|
|
mixer->tracklist = g_list_append (mixer->tracklist, track);
|
2003-10-14 10:11:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
GstOssMixer *
|
|
|
|
gst_ossmixer_new (const char *device, GstOssMixerDirection dir)
|
2003-10-10 12:24:20 +00:00
|
|
|
{
|
2005-08-23 13:26:21 +00:00
|
|
|
GstOssMixer *ret = NULL;
|
2003-10-10 12:24:20 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
g_return_val_if_fail (device != NULL, NULL);
|
2003-10-10 12:24:20 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
ret = g_new0 (GstOssMixer, 1);
|
2003-10-10 12:24:20 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
ret->device = g_strdup (device);
|
|
|
|
ret->dir = dir;
|
2005-08-23 13:53:17 +00:00
|
|
|
ret->mixer_fd = -1;
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
if (!gst_ossmixer_open (ret))
|
|
|
|
goto error;
|
2003-10-14 10:11:14 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
return ret;
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
error:
|
|
|
|
if (ret)
|
|
|
|
gst_ossmixer_free (ret);
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
return NULL;
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-08-23 13:26:21 +00:00
|
|
|
gst_ossmixer_free (GstOssMixer * mixer)
|
2003-09-13 01:22:59 +00:00
|
|
|
{
|
2005-08-23 13:26:21 +00:00
|
|
|
g_return_if_fail (mixer != NULL);
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
if (mixer->device) {
|
|
|
|
g_free (mixer->device);
|
|
|
|
mixer->device = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2005-07-08 11:19:19 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
if (mixer->mixer_fd != -1) {
|
|
|
|
close (mixer->mixer_fd);
|
|
|
|
mixer->mixer_fd = -1;
|
|
|
|
}
|
2003-09-13 15:47:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
g_free (mixer);
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
|
compile fixes for --disable-gst-debug, G_DISABLE_ASSERT and friends
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (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/dvdnav/dvdnavsrc.c: (dvdnav_get_event_name),
(dvdnavsrc_print_event):
* ext/ogg/gstoggdemux.c: (_find_chain_process), (gst_ogg_print):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_pad_link),
(gst_ogg_mux_pad_unlink):
* gst/multipart/multipartmux.c: (gst_multipart_mux_pad_link),
(gst_multipart_mux_pad_unlink):
* gst/videofilter/gstvideobalance.c:
(gst_videobalance_colorbalance_set_value):
* gst/videomixer/videomixer.c: (gst_videomixer_pad_link),
(gst_videomixer_pad_unlink):
* po/uk.po:
* sys/oss/gstossmixer.c:
* sys/v4l/gstv4lcolorbalance.c:
* sys/v4l/gstv4ltuner.c:
* sys/v4l/v4lsrc_calls.c:
* sys/v4l2/gstv4l2colorbalance.c:
* sys/v4l2/gstv4l2tuner.c:
compile fixes for --disable-gst-debug, G_DISABLE_ASSERT and friends
2004-08-03 16:06:09 +00:00
|
|
|
/* unused with G_DISABLE_* */
|
|
|
|
static G_GNUC_UNUSED gboolean
|
2005-08-23 13:26:21 +00:00
|
|
|
gst_ossmixer_contains_track (GstOssMixer * mixer, GstOssMixerTrack * osstrack)
|
2003-09-13 01:22:59 +00:00
|
|
|
{
|
2003-10-10 12:24:20 +00:00
|
|
|
const GList *item;
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
for (item = mixer->tracklist; item != NULL; item = item->next)
|
2003-10-10 12:24:20 +00:00
|
|
|
if (item->data == osstrack)
|
|
|
|
return TRUE;
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2003-10-10 12:24:20 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
const GList *
|
|
|
|
gst_ossmixer_list_tracks (GstOssMixer * mixer)
|
2003-10-10 12:24:20 +00:00
|
|
|
{
|
2005-08-23 13:26:21 +00:00
|
|
|
gst_ossmixer_ensure_track_list (mixer);
|
2005-07-08 11:19:19 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
return (const GList *) mixer->tracklist;
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
void
|
|
|
|
gst_ossmixer_get_volume (GstOssMixer * mixer,
|
2004-03-14 22:34:33 +00:00
|
|
|
GstMixerTrack * track, gint * volumes)
|
2003-09-13 01:22:59 +00:00
|
|
|
{
|
|
|
|
gint volume;
|
2003-10-10 12:24:20 +00:00
|
|
|
GstOssMixerTrack *osstrack = GST_OSSMIXER_TRACK (track);
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
g_return_if_fail (mixer->mixer_fd != -1);
|
|
|
|
g_return_if_fail (gst_ossmixer_contains_track (mixer, osstrack));
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2003-10-09 22:02:37 +00:00
|
|
|
if (track->flags & GST_MIXER_TRACK_MUTE) {
|
|
|
|
volumes[0] = osstrack->lvol;
|
|
|
|
if (track->num_channels == 2) {
|
|
|
|
volumes[1] = osstrack->rvol;
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* get */
|
2005-08-23 13:26:21 +00:00
|
|
|
if (ioctl (mixer->mixer_fd, MIXER_READ (osstrack->track_num), &volume) < 0) {
|
2004-03-14 22:34:33 +00:00
|
|
|
g_warning ("Error getting recording device (%d) volume: %s",
|
2004-03-15 19:32:27 +00:00
|
|
|
osstrack->track_num, strerror (errno));
|
2003-09-13 01:22:59 +00:00
|
|
|
volume = 0;
|
|
|
|
}
|
|
|
|
|
2003-10-09 22:02:37 +00:00
|
|
|
osstrack->lvol = volumes[0] = (volume & 0xff);
|
|
|
|
if (track->num_channels == 2) {
|
|
|
|
osstrack->rvol = volumes[1] = ((volume >> 8) & 0xff);
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
void
|
|
|
|
gst_ossmixer_set_volume (GstOssMixer * mixer,
|
2004-03-14 22:34:33 +00:00
|
|
|
GstMixerTrack * track, gint * volumes)
|
2003-09-13 01:22:59 +00:00
|
|
|
{
|
|
|
|
gint volume;
|
2003-10-10 12:24:20 +00:00
|
|
|
GstOssMixerTrack *osstrack = GST_OSSMIXER_TRACK (track);
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
g_return_if_fail (mixer->mixer_fd != -1);
|
|
|
|
g_return_if_fail (gst_ossmixer_contains_track (mixer, osstrack));
|
2003-09-13 01:22:59 +00:00
|
|
|
|
|
|
|
/* prepare the value for ioctl() */
|
2003-10-09 22:02:37 +00:00
|
|
|
if (!(track->flags & GST_MIXER_TRACK_MUTE)) {
|
2003-09-13 01:22:59 +00:00
|
|
|
volume = (volumes[0] & 0xff);
|
2003-10-09 22:02:37 +00:00
|
|
|
if (track->num_channels == 2) {
|
2003-09-13 01:22:59 +00:00
|
|
|
volume |= ((volumes[1] & 0xff) << 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set */
|
2005-08-23 13:26:21 +00:00
|
|
|
if (ioctl (mixer->mixer_fd, MIXER_WRITE (osstrack->track_num), &volume) < 0) {
|
2004-03-14 22:34:33 +00:00
|
|
|
g_warning ("Error setting recording device (%d) volume (0x%x): %s",
|
2004-03-15 19:32:27 +00:00
|
|
|
osstrack->track_num, volume, strerror (errno));
|
2003-09-13 01:22:59 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-09 22:02:37 +00:00
|
|
|
osstrack->lvol = volumes[0];
|
|
|
|
if (track->num_channels == 2) {
|
|
|
|
osstrack->rvol = volumes[1];
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
void
|
|
|
|
gst_ossmixer_set_mute (GstOssMixer * mixer, GstMixerTrack * track,
|
|
|
|
gboolean mute)
|
2003-09-13 01:22:59 +00:00
|
|
|
{
|
|
|
|
int volume;
|
2003-10-10 12:24:20 +00:00
|
|
|
GstOssMixerTrack *osstrack = GST_OSSMIXER_TRACK (track);
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
g_return_if_fail (mixer->mixer_fd != -1);
|
|
|
|
g_return_if_fail (gst_ossmixer_contains_track (mixer, osstrack));
|
2003-09-13 01:22:59 +00:00
|
|
|
|
|
|
|
if (mute) {
|
|
|
|
volume = 0;
|
|
|
|
} else {
|
2003-10-09 22:02:37 +00:00
|
|
|
volume = (osstrack->lvol & 0xff);
|
2005-08-23 13:26:21 +00:00
|
|
|
if (MASK_BIT_IS_SET (mixer->stereomask, osstrack->track_num)) {
|
2003-10-09 22:02:37 +00:00
|
|
|
volume |= ((osstrack->rvol & 0xff) << 8);
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
if (ioctl (mixer->mixer_fd, MIXER_WRITE (osstrack->track_num), &volume) < 0) {
|
2004-03-14 22:34:33 +00:00
|
|
|
g_warning ("Error setting mixer recording device volume (0x%x): %s",
|
2004-03-15 19:32:27 +00:00
|
|
|
volume, strerror (errno));
|
2003-09-13 01:22:59 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mute) {
|
2003-10-09 22:02:37 +00:00
|
|
|
track->flags |= GST_MIXER_TRACK_MUTE;
|
2003-09-13 01:22:59 +00:00
|
|
|
} else {
|
2003-10-09 22:02:37 +00:00
|
|
|
track->flags &= ~GST_MIXER_TRACK_MUTE;
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
void
|
|
|
|
gst_ossmixer_set_record (GstOssMixer * mixer,
|
2004-03-14 22:34:33 +00:00
|
|
|
GstMixerTrack * track, gboolean record)
|
2003-09-13 01:22:59 +00:00
|
|
|
{
|
2003-10-10 12:24:20 +00:00
|
|
|
GstOssMixerTrack *osstrack = GST_OSSMIXER_TRACK (track);
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
g_return_if_fail (mixer->mixer_fd != -1);
|
|
|
|
g_return_if_fail (gst_ossmixer_contains_track (mixer, osstrack));
|
2003-09-13 01:22:59 +00:00
|
|
|
|
2003-11-09 10:51:26 +00:00
|
|
|
/* if there's nothing to do... */
|
|
|
|
if ((record && GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD)) ||
|
|
|
|
(!record && !GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD)))
|
|
|
|
return;
|
|
|
|
|
2003-09-13 01:22:59 +00:00
|
|
|
/* if we're exclusive, then we need to unset the current one(s) */
|
2005-08-23 13:26:21 +00:00
|
|
|
if (mixer->mixcaps & SOUND_CAP_EXCL_INPUT) {
|
2003-10-09 22:02:37 +00:00
|
|
|
GList *track;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-08-23 13:26:21 +00:00
|
|
|
for (track = mixer->tracklist; track != NULL; track = track->next) {
|
2003-10-09 22:02:37 +00:00
|
|
|
GstMixerTrack *turn = (GstMixerTrack *) track->data;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-10-09 22:02:37 +00:00
|
|
|
turn->flags &= ~GST_MIXER_TRACK_RECORD;
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
2005-08-23 13:26:21 +00:00
|
|
|
mixer->recdevs = 0;
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set new record bit, if needed */
|
|
|
|
if (record) {
|
2005-08-23 13:26:21 +00:00
|
|
|
mixer->recdevs |= (1 << osstrack->track_num);
|
2003-09-13 01:22:59 +00:00
|
|
|
} else {
|
2005-08-23 13:26:21 +00:00
|
|
|
mixer->recdevs &= ~(1 << osstrack->track_num);
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set it to the device */
|
2005-08-23 13:26:21 +00:00
|
|
|
if (ioctl (mixer->mixer_fd, SOUND_MIXER_WRITE_RECSRC, &mixer->recdevs) < 0) {
|
2004-03-14 22:34:33 +00:00
|
|
|
g_warning ("Error setting mixer recording devices (0x%x): %s",
|
2005-08-23 13:26:21 +00:00
|
|
|
mixer->recdevs, strerror (errno));
|
2003-09-13 01:22:59 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (record) {
|
2003-10-09 22:02:37 +00:00
|
|
|
track->flags |= GST_MIXER_TRACK_RECORD;
|
2003-09-13 01:22:59 +00:00
|
|
|
} else {
|
2003-10-09 22:02:37 +00:00
|
|
|
track->flags &= ~GST_MIXER_TRACK_RECORD;
|
2003-09-13 01:22:59 +00:00
|
|
|
}
|
|
|
|
}
|