gst-indent
[platform/upstream/gst-plugins-good.git] / gst / law / alaw.c
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4 #include "alaw-encode.h"
5 #include "alaw-decode.h"
6
7 static GstCaps *
8 alaw_factory (void)
9 {
10   return gst_caps_new_simple ("audio/x-alaw",
11       "rate", GST_TYPE_INT_RANGE, 8000, 192000,
12       "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
13 }
14
15 static GstCaps *
16 linear_factory (void)
17 {
18   return gst_caps_new_simple ("audio/x-raw-int",
19       "width", G_TYPE_INT, 16,
20       "depth", G_TYPE_INT, 16,
21       "endianness", G_TYPE_INT, G_BYTE_ORDER,
22       "signed", G_TYPE_BOOLEAN, TRUE,
23       "rate", GST_TYPE_INT_RANGE, 8000, 192000,
24       "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
25 }
26
27 GstPadTemplate *alawenc_src_template, *alawenc_sink_template;
28 GstPadTemplate *alawdec_src_template, *alawdec_sink_template;
29
30 static gboolean
31 plugin_init (GstPlugin * plugin)
32 {
33   GstCaps *alaw_caps, *linear_caps;
34
35   alaw_caps = alaw_factory ();
36   linear_caps = linear_factory ();
37
38   alawenc_src_template =
39       gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, alaw_caps);
40   alawenc_sink_template =
41       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, linear_caps);
42
43   alawdec_src_template =
44       gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, linear_caps);
45   alawdec_sink_template =
46       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, alaw_caps);
47
48   if (!gst_element_register (plugin, "alawenc",
49           GST_RANK_NONE, GST_TYPE_ALAWENC) ||
50       !gst_element_register (plugin, "alawdec",
51           GST_RANK_PRIMARY, GST_TYPE_ALAWENC))
52     return FALSE;
53
54   return TRUE;
55 }
56
57 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
58     GST_VERSION_MINOR,
59     "alaw",
60     "ALaw audio conversion routines",
61     plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)