1 /* GStreamer PCM/A-Law conversions
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Library General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
12 *
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22 #include "mulaw-encode.h"
23 #include "mulaw-decode.h"
24
25 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
26 #define INT_FORMAT "S16LE"
27 #else
28 #define INT_FORMAT "S16BE"
29 #endif
30
31 GstStaticPadTemplate mulaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
32 GST_PAD_SRC,
33 GST_PAD_ALWAYS,
34 GST_STATIC_CAPS ("audio/x-raw, "
35 "format = (string) " INT_FORMAT ", "
36 "layout = (string) interleaved, "
37 "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]")
38 );
39
40 GstStaticPadTemplate mulaw_dec_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
41 GST_PAD_SINK,
42 GST_PAD_ALWAYS,
43 GST_STATIC_CAPS ("audio/x-mulaw, "
44 "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]")
45 );
46
47 GstStaticPadTemplate mulaw_enc_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
48 GST_PAD_SINK,
49 GST_PAD_ALWAYS,
50 GST_STATIC_CAPS ("audio/x-raw, "
51 "format = (string) " INT_FORMAT ", "
52 "layout = (string) interleaved, "
53 "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]")
54 );
55
56 GstStaticPadTemplate mulaw_enc_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
57 GST_PAD_SRC,
58 GST_PAD_ALWAYS,
59 GST_STATIC_CAPS ("audio/x-mulaw, "
60 "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]")
61 );
62
63 static gboolean
plugin_init(GstPlugin * plugin)64 plugin_init (GstPlugin * plugin)
65 {
66 if (!gst_element_register (plugin, "mulawenc",
67 GST_RANK_PRIMARY, GST_TYPE_MULAWENC) ||
68 !gst_element_register (plugin, "mulawdec",
69 GST_RANK_PRIMARY, GST_TYPE_MULAWDEC))
70 return FALSE;
71
72 return TRUE;
73 }
74
75 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
76 GST_VERSION_MINOR,
77 mulaw,
78 "MuLaw audio conversion routines",
79 plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
80