gst-indent
[platform/upstream/gst-plugins-good.git] / gst / law / mulaw.c
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4 #include "mulaw-encode.h"
5 #include "mulaw-decode.h"
6
7 static GstCaps *
8 mulaw_factory (void)
9 {
10   return gst_caps_new_simple ("audio/x-mulaw",
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 *mulawenc_src_template, *mulawenc_sink_template;
28 GstPadTemplate *mulawdec_src_template, *mulawdec_sink_template;
29
30 static gboolean
31 plugin_init (GstPlugin * plugin)
32 {
33   GstCaps *mulaw_caps, *linear_caps;
34
35   mulaw_caps = mulaw_factory ();
36   linear_caps = linear_factory ();
37
38   mulawenc_src_template =
39       gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, mulaw_caps);
40   mulawenc_sink_template =
41       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, linear_caps);
42
43   mulawdec_src_template =
44       gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, linear_caps);
45   mulawdec_sink_template =
46       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, mulaw_caps);
47
48   if (!gst_element_register (plugin, "mulawenc",
49           GST_RANK_NONE, GST_TYPE_MULAWENC) ||
50       !gst_element_register (plugin, "mulawdec",
51           GST_RANK_PRIMARY, GST_TYPE_MULAWDEC))
52     return FALSE;
53
54   return TRUE;
55 }
56
57 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
58     GST_VERSION_MINOR,
59     "mulaw",
60     "MuLaw audio conversion routines",
61     plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)