2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-22 23:27:31 +00:00
|
|
|
#include "mulaw-encode.h"
|
|
|
|
#include "mulaw-decode.h"
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstCaps *
|
2001-12-22 23:27:31 +00:00
|
|
|
mulaw_factory (void)
|
|
|
|
{
|
2003-12-22 01:47:09 +00:00
|
|
|
return gst_caps_new_simple ("audio/x-mulaw",
|
2004-03-14 22:34:33 +00:00
|
|
|
"rate", GST_TYPE_INT_RANGE, 8000, 192000,
|
|
|
|
"channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstCaps *
|
2001-12-22 23:27:31 +00:00
|
|
|
linear_factory (void)
|
|
|
|
{
|
2003-12-22 01:47:09 +00:00
|
|
|
return gst_caps_new_simple ("audio/x-raw-int",
|
2004-03-14 22:34:33 +00:00
|
|
|
"width", G_TYPE_INT, 16,
|
|
|
|
"depth", G_TYPE_INT, 16,
|
2003-12-22 01:47:09 +00:00
|
|
|
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
2004-11-09 06:08:22 +00:00
|
|
|
"signed", G_TYPE_BOOLEAN, TRUE,
|
2004-03-14 22:34:33 +00:00
|
|
|
"rate", GST_TYPE_INT_RANGE, 8000, 192000,
|
|
|
|
"channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
2003-11-16 22:02:22 +00:00
|
|
|
GstPadTemplate *mulawenc_src_template, *mulawenc_sink_template;
|
2001-12-22 23:27:31 +00:00
|
|
|
GstPadTemplate *mulawdec_src_template, *mulawdec_sink_template;
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstCaps *mulaw_caps, *linear_caps;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
mulaw_caps = mulaw_factory ();
|
|
|
|
linear_caps = linear_factory ();
|
2003-11-16 22:02:22 +00:00
|
|
|
|
2008-08-29 00:28:55 +00:00
|
|
|
gst_caps_ref (mulaw_caps);
|
|
|
|
gst_caps_ref (linear_caps);
|
2004-03-14 22:34:33 +00:00
|
|
|
mulawenc_src_template =
|
|
|
|
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, mulaw_caps);
|
|
|
|
mulawenc_sink_template =
|
|
|
|
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, linear_caps);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2008-08-29 00:28:55 +00:00
|
|
|
gst_caps_ref (mulaw_caps);
|
|
|
|
gst_caps_ref (linear_caps);
|
2004-03-14 22:34:33 +00:00
|
|
|
mulawdec_src_template =
|
|
|
|
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, linear_caps);
|
|
|
|
mulawdec_sink_template =
|
|
|
|
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, mulaw_caps);
|
2003-11-16 22:02:22 +00:00
|
|
|
|
2008-08-29 00:28:55 +00:00
|
|
|
gst_caps_unref (mulaw_caps);
|
|
|
|
gst_caps_unref (linear_caps);
|
|
|
|
|
2003-11-02 18:13:24 +00:00
|
|
|
if (!gst_element_register (plugin, "mulawenc",
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_RANK_NONE, GST_TYPE_MULAWENC) ||
|
2003-11-02 18:13:24 +00:00
|
|
|
!gst_element_register (plugin, "mulawdec",
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_RANK_PRIMARY, GST_TYPE_MULAWDEC))
|
2003-11-02 18:13:24 +00:00
|
|
|
return FALSE;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"mulaw",
|
|
|
|
"MuLaw audio conversion routines",
|
2005-11-14 02:13:35 +00:00
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|