diff --git a/gst/law/alaw-decode.c b/gst/law/alaw-decode.c index 7587fbde75..95c2bc28d2 100644 --- a/gst/law/alaw-decode.c +++ b/gst/law/alaw-decode.c @@ -41,6 +41,8 @@ static GstFlowReturn gst_alaw_dec_handle_frame (GstAudioDecoder * dec, #define gst_alaw_dec_parent_class parent_class G_DEFINE_TYPE (GstALawDec, gst_alaw_dec, GST_TYPE_AUDIO_DECODER); +GST_ELEMENT_REGISTER_DEFINE (alawdec, "alawdec", GST_RANK_PRIMARY, + GST_TYPE_ALAW_DEC); /* some day we might have defines in gstconfig.h that tell us about the * desired cpu/memory/binary size trade-offs */ @@ -111,6 +113,22 @@ alaw_to_s16 (guint8 a_val) #endif /* GST_ALAW_DEC_USE_TABLE */ +GstStaticPadTemplate alaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw, " + "format = (string) " GST_AUDIO_NE (S16) ", " + "layout = (string) interleaved, " + "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]") + ); + +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 ]") + ); + static gboolean gst_alaw_dec_set_format (GstAudioDecoder * dec, GstCaps * caps) { diff --git a/gst/law/alaw-decode.h b/gst/law/alaw-decode.h index 58647dc9e3..8994c38df3 100644 --- a/gst/law/alaw-decode.h +++ b/gst/law/alaw-decode.h @@ -49,6 +49,8 @@ struct _GstALawDecClass { GType gst_alaw_dec_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (alawdec); + G_END_DECLS #endif /* __GST_ALAW_DECODE_H__ */ diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c index dae82ac731..8a1b6e48d3 100644 --- a/gst/law/alaw-encode.c +++ b/gst/law/alaw-encode.c @@ -28,6 +28,7 @@ #endif #include + #include "alaw-encode.h" GST_DEBUG_CATEGORY_STATIC (alaw_enc_debug); @@ -37,6 +38,8 @@ extern GstStaticPadTemplate alaw_enc_src_factory; extern GstStaticPadTemplate alaw_enc_sink_factory; G_DEFINE_TYPE (GstALawEnc, gst_alaw_enc, GST_TYPE_AUDIO_ENCODER); +GST_ELEMENT_REGISTER_DEFINE (alawenc, "alawenc", GST_RANK_PRIMARY, + GST_TYPE_ALAW_ENC); static gboolean gst_alaw_enc_start (GstAudioEncoder * audioenc); static gboolean gst_alaw_enc_set_format (GstAudioEncoder * enc, @@ -302,6 +305,22 @@ s16_to_alaw (gint pcm_val) #endif /* GST_ALAW_ENC_USE_TABLE */ +GstStaticPadTemplate alaw_enc_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw, " + "format = (string) " GST_AUDIO_NE (S16) ", " + "layout = (string) interleaved, " + "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]") + ); + +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 gst_alaw_enc_start (GstAudioEncoder * audioenc) { diff --git a/gst/law/alaw-encode.h b/gst/law/alaw-encode.h index 7b08f483bc..59b9561b16 100644 --- a/gst/law/alaw-encode.h +++ b/gst/law/alaw-encode.h @@ -52,6 +52,8 @@ struct _GstALawEncClass { GType gst_alaw_enc_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (alawenc); + G_END_DECLS #endif /* __GST_ALAW_ENCODE_H__ */ diff --git a/gst/law/alaw.c b/gst/law/alaw.c index 64f7e069f8..d1c53b26bd 100644 --- a/gst/law/alaw.c +++ b/gst/law/alaw.c @@ -25,48 +25,15 @@ #include "alaw-encode.h" #include "alaw-decode.h" -GstStaticPadTemplate alaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw, " - "format = (string) " GST_AUDIO_NE (S16) ", " - "layout = (string) interleaved, " - "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]") - ); - -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, " - "format = (string) " GST_AUDIO_NE (S16) ", " - "layout = (string) interleaved, " - "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]") - ); - -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) { - if (!gst_element_register (plugin, "alawenc", - GST_RANK_PRIMARY, GST_TYPE_ALAW_ENC) || - !gst_element_register (plugin, "alawdec", - GST_RANK_PRIMARY, GST_TYPE_ALAW_DEC)) - return FALSE; + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (alawenc, plugin); + ret |= GST_ELEMENT_REGISTER (alawdec, plugin); + + return ret; } /* FIXME 0.11: merge alaw and mulaw into one plugin? */ diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c index 044e8fee12..2783376f3f 100644 --- a/gst/law/mulaw-decode.c +++ b/gst/law/mulaw-decode.c @@ -51,8 +51,32 @@ enum PROP_0 }; +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +#define INT_FORMAT "S16LE" +#else +#define INT_FORMAT "S16BE" +#endif + +GstStaticPadTemplate mulaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw, " + "format = (string) " INT_FORMAT ", " + "layout = (string) interleaved, " + "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]") + ); + +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 ]") + ); + #define gst_mulawdec_parent_class parent_class G_DEFINE_TYPE (GstMuLawDec, gst_mulawdec, GST_TYPE_AUDIO_DECODER); +GST_ELEMENT_REGISTER_DEFINE (mulawdec, "mulawdec", GST_RANK_PRIMARY, + GST_TYPE_MULAWDEC); static gboolean gst_mulawdec_set_format (GstAudioDecoder * dec, GstCaps * caps) diff --git a/gst/law/mulaw-decode.h b/gst/law/mulaw-decode.h index bed62fa097..b1b284e777 100644 --- a/gst/law/mulaw-decode.h +++ b/gst/law/mulaw-decode.h @@ -49,6 +49,7 @@ struct _GstMuLawDecClass }; GType gst_mulawdec_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (mulawdec); G_END_DECLS #endif /* __GST_STEREO_H__ */ diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c index ccf0611ca9..8f951d46ff 100644 --- a/gst/law/mulaw-encode.c +++ b/gst/law/mulaw-encode.c @@ -35,6 +35,27 @@ extern GstStaticPadTemplate mulaw_enc_src_factory; extern GstStaticPadTemplate mulaw_enc_sink_factory; +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +#define INT_FORMAT "S16LE" +#else +#define INT_FORMAT "S16BE" +#endif + +GstStaticPadTemplate mulaw_enc_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw, " + "format = (string) " INT_FORMAT ", " + "layout = (string) interleaved, " + "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]") + ); + +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 ]") + ); /* Stereo signals and args */ enum { @@ -57,6 +78,8 @@ static void gst_mulawenc_set_tags (GstMuLawEnc * mulawenc); #define gst_mulawenc_parent_class parent_class G_DEFINE_TYPE (GstMuLawEnc, gst_mulawenc, GST_TYPE_AUDIO_ENCODER); +GST_ELEMENT_REGISTER_DEFINE (mulawenc, "mulawenc", GST_RANK_PRIMARY, + GST_TYPE_MULAWENC); /*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; */ diff --git a/gst/law/mulaw-encode.h b/gst/law/mulaw-encode.h index c5ade39c1e..cda2a54396 100644 --- a/gst/law/mulaw-encode.h +++ b/gst/law/mulaw-encode.h @@ -53,5 +53,7 @@ struct _GstMuLawEncClass GType gst_mulawenc_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (mulawenc); + G_END_DECLS #endif /* __GST_STEREO_H__ */ diff --git a/gst/law/mulaw.c b/gst/law/mulaw.c index a2e614df7d..14bfc28d51 100644 --- a/gst/law/mulaw.c +++ b/gst/law/mulaw.c @@ -28,48 +28,15 @@ #define INT_FORMAT "S16BE" #endif -GstStaticPadTemplate mulaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw, " - "format = (string) " INT_FORMAT ", " - "layout = (string) interleaved, " - "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]") - ); - -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, " - "format = (string) " INT_FORMAT ", " - "layout = (string) interleaved, " - "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]") - ); - -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) { - if (!gst_element_register (plugin, "mulawenc", - GST_RANK_PRIMARY, GST_TYPE_MULAWENC) || - !gst_element_register (plugin, "mulawdec", - GST_RANK_PRIMARY, GST_TYPE_MULAWDEC)) - return FALSE; + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (mulawenc, plugin); + ret |= GST_ELEMENT_REGISTER (mulawdec, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,