mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
sys/oss/gstossmixerelement.*: Added mixer element like alsamixer.
Original commit message from CVS: 2005-08-23 Andy Wingo <wingo@pobox.com> * sys/oss/gstossmixerelement.h: * sys/oss/gstossmixerelement.c: Added mixer element like alsamixer. * sys/oss/Makefile.am: * sys/oss/gstossaudio.c: Register the ossmixer element.
This commit is contained in:
parent
007a0868a3
commit
b976e88c29
6 changed files with 173 additions and 12 deletions
|
@ -1,5 +1,12 @@
|
|||
2005-08-23 Andy Wingo <wingo@pobox.com>
|
||||
|
||||
* sys/oss/gstossmixerelement.h:
|
||||
* sys/oss/gstossmixerelement.c: Added mixer element like
|
||||
alsamixer.
|
||||
|
||||
* sys/oss/Makefile.am:
|
||||
* sys/oss/gstossaudio.c: Register the ossmixer element.
|
||||
|
||||
* sys/oss/gstossmixer.h:
|
||||
* sys/oss/gstossmixer.c: Refactored to be more like alsamixer.
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
plugin_LTLIBRARIES = libgstossaudio.la
|
||||
|
||||
libgstossaudio_la_SOURCES = gstossaudio.c \
|
||||
gstosshelper.c \
|
||||
gstossmixer.c \
|
||||
gstossmixertrack.c \
|
||||
gstosssink.c \
|
||||
libgstossaudio_la_SOURCES = gstossaudio.c \
|
||||
gstosshelper.c \
|
||||
gstossmixer.c \
|
||||
gstossmixerelement.c \
|
||||
gstossmixertrack.c \
|
||||
gstosssink.c \
|
||||
gstosssrc.c
|
||||
|
||||
# gstossdmabuffer.c
|
||||
|
@ -15,11 +16,12 @@ libgstossaudio_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
|
|||
-lgstaudio-@GST_MAJORMINOR@
|
||||
libgstossaudio_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
|
||||
noinst_HEADERS = gstosssink.h \
|
||||
gstosssrc.h \
|
||||
gstosshelper.h \
|
||||
gstossdmabuffer.h \
|
||||
gstossmixer.h \
|
||||
noinst_HEADERS = gstosssink.h \
|
||||
gstosssrc.h \
|
||||
gstosshelper.h \
|
||||
gstossdmabuffer.h \
|
||||
gstossmixer.h \
|
||||
gstossmixerelement.h \
|
||||
gstossmixertrack.h
|
||||
|
||||
# noinst_PROGRAMS = #oss_probe
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "gst/gst-i18n-plugin.h"
|
||||
|
||||
#include "gstossmixerelement.h"
|
||||
#include "gstosssink.h"
|
||||
#include "gstosssrc.h"
|
||||
|
||||
|
@ -33,8 +34,8 @@ GST_DEBUG_CATEGORY (oss_debug);
|
|||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if ( /*!gst_element_register (plugin, "ossmixer", GST_RANK_PRIMARY,
|
||||
GST_TYPE_OSSELEMENT) || */
|
||||
if (!gst_element_register (plugin, "ossmixer", GST_RANK_NONE,
|
||||
GST_TYPE_OSS_MIXER_ELEMENT) ||
|
||||
!gst_element_register (plugin, "osssrc", GST_RANK_PRIMARY,
|
||||
GST_TYPE_OSS_SRC) ||
|
||||
!gst_element_register (plugin, "osssink", GST_RANK_SECONDARY,
|
||||
|
|
|
@ -143,6 +143,7 @@ gst_ossmixer_new (const char *device, GstOssMixerDirection dir)
|
|||
|
||||
ret->device = g_strdup (device);
|
||||
ret->dir = dir;
|
||||
ret->mixer_fd = -1;
|
||||
|
||||
if (!gst_ossmixer_open (ret))
|
||||
goto error;
|
||||
|
|
92
sys/oss/gstossmixerelement.c
Normal file
92
sys/oss/gstossmixerelement.c
Normal file
|
@ -0,0 +1,92 @@
|
|||
/* OSS mixer interface element.
|
||||
* Copyright (C) 2005 Andrew Vander Wingo <wingo@pobox.com>
|
||||
*
|
||||
* 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 "gstossmixerelement.h"
|
||||
|
||||
|
||||
static GstElementDetails gst_oss_mixer_element_details =
|
||||
GST_ELEMENT_DETAILS ("OSS Mixer",
|
||||
"Generic/Audio",
|
||||
"Control sound input and output levels with OSS",
|
||||
"Andrew Vander Wingo <wingo@pobox.com>");
|
||||
|
||||
|
||||
GST_BOILERPLATE_WITH_INTERFACE (GstOssMixerElement, gst_oss_mixer_element,
|
||||
GstElement, GST_TYPE_ELEMENT, GstMixer, GST_TYPE_MIXER,
|
||||
gst_oss_mixer_element);
|
||||
|
||||
GST_IMPLEMENT_OSS_MIXER_METHODS (GstOssMixerElement, gst_oss_mixer_element);
|
||||
|
||||
static GstElementStateReturn gst_oss_mixer_element_change_state (GstElement *
|
||||
element);
|
||||
|
||||
static void
|
||||
gst_oss_mixer_element_base_init (gpointer klass)
|
||||
{
|
||||
gst_element_class_set_details (GST_ELEMENT_CLASS (klass),
|
||||
&gst_oss_mixer_element_details);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_oss_mixer_element_class_init (GstOssMixerElementClass * klass)
|
||||
{
|
||||
GstElementClass *element_class;
|
||||
|
||||
element_class = (GstElementClass *) klass;
|
||||
|
||||
element_class->change_state = gst_oss_mixer_element_change_state;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_oss_mixer_element_init (GstOssMixerElement * this)
|
||||
{
|
||||
this->mixer = NULL;
|
||||
}
|
||||
|
||||
static GstElementStateReturn
|
||||
gst_oss_mixer_element_change_state (GstElement * element)
|
||||
{
|
||||
GstOssMixerElement *this = GST_OSS_MIXER_ELEMENT (element);
|
||||
|
||||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_NULL_TO_READY:
|
||||
if (!this->mixer) {
|
||||
this->mixer = gst_ossmixer_new ("/dev/mixer", GST_OSS_MIXER_ALL);
|
||||
}
|
||||
break;
|
||||
case GST_STATE_READY_TO_NULL:
|
||||
if (this->mixer) {
|
||||
gst_ossmixer_free (this->mixer);
|
||||
this->mixer = NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
||||
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
||||
|
||||
return GST_STATE_SUCCESS;
|
||||
}
|
58
sys/oss/gstossmixerelement.h
Normal file
58
sys/oss/gstossmixerelement.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* OSS mixer interface element.
|
||||
* Copyright (C) 2005 Andrew Vander Wingo <wingo@pobox.com>
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GST_OSS_MIXER_ELEMENT_H__
|
||||
#define __GST_OSS_MIXER_ELEMENT_H__
|
||||
|
||||
|
||||
#include "gstossmixer.h"
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GST_OSS_MIXER_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OSS_MIXER_ELEMENT,GstOssMixerElement))
|
||||
#define GST_OSS_MIXER_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OSS_MIXER_ELEMENT,GstOssMixerElementClass))
|
||||
#define GST_IS_OSS_MIXER_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OSS_MIXER_ELEMENT))
|
||||
#define GST_IS_OSS_MIXER_ELEMENT_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OSS_MIXER_ELEMENT))
|
||||
#define GST_TYPE_OSS_MIXER_ELEMENT (gst_oss_mixer_element_get_type())
|
||||
|
||||
|
||||
typedef struct _GstOssMixerElement GstOssMixerElement;
|
||||
typedef struct _GstOssMixerElementClass GstOssMixerElementClass;
|
||||
|
||||
|
||||
struct _GstOssMixerElement {
|
||||
GstElement parent;
|
||||
|
||||
GstOssMixer *mixer;
|
||||
};
|
||||
|
||||
struct _GstOssMixerElementClass {
|
||||
GstElementClass parent;
|
||||
};
|
||||
|
||||
|
||||
GType gst_oss_mixer_element_get_type (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
#endif /* __GST_OSS_MIXER_ELEMENT_H__ */
|
Loading…
Reference in a new issue