mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 11:10:37 +00:00
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.
This commit is contained in:
parent
57d97b4cbf
commit
5ad613d9b9
11 changed files with 159 additions and 125 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2008-12-13 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||
|
||||
* 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.
|
||||
|
||||
2008-12-13 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||
|
||||
* m4/Makefile.am:
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit 1c24dce4e32f0a725ebd1b8ba2cd48d373818f75
|
||||
Subproject commit 24efb72e9a01364c6ea90b70ef2bb7049af980b4
|
|
@ -103,8 +103,6 @@ static const GstAudioChannelPosition channel_positions[8][8] = {
|
|||
GST_DEBUG_CATEGORY_STATIC (flacdec_debug);
|
||||
#define GST_CAT_DEFAULT flacdec_debug
|
||||
|
||||
static GstPadTemplate *src_template, *sink_template;
|
||||
|
||||
static void gst_flac_dec_finalize (GObject * object);
|
||||
static void gst_flac_dec_loop (GstPad * pad);
|
||||
|
||||
|
@ -209,6 +207,12 @@ GST_BOILERPLATE (GstFlacDec, gst_flac_dec, GstElement, GST_TYPE_ELEMENT);
|
|||
/* FIXME 0.11: Use width=32 for all depths and let audioconvert
|
||||
* handle the conversions instead of doing it ourself.
|
||||
*/
|
||||
static const GstElementDetails vorbis_dec_details =
|
||||
GST_ELEMENT_DETAILS ("Vorbis audio decoder",
|
||||
"Codec/Decoder/Audio",
|
||||
"decode raw vorbis streams to float audio",
|
||||
"Benjamin Otte <in7y118@public.uni-hamburg.de>");
|
||||
|
||||
#define GST_FLAC_DEC_SRC_CAPS \
|
||||
"audio/x-raw-int, " \
|
||||
"endianness = (int) BYTE_ORDER, " \
|
||||
|
@ -217,22 +221,28 @@ GST_BOILERPLATE (GstFlacDec, gst_flac_dec, GstElement, GST_TYPE_ELEMENT);
|
|||
"depth = (int) [ 4, 32 ], " \
|
||||
"rate = (int) [ 1, 655350 ], " \
|
||||
"channels = (int) [ 1, 8 ]"
|
||||
|
||||
static GstStaticPadTemplate flac_dec_src_factory =
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_FLAC_DEC_SRC_CAPS));
|
||||
static GstStaticPadTemplate flac_dec_sink_factory =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-flac")
|
||||
);
|
||||
|
||||
static void
|
||||
gst_flac_dec_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
GstCaps *raw_caps, *flac_caps;
|
||||
|
||||
raw_caps = gst_caps_from_string (GST_FLAC_DEC_SRC_CAPS);
|
||||
flac_caps = gst_caps_new_simple ("audio/x-flac", NULL);
|
||||
|
||||
sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS, flac_caps);
|
||||
src_template = gst_pad_template_new ("src", GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS, raw_caps);
|
||||
gst_element_class_add_pad_template (element_class, sink_template);
|
||||
gst_element_class_add_pad_template (element_class, src_template);
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&flac_dec_src_factory));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&flac_dec_sink_factory));
|
||||
gst_element_class_set_details_simple (element_class, "FLAC audio decoder",
|
||||
"Codec/Decoder/Audio",
|
||||
"Decodes FLAC lossless audio streams", "Wim Taymans <wim@fluendo.com>");
|
||||
|
@ -259,7 +269,8 @@ gst_flac_dec_class_init (GstFlacDecClass * klass)
|
|||
static void
|
||||
gst_flac_dec_init (GstFlacDec * flacdec, GstFlacDecClass * klass)
|
||||
{
|
||||
flacdec->sinkpad = gst_pad_new_from_template (sink_template, "sink");
|
||||
flacdec->sinkpad =
|
||||
gst_pad_new_from_static_template (&flac_dec_sink_factory, "sink");
|
||||
gst_pad_set_activate_function (flacdec->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_flac_dec_sink_activate));
|
||||
gst_pad_set_activatepull_function (flacdec->sinkpad,
|
||||
|
@ -276,7 +287,8 @@ gst_flac_dec_init (GstFlacDec * flacdec, GstFlacDecClass * klass)
|
|||
GST_DEBUG_FUNCPTR (gst_flac_dec_chain));
|
||||
gst_element_add_pad (GST_ELEMENT (flacdec), flacdec->sinkpad);
|
||||
|
||||
flacdec->srcpad = gst_pad_new_from_template (src_template, "src");
|
||||
flacdec->srcpad =
|
||||
gst_pad_new_from_static_template (&flac_dec_src_factory, "src");
|
||||
gst_pad_set_query_type_function (flacdec->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_flac_dec_get_src_query_types));
|
||||
gst_pad_set_query_function (flacdec->srcpad,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 ]")
|
||||
);
|
||||
|
||||
GstPadTemplate *alawenc_src_template, *alawenc_sink_template;
|
||||
GstPadTemplate *alawdec_src_template, *alawdec_sink_template;
|
||||
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")
|
||||
);
|
||||
|
||||
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",
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
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")
|
||||
);
|
||||
|
||||
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 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 ]")
|
||||
);
|
||||
|
||||
GstPadTemplate *mulawenc_src_template, *mulawenc_sink_template;
|
||||
GstPadTemplate *mulawdec_src_template, *mulawdec_sink_template;
|
||||
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",
|
||||
|
|
|
@ -91,7 +91,7 @@ gst_udp_get_addr (const char *hostname, int port, struct sockaddr_storage *addr)
|
|||
|
||||
if ((ret = getaddrinfo (hostname, (port == -1) ? NULL : service, &hints,
|
||||
&res)) < 0) {
|
||||
return ret;
|
||||
goto beach;
|
||||
}
|
||||
|
||||
nres = res;
|
||||
|
@ -107,8 +107,9 @@ gst_udp_get_addr (const char *hostname, int port, struct sockaddr_storage *addr)
|
|||
errno = EAI_ADDRFAMILY;
|
||||
ret = -1;
|
||||
}
|
||||
freeaddrinfo (res);
|
||||
|
||||
beach:
|
||||
freeaddrinfo (res);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -168,6 +168,7 @@ gst_wavparse_reset (GstWavParse * wav)
|
|||
wav->seek_event = NULL;
|
||||
if (wav->adapter) {
|
||||
gst_adapter_clear (wav->adapter);
|
||||
g_object_unref (wav->adapter);
|
||||
wav->adapter = NULL;
|
||||
}
|
||||
if (wav->tags)
|
||||
|
@ -2219,12 +2220,17 @@ gst_wavparse_sink_activate (GstPad * sinkpad)
|
|||
if (gst_pad_check_pull_range (sinkpad)) {
|
||||
GST_DEBUG ("going to pull mode");
|
||||
wav->streaming = FALSE;
|
||||
if (wav->adapter) {
|
||||
gst_adapter_clear (wav->adapter);
|
||||
g_object_unref (wav->adapter);
|
||||
}
|
||||
wav->adapter = NULL;
|
||||
res = gst_pad_activate_pull (sinkpad, TRUE);
|
||||
} else {
|
||||
GST_DEBUG ("going to push (streaming) mode");
|
||||
wav->streaming = TRUE;
|
||||
wav->adapter = gst_adapter_new ();
|
||||
if (wav->adapter == NULL)
|
||||
wav->adapter = gst_adapter_new ();
|
||||
res = gst_pad_activate_push (sinkpad, TRUE);
|
||||
}
|
||||
gst_object_unref (wav);
|
||||
|
|
Loading…
Reference in a new issue