summaryrefslogtreecommitdiffstats
path: root/sys/sunaudio
diff options
context:
space:
mode:
authorChristian Schaller <uraeus@gnome.org>2006-01-11 15:34:52 +0000
committerChristian Schaller <uraeus@gnome.org>2006-01-11 15:34:52 +0000
commitb08efa5f3e323c089e3417674bd14ac876d7e425 (patch)
tree3250f2d1264fc410a70997dd117bc44ed3620cf6 /sys/sunaudio
parent7c8d38fbc9fa7ffb7ee2dc40e7c298497ecd6355 (diff)
downloadgst-plugins-bad-b08efa5f3e323c089e3417674bd14ac876d7e425.tar.gz
gst-plugins-bad-b08efa5f3e323c089e3417674bd14ac876d7e425.tar.bz2
gst-plugins-bad-b08efa5f3e323c089e3417674bd14ac876d7e425.zip
remove old (broken) sunaudio plugin from bad as there is a new working one in -good
Original commit message from CVS: remove old (broken) sunaudio plugin from bad as there is a new working one in -good
Diffstat (limited to 'sys/sunaudio')
-rw-r--r--sys/sunaudio/Makefile.am16
-rw-r--r--sys/sunaudio/gstsunaudio.c457
-rw-r--r--sys/sunaudio/gstsunaudiosrc.c369
-rw-r--r--sys/sunaudio/gstsunaudiosrc.h74
-rw-r--r--sys/sunaudio/gstsunelement.c498
-rw-r--r--sys/sunaudio/gstsunelement.h63
-rw-r--r--sys/sunaudio/gstsunmixer.c306
-rw-r--r--sys/sunaudio/gstsunmixer.h43
8 files changed, 0 insertions, 1826 deletions
diff --git a/sys/sunaudio/Makefile.am b/sys/sunaudio/Makefile.am
deleted file mode 100644
index fff46318..00000000
--- a/sys/sunaudio/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-plugin_LTLIBRARIES = libgstsunaudio.la
-
-libgstsunaudio_la_SOURCES = gstsunaudio.c \
- gstsunaudiosrc.c \
- gstsunelement.c \
- gstsunmixer.c
-
-
-libgstsunaudio_la_CFLAGS = $(GST_CFLAGS)
-libgstsunaudio_la_LIBADD = $(top_builddir)/gst-libs/gst/libgstinterfaces-@GST_MAJORMINOR@.la
-libgstsunaudio_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-
-noinst_HEADERS = gstsunelement.h \
- gstsunaudiosrc.h \
- gstsunmixer.h
-
diff --git a/sys/sunaudio/gstsunaudio.c b/sys/sunaudio/gstsunaudio.c
deleted file mode 100644
index 945d797d..00000000
--- a/sys/sunaudio/gstsunaudio.c
+++ /dev/null
@@ -1,457 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) 2004 David A. Schleef <ds@schleef.org>
- *
- * 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.h>
-
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <sys/audioio.h>
-#include "gstsunelement.h"
-#include "gstsunmixer.h"
-#include "gstsunaudiosrc.h"
-
-
-#define GST_TYPE_SUNAUDIOSINK \
- (gst_gst_sunaudiosink_get_type())
-#define GST_SUNAUDIOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SUNAUDIOSINK,GstSunAudioSink))
-#define GST_SUNAUDIOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SUNAUDIOSINK,GstSunAudioSink))
-#define GST_IS_SUNAUDIOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SUNAUDIOSINK))
-#define GST_IS_SUNAUDIOSINK_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SUNAUDIOSINK))
-
-typedef struct _GstSunAudioSink GstSunAudioSink;
-typedef struct _GstSunAudioSinkClass GstSunAudioSinkClass;
-
-struct _GstSunAudioSink
-{
- GstElement element;
-
- GstPad *sinkpad;
-
- char *device;
- int fd;
- audio_device_t dev;
- audio_info_t info;
-
- int channels;
- int width;
- int rate;
- int buffer_size;
-};
-
-struct _GstSunAudioSinkClass
-{
- GstElementClass parent_class;
-};
-
-GType gst_gst_sunaudiosink_get_type (void);
-
-
-static GstElementDetails plugin_details = {
- "SunAudioSink",
- "Sink/Audio",
- "Audio sink for Sun Audio devices",
- "David A. Schleef <ds@schleef.org>",
-};
-
-/* Filter signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
- ARG_DEVICE,
- ARG_BUFFER_SIZE
-};
-
-static GstStaticPadTemplate gst_sunaudiosink_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16, "
- /* [5510,48000] seems to be a Solaris limit */
- "rate = (int) [ 5510, 48000 ], " "channels = (int) [ 1, 2 ]")
- );
-
-static void gst_sunaudiosink_base_init (gpointer g_class);
-static void gst_sunaudiosink_class_init (GstSunAudioSinkClass * klass);
-static void gst_sunaudiosink_init (GstSunAudioSink * filter);
-
-static GstCaps *gst_sunaudiosink_getcaps (GstPad * pad);
-static GstPadLinkReturn gst_sunaudiosink_pad_link (GstPad * pad,
- const GstCaps * caps);
-
-static void gst_sunaudiosink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_sunaudiosink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static gboolean gst_sunaudiosink_setparams (GstSunAudioSink * sunaudiosink);
-static void gst_sunaudiosink_chain (GstPad * pad, GstData * _data);
-static GstStateChangeReturn gst_sunaudiosink_change_state (GstElement *
- element);
-
-static GstElementClass *parent_class = NULL;
-
-typedef struct _GstFencedBuffer GstFencedBuffer;
-struct _GstFencedBuffer
-{
- GstBuffer buffer;
- void *region;
- unsigned int length;
-};
-
-GType
-gst_gst_sunaudiosink_get_type (void)
-{
- static GType plugin_type = 0;
-
- if (!plugin_type) {
- static const GTypeInfo plugin_info = {
- sizeof (GstSunAudioSinkClass),
- gst_sunaudiosink_base_init,
- NULL,
- (GClassInitFunc) gst_sunaudiosink_class_init,
- NULL,
- NULL,
- sizeof (GstSunAudioSink),
- 0,
- (GInstanceInitFunc) gst_sunaudiosink_init,
- };
-
- plugin_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstSunAudioSink", &plugin_info, 0);
- }
- return plugin_type;
-}
-
-static void
-gst_sunaudiosink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_sunaudiosink_sink_factory));
- gst_element_class_set_details (element_class, &plugin_details);
-}
-
-static void
-gst_sunaudiosink_class_init (GstSunAudioSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
- gobject_class->set_property = gst_sunaudiosink_set_property;
- gobject_class->get_property = gst_sunaudiosink_get_property;
-
- gstelement_class->change_state = gst_sunaudiosink_change_state;
-
- g_object_class_install_property (gobject_class, ARG_DEVICE,
- g_param_spec_string ("device", "Device", "Audio Device (/dev/audio)",
- "/dev/audio", G_PARAM_READWRITE));
- g_object_class_install_property (gobject_class, ARG_BUFFER_SIZE,
- g_param_spec_int ("buffer_size", "Buffer Size", "Buffer Size",
- 1, G_MAXINT, 64, G_PARAM_READWRITE));
-}
-
-static void
-gst_sunaudiosink_init (GstSunAudioSink * sunaudiosink)
-{
- const char *audiodev;
-
- sunaudiosink->sinkpad =
- gst_pad_new_from_template (gst_static_pad_template_get
- (&gst_sunaudiosink_sink_factory), "sink");
- gst_pad_set_getcaps_function (sunaudiosink->sinkpad,
- gst_sunaudiosink_getcaps);
- gst_pad_set_link_function (sunaudiosink->sinkpad, gst_sunaudiosink_pad_link);
-
- gst_element_add_pad (GST_ELEMENT (sunaudiosink), sunaudiosink->sinkpad);
- gst_pad_set_chain_function (sunaudiosink->sinkpad, gst_sunaudiosink_chain);
-
- sunaudiosink->buffer_size = 64;
-
- audiodev = g_getenv ("AUDIODEV");
- if (audiodev == NULL)
- audiodev = "/dev/audio";
- sunaudiosink->device = g_strdup (audiodev);
-}
-
-static GstCaps *
-gst_sunaudiosink_getcaps (GstPad * pad)
-{
- GstSunAudioSink *sunaudiosink = GST_SUNAUDIOSINK (gst_pad_get_parent (pad));
- GstCaps *caps;
-
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
- GST_DEBUG ("getcaps called on %" GST_PTR_FORMAT ", returning %"
- GST_PTR_FORMAT, pad, caps);
-
- return caps;
-}
-
-static GstPadLinkReturn
-gst_sunaudiosink_pad_link (GstPad * pad, const GstCaps * caps)
-{
- GstSunAudioSink *sunaudiosink = GST_SUNAUDIOSINK (gst_pad_get_parent (pad));
- GstPadLinkReturn ret;
- GstStructure *structure;
-
- structure = gst_caps_get_structure (caps, 0);
-
- gst_structure_get_int (structure, "rate", &sunaudiosink->rate);
- gst_structure_get_int (structure, "width", &sunaudiosink->width);
- gst_structure_get_int (structure, "channels", &sunaudiosink->channels);
-
- if (gst_sunaudiosink_setparams (sunaudiosink)) {
- ret = GST_PAD_LINK_OK;
- } else {
- ret = GST_PAD_LINK_REFUSED;
- }
- GST_DEBUG ("pad_link called on %" GST_PTR_FORMAT " with caps %"
- GST_PTR_FORMAT ", returning %d", pad, caps, ret);
-
- return ret;
-}
-
-static void
-gst_sunaudiosink_chain (GstPad * pad, GstData * data)
-{
- GstSunAudioSink *sunaudiosink = GST_SUNAUDIOSINK (gst_pad_get_parent (pad));
- GstBuffer *buffer = GST_BUFFER (data);
- int ret;
-
- if (GST_IS_EVENT (data)) {
- g_assert (0);
- } else {
- ret = write (sunaudiosink->fd, GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer));
- if (ret != GST_BUFFER_SIZE (buffer)) {
- GST_ELEMENT_ERROR (sunaudiosink, RESOURCE, WRITE, (NULL),
- ("%s", strerror (errno)));
- }
- }
-
- gst_data_unref (data);
-}
-
-static gboolean
-gst_sunaudiosink_setparams (GstSunAudioSink * sunaudiosink)
-{
- audio_info_t ainfo;
- int ret;
- int ports;
-
- ret = ioctl (sunaudiosink->fd, AUDIO_GETINFO, &ainfo);
- if (ret == -1) {
- GST_ELEMENT_ERROR (sunaudiosink, RESOURCE, SETTINGS, (NULL), ("%s",
- strerror (errno)));
- return FALSE;
- }
-
- ports = ainfo.play.port;
- if (!(ports & AUDIO_SPEAKER) && (ainfo.play.avail_ports & AUDIO_SPEAKER)) {
- ports = ports | AUDIO_SPEAKER;
- }
-
- AUDIO_INITINFO (&ainfo);
-
- ainfo.play.sample_rate = sunaudiosink->rate;
- ainfo.play.channels = sunaudiosink->channels;
- ainfo.play.precision = sunaudiosink->width;
- ainfo.play.encoding = AUDIO_ENCODING_LINEAR;
- ainfo.play.port = ports;
- ainfo.play.buffer_size = sunaudiosink->buffer_size;
- ainfo.output_muted = 0;
-
- ret = ioctl (sunaudiosink->fd, AUDIO_SETINFO, &ainfo);
- if (ret == -1) {
- GST_ELEMENT_ERROR (sunaudiosink, RESOURCE, SETTINGS, (NULL), ("%s",
- strerror (errno)));
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-gst_sunaudiosink_open (GstSunAudioSink * sunaudiosink)
-{
- int fd, ret;
-
- fd = open (sunaudiosink->device, O_WRONLY);
- if (fd == -1) {
- /* FIXME error */
- return FALSE;
- }
-
- sunaudiosink->fd = fd;
-
- ret = ioctl (fd, AUDIO_GETDEV, &sunaudiosink->dev);
- if (ret == -1) {
- GST_ELEMENT_ERROR (sunaudiosink, RESOURCE, SETTINGS, (NULL), ("%s",
- strerror (errno)));
- return FALSE;
- }
-
- GST_INFO ("name %s", sunaudiosink->dev.name);
- GST_INFO ("version %s", sunaudiosink->dev.version);
- GST_INFO ("config %s", sunaudiosink->dev.config);
-
- ret = ioctl (fd, AUDIO_GETINFO, &sunaudiosink->info);
- if (ret == -1) {
- GST_ELEMENT_ERROR (sunaudiosink, RESOURCE, SETTINGS, (NULL), ("%s",
- strerror (errno)));
- return FALSE;
- }
-
- GST_INFO ("monitor_gain %d", sunaudiosink->info.monitor_gain);
- GST_INFO ("output_muted %d", sunaudiosink->info.output_muted);
- GST_INFO ("hw_features %08x", sunaudiosink->info.hw_features);
- GST_INFO ("sw_features %08x", sunaudiosink->info.sw_features);
- GST_INFO ("sw_features_enabled %08x", sunaudiosink->info.sw_features_enabled);
-
- return TRUE;
-}
-
-static void
-gst_sunaudiosink_close (GstSunAudioSink * sunaudiosink)
-{
- close (sunaudiosink->fd);
-}
-
-static GstStateChangeReturn
-gst_sunaudiosink_change_state (GstElement * element, GstStateChange transition)
-{
- GstSunAudioSink *sunaudiosink = GST_SUNAUDIOSINK (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (!gst_sunaudiosink_open (sunaudiosink)) {
- return GST_STATE_CHANGE_FAILURE;
- }
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_sunaudiosink_close (sunaudiosink);
- break;
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-static void
-gst_sunaudiosink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstSunAudioSink *sunaudiosink;
-
- g_return_if_fail (GST_IS_SUNAUDIOSINK (object));
- sunaudiosink = GST_SUNAUDIOSINK (object);
-
- switch (prop_id) {
- case ARG_DEVICE:
- if (gst_element_get_state (GST_ELEMENT (sunaudiosink)) == GST_STATE_NULL) {
- g_free (sunaudiosink->device);
- sunaudiosink->device = g_strdup (g_value_get_string (value));
- }
- break;
- case ARG_BUFFER_SIZE:
- if (gst_element_get_state (GST_ELEMENT (sunaudiosink)) == GST_STATE_NULL) {
- sunaudiosink->buffer_size = g_value_get_int (value);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_sunaudiosink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstSunAudioSink *sunaudiosink;
-
- g_return_if_fail (GST_IS_SUNAUDIOSINK (object));
- sunaudiosink = GST_SUNAUDIOSINK (object);
-
- switch (prop_id) {
- case ARG_DEVICE:
- g_value_set_string (value, sunaudiosink->device);
- break;
- case ARG_BUFFER_SIZE:
- g_value_set_int (value, sunaudiosink->buffer_size);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "sunaudiosink", GST_RANK_NONE,
- GST_TYPE_SUNAUDIOSINK) ||
- !gst_element_register (plugin, "sunaudiomixer", GST_RANK_NONE,
- GST_TYPE_SUNAUDIOELEMENT) ||
- !gst_element_register (plugin, "sunaudiosrc", GST_RANK_NONE,
- GST_TYPE_SUNAUDIOSRC))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "sunaudio",
- "elements for SunAudio",
- plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/sys/sunaudio/gstsunaudiosrc.c b/sys/sunaudio/gstsunaudiosrc.c
deleted file mode 100644
index 6a54d2dc..00000000
--- a/sys/sunaudio/gstsunaudiosrc.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- *
- * gstsunaudiosrc.c:
- *
- * 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 <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/audioio.h>
-
-#include <gstsunaudiosrc.h>
-#include <gstsunelement.h>
-
-/* elementfactory information */
-static GstElementDetails gst_sunaudiosrc_details =
-GST_ELEMENT_DETAILS ("SunAudioSource",
- "Source/Audio",
- "Audio source for Sun Audio devices",
- "Balamurali Viswanathan <balamurali.viswanathan@wipro.com>");
-
-enum
-{
- ARG_0,
- ARG_DEVICE,
- ARG_BUFFER_SIZE
-};
-
-static GstStaticPadTemplate gst_sunaudiosrc_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 5510, 48000 ], " "channels = (int) [ 1, 2 ]")
- );
-
-static void gst_sunaudiosrc_base_init (gpointer g_class);
-static void gst_sunaudiosrc_class_init (GstSunAudioSrcClass * klass);
-static void gst_sunaudiosrc_init (GstSunAudioSrc * sunaudiosrc);
-
-static void gst_sunaudiosrc_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_sunaudiosrc_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstStateChangeReturn gst_sunaudiosrc_change_state (GstElement * element);
-
-static gboolean gst_sunaudiosrc_setparams (GstSunAudioSrc * sunaudiosrc);
-static GstData *gst_sunaudiosrc_get (GstPad * pad);
-static GstCaps *gst_sunaudiosrc_getcaps (GstPad * pad);
-static GstPadLinkReturn gst_sunaudiosrc_pad_link (GstPad * pad,
- const GstCaps * caps);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_sunaudiosrc_get_type (void)
-{
- static GType sunaudiosrc_type = 0;
-
- if (!sunaudiosrc_type) {
- static const GTypeInfo sunaudiosrc_info = {
- sizeof (GstSunAudioSrcClass),
- gst_sunaudiosrc_base_init,
- NULL,
- (GClassInitFunc) gst_sunaudiosrc_class_init,
- NULL,
- NULL,
- sizeof (GstSunAudioSrc),
- 0,
- (GInstanceInitFunc) gst_sunaudiosrc_init,
- };
-
- sunaudiosrc_type = g_type_register_static (GST_TYPE_SUNAUDIOELEMENT,
- "GstSunAudioSrc", &sunaudiosrc_info, 0);
- }
- return sunaudiosrc_type;
-}
-
-static void
-gst_sunaudiosrc_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gst_sunaudiosrc_details);
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_sunaudiosrc_src_factory));
-}
-
-static void
-gst_sunaudiosrc_class_init (GstSunAudioSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_ref (GST_TYPE_SUNAUDIOELEMENT);
-
- gobject_class->set_property = gst_sunaudiosrc_set_property;
- gobject_class->get_property = gst_sunaudiosrc_get_property;
-
- gstelement_class->change_state = gst_sunaudiosrc_change_state;
-
- g_object_class_install_property (gobject_class, ARG_DEVICE,
- g_param_spec_string ("device", "Device", "Audio Device (/dev/audio)",
- "/dev/audio", G_PARAM_READWRITE));
- g_object_class_install_property (gobject_class, ARG_BUFFER_SIZE,
- g_param_spec_int ("buffer_size", "Buffer Size", "Buffer Size",
- 1, G_MAXINT, 64, G_PARAM_READWRITE));
-
-}
-
-
-static void
-gst_sunaudiosrc_init (GstSunAudioSrc * sunaudiosrc)
-{
- const char *audiodev;
-
- sunaudiosrc->srcpad = gst_pad_new_from_template (gst_static_pad_template_get
- (&gst_sunaudiosrc_src_factory), "src");
-
- gst_pad_set_get_function (sunaudiosrc->srcpad, gst_sunaudiosrc_get);
- gst_pad_set_getcaps_function (sunaudiosrc->srcpad, gst_sunaudiosrc_getcaps);
- gst_pad_set_link_function (sunaudiosrc->srcpad, gst_sunaudiosrc_pad_link);
-
- gst_element_add_pad (GST_ELEMENT (sunaudiosrc), sunaudiosrc->srcpad);
-
- sunaudiosrc->buffer_size = 64;
-
- audiodev = g_getenv ("AUDIODEV");
- if (audiodev == NULL)
- audiodev = "/dev/audio";
- sunaudiosrc->device = g_strdup (audiodev);
-
-}
-
-static void
-gst_sunaudiosrc_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstSunAudioSrc *sunaudiosrc;
-
- g_return_if_fail (GST_IS_SUNAUDIOSRC (object));
- sunaudiosrc = GST_SUNAUDIOSRC (object);
-
- switch (prop_id) {
- case ARG_DEVICE:
- if (gst_element_get_state (GST_ELEMENT (sunaudiosrc)) == GST_STATE_NULL) {
- g_free (sunaudiosrc->device);
- sunaudiosrc->device = g_strdup (g_value_get_string (value));
- }
- break;
- case ARG_BUFFER_SIZE:
- if (gst_element_get_state (GST_ELEMENT (sunaudiosrc)) == GST_STATE_NULL) {
- sunaudiosrc->buffer_size = g_value_get_int (value);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_sunaudiosrc_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstSunAudioSrc *sunaudiosrc;
-
- g_return_if_fail (GST_IS_SUNAUDIOSRC (object));
- sunaudiosrc = GST_SUNAUDIOSRC (object);
-
- switch (prop_id) {
- case ARG_DEVICE:
- g_value_set_string (value, sunaudiosrc->device);
- break;
- case ARG_BUFFER_SIZE:
- g_value_set_int (value, sunaudiosrc->buffer_size);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_sunaudiosrc_change_state (GstElement * element, GstStateChange transition)
-{
- GstSunAudioSrc *sunaudiosrc = GST_SUNAUDIOSRC (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- return GST_STATE_CHANGE_SUCCESS;
-
-}
-
-static gboolean
-gst_sunaudiosrc_negotiate (GstPad * pad)
-{
- GstSunAudioSrc *sunaudiosrc;
- GstCaps *allowed;
-
- sunaudiosrc = GST_SUNAUDIOSRC (gst_pad_get_parent (pad));
-
- allowed = gst_pad_get_allowed_caps (pad);
-
- if (gst_pad_try_set_caps (sunaudiosrc->srcpad,
- gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, sunaudiosrc->width,
- "rate", G_TYPE_INT, sunaudiosrc->rate,
- "channels", G_TYPE_INT, sunaudiosrc->channels, NULL)) <= 0) {
- return FALSE;
- }
- return TRUE;
-}
-
-static GstData *
-gst_sunaudiosrc_get (GstPad * pad)
-{
- GstBuffer *buf;
- glong readbytes;
- glong readsamples;
- GstSunAudioSrc *sunaudiosrc = GST_SUNAUDIOSRC (gst_pad_get_parent (pad));
-
- buf = gst_buffer_new_and_alloc (sunaudiosrc->buffer_size);
-
- if (!GST_PAD_CAPS (pad)) {
- /* nothing was negotiated, we can decide on a format */
- if (!gst_sunaudiosrc_negotiate (pad)) {
- gst_buffer_unref (buf);
- GST_ELEMENT_ERROR (sunaudiosrc, CORE, NEGOTIATION, (NULL), (NULL));
- return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
- }
- }
-
- readbytes =
- read (GST_SUNAUDIOELEMENT (sunaudiosrc)->fd, GST_BUFFER_DATA (buf),
- sunaudiosrc->buffer_size);
-
- if (readbytes < 0) {
- gst_buffer_unref (buf);
- GST_ELEMENT_ERROR (sunaudiosrc, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
- return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
- }
-
- if (readbytes == 0) {
- gst_buffer_unref (buf);
- gst_element_set_eos (GST_ELEMENT (sunaudiosrc));
- return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
- }
-
- readsamples = readbytes * sunaudiosrc->rate;
-
- GST_BUFFER_SIZE (buf) = readbytes;
- GST_BUFFER_OFFSET (buf) = sunaudiosrc->curoffset;
- GST_BUFFER_OFFSET_END (buf) = sunaudiosrc->curoffset + readsamples;
- GST_BUFFER_DURATION (buf) = readsamples * GST_SECOND / sunaudiosrc->rate;
-
- GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
-
- sunaudiosrc->curoffset += readsamples;
-
- return GST_DATA (buf);
-}
-
-static GstCaps *
-gst_sunaudiosrc_getcaps (GstPad * pad)
-{
- GstSunAudioSrc *sunaudiosrc = GST_SUNAUDIOSRC (gst_pad_get_parent (pad));
- GstCaps *caps;
-
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
- GST_DEBUG ("getcaps called on %" GST_PTR_FORMAT ", returning %"
- GST_PTR_FORMAT, pad, caps);
-
- return caps;
-}
-
-static GstPadLinkReturn
-gst_sunaudiosrc_pad_link (GstPad * pad, const GstCaps * caps)
-{
- GstSunAudioSrc *sunaudiosrc = GST_SUNAUDIOSRC (gst_pad_get_parent (pad));
- GstPadLinkReturn ret;
- GstStructure *structure;
-
- structure = gst_caps_get_structure (caps, 0);
-
- gst_structure_get_int (structure, "rate", &sunaudiosrc->rate);
- gst_structure_get_int (structure, "width", &sunaudiosrc->width);
- gst_structure_get_int (structure, "channels", &sunaudiosrc->channels);
-
- if (gst_sunaudiosrc_setparams (sunaudiosrc)) {
- ret = GST_PAD_LINK_OK;
- } else {
- ret = GST_PAD_LINK_REFUSED;
- }
- GST_DEBUG ("pad_link called on %" GST_PTR_FORMAT " with caps %"
- GST_PTR_FORMAT ", returning %d", pad, caps, ret);
-
- return ret;
-}
-
-static gboolean
-gst_sunaudiosrc_setparams (GstSunAudioSrc * sunaudiosrc)
-{
- audio_info_t ainfo;
- int ret;
-
- AUDIO_INITINFO (&ainfo);
-
- ainfo.record.sample_rate = sunaudiosrc->rate;
- ainfo.record.channels = sunaudiosrc->channels;
- ainfo.record.precision = sunaudiosrc->width;
- ainfo.record.encoding = AUDIO_ENCODING_LINEAR;
- ainfo.record.port = AUDIO_MICROPHONE;
- ainfo.record.buffer_size = sunaudiosrc->buffer_size;
- /* ainfo.output_muted = 0; */
-
- ret = ioctl (GST_SUNAUDIOELEMENT (sunaudiosrc)->fd, AUDIO_SETINFO, &ainfo);
- if (ret == -1) {
- GST_ELEMENT_ERROR (sunaudiosrc, RESOURCE, SETTINGS, (NULL), ("%s",
- strerror (errno)));
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/sys/sunaudio/gstsunaudiosrc.h b/sys/sunaudio/gstsunaudiosrc.h
deleted file mode 100644
index b5546e1b..00000000
--- a/sys/sunaudio/gstsunaudiosrc.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- *
- * gstsunaudiosrc.h:
- *
- * 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_SUNAUDIO_SRC_H__
-#define __GST_SUNAUDIO_SRC_H__
-
-
-#include <gst/gst.h>
-#include "gstsunelement.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SUNAUDIOSRC \
- (gst_sunaudiosrc_get_type())
-#define GST_SUNAUDIOSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SUNAUDIOSRC,GstSunAudioSrc))
-#define GST_SUNAUDIOSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SUNAUDIOSRC,GstSunAudioSrcClass))
-#define GST_IS_SUNAUDIOSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SUNAUDIOSRC))
-#define GST_IS_SUNAUDIOSRC_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SUNAUDIOSRC))
-
-
-struct _GstSunAudioSrc {
- GstSunAudioElement element;
-
- GstPad *srcpad;
-
- char *device;
- int fd;
-
- audio_device_t dev;
- audio_info_t info;
-
- int rate;
- int width;
- int channels;
- int buffer_size;
-
- gulong curoffset;
-};
-
-struct _GstSunAudioSrcClass {
- GstSunAudioElementClass parent_class;
-};
-
-typedef struct _GstSunAudioSrc GstSunAudioSrc;
-typedef struct _GstSunAudioSrcClass GstSunAudioSrcClass;
-
-GType gst_sunaudiosrc_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_SUNAUDIO_SRC_H__ */
diff --git a/sys/sunaudio/gstsunelement.c b/sys/sunaudio/gstsunelement.c
deleted file mode 100644
index fbbd3e8e..00000000
--- a/sys/sunaudio/gstsunelement.c
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) 2004 David A. Schleef <ds@schleef.org>
- *
- * 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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-
-#include "gstsunelement.h"
-#include "gstsunmixer.h"
-
-#include <gst/propertyprobe/propertyprobe.h>
-
-enum
-{
- ARG_0,
- ARG_DEVICE,
- ARG_MIXERDEV,
- ARG_DEVICE_NAME,
-};
-
-/* elementfactory information */
-static GstElementDetails gst_sunaudioelement_details =
-GST_ELEMENT_DETAILS ("SunAudioMixer",
- "Generic/Audio",
- "Audio mixer for Sun Audio devices",
- "Balamurali Viswanathan <balamurali.viswanathan@wipro.com>");
-
-static void gst_sunaudioelement_base_init (GstSunAudioElementClass * klass);
-static void gst_sunaudioelement_class_init (GstSunAudioElementClass * klass);
-
-static void gst_sunaudioprobe_interface_init (GstPropertyProbeInterface *
- iface);
-static void gst_sunaudioelement_init (GstSunAudioElement * sunaudio);
-static void gst_sunaudioelement_dispose (GObject * object);
-
-static void gst_sunaudioelement_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-
-static void gst_sunaudioelement_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static GstStateChangeReturn gst_sunaudioelement_change_state (GstElement *
- element);
-
-static GstElementClass *parent_class = NULL;
-
-static gboolean gst_sunaudioelement_open_audio (GstSunAudioElement * sunaudio);
-static gboolean gst_sunaudioelement_close_audio (GstSunAudioElement * sunaudio);
-void gst_sunaudioelement_reset (GstSunAudioElement * sunaudio);
-
-GType
-gst_sunaudioelement_get_type (void)
-{
- static GType sunaudioelement_type = 0;
-
- if (!sunaudioelement_type) {
- static const GTypeInfo sunaudioelement_info = {
- sizeof (GstSunAudioElementClass),
- (GBaseInitFunc) gst_sunaudioelement_base_init,
- NULL,
- (GClassInitFunc) gst_sunaudioelement_class_init,
- NULL,
- NULL,
- sizeof (GstSunAudioElement),
- 0,
- (GInstanceInitFunc) gst_sunaudioelement_init
- };
- static const GInterfaceInfo sunaudioiface_info = {
- (GInterfaceInitFunc) gst_sunaudio_interface_init,
- NULL,
- NULL
- };
- static const GInterfaceInfo sunaudiomixer_info = {
- (GInterfaceInitFunc) gst_sunaudiomixer_interface_init,
- NULL,
- NULL
- };
- static const GInterfaceInfo sunaudioprobe_info = {
- (GInterfaceInitFunc) gst_sunaudioprobe_interface_init,
- NULL,
- NULL
- };
-
- sunaudioelement_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstSunAudioElement", &sunaudioelement_info, 0);
- g_type_add_interface_static (sunaudioelement_type,
- GST_TYPE_IMPLEMENTS_INTERFACE, &sunaudioiface_info);
- g_type_add_interface_static (sunaudioelement_type,
- GST_TYPE_MIXER, &sunaudiomixer_info);
- g_type_add_interface_static (sunaudioelement_type,
- GST_TYPE_PROPERTY_PROBE, &sunaudioprobe_info);
- }
-
- return sunaudioelement_type;
-}
-
-static void
-gst_sunaudioelement_base_init (GstSunAudioElementClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- klass->device_combinations = NULL;
-
- gst_element_class_set_details (element_class, &gst_sunaudioelement_details);
-}
-
-static void
-gst_sunaudioelement_class_init (GstSunAudioElementClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEVICE,
- g_param_spec_string ("device", "Device",
- "SunAudio device (/dev/audioctl usually)", "default",
- G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MIXERDEV,
- g_param_spec_string ("mixerdev", "Mixer device",
- "SunAudio mixer device (/dev/audioctl usually)", "default",
- G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEVICE_NAME,
- g_param_spec_string ("device_name", "Device name", "Name of the device",
- NULL, G_PARAM_READABLE));
-
- gobject_class->set_property = gst_sunaudioelement_set_property;
- gobject_class->get_property = gst_sunaudioelement_get_property;
- gobject_class->dispose = gst_sunaudioelement_dispose;
-
- gstelement_class->change_state = gst_sunaudioelement_change_state;
-}
-
-static GList *
-device_combination_append (GList * device_combinations,
- GstSunAudioDeviceCombination * combi)
-{
- GList *it;
-
- for (it = device_combinations; it != NULL; it = it->next) {
- GstSunAudioDeviceCombination *cur;
-
- cur = (GstSunAudioDeviceCombination *) it->data;
- if (cur->dev == combi->dev) {
- return device_combinations;
- }
- }
-
- return g_list_append (device_combinations, combi);
-}
-
-static gboolean
-gst_sunaudioelement_class_probe_devices (GstSunAudioElementClass * klass,
- gboolean check)
-{
- GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
- gint openmode = O_RDONLY;
- GList *padtempllist;
- static GList *device_combinations;
- static gboolean init = FALSE;
- int fd;
-
- padtempllist = gst_element_class_get_pad_template_list (eklass);
- if (padtempllist != NULL) {
- GstPadTemplate *firstpadtempl = padtempllist->data;
-
- if (GST_PAD_TEMPLATE_DIRECTION (firstpadtempl) == GST_PAD_SINK) {
- openmode = O_WRONLY;
- }
- }
-
-
- if (!init && !check) {
- if ((fd = open ("/dev/audioctl", openmode | O_NONBLOCK)) > 0
- || errno == EBUSY) {
- GstSunAudioDeviceCombination *combi;
-
- if (fd > 0)
- close (fd);
-
- combi = g_new0 (GstSunAudioDeviceCombination, 1);
- combi->mixer = g_strdup ("/dev/audioctl");
- device_combinations =
- device_combination_append (device_combinations, combi);
- }
- init = TRUE;
- }
-
- klass->device_combinations = device_combinations;
-
- return init;
-}
-
-static void
-gst_sunaudioprobe_probe_property (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- GstSunAudioElementClass *klass = GST_SUNAUDIOELEMENT_GET_CLASS (probe);
-
- switch (prop_id) {
- case ARG_DEVICE:
- gst_sunaudioelement_class_probe_devices (klass, FALSE);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-gst_sunaudioprobe_needs_probe (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- GstSunAudioElementClass *klass = GST_SUNAUDIOELEMENT_GET_CLASS (probe);
- gboolean ret = FALSE;
-
- switch (prop_id) {
- case ARG_DEVICE:
- ret = !gst_sunaudioelement_class_probe_devices (klass, TRUE);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-
- return ret;
-}
-
-static const GList *
-gst_sunaudioprobe_get_properties (GstPropertyProbe * probe)
-{
- GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
- static GList *list = NULL;
-
- if (!list) {
- list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
- }
-
- return list;
-}
-
-static GValueArray *
-gst_sunaudioelement_class_list_devices (GstSunAudioElementClass * klass)
-{
- GValueArray *array;
- GValue value = { 0 };
- GList *item;
-
- if (!klass->device_combinations) {
- return NULL;
- }
-
- array = g_value_array_new (g_list_length (klass->device_combinations));
- item = klass->device_combinations;
- g_value_init (&value, G_TYPE_STRING);
- while (item) {
- GstSunAudioDeviceCombination *combi = item->data;
-
- g_value_set_string (&value, combi->mixer);
- g_value_array_append (array, &value);
-
- item = item->next;
- }
- g_value_unset (&value);
-
- return array;
-}
-
-static GValueArray *
-gst_sunaudioprobe_get_values (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- GstSunAudioElementClass *klass = GST_SUNAUDIOELEMENT_GET_CLASS (probe);
- GValueArray *array = NULL;
-
- switch (prop_id) {
- case ARG_DEVICE:
- array = gst_sunaudioelement_class_list_devices (klass);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-
- return array;
-}
-
-static void
-gst_sunaudioprobe_interface_init (GstPropertyProbeInterface * iface)
-{
- iface->get_properties = gst_sunaudioprobe_get_properties;
- iface->probe_property = gst_sunaudioprobe_probe_property;
- iface->needs_probe = gst_sunaudioprobe_needs_probe;
- iface->get_values = gst_sunaudioprobe_get_values;
-}
-
-static void
-gst_sunaudioelement_init (GstSunAudioElement * sunaudio)
-{
- sunaudio->device = g_strdup ("/dev/audio");
- sunaudio->mixer_dev = g_strdup ("/dev/audioctl");
- sunaudio->fd = -1;
- sunaudio->mixer_fd = -1;
- sunaudio->tracklist = NULL;
- sunaudio->device_name = NULL;
-
- gst_sunaudioelement_reset (sunaudio);
-}
-
-void
-gst_sunaudioelement_reset (GstSunAudioElement * sunaudio)
-{
- return;
-}
-
-static void
-gst_sunaudioelement_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstSunAudioElement *sunaudio = GST_SUNAUDIOELEMENT (object);
-
- switch (prop_id) {
- case ARG_DEVICE:
- if (gst_element_get_state (GST_ELEMENT (sunaudio)) == GST_STATE_NULL) {
- g_free (sunaudio->device);
- sunaudio->device = g_strdup (g_value_get_string (value));
-
- if (GST_SUNAUDIOELEMENT_GET_CLASS (sunaudio)->device_combinations !=
- NULL) {
- GList *list =
- GST_SUNAUDIOELEMENT_GET_CLASS (sunaudio)->device_combinations;
-
- while (list) {
- GstSunAudioDeviceCombination *combi = list->data;
-
- if (!strcmp (combi->mixer, sunaudio->device)) {
- g_free (sunaudio->mixer_dev);
- sunaudio->mixer_dev = g_strdup (combi->mixer);
- break;
- }
-
- list = list->next;
- }
- }
- }
- break;
- case ARG_MIXERDEV:
- if (gst_element_get_state (GST_ELEMENT (sunaudio)) == GST_STATE_NULL) {
- g_free (sunaudio->mixer_dev);
- sunaudio->mixer_dev = g_strdup (g_value_get_string (value));
- }
- break;
- default:
- break;
- }
-}
-
-static void
-gst_sunaudioelement_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstSunAudioElement *sunaudio = GST_SUNAUDIOELEMENT (object);
-
- switch (prop_id) {
- case ARG_DEVICE:
- g_value_set_string (value, sunaudio->device);
- break;
- case ARG_MIXERDEV:
- g_value_set_string (value, sunaudio->mixer_dev);
- break;
- case ARG_DEVICE_NAME:
- g_value_set_string (value, sunaudio->device_name);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_sunaudioelement_dispose (GObject * object)
-{
- GstSunAudioElement *sunaudio = (GstSunAudioElement *) object;
-
- g_free (sunaudio->device);
- g_free (sunaudio->mixer_dev);
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static GstStateChangeReturn
-gst_sunaudioelement_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstSunAudioElement *sunaudio = GST_SUNAUDIOELEMENT (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (!gst_sunaudioelement_open_audio (sunaudio)) {
- return GST_STATE_CHANGE_FAILURE;
- }
- GST_INFO ("opened sound device");
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_sunaudioelement_close_audio (sunaudio);
- gst_sunaudioelement_reset (sunaudio);
- GST_INFO ("closed sound device");
- break;
- default:
- break;
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-static gboolean
-gst_sunaudioelement_open_audio (GstSunAudioElement * sunaudio)
-{
- gint caps;
- GstSunAudioOpenMode mode = GST_SUNAUDIOELEMENT_READ;
- const GList *padlist;
-
- g_return_val_if_fail (sunaudio->fd == -1, FALSE);
-
- padlist = gst_element_get_pad_list (GST_ELEMENT (sunaudio));
-
- if (padlist != NULL) {
- GstPad *firstpad = padlist->data;
-
- if (GST_PAD_IS_SINK (firstpad)) {
- mode = GST_SUNAUDIOELEMENT_WRITE;
- }
- }
-
- if (mode == GST_SUNAUDIOELEMENT_WRITE) {
- sunaudio->fd = open (sunaudio->device, O_WRONLY | O_NONBLOCK);
-
- if (sunaudio->fd >= 0) {
- close (sunaudio->fd);
-
- sunaudio->fd = open (sunaudio->device, O_WRONLY);
- }
- } else {
- sunaudio->fd = open (sunaudio->device, O_RDONLY);
- }
-
- if (sunaudio->fd < 0) {
- switch (errno) {
- default:
- printf ("could not open device\n");
- }
- return FALSE;
- }
-
- sunaudio->mode = mode;
- gst_sunaudiomixer_build_list (sunaudio);
- return TRUE;
-
-}
-
-static gboolean
-gst_sunaudioelement_close_audio (GstSunAudioElement * sunaudio)
-{
- close (sunaudio->fd);
- sunaudio->fd = -1;
-}
diff --git a/sys/sunaudio/gstsunelement.h b/sys/sunaudio/gstsunelement.h
deleted file mode 100644
index 86d5ca93..00000000
--- a/sys/sunaudio/gstsunelement.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef __GST_SUNAUDIO_ELEMENT_H__
-#define __GST_SUNAUDIO_ELEMENT_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SUNAUDIOELEMENT \
- (gst_sunaudioelement_get_type())
-#define GST_SUNAUDIOELEMENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SUNAUDIOELEMENT,GstSunAudioElement))
-#define GST_SUNAUDIOELEMENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SUNAUDIOELEMENT,GstSunAudioElementClass))
-#define GST_IS_SUNAUDIOELEMENT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SUNAUDIOELEMENT))
-#define GST_IS_SUNAUDIOELEMENT_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SUNAUDIOELEMENT))
-#define GST_SUNAUDIOELEMENT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_SUNAUDIOELEMENT, GstSunAudioElementClass))
-
-typedef enum {
- GST_SUNAUDIOELEMENT_READ,
- GST_SUNAUDIOELEMENT_WRITE,
-} GstSunAudioOpenMode;
-
-
-struct _GstSunAudioElement
-{
- /* yes, we're a gstelement too */
- GstElement parent;
-
- gchar *device,
- *mixer_dev;
-
- /* device state */
- int fd;
- GstSunAudioOpenMode mode;
-
- /* mixer stuff */
- GList *tracklist;
- gint mixer_fd;
- gchar *device_name;
-};
-
-struct _GstSunAudioElementClass {
- GstElementClass klass;
-
- GList *device_combinations;
-};
-
-typedef struct _GstSunAudioDeviceCombination {
- gchar *mixer;
- dev_t dev;
-} GstSunAudioDeviceCombination;
-
-typedef struct _GstSunAudioElement GstSunAudioElement;
-typedef struct _GstSunAudioElementClass GstSunAudioElementClass;
-
-GType gst_sunaudioelement_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/sys/sunaudio/gstsunmixer.c b/sys/sunaudio/gstsunmixer.c
deleted file mode 100644
index 29135858..00000000
--- a/sys/sunaudio/gstsunmixer.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) 2004 David A. Schleef <ds@schleef.org>
- *
- * 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>
-#include <sys/audioio.h>
-
-#include "gst/gst-i18n-plugin.h"
-#include "gstsunmixer.h"
-
-static void gst_sunaudiomixer_track_class_init (GstSunAudioMixerTrackClass *
- klass);
-static void gst_sunaudiomixer_track_init (GstSunAudioMixerTrack * track);
-
-static gboolean gst_sunaudiomixer_supported (GstImplementsInterface * iface,
- GType iface_type);
-static const GList *gst_sunaudiomixer_list_tracks (GstMixer * sunaudiomixer);
-static void gst_sunaudiomixer_set_volume (GstMixer * sunaudiomixer,
- GstMixerTrack * track, gint * volumes);
-static void gst_sunaudiomixer_get_volume (GstMixer * sunaudiomixer,
- GstMixerTrack * track, gint * volumes);
-static void gst_sunaudiomixer_set_mute (GstMixer * sunaudiomixer,
- GstMixerTrack * track, gboolean mute);
-static void gst_sunaudiomixer_set_record (GstMixer * sunaudiomixer,
- GstMixerTrack * track, gboolean record);
-
-#define MIXER_DEVICES 3
-#define SCALE_FACTOR 2.55 /* 255/100 */
-static gchar **labels = NULL;
-static GstMixerTrackClass *parent_class = NULL;
-
-GType
-gst_sunaudiomixer_track_get_type (void)
-{
- static GType gst_sunaudiomixer_track_type = 0;
-
- if (!gst_sunaudiomixer_track_type) {
- static const GTypeInfo sunaudiomixer_track_info = {
- sizeof (GstSunAudioMixerTrackClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_sunaudiomixer_track_class_init,
- NULL,
- NULL,
- sizeof (GstSunAudioMixerTrack),
- 0,
- (GInstanceInitFunc) gst_sunaudiomixer_track_init,
- NULL
- };
-
- gst_sunaudiomixer_track_type = g_type_register_static (GST_TYPE_MIXER_TRACK,
- "GstSunAudioMixerTrack", &sunaudiomixer_track_info, 0);
-
- }
-
- return gst_sunaudiomixer_track_type;
-}
-
-static void
-gst_sunaudiomixer_track_class_init (GstSunAudioMixerTrackClass * klass)
-{
- parent_class = g_type_class_ref (GST_TYPE_MIXER_TRACK);
-}
-
-static void
-gst_sunaudiomixer_track_init (GstSunAudioMixerTrack * track)
-{
- track->lvol = track->rvol = 0;
- track->track_num = 0;
-}
-
-void
-gst_sunaudio_interface_init (GstImplementsInterfaceClass * klass)
-{
- /* default virtual functions */
- klass->supported = gst_sunaudiomixer_supported;
-}
-
-static gboolean
-gst_sunaudiomixer_supported (GstImplementsInterface * iface, GType iface_type)
-{
- g_assert (iface_type == GST_TYPE_MIXER);
-
- return (GST_SUNAUDIOELEMENT (iface)->mixer_fd != -1);
-}
-
-void
-gst_sunaudiomixer_interface_init (GstMixerClass * klass)
-{
- GST_MIXER_TYPE (klass) = GST_MIXER_HARDWARE;
-
- klass->list_tracks = gst_sunaudiomixer_list_tracks;
- klass->set_volume = gst_sunaudiomixer_set_volume;
- klass->get_volume = gst_sunaudiomixer_get_volume;
- klass->set_mute = gst_sunaudiomixer_set_mute;
- klass->set_record = gst_sunaudiomixer_set_record;
-}
-
-static void
-fill_labels (void)
-{
- int i;
- struct
- {
- gchar *given, *wanted;
- }
- cases[] = {
- {
- "Vol ", N_("Volume")}
- , {
- "Gain ", N_("Gain")}
- , {
- "Mon ", N_("Monitor")}
- , {
- NULL, NULL}
- };
-
- labels = g_malloc (sizeof (gchar *) * MIXER_DEVICES);
-
- for (i = 0; i < MIXER_DEVICES; i++) {
- labels[i] = g_strdup (cases[i].wanted);
- }
-}
-
-GstMixerTrack *
-gst_sunaudiomixer_track_new (GstSunAudioElement * sunaudio,
- gint track_num, gint max_chans, gint flags)
-{
- GstSunAudioMixerTrack *sunaudiotrack;
- GstMixerTrack *track;
- gint volume;
-
- if (!labels)
- fill_labels ();
-
- sunaudiotrack = g_object_new (GST_TYPE_SUNAUDIOMIXER_TRACK, NULL);
- track = GST_MIXER_TRACK (sunaudiotrack);
- track->label = g_strdup (labels[track_num]);
- track->num_channels = max_chans;
- track->flags = flags;
- track->min_volume = 0;
- track->max_volume = 100;
- sunaudiotrack->track_num = track_num;
-
- sunaudiotrack->lvol = (0 & 0xff);
-
- return track;
-}
-
-void
-gst_sunaudiomixer_build_list (GstSunAudioElement * sunaudio)
-{
- GstMixerTrack *track;
-
- sunaudio->mixer_fd = open (sunaudio->mixer_dev, O_RDWR);
-
- if (sunaudio->mixer_fd == -1) {
- return;
- }
-
- sunaudio->device_name = g_strdup ("Unknown");
-
- track = gst_sunaudiomixer_track_new (sunaudio, 0, 1, GST_MIXER_TRACK_OUTPUT);
- sunaudio->tracklist = g_list_append (sunaudio->tracklist, track);
- track = gst_sunaudiomixer_track_new (sunaudio, 1, 1, 0);
- sunaudio->tracklist = g_list_append (sunaudio->tracklist, track);
- track = gst_sunaudiomixer_track_new (sunaudio, 2, 1, 0);
- sunaudio->tracklist = g_list_append (sunaudio->tracklist, track);
-}
-
-static const GList *
-gst_sunaudiomixer_list_tracks (GstMixer * mixer)
-{
- return (const GList *) GST_SUNAUDIOELEMENT (mixer)->tracklist;
-}
-
-static void
-gst_sunaudiomixer_set_volume (GstMixer * mixer,
- GstMixerTrack * track, gint * volumes)
-{
- gint volume;
- gchar buf[100];
- struct audio_info audioinfo;
- GstSunAudioElement *sunaudio = GST_SUNAUDIOELEMENT (mixer);
- GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIOMIXER_TRACK (track);
-
- g_return_if_fail (sunaudio->mixer_fd != -1);
-
- volume = volumes[0] * SCALE_FACTOR + 0.5;
-
- /* Set the volume */
- AUDIO_INITINFO (&audioinfo);
-
- switch (sunaudiotrack->track_num) {
- case 0:
- audioinfo.play.gain = volume;
- break;
- case 1:
- audioinfo.record.gain = volume;
- break;
- case 2:
- audioinfo.monitor_gain = volume;
- break;
- }
-
-
- if (ioctl (sunaudio->mixer_fd, AUDIO_SETINFO, &audioinfo) < 0) {
- g_warning ("Error setting volume");
- return;
- }
-}
-
-static void
-gst_sunaudiomixer_get_volume (GstMixer * mixer,
- GstMixerTrack * track, gint * volumes)
-{
- gint volume;
- struct audio_info audioinfo;
- GstSunAudioElement *sunaudio = GST_SUNAUDIOELEMENT (mixer);
- GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIOMIXER_TRACK (track);
-
- g_return_if_fail (sunaudio->mixer_fd != -1);
-
- if (ioctl (sunaudio->mixer_fd, AUDIO_GETINFO, &audioinfo) < 0) {
- g_warning ("Error setting volume device");
- return;
- }
-
- switch (sunaudiotrack->track_num) {
- case 0:
- sunaudiotrack->lvol = volumes[0] =
- (audioinfo.play.gain / SCALE_FACTOR) + 0.5;
- break;
- case 1:
- sunaudiotrack->lvol = volumes[0] =
- (audioinfo.record.gain / SCALE_FACTOR) + 0.5;
- break;
- case 2:
- sunaudiotrack->lvol = volumes[0] =
- (audioinfo.monitor_gain / SCALE_FACTOR) + 0.5;
- break;
- }
-
-}
-
-static void
-gst_sunaudiomixer_set_mute (GstMixer * mixer,
- GstMixerTrack * track, gboolean mute)
-{
- struct audio_info audioinfo;
- GstSunAudioElement *sunaudio = GST_SUNAUDIOELEMENT (mixer);
- GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIOMIXER_TRACK (track);
-
- g_return_if_fail (sunaudio->mixer_fd != -1);
- if (sunaudiotrack->track_num != 0)
- return;
-
- AUDIO_INITINFO (&audioinfo);
-
- if (mute) {
- audioinfo.output_muted = 1;
- } else {
- audioinfo.output_muted = 0;
- }
-
- if (ioctl (sunaudio->mixer_fd, AUDIO_SETINFO, &audioinfo) < 0) {
- g_warning ("Error setting volume device");
- return;
- }
-}
-
-static void
-gst_sunaudiomixer_set_record (GstMixer * mixer,
- GstMixerTrack * track, gboolean record)
-{
-
- /* Implementation Pending */
-
-}
diff --git a/sys/sunaudio/gstsunmixer.h b/sys/sunaudio/gstsunmixer.h
deleted file mode 100644
index dd3a7f7e..00000000
--- a/sys/sunaudio/gstsunmixer.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef __GST_SUNAUDIO_MIXER_H
-#define __GST_SUNAUDIO_MIXER_H
-
-#include <gst/gst.h>
-#include <gst/mixer/mixer.h>
-#include "gstsunelement.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SUNAUDIOMIXER_TRACK \
- (gst_sunaudiomixer_track_get_type ())
-#define GST_SUNAUDIOMIXER_TRACK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SUNAUDIOMIXER_TRACK, \
- GstSunAudioMixerTrack))
-#define GST_SUNAUDIOMIXER_TRACK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SUNAUDIOMIXER_TRACK, \
- GstSunAudioMixerTrackClass))
-#define GST_IS_SUNAUDIOMIXER_TRACK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SUNAUDIOMIXER_TRACK))
-#define GST_IS_SUNAUDIOMIXER_TRACK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SUNAUDIOMIXER_TRACK))
-
-typedef struct _GstSunAudioMixerTrack {
- GstMixerTrack parent;
-
- gint lvol, rvol;
- gint track_num;
-} GstSunAudioMixerTrack;
-
-typedef struct _GstSunAudioMixerTrackClass {
- GstMixerTrackClass parent;
-} GstSunAudioMixerTrackClass;
-
-GType gst_sunaudiomixer_track_get_type (void);
-
-void gst_sunaudiomixer_interface_init (GstMixerClass *klass);
-void gst_sunaudio_interface_init (GstImplementsInterfaceClass *klass);
-void gst_sunaudiomixer_build_list (GstSunAudioElement *sunaudio);
-void gst_sunaudiomixer_free_list (GstSunAudioElement *sunaudio);
-
-G_END_DECLS
-
-#endif