From 02a32faa481dfc259dad9e40b75a88f1d917d224 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 23 Aug 2005 13:59:22 +0000 Subject: [PATCH] sys/oss/gstosssrc.*: Easy to implement a mixer, eh... Original commit message from CVS: 2005-08-23 Andy Wingo * sys/oss/gstosssrc.c: * sys/oss/gstosssrc.h: Easy to implement a mixer, eh... --- ChangeLog | 3 +++ sys/oss/gstosssrc.c | 22 ++++++++++++++++------ sys/oss/gstosssrc.h | 3 +++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d3395bb57..4a8aa2bffc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-08-23 Andy Wingo + * sys/oss/gstosssrc.c: + * sys/oss/gstosssrc.h: Easy to implement a mixer, eh... + * sys/oss/gstossmixerelement.h: * sys/oss/gstossmixerelement.c: Added mixer element like alsamixer. diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c index 2c413657ab..c40df24a62 100644 --- a/sys/oss/gstosssrc.c +++ b/sys/oss/gstosssrc.c @@ -47,13 +47,10 @@ enum PROP_DEVICE_NAME, }; -GST_BOILERPLATE (GstOssSrc, gst_oss_src, GstAudioSrc, GST_TYPE_AUDIO_SRC); +GST_BOILERPLATE_WITH_INTERFACE (GstOssSrc, gst_oss_src, GstAudioSrc, + GST_TYPE_AUDIO_SRC, GstMixer, GST_TYPE_MIXER, gst_oss_src_mixer); -/* -GST_BOILERPLATE_WITH_INTERFACE (GstOssSrc, gst_oss_src, GstAudioSrc, GST_TYPE_AUDIO_SRC, - GstMixer, GST_TYPE_MIXER, gst_oss_src_mixer); GST_IMPLEMENT_OSS_MIXER_METHODS (GstOssSrc, gst_oss_src_mixer); -*/ static void gst_oss_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); @@ -309,13 +306,26 @@ gst_oss_src_open (GstAudioSrc * asrc) return FALSE; } + if (!oss->mixer) + oss->mixer = gst_ossmixer_new ("/dev/mixer", GST_OSS_MIXER_CAPTURE); + return TRUE; } static gboolean gst_oss_src_close (GstAudioSrc * asrc) { - close (GST_OSS_SRC (asrc)->fd); + GstOssSrc *oss; + + oss = GST_OSS_SRC (asrc); + + close (oss->fd); + + if (oss->mixer) { + gst_ossmixer_free (oss->mixer); + oss->mixer = NULL; + } + return TRUE; } diff --git a/sys/oss/gstosssrc.h b/sys/oss/gstosssrc.h index 23f7c3897f..a3b5ba6fca 100644 --- a/sys/oss/gstosssrc.h +++ b/sys/oss/gstosssrc.h @@ -29,6 +29,7 @@ #include #include "gstosshelper.h" +#include "gstossmixer.h" G_BEGIN_DECLS @@ -49,6 +50,8 @@ struct _GstOssSrc { gchar *device; gchar *device_name; + + GstOssMixer *mixer; }; struct _GstOssSrcClass {