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 "alaw-encode.h"
|
|
|
|
#include "alaw-decode.h"
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstCaps *
|
2001-12-22 23:27:31 +00:00
|
|
|
alaw_factory (void)
|
|
|
|
{
|
2003-12-22 01:47:09 +00:00
|
|
|
return gst_caps_new_simple ("audio/x-alaw",
|
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-03-14 22:34:33 +00:00
|
|
|
"signed", G_TYPE_BOOLEAN, TRUE,
|
|
|
|
"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 *alawenc_src_template, *alawenc_sink_template;
|
2001-12-22 23:27:31 +00:00
|
|
|
GstPadTemplate *alawdec_src_template, *alawdec_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 *alaw_caps, *linear_caps;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
alaw_caps = alaw_factory ();
|
|
|
|
linear_caps = linear_factory ();
|
2003-11-16 22:02:22 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
alawenc_src_template =
|
|
|
|
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, alaw_caps);
|
|
|
|
alawenc_sink_template =
|
|
|
|
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, linear_caps);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
alawdec_src_template =
|
|
|
|
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, linear_caps);
|
|
|
|
alawdec_sink_template =
|
|
|
|
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, alaw_caps);
|
2003-11-16 22:02:22 +00:00
|
|
|
|
2003-11-02 18:13:24 +00:00
|
|
|
if (!gst_element_register (plugin, "alawenc",
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_RANK_NONE, GST_TYPE_ALAWENC) ||
|
2003-11-02 18:13:24 +00:00
|
|
|
!gst_element_register (plugin, "alawdec",
|
2004-05-09 22:46:06 +00:00
|
|
|
GST_RANK_PRIMARY, GST_TYPE_ALAWDEC))
|
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,
|
|
|
|
"alaw",
|
|
|
|
"ALaw audio conversion routines",
|
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
|