gst-libs/gst/video/video.h: Fix caps template names to be understandable.
[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,
13       NULL);
14 }
15
16 static GstCaps*
17 linear_factory (void)
18 {
19   return gst_caps_new_simple ("audio/x-raw-int",
20       "width",      G_TYPE_INT, 16,
21       "depth",      G_TYPE_INT, 16,
22       "endianness", G_TYPE_INT, G_BYTE_ORDER,
23       "signed",     G_TYPE_BOOLEAN, TRUE,
24       "rate",       GST_TYPE_INT_RANGE, 8000, 192000,
25       "channels",   GST_TYPE_INT_RANGE, 1, 2,
26       NULL);
27 }
28
29 GstPadTemplate *mulawenc_src_template, *mulawenc_sink_template;
30 GstPadTemplate *mulawdec_src_template, *mulawdec_sink_template;
31
32 static gboolean
33 plugin_init (GstPlugin *plugin)
34 {
35   GstCaps* mulaw_caps, *linear_caps;
36
37   mulaw_caps = mulaw_factory ();
38   linear_caps = linear_factory ();
39
40   mulawenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
41                                                mulaw_caps);
42   mulawenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
43                                                 linear_caps);
44
45   mulawdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
46                                                 linear_caps);
47   mulawdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
48                                                 mulaw_caps);
49
50   if (!gst_element_register (plugin, "mulawenc",
51                              GST_RANK_NONE, GST_TYPE_MULAWENC) ||
52       !gst_element_register (plugin, "mulawdec",
53                              GST_RANK_PRIMARY, GST_TYPE_MULAWENC))
54     return FALSE;
55
56   return TRUE;
57 }
58
59 GST_PLUGIN_DEFINE (
60   GST_VERSION_MAJOR,
61   GST_VERSION_MINOR,
62   "mulaw",
63   "MuLaw audio conversion routines",
64   plugin_init,
65   VERSION,
66   GST_LICENSE,
67   GST_PACKAGE,
68   GST_ORIGIN
69 )