1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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 <string.h>
#include <math.h>
#ifdef HAVE_OSS_INCLUDE_IN_SYS
#include <sys/soundcard.h>
#else
#ifdef HAVE_OSS_INCLUDE_IN_ROOT
#include <soundcard.h>
#else
#include <machine/soundcard.h>
#endif /* HAVE_OSS_INCLUDE_IN_ROOT */
#endif /* HAVE_OSS_INCLUDE_IN_SYS */
/*#define DEBUG_ENABLED */
#include "gst_arts.h"
#include "gst_artsio_impl.h"
/* elementfactory information */
static GstElementDetails gst_arts_details = {
"aRts plugin",
"Filter/Audio",
"aRts wrapper filter",
"Erik Walthinsen <omega@temple-baptist.com,\n"
"Stefan Westerfeld <stefan@space.twc.de>",
};
static GstStaticPadTemplate sink_temp = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"depth = (int) 16, "
"width = (int) 16, "
"signed = (boolean) true, "
"channels = (int) 2, " "endianness = (int) byte_order")
);
static GstStaticPadTemplate src_temp = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"depth = (int) 16, "
"width = (int) 16, "
"signed = (boolean) true, "
"channels = (int) 2, "
"rate = (int) 44100, " "endianness = (int) byte_order")
);
enum
{
ARG_0,
ARG_LAST
};
static void gst_arts_base_init (gpointer g_class);
static void gst_arts_class_init (GstARTSClass * klass);
static void gst_arts_init (GstARTS * arts);
static void gst_arts_loop (GstElement * element);
static GstElementClass *parent_class = NULL;
/*static guint gst_arts_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_arts_get_type (void)
{
static GType gst_arts_type = 0;
if (!gst_arts_type) {
static const GTypeInfo gst_arts_info = {
sizeof (GstARTSClass),
gst_arts_base_init,
NULL,
(GClassInitFunc) gst_arts_class_init,
NULL,
NULL,
sizeof (GstARTS),
0,
(GInstanceInitFunc) gst_arts_init,
};
gst_arts_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstArts", &gst_arts_info, 0);
}
return gst_arts_type;
}
static void
gst_arts_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 (&sink_temp));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_temp));
gst_element_class_set_details (element_class, &gst_arts_details);
}
static void
gst_arts_class_init (GstARTSClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
}
static void
gst_arts_init (GstARTS * arts)
{
arts->sinkpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
(arts), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (arts), arts->sinkpad);
arts->srcpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
(arts), "src"), "src");
gst_element_add_pad (GST_ELEMENT (arts), arts->srcpad);
gst_element_set_loop_function (GST_ELEMENT (arts), gst_arts_loop);
arts->wrapper = gst_arts_wrapper_new (arts->sinkpad, arts->srcpad);
}
static void
gst_arts_loop (GstElement * element)
{
GstARTS *arts = (GstARTS *) element;
g_return_if_fail (arts != NULL);
gst_arts_wrapper_do (arts->wrapper);
}
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "gstarts", GST_RANK_NONE, GST_TYPE_ARTS))
return FALSE;
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"gst_arts",
"arTs filter wrapper",
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|