Commit a5ff454e authored by Mark Nauwelaerts's avatar Mark Nauwelaerts

oss4: port to 0.11

parent c4c3736e
......@@ -310,7 +310,6 @@ dnl Non ported plugins (non-dependant, then dependant)
dnl Make sure you have a space before and after all plugins
GST_PLUGINS_NONPORTED="deinterlace \
cairo cairo_gobject gdk_pixbuf \
oss4 \
osx_video osx_audio "
AC_SUBST(GST_PLUGINS_NONPORTED)
......
......@@ -191,7 +191,6 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/wavparse/gstwavparse.h \
$(top_srcdir)/gst/y4m/gsty4mencode.h \
$(top_srcdir)/sys/directsound/gstdirectsoundsink.h \
$(top_srcdir)/sys/oss4/oss4-mixer.h \
$(top_srcdir)/sys/oss4/oss4-sink.h \
$(top_srcdir)/sys/oss4/oss4-source.h \
$(top_srcdir)/sys/oss/gstosssink.h \
......
......@@ -111,7 +111,6 @@
<xi:include href="xml/element-multipartmux.xml" />
<xi:include href="xml/element-multiudpsink.xml" />
<xi:include href="xml/element-optv.xml" />
<xi:include href="xml/element-oss4mixer.xml" />
<xi:include href="xml/element-oss4sink.xml" />
<xi:include href="xml/element-oss4src.xml" />
<xi:include href="xml/element-osssink.xml" />
......
......@@ -1396,30 +1396,6 @@ GST_IS_MULTIUDPSINK_CLASS
gst_multiudpsink_get_type
</SECTION>
<SECTION>
<FILE>element-oss4mixer</FILE>
<TITLE>oss4mixer</TITLE>
GstOss4Mixer
<SUBSECTION Standard>
GstOss4MixerClass
GST_OSS4_MIXER
GST_OSS4_MIXER_CLASS
GST_IS_OSS4_MIXER
GST_IS_OSS4_MIXER_CLASS
GST_TYPE_OSS4_MIXER
gst_oss4_mixer_get_type
GST_OSS4_MIXER_CAST
GST_OSS4_MIXER_IS_OPEN
MIXEXT_ENUM_IS_AVAILABLE
MIXEXT_HAS_DESCRIPTION
MIXEXT_IS_ROOT
MIXEXT_IS_SLIDER
gst_oss4_mixer_get_control_val
gst_oss4_mixer_set_control_val
gst_oss4_source_input_get_type
GstOss4MixerControl
</SECTION>
<SECTION>
<FILE>element-oss4sink</FILE>
<TITLE>oss4sink</TITLE>
......
......@@ -2,10 +2,6 @@ plugin_LTLIBRARIES = libgstoss4audio.la
libgstoss4audio_la_SOURCES = \
oss4-audio.c \
oss4-mixer.c \
oss4-mixer-enum.c \
oss4-mixer-slider.c \
oss4-mixer-switch.c \
oss4-property-probe.c \
oss4-sink.c \
oss4-source.c
......@@ -13,7 +9,6 @@ libgstoss4audio_la_SOURCES = \
libgstoss4audio_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libgstoss4audio_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) \
-lgstinterfaces-$(GST_API_VERSION) \
-lgstaudio-$(GST_API_VERSION) \
$(GST_LIBS)
libgstoss4audio_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
......@@ -21,13 +16,8 @@ libgstoss4audio_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
oss4-audio.h \
oss4-mixer.h \
oss4-mixer-enum.h \
oss4-mixer-slider.h \
oss4-mixer-switch.h \
oss4-property-probe.h \
oss4-sink.h \
oss4-soundcard.h \
oss4-source.h
This diff is collapsed.
......@@ -21,7 +21,7 @@
#define GST_OSS4_AUDIO_H_
#include <gst/gst.h>
#include <gst/audio/gstringbuffer.h>
#include <gst/audio/gstaudioringbuffer.h>
/* This is the minimum version we require */
#define GST_MIN_OSS4_VERSION 0x040003
......@@ -32,7 +32,7 @@ gboolean gst_oss4_audio_check_version (GstObject * obj, int fd);
GstCaps * gst_oss4_audio_probe_caps (GstObject * obj, int fd);
gboolean gst_oss4_audio_set_format (GstObject * obj, int fd, GstRingBufferSpec * spec);
gboolean gst_oss4_audio_set_format (GstObject * obj, int fd, GstAudioRingBufferSpec * spec);
GstCaps * gst_oss4_audio_get_template_caps (void);
......
/* GStreamer OSS4 mixer enumeration control
* Copyright (C) 2007-2008 Tim-Philipp Müller <tim centricular 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.
*/
/* An 'enum' in gnome-volume-control / GstMixer is represented by a
* GstMixerOptions object
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst-i18n-plugin.h>
#define NO_LEGACY_MIXER
#include "oss4-mixer.h"
#include "oss4-mixer-enum.h"
#include "oss4-soundcard.h"
GST_DEBUG_CATEGORY_EXTERN (oss4mixer_debug);
#define GST_CAT_DEFAULT oss4mixer_debug
static GList *gst_oss4_mixer_enum_get_values (GstMixerOptions * options);
/* GstMixerTrack is a plain GObject, so let's just use the GLib macro here */
G_DEFINE_TYPE (GstOss4MixerEnum, gst_oss4_mixer_enum, GST_TYPE_MIXER_OPTIONS);
static void
gst_oss4_mixer_enum_init (GstOss4MixerEnum * e)
{
e->need_update = TRUE;
}
static void
gst_oss4_mixer_enum_dispose (GObject * obj)
{
GstMixerOptions *options = GST_MIXER_OPTIONS (obj);
/* our list is a flat list with constant strings, but the GstMixerOptions
* dispose will try to g_free the contained strings, so clean up the list
* before chaining up to GstMixerOptions */
g_list_free (options->values);
options->values = NULL;
G_OBJECT_CLASS (gst_oss4_mixer_enum_parent_class)->dispose (obj);
}
static void
gst_oss4_mixer_enum_class_init (GstOss4MixerEnumClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstMixerOptionsClass *mixeroptions_class = (GstMixerOptionsClass *) klass;
gobject_class->dispose = gst_oss4_mixer_enum_dispose;
mixeroptions_class->get_values = gst_oss4_mixer_enum_get_values;
}
static GList *
gst_oss4_mixer_enum_get_values_locked (GstMixerOptions * options)
{
GstOss4MixerEnum *e = GST_OSS4_MIXER_ENUM_CAST (options);
GList *oldlist, *list = NULL;
int i;
/* if current list of values is empty, update/re-check in any case */
if (!e->need_update && options->values != NULL)
return options->values;
GST_LOG_OBJECT (e, "updating available values for %s", e->mc->mixext.extname);
for (i = 0; i < e->mc->mixext.maxvalue; ++i) {
const gchar *s;
s = g_quark_to_string (e->mc->enum_vals[i]);
if (MIXEXT_ENUM_IS_AVAILABLE (e->mc->mixext, i)) {
GST_LOG_OBJECT (e, "option '%s' is available", s);
list = g_list_prepend (list, (gpointer) s);
} else {
GST_LOG_OBJECT (e, "option '%s' is currently not available", s);
}
}
list = g_list_reverse (list);
/* this is not thread-safe, but then the entire GstMixer API isn't really,
* since we return foo->list and not a copy and don't take any locks, so
* not much we can do here but pray; we're usually either called from _new()
* or from within _get_values() though, so it should be okay. We could use
* atomic ops here, but I'm not sure how much more that really buys us.*/
oldlist = options->values; /* keep window small */
options->values = list;
g_list_free (oldlist);
e->need_update = FALSE;
return options->values;
}
static GList *
gst_oss4_mixer_enum_get_values (GstMixerOptions * options)
{
GstOss4MixerEnum *e = GST_OSS4_MIXER_ENUM (options);
GList *list;
/* we take the lock here mostly to serialise ioctls with the watch thread */
GST_OBJECT_LOCK (e->mixer);
list = gst_oss4_mixer_enum_get_values_locked (options);
GST_OBJECT_UNLOCK (e->mixer);
return list;
}
static const gchar *
gst_oss4_mixer_enum_get_current_value (GstOss4MixerEnum * e)
{
const gchar *cur_val = NULL;
if (e->mc->enum_vals != NULL && e->mc->last_val < e->mc->mixext.maxvalue) {
cur_val = g_quark_to_string (e->mc->enum_vals[e->mc->last_val]);
}
return cur_val;
}
static gboolean
gst_oss4_mixer_enum_update_current (GstOss4MixerEnum * e)
{
int cur = -1;
if (!gst_oss4_mixer_get_control_val (e->mixer, e->mc, &cur))
return FALSE;
if (cur < 0 || cur >= e->mc->mixext.maxvalue) {
GST_WARNING_OBJECT (e, "read value %d out of bounds [0-%d]", cur,
e->mc->mixext.maxvalue - 1);
e->mc->last_val = 0;
return FALSE;
}
return TRUE;
}
gboolean
gst_oss4_mixer_enum_set_option (GstOss4MixerEnum * e, const gchar * value)
{
GQuark q;
int i;
q = g_quark_try_string (value);
if (q == 0) {
GST_WARNING_OBJECT (e, "unknown option '%s'", value);
return FALSE;
}
for (i = 0; i < e->mc->mixext.maxvalue; ++i) {
if (q == e->mc->enum_vals[i])
break;
}
if (i >= e->mc->mixext.maxvalue) {
GST_WARNING_OBJECT (e, "option '%s' is not valid for this control", value);
return FALSE;
}
GST_LOG_OBJECT (e, "option '%s' = %d", value, i);
if (!MIXEXT_ENUM_IS_AVAILABLE (e->mc->mixext, i)) {
GST_WARNING_OBJECT (e, "option '%s' is not selectable currently", value);
return FALSE;
}
if (!gst_oss4_mixer_set_control_val (e->mixer, e->mc, i)) {
GST_WARNING_OBJECT (e, "could not set option '%s' (%d)", value, i);
return FALSE;
}
/* and re-read current value with sanity checks (or could just assign here) */
gst_oss4_mixer_enum_update_current (e);
return TRUE;
}
const gchar *
gst_oss4_mixer_enum_get_option (GstOss4MixerEnum * e)
{
const gchar *cur_str = NULL;
if (!gst_oss4_mixer_enum_update_current (e)) {
GST_WARNING_OBJECT (e, "failed to read current value");
return NULL;
}
cur_str = gst_oss4_mixer_enum_get_current_value (e);
GST_LOG_OBJECT (e, "%s (%d)", GST_STR_NULL (cur_str), e->mc->last_val);
return cur_str;
}
GstMixerTrack *
gst_oss4_mixer_enum_new (GstOss4Mixer * mixer, GstOss4MixerControl * mc)
{
GstOss4MixerEnum *e;
GstMixerTrack *track;
e = g_object_new (GST_TYPE_OSS4_MIXER_ENUM, "untranslated-label",
mc->mixext.extname, NULL);
e->mixer = mixer;
e->mc = mc;
track = GST_MIXER_TRACK (e);
/* caller will set track->label and track->flags */
track->num_channels = 0;
track->min_volume = 0;
track->max_volume = 0;
(void) gst_oss4_mixer_enum_get_values_locked (GST_MIXER_OPTIONS (track));
if (!gst_oss4_mixer_enum_update_current (e)) {
GST_WARNING_OBJECT (track, "failed to read current value, returning NULL");
g_object_unref (track);
track = NULL;
}
GST_LOG_OBJECT (e, "current value: %d (%s)", e->mc->last_val,
gst_oss4_mixer_enum_get_current_value (e));
return track;
}
/* This is called from the watch thread */
void
gst_oss4_mixer_enum_process_change_unlocked (GstMixerTrack * track)
{
GstOss4MixerEnum *e = GST_OSS4_MIXER_ENUM_CAST (track);
gchar *cur;
if (!e->mc->changed && !e->mc->list_changed)
return;
if (e->mc->list_changed) {
gst_mixer_options_list_changed (GST_MIXER (e->mixer),
GST_MIXER_OPTIONS (e));
}
GST_OBJECT_LOCK (e->mixer);
cur = (gchar *) gst_oss4_mixer_enum_get_current_value (e);
GST_OBJECT_UNLOCK (e->mixer);
gst_mixer_option_changed (GST_MIXER (e->mixer), GST_MIXER_OPTIONS (e), cur);
}
/* GStreamer OSS4 mixer on/off enum control
* Copyright (C) 2007-2008 Tim-Philipp Müller <tim centricular 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.
*/
#ifndef GST_OSS4_MIXER_ENUM_H
#define GST_OSS4_MIXER_ENUM_H
#include <gst/gst.h>
#include <gst/interfaces/mixer.h>
#include "oss4-mixer.h"
G_BEGIN_DECLS
#define GST_TYPE_OSS4_MIXER_ENUM (gst_oss4_mixer_enum_get_type())
#define GST_OSS4_MIXER_ENUM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OSS4_MIXER_ENUM,GstOss4MixerEnum))
#define GST_OSS4_MIXER_ENUM_CAST(obj) ((GstOss4MixerEnum *)(obj))
#define GST_OSS4_MIXER_ENUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OSS4_MIXER_ENUM,GstOss4MixerEnumClass))
#define GST_IS_OSS4_MIXER_ENUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OSS4_MIXER_ENUM))
#define GST_IS_OSS4_MIXER_ENUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OSS4_MIXER_ENUM))
typedef struct _GstOss4MixerEnum GstOss4MixerEnum;
typedef struct _GstOss4MixerEnumClass GstOss4MixerEnumClass;
struct _GstOss4MixerEnum {
GstMixerOptions mixer_option;
GstOss4MixerControl * mc;
GstOss4Mixer * mixer; /* the mixer we belong to (no ref taken) */
gboolean need_update;
};
struct _GstOss4MixerEnumClass {
GstMixerOptionsClass mixer_option_class;
};
GType gst_oss4_mixer_enum_get_type (void);
gboolean gst_oss4_mixer_enum_set_option (GstOss4MixerEnum * e, const gchar * value);
const gchar * gst_oss4_mixer_enum_get_option (GstOss4MixerEnum * e);
GstMixerTrack * gst_oss4_mixer_enum_new (GstOss4Mixer * mixer, GstOss4MixerControl * mc);
void gst_oss4_mixer_enum_process_change_unlocked (GstMixerTrack * track);
G_END_DECLS
#endif /* GST_OSS4_MIXER_ENUM_H */
/* GStreamer OSS4 mixer slider control
* Copyright (C) 2007-2008 Tim-Philipp Müller <tim centricular 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.
*/
/* A 'slider' in gnome-volume-control / GstMixer is represented by a
* GstMixerTrack with one or more channels.
*
* A slider should be either flagged as INPUT or OUTPUT (mostly because of
* gnome-volume-control being littered with g_asserts for everything it doesn't
* expect).
*
* From mixertrack.h:
* "Input tracks can have 'recording' enabled, which means that any input will
* be hearable into the speakers that are attached to the output. Mute is
* obvious."
*/
#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>
#include <gst/gst-i18n-plugin.h>
#define NO_LEGACY_MIXER
#include "oss4-mixer-slider.h"
GST_DEBUG_CATEGORY_EXTERN (oss4mixer_debug);
#define GST_CAT_DEFAULT oss4mixer_debug
/* GstMixerTrack is a plain GObject, so let's just use the GLib macro here */
G_DEFINE_TYPE (GstOss4MixerSlider, gst_oss4_mixer_slider, GST_TYPE_MIXER_TRACK);
static void
gst_oss4_mixer_slider_class_init (GstOss4MixerSliderClass * klass)
{
/* nothing to do here */
}
static void
gst_oss4_mixer_slider_init (GstOss4MixerSlider * s)
{
/* nothing to do here */
}
static int
gst_oss4_mixer_slider_pack_volume (GstOss4MixerSlider * s, const gint * volumes)
{
int val = 0;
switch (s->mc->mixext.type) {
case MIXT_MONOSLIDER:
case MIXT_MONOSLIDER16:
case MIXT_SLIDER:
val = volumes[0];
break;
case MIXT_STEREOSLIDER:
val = ((volumes[1] & 0xff) << 8) | (volumes[0] & 0xff);
break;
case MIXT_STEREOSLIDER16:
val = ((volumes[1] & 0xffff) << 16) | (volumes[0] & 0xffff);
break;
default:
g_return_val_if_reached (0);
}
return val;
}
static void
gst_oss4_mixer_slider_unpack_volume (GstOss4MixerSlider * s, int v,
gint * volumes)
{
guint32 val; /* use uint so bitshifting the highest bit works right */
val = (guint32) v;
switch (s->mc->mixext.type) {
case MIXT_SLIDER:
volumes[0] = val;
break;
case MIXT_MONOSLIDER:
/* oss repeats the value in the upper bits, as if it was stereo */
volumes[0] = val & 0x00ff;
break;
case MIXT_MONOSLIDER16:
/* oss repeats the value in the upper bits, as if it was stereo */
volumes[0] = val & 0x0000ffff;
break;
case MIXT_STEREOSLIDER:
volumes[0] = (val & 0x00ff);
volumes[1] = (val & 0xff00) >> 8;
break;
case MIXT_STEREOSLIDER16:
volumes[0] = (val & 0x0000ffff);
volumes[1] = (val & 0xffff0000) >> 16;
break;
default:
g_return_if_reached ();
}
}
gboolean
gst_oss4_mixer_slider_get_volume (GstOss4MixerSlider * s, gint * volumes)
{
GstMixerTrack *track = GST_MIXER_TRACK (s);
int v = 0;
/* if we're supposed to be muted, and don't have an actual mute control
* (ie. 'simulate' the mute), then just return the volume as saved, not
* the actually set volume which is most likely 0 */
if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE) && !s->mc->mute) {
volumes[0] = s->volumes[0];
if (track->num_channels == 2)
volumes[1] = s->volumes[1];
return TRUE;
}
if (!gst_oss4_mixer_get_control_val (s->mixer, s->mc, &v))
return FALSE;
gst_oss4_mixer_slider_unpack_volume (s, v, volumes);
if (track->num_channels > 1) {
GST_LOG_OBJECT (s, "volume: left=%d, right=%d", volumes[0], volumes[1]);
} else {
GST_LOG_OBJECT (s, "volume: mono=%d", volumes[0]);
}
return TRUE;
}
gboolean
gst_oss4_mixer_slider_set_volume (GstOss4MixerSlider * s, const gint * volumes)
{
GstMixerTrack *track = GST_MIXER_TRACK (s);
int val = 0;
/* if we're supposed to be muted, and are 'simulating' the mute because
* we don't have a mute control, don't actually change the volume, just
* save it as the new desired volume for later when we get unmuted again */
if (!GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_NO_MUTE)) {
if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE) && !s->mc->mute)
goto done;
}
val = gst_oss4_mixer_slider_pack_volume (s, volumes);
if (track->num_channels > 1) {
GST_LOG_OBJECT (s, "left=%d, right=%d", volumes[0], volumes[1]);
} else {
GST_LOG_OBJECT (s, "mono=%d", volumes[0]);
}
if (!gst_oss4_mixer_set_control_val (s->mixer, s->mc, val))
return FALSE;
done:
s->volumes[0] = volumes[0];
if (track->num_channels == 2)
s->volumes[1] = volumes[1];
return TRUE;
}
gboolean
gst_oss4_mixer_slider_set_record (GstOss4MixerSlider * s, gboolean record)
{
/* There doesn't seem to be a way to do this using the OSS4 mixer API, so
* just do nothing here for now. */
return FALSE;
}
gboolean
gst_oss4_mixer_slider_set_mute (GstOss4MixerSlider * s, gboolean mute)
{
GstMixerTrack *track = GST_MIXER_TRACK (s);
gboolean ret;
/* if the control does not support muting, then do not do anything */
if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_NO_MUTE)) {
return TRUE;
}
/* If we do not have a mute control, simulate mute (which is a bit broken,
* since we can not differentiate between capture/playback volume etc., so
* we just assume that setting the volume to 0 would be the same as muting
* this control) */
if (s->mc->mute == NULL) {
int volume;
if (mute) {
/* make sure the current volume values get saved. */
gst_oss4_mixer_slider_get_volume (s, s->volumes);
volume = 0;
} else {
volume = gst_oss4_mixer_slider_pack_volume (s, s->volumes);
}
ret = gst_oss4_mixer_set_control_val (s->mixer, s->mc, volume);
} else {
ret = gst_oss4_mixer_set_control_val (s->mixer, s->mc->mute, !!mute);
}
if (mute) {
track->flags |= GST_MIXER_TRACK_MUTE;
} else {
track->flags &= ~GST_MIXER_TRACK_MUTE;
}
return ret;
}
GstMixerTrack *
gst_oss4_mixer_slider_new (GstOss4Mixer * mixer, GstOss4MixerControl * mc)
{
GstOss4MixerSlider *s;
GstMixerTrack *track;
gint volumes[2] = { 0, };
s = g_object_new (GST_TYPE_OSS4_MIXER_SLIDER, "untranslated-label",
mc->mixext.extname, NULL);
track = GST_MIXER_TRACK (s);
/* caller will set track->label and track->flags */
s->mc = mc;
s->mixer = mixer;
/* we don't do value scaling but just present a scale of 0-maxvalue */
track->min_volume = 0;
track->max_volume = mc->mixext.maxvalue;
switch (mc->mixext.type) {
case MIXT_MONOSLIDER:
case MIXT_MONOSLIDER16:
case MIXT_SLIDER:
track->num_channels = 1;
break;
case MIXT_STEREOSLIDER:
case MIXT_STEREOSLIDER16:
track->num_channels = 2;
break;
default:
g_return_val_if_reached (NULL);
}
GST_LOG_OBJECT (track, "min=%d, max=%d, channels=%d", track->min_volume,
track->max_volume, track->num_channels);
if (!gst_oss4_mixer_slider_get_volume (s, volumes)) {
GST_WARNING_OBJECT (track, "failed to read volume, returning NULL");
g_object_unref (track);
track = NULL;
}
return track;
}
/* This is called from the watch thread */
void
gst_oss4_mixer_slider_process_change_unlocked (GstMixerTrack * track)
{
GstOss4MixerSlider *s = GST_OSS4_MIXER_SLIDER_CAST (track);
if (s->mc->mute != NULL && s->mc->mute->changed) {
gst_mixer_mute_toggled (GST_MIXER (s->mixer), track,
!!s->mc->mute->last_val);
} else {
/* nothing to do here, since we don't/can't easily implement the record