summaryrefslogtreecommitdiffstats
path: root/gst/law
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2008-12-13 15:34:01 +0000
committerEdward Hervey <bilboed@bilboed.com>2008-12-13 15:34:01 +0000
commit5ad613d9b97d412d657d64a25ec2ab34e964a532 (patch)
tree5fd3e37d77851d3bfca5594aeb757af04cf0f756 /gst/law
parent57d97b4cbf02f143905ab4898da04810ebdf4a2b (diff)
Switch to using GstStaticPadTemplate.
Original commit message from CVS: * ext/flac/gstflacdec.c: (gst_flac_dec_base_init), (gst_flac_dec_init): * gst/law/alaw-decode.c: (gst_alaw_dec_base_init), (gst_alaw_dec_init): * gst/law/alaw-encode.c: (gst_alaw_enc_base_init), (gst_alaw_enc_init): * gst/law/alaw.c: (plugin_init): * gst/law/mulaw-decode.c: (gst_mulawdec_base_init), (gst_mulawdec_init): * gst/law/mulaw-encode.c: (gst_mulawenc_base_init), (gst_mulawenc_init): * gst/law/mulaw.c: (plugin_init): Switch to using GstStaticPadTemplate. * gst/udp/gstudpnetutils.c: (gst_udp_get_addr): Don't forget to free the addrinfo structure. * gst/wavparse/gstwavparse.c: (gst_wavparse_reset), (gst_wavparse_sink_activate): Don't forget to unref the GstAdapter.
Diffstat (limited to 'gst/law')
-rw-r--r--gst/law/alaw-decode.c16
-rw-r--r--gst/law/alaw-encode.c16
-rw-r--r--gst/law/alaw.c73
-rw-r--r--gst/law/mulaw-decode.c14
-rw-r--r--gst/law/mulaw-encode.c14
-rw-r--r--gst/law/mulaw.c77
6 files changed, 102 insertions, 108 deletions
diff --git a/gst/law/alaw-decode.c b/gst/law/alaw-decode.c
index 41bdac51..6db91cfd 100644
--- a/gst/law/alaw-decode.c
+++ b/gst/law/alaw-decode.c
@@ -23,8 +23,8 @@
#include "alaw-decode.h"
-extern GstPadTemplate *alawdec_src_template;
-extern GstPadTemplate *alawdec_sink_template;
+extern GstStaticPadTemplate alaw_dec_src_factory;
+extern GstStaticPadTemplate alaw_dec_sink_factory;
GST_DEBUG_CATEGORY_STATIC (alaw_dec_debug);
#define GST_CAT_DEFAULT alaw_dec_debug
@@ -145,8 +145,10 @@ gst_alaw_dec_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- gst_element_class_add_pad_template (element_class, alawdec_src_template);
- gst_element_class_add_pad_template (element_class, alawdec_sink_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&alaw_dec_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&alaw_dec_sink_factory));
gst_element_class_set_details_simple (element_class, "A Law audio decoder",
"Codec/Decoder/Audio", "Convert 8bit A law to 16bit PCM",
@@ -166,14 +168,16 @@ gst_alaw_dec_class_init (GstALawDecClass * klass)
static void
gst_alaw_dec_init (GstALawDec * alawdec, GstALawDecClass * klass)
{
- alawdec->sinkpad = gst_pad_new_from_template (alawdec_sink_template, "sink");
+ alawdec->sinkpad =
+ gst_pad_new_from_static_template (&alaw_dec_sink_factory, "sink");
gst_pad_set_setcaps_function (alawdec->sinkpad,
GST_DEBUG_FUNCPTR (gst_alaw_dec_sink_setcaps));
gst_pad_set_chain_function (alawdec->sinkpad,
GST_DEBUG_FUNCPTR (gst_alaw_dec_chain));
gst_element_add_pad (GST_ELEMENT (alawdec), alawdec->sinkpad);
- alawdec->srcpad = gst_pad_new_from_template (alawdec_src_template, "src");
+ alawdec->srcpad =
+ gst_pad_new_from_static_template (&alaw_dec_src_factory, "src");
gst_pad_use_fixed_caps (alawdec->srcpad);
gst_element_add_pad (GST_ELEMENT (alawdec), alawdec->srcpad);
}
diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c
index 2585eb64..0a025fa2 100644
--- a/gst/law/alaw-encode.c
+++ b/gst/law/alaw-encode.c
@@ -26,8 +26,8 @@
GST_DEBUG_CATEGORY_STATIC (alaw_enc_debug);
#define GST_CAT_DEFAULT alaw_enc_debug
-extern GstPadTemplate *alawenc_src_template;
-extern GstPadTemplate *alawenc_sink_template;
+extern GstStaticPadTemplate alaw_enc_src_factory;
+extern GstStaticPadTemplate alaw_enc_sink_factory;
static GstFlowReturn gst_alaw_enc_chain (GstPad * pad, GstBuffer * buffer);
@@ -387,8 +387,10 @@ gst_alaw_enc_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- gst_element_class_add_pad_template (element_class, alawenc_src_template);
- gst_element_class_add_pad_template (element_class, alawenc_sink_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&alaw_enc_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&alaw_enc_sink_factory));
gst_element_class_set_details_simple (element_class,
"A Law audio encoder", "Codec/Encoder/Audio",
@@ -407,7 +409,8 @@ gst_alaw_enc_class_init (GstALawEncClass * klass)
static void
gst_alaw_enc_init (GstALawEnc * alawenc, GstALawEncClass * klass)
{
- alawenc->sinkpad = gst_pad_new_from_template (alawenc_sink_template, "sink");
+ alawenc->sinkpad =
+ gst_pad_new_from_static_template (&alaw_enc_sink_factory, "sink");
gst_pad_set_setcaps_function (alawenc->sinkpad,
GST_DEBUG_FUNCPTR (gst_alaw_enc_setcaps));
gst_pad_set_getcaps_function (alawenc->sinkpad,
@@ -416,7 +419,8 @@ gst_alaw_enc_init (GstALawEnc * alawenc, GstALawEncClass * klass)
GST_DEBUG_FUNCPTR (gst_alaw_enc_chain));
gst_element_add_pad (GST_ELEMENT (alawenc), alawenc->sinkpad);
- alawenc->srcpad = gst_pad_new_from_template (alawenc_src_template, "src");
+ alawenc->srcpad =
+ gst_pad_new_from_static_template (&alaw_enc_src_factory, "src");
gst_pad_set_setcaps_function (alawenc->srcpad,
GST_DEBUG_FUNCPTR (gst_alaw_enc_setcaps));
gst_pad_set_getcaps_function (alawenc->srcpad,
diff --git a/gst/law/alaw.c b/gst/law/alaw.c
index 495d0582..3525848d 100644
--- a/gst/law/alaw.c
+++ b/gst/law/alaw.c
@@ -23,54 +23,43 @@
#include "alaw-encode.h"
#include "alaw-decode.h"
-static GstCaps *
-alaw_factory (void)
-{
- return gst_caps_new_simple ("audio/x-alaw",
- "rate", GST_TYPE_INT_RANGE, 8000, 192000,
- "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
-}
+GstStaticPadTemplate alaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) [ 8000, 192000 ], "
+ "channels = (int) [ 1, 2 ], "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) 16, " "width = (int) 16, " "signed = (boolean) True")
+ );
-static GstCaps *
-linear_factory (void)
-{
- return gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "rate", GST_TYPE_INT_RANGE, 8000, 192000,
- "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
-}
+GstStaticPadTemplate alaw_dec_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-alaw, "
+ "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]")
+ );
+
+GstStaticPadTemplate alaw_enc_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) [ 8000, 192000 ], "
+ "channels = (int) [ 1, 2 ], "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) 16, " "width = (int) 16, " "signed = (boolean) True")
+ );
-GstPadTemplate *alawenc_src_template, *alawenc_sink_template;
-GstPadTemplate *alawdec_src_template, *alawdec_sink_template;
+GstStaticPadTemplate alaw_enc_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-alaw, "
+ "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]")
+ );
static gboolean
plugin_init (GstPlugin * plugin)
{
- GstCaps *alaw_caps, *linear_caps;
-
- alaw_caps = alaw_factory ();
- linear_caps = linear_factory ();
-
- gst_caps_ref (alaw_caps);
- gst_caps_ref (linear_caps);
- 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);
-
- gst_caps_ref (alaw_caps);
- gst_caps_ref (linear_caps);
- 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);
-
- gst_caps_unref (alaw_caps);
- gst_caps_unref (linear_caps);
-
if (!gst_element_register (plugin, "alawenc",
GST_RANK_NONE, GST_TYPE_ALAW_ENC) ||
!gst_element_register (plugin, "alawdec",
diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c
index 46232d35..fb40f18b 100644
--- a/gst/law/mulaw-decode.c
+++ b/gst/law/mulaw-decode.c
@@ -24,7 +24,8 @@
#include "mulaw-decode.h"
#include "mulaw-conversion.h"
-extern GstPadTemplate *mulawdec_src_template, *mulawdec_sink_template;
+extern GstStaticPadTemplate mulaw_dec_src_factory;
+extern GstStaticPadTemplate mulaw_dec_sink_factory;
/* Stereo signals and args */
enum
@@ -117,8 +118,10 @@ gst_mulawdec_base_init (GstMuLawDecClass * klass)
"Convert 8bit mu law to 16bit PCM",
"Zaheer Abbas Merali <zaheerabbas at merali dot org>");
- gst_element_class_add_pad_template (element_class, mulawdec_src_template);
- gst_element_class_add_pad_template (element_class, mulawdec_sink_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&mulaw_dec_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&mulaw_dec_sink_factory));
gst_element_class_set_details (element_class, &mulawdec_details);
}
@@ -136,12 +139,13 @@ static void
gst_mulawdec_init (GstMuLawDec * mulawdec)
{
mulawdec->sinkpad =
- gst_pad_new_from_template (mulawdec_sink_template, "sink");
+ gst_pad_new_from_static_template (&mulaw_dec_sink_factory, "sink");
gst_pad_set_setcaps_function (mulawdec->sinkpad, mulawdec_sink_setcaps);
gst_pad_set_chain_function (mulawdec->sinkpad, gst_mulawdec_chain);
gst_element_add_pad (GST_ELEMENT (mulawdec), mulawdec->sinkpad);
- mulawdec->srcpad = gst_pad_new_from_template (mulawdec_src_template, "src");
+ mulawdec->srcpad =
+ gst_pad_new_from_static_template (&mulaw_dec_src_factory, "src");
gst_pad_use_fixed_caps (mulawdec->srcpad);
gst_element_add_pad (GST_ELEMENT (mulawdec), mulawdec->srcpad);
}
diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c
index 033665e4..c8c8c054 100644
--- a/gst/law/mulaw-encode.c
+++ b/gst/law/mulaw-encode.c
@@ -24,7 +24,8 @@
#include "mulaw-encode.h"
#include "mulaw-conversion.h"
-extern GstPadTemplate *mulawenc_src_template, *mulawenc_sink_template;
+extern GstStaticPadTemplate mulaw_enc_src_factory;
+extern GstStaticPadTemplate mulaw_enc_sink_factory;
/* Stereo signals and args */
enum
@@ -170,8 +171,10 @@ gst_mulawenc_base_init (GstMuLawEncClass * klass)
"Convert 16bit PCM to 8bit mu law",
"Zaheer Abbas Merali <zaheerabbas at merali dot org>");
- gst_element_class_add_pad_template (element_class, mulawenc_src_template);
- gst_element_class_add_pad_template (element_class, mulawenc_sink_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&mulaw_enc_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&mulaw_enc_sink_factory));
gst_element_class_set_details (element_class, &mulawenc_details);
}
@@ -185,13 +188,14 @@ static void
gst_mulawenc_init (GstMuLawEnc * mulawenc)
{
mulawenc->sinkpad =
- gst_pad_new_from_template (mulawenc_sink_template, "sink");
+ gst_pad_new_from_static_template (&mulaw_enc_sink_factory, "sink");
gst_pad_set_setcaps_function (mulawenc->sinkpad, mulawenc_setcaps);
gst_pad_set_getcaps_function (mulawenc->sinkpad, mulawenc_getcaps);
gst_pad_set_chain_function (mulawenc->sinkpad, gst_mulawenc_chain);
gst_element_add_pad (GST_ELEMENT (mulawenc), mulawenc->sinkpad);
- mulawenc->srcpad = gst_pad_new_from_template (mulawenc_src_template, "src");
+ mulawenc->srcpad =
+ gst_pad_new_from_static_template (&mulaw_enc_src_factory, "src");
gst_pad_set_setcaps_function (mulawenc->srcpad, mulawenc_setcaps);
gst_pad_set_getcaps_function (mulawenc->srcpad, mulawenc_getcaps);
gst_pad_use_fixed_caps (mulawenc->srcpad);
diff --git a/gst/law/mulaw.c b/gst/law/mulaw.c
index b26f3f51..8945a101 100644
--- a/gst/law/mulaw.c
+++ b/gst/law/mulaw.c
@@ -4,54 +4,43 @@
#include "mulaw-encode.h"
#include "mulaw-decode.h"
-static GstCaps *
-mulaw_factory (void)
-{
- return gst_caps_new_simple ("audio/x-mulaw",
- "rate", GST_TYPE_INT_RANGE, 8000, 192000,
- "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
-}
-
-static GstCaps *
-linear_factory (void)
-{
- return gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "rate", GST_TYPE_INT_RANGE, 8000, 192000,
- "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
-}
-
-GstPadTemplate *mulawenc_src_template, *mulawenc_sink_template;
-GstPadTemplate *mulawdec_src_template, *mulawdec_sink_template;
+GstStaticPadTemplate mulaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) [ 8000, 192000 ], "
+ "channels = (int) [ 1, 2 ], "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) 16, " "width = (int) 16, " "signed = (boolean) True")
+ );
+
+GstStaticPadTemplate mulaw_dec_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-mulaw, "
+ "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]")
+ );
+
+GstStaticPadTemplate mulaw_enc_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) [ 8000, 192000 ], "
+ "channels = (int) [ 1, 2 ], "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) 16, " "width = (int) 16, " "signed = (boolean) True")
+ );
+
+GstStaticPadTemplate mulaw_enc_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-mulaw, "
+ "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]")
+ );
static gboolean
plugin_init (GstPlugin * plugin)
{
- GstCaps *mulaw_caps, *linear_caps;
-
- mulaw_caps = mulaw_factory ();
- linear_caps = linear_factory ();
-
- gst_caps_ref (mulaw_caps);
- gst_caps_ref (linear_caps);
- 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);
-
- gst_caps_ref (mulaw_caps);
- gst_caps_ref (linear_caps);
- 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);
-
- gst_caps_unref (mulaw_caps);
- gst_caps_unref (linear_caps);
-
if (!gst_element_register (plugin, "mulawenc",
GST_RANK_NONE, GST_TYPE_MULAWENC) ||
!gst_element_register (plugin, "mulawdec",