Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / gst / law / alaw.c
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., 59 Temple Place - Suite 330,
16  * Boston, MA 02111-1307, USA.
17  */
18
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22
23 #include "alaw-encode.h"
24 #include "alaw-decode.h"
25
26 GstStaticPadTemplate alaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
27     GST_PAD_SRC,
28     GST_PAD_ALWAYS,
29     GST_STATIC_CAPS ("audio/x-raw-int, "
30         "rate = (int) [ 8000, 192000 ], "
31         "channels = (int) [ 1, 2 ], "
32         "endianness = (int) BYTE_ORDER, "
33         "width = (int) 16, " "depth = (int) 16, " "signed = (boolean) True")
34     );
35
36 GstStaticPadTemplate alaw_dec_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
37     GST_PAD_SINK,
38     GST_PAD_ALWAYS,
39     GST_STATIC_CAPS ("audio/x-alaw, "
40         "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]")
41     );
42
43 GstStaticPadTemplate alaw_enc_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
44     GST_PAD_SINK,
45     GST_PAD_ALWAYS,
46     GST_STATIC_CAPS ("audio/x-raw-int, "
47         "rate = (int) [ 8000, 192000 ], "
48         "channels = (int) [ 1, 2 ], "
49         "endianness = (int) BYTE_ORDER, "
50         "width = (int) 16, " "depth = (int) 16, " "signed = (boolean) True")
51     );
52
53 GstStaticPadTemplate alaw_enc_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
54     GST_PAD_SRC,
55     GST_PAD_ALWAYS,
56     GST_STATIC_CAPS ("audio/x-alaw, "
57         "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]")
58     );
59
60 static gboolean
61 plugin_init (GstPlugin * plugin)
62 {
63   if (!gst_element_register (plugin, "alawenc",
64           GST_RANK_PRIMARY, GST_TYPE_ALAW_ENC) ||
65       !gst_element_register (plugin, "alawdec",
66           GST_RANK_PRIMARY, GST_TYPE_ALAW_DEC))
67     return FALSE;
68
69   return TRUE;
70 }
71
72 /* FIXME 0.11: merge alaw and mulaw into one plugin? */
73 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
74     GST_VERSION_MINOR,
75     "alaw",
76     "ALaw audio conversion routines",
77     plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)