From 60db07b4bb303b5c9373581e37e5549039e3a711 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 25 Apr 2011 13:16:58 +0200 Subject: [PATCH] rtp: port some more (de)payloaders --- gst/rtp/gstrtpac3depay.c | 30 ++++++++++++------------------ gst/rtp/gstrtpac3pay.c | 37 ++++++++++++++++--------------------- gst/rtp/gstrtpbvdepay.c | 29 +++++++++++++---------------- gst/rtp/gstrtpbvpay.c | 35 ++++++++++++++++------------------- gst/rtp/gstrtpceltdepay.c | 37 +++++++++++++++++-------------------- gst/rtp/gstrtpceltpay.c | 37 ++++++++++++++++--------------------- gst/rtp/gstrtpdepay.c | 15 ++++++--------- gst/rtp/gstrtpdvdepay.c | 37 ++++++++++++++++--------------------- gst/rtp/gstrtpdvpay.c | 40 +++++++++++++++++++--------------------- gst/rtp/gstrtpgstdepay.c | 39 ++++++++++++++++----------------------- gst/rtp/gstrtpgstpay.c | 29 +++++++++++++---------------- gst/rtp/gstrtpilbcdepay.c | 33 +++++++++++++++------------------ gst/rtp/gstrtpilbcpay.c | 34 ++++++++++++++++------------------ gst/rtp/gstrtpmpadepay.c | 35 +++++++++++++++-------------------- gst/rtp/gstrtpmpapay.c | 37 ++++++++++++++++--------------------- 15 files changed, 222 insertions(+), 282 deletions(-) diff --git a/gst/rtp/gstrtpac3depay.c b/gst/rtp/gstrtpac3depay.c index ba622ff..099be64 100644 --- a/gst/rtp/gstrtpac3depay.c +++ b/gst/rtp/gstrtpac3depay.c @@ -47,8 +47,7 @@ GST_STATIC_PAD_TEMPLATE ("sink", "encoding-name = (string) \"AC3\"") ); -GST_BOILERPLATE (GstRtpAC3Depay, gst_rtp_ac3_depay, GstBaseRTPDepayload, - GST_TYPE_BASE_RTP_DEPAYLOAD); +G_DEFINE_TYPE (GstRtpAC3Depay, gst_rtp_ac3_depay, GST_TYPE_BASE_RTP_DEPAYLOAD); static gboolean gst_rtp_ac3_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps); @@ -56,27 +55,23 @@ static GstBuffer *gst_rtp_ac3_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf); static void -gst_rtp_ac3_depay_base_init (gpointer klass) +gst_rtp_ac3_depay_class_init (GstRtpAC3DepayClass * klass) { - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstElementClass *gstelement_class; + GstBaseRTPDepayloadClass *gstbasertpdepayload_class; + + gstelement_class = (GstElementClass *) klass; + gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; - gst_element_class_add_pad_template (element_class, + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_ac3_depay_src_template)); - gst_element_class_add_pad_template (element_class, + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_ac3_depay_sink_template)); - gst_element_class_set_details_simple (element_class, "RTP AC3 depayloader", + gst_element_class_set_details_simple (gstelement_class, "RTP AC3 depayloader", "Codec/Depayloader/Network/RTP", "Extracts AC3 audio from RTP packets (RFC 4184)", "Wim Taymans "); -} - -static void -gst_rtp_ac3_depay_class_init (GstRtpAC3DepayClass * klass) -{ - GstBaseRTPDepayloadClass *gstbasertpdepayload_class; - - gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; gstbasertpdepayload_class->set_caps = gst_rtp_ac3_depay_setcaps; gstbasertpdepayload_class->process = gst_rtp_ac3_depay_process; @@ -86,10 +81,9 @@ gst_rtp_ac3_depay_class_init (GstRtpAC3DepayClass * klass) } static void -gst_rtp_ac3_depay_init (GstRtpAC3Depay * rtpac3depay, - GstRtpAC3DepayClass * klass) +gst_rtp_ac3_depay_init (GstRtpAC3Depay * rtpac3depay) { - /* needed because of GST_BOILERPLATE */ + /* needed because of G_DEFINE_TYPE */ } static gboolean diff --git a/gst/rtp/gstrtpac3pay.c b/gst/rtp/gstrtpac3pay.c index f474a8c..b29abd7 100644 --- a/gst/rtp/gstrtpac3pay.c +++ b/gst/rtp/gstrtpac3pay.c @@ -60,23 +60,8 @@ static GstFlowReturn gst_rtp_ac3_pay_flush (GstRtpAC3Pay * rtpac3pay); static GstFlowReturn gst_rtp_ac3_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer); -GST_BOILERPLATE (GstRtpAC3Pay, gst_rtp_ac3_pay, GstBaseRTPPayload, - GST_TYPE_BASE_RTP_PAYLOAD) - - static void gst_rtp_ac3_pay_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_ac3_pay_src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_ac3_pay_sink_template)); - - gst_element_class_set_details_simple (element_class, - "RTP AC3 audio payloader", "Codec/Payloader/Network/RTP", - "Payload AC3 audio as RTP packets (RFC 4184)", - "Wim Taymans "); -} +#define gst_rtp_ac3_pay_parent_class parent_class +G_DEFINE_TYPE (GstRtpAC3Pay, gst_rtp_ac3_pay, GST_TYPE_BASE_RTP_PAYLOAD); static void gst_rtp_ac3_pay_class_init (GstRtpAC3PayClass * klass) @@ -85,6 +70,9 @@ gst_rtp_ac3_pay_class_init (GstRtpAC3PayClass * klass) GstElementClass *gstelement_class; GstBaseRTPPayloadClass *gstbasertppayload_class; + GST_DEBUG_CATEGORY_INIT (rtpac3pay_debug, "rtpac3pay", 0, + "AC3 Audio RTP Depayloader"); + gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; @@ -93,16 +81,23 @@ gst_rtp_ac3_pay_class_init (GstRtpAC3PayClass * klass) gstelement_class->change_state = gst_rtp_ac3_pay_change_state; + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_ac3_pay_src_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_ac3_pay_sink_template)); + + gst_element_class_set_details_simple (gstelement_class, + "RTP AC3 audio payloader", "Codec/Payloader/Network/RTP", + "Payload AC3 audio as RTP packets (RFC 4184)", + "Wim Taymans "); + gstbasertppayload_class->set_caps = gst_rtp_ac3_pay_setcaps; gstbasertppayload_class->handle_event = gst_rtp_ac3_pay_handle_event; gstbasertppayload_class->handle_buffer = gst_rtp_ac3_pay_handle_buffer; - - GST_DEBUG_CATEGORY_INIT (rtpac3pay_debug, "rtpac3pay", 0, - "AC3 Audio RTP Depayloader"); } static void -gst_rtp_ac3_pay_init (GstRtpAC3Pay * rtpac3pay, GstRtpAC3PayClass * klass) +gst_rtp_ac3_pay_init (GstRtpAC3Pay * rtpac3pay) { rtpac3pay->adapter = gst_adapter_new (); } diff --git a/gst/rtp/gstrtpbvdepay.c b/gst/rtp/gstrtpbvdepay.c index 7133f8e..a01aa47 100644 --- a/gst/rtp/gstrtpbvdepay.c +++ b/gst/rtp/gstrtpbvdepay.c @@ -54,37 +54,34 @@ static GstBuffer *gst_rtp_bv_depay_process (GstBaseRTPDepayload * depayload, static gboolean gst_rtp_bv_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps); -GST_BOILERPLATE (GstRTPBVDepay, gst_rtp_bv_depay, GstBaseRTPDepayload, - GST_TYPE_BASE_RTP_DEPAYLOAD); +#define gst_rtp_bv_depay_parent_class parent_class +G_DEFINE_TYPE (GstRTPBVDepay, gst_rtp_bv_depay, GST_TYPE_BASE_RTP_DEPAYLOAD); static void -gst_rtp_bv_depay_base_init (gpointer klass) +gst_rtp_bv_depay_class_init (GstRTPBVDepayClass * klass) { - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstElementClass *gstelement_class; + GstBaseRTPDepayloadClass *gstbasertpdepayload_class; + + gstelement_class = (GstElementClass *) klass; + gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; - gst_element_class_add_pad_template (element_class, + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_bv_depay_src_template)); - gst_element_class_add_pad_template (element_class, + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_bv_depay_sink_template)); - gst_element_class_set_details_simple (element_class, + + gst_element_class_set_details_simple (gstelement_class, "RTP BroadcomVoice depayloader", "Codec/Depayloader/Network/RTP", "Extracts BroadcomVoice audio from RTP packets (RFC 4298)", "Wim Taymans "); -} - -static void -gst_rtp_bv_depay_class_init (GstRTPBVDepayClass * klass) -{ - GstBaseRTPDepayloadClass *gstbasertpdepayload_class; - - gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; gstbasertpdepayload_class->process = gst_rtp_bv_depay_process; gstbasertpdepayload_class->set_caps = gst_rtp_bv_depay_setcaps; } static void -gst_rtp_bv_depay_init (GstRTPBVDepay * rtpbvdepay, GstRTPBVDepayClass * klass) +gst_rtp_bv_depay_init (GstRTPBVDepay * rtpbvdepay) { rtpbvdepay->mode = -1; } diff --git a/gst/rtp/gstrtpbvpay.c b/gst/rtp/gstrtpbvpay.c index 0c01001..5184826 100644 --- a/gst/rtp/gstrtpbvpay.c +++ b/gst/rtp/gstrtpbvpay.c @@ -58,40 +58,37 @@ static GstCaps *gst_rtp_bv_pay_sink_getcaps (GstBaseRTPPayload * payload, static gboolean gst_rtp_bv_pay_sink_setcaps (GstBaseRTPPayload * payload, GstCaps * caps); -GST_BOILERPLATE (GstRTPBVPay, gst_rtp_bv_pay, GstBaseRTPAudioPayload, - GST_TYPE_BASE_RTP_AUDIO_PAYLOAD); +#define gst_rtp_bv_pay_parent_class parent_class +G_DEFINE_TYPE (GstRTPBVPay, gst_rtp_bv_pay, GST_TYPE_BASE_RTP_AUDIO_PAYLOAD); static void -gst_rtp_bv_pay_base_init (gpointer klass) +gst_rtp_bv_pay_class_init (GstRTPBVPayClass * klass) { - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstElementClass *gstelement_class; + GstBaseRTPPayloadClass *gstbasertppayload_class; + + GST_DEBUG_CATEGORY_INIT (rtpbvpay_debug, "rtpbvpay", 0, + "BroadcomVoice audio RTP payloader"); - gst_element_class_add_pad_template (element_class, + gstelement_class = (GstElementClass *) klass; + gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; + + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_bv_pay_sink_template)); - gst_element_class_add_pad_template (element_class, + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_bv_pay_src_template)); - gst_element_class_set_details_simple (element_class, "RTP BV Payloader", + + gst_element_class_set_details_simple (gstelement_class, "RTP BV Payloader", "Codec/Payloader/Network/RTP", "Packetize BroadcomVoice audio streams into RTP packets (RFC 4298)", "Wim Taymans "); -} - -static void -gst_rtp_bv_pay_class_init (GstRTPBVPayClass * klass) -{ - GstBaseRTPPayloadClass *gstbasertppayload_class; - - gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; gstbasertppayload_class->set_caps = gst_rtp_bv_pay_sink_setcaps; gstbasertppayload_class->get_caps = gst_rtp_bv_pay_sink_getcaps; - - GST_DEBUG_CATEGORY_INIT (rtpbvpay_debug, "rtpbvpay", 0, - "BroadcomVoice audio RTP payloader"); } static void -gst_rtp_bv_pay_init (GstRTPBVPay * rtpbvpay, GstRTPBVPayClass * klass) +gst_rtp_bv_pay_init (GstRTPBVPay * rtpbvpay) { GstBaseRTPAudioPayload *basertpaudiopayload; diff --git a/gst/rtp/gstrtpceltdepay.c b/gst/rtp/gstrtpceltdepay.c index e1fc4c5..b0a63c1 100644 --- a/gst/rtp/gstrtpceltdepay.c +++ b/gst/rtp/gstrtpceltdepay.c @@ -70,41 +70,38 @@ static GstBuffer *gst_rtp_celt_depay_process (GstBaseRTPDepayload * depayload, static gboolean gst_rtp_celt_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps); -GST_BOILERPLATE (GstRtpCELTDepay, gst_rtp_celt_depay, GstBaseRTPDepayload, +#define gst_rtp_celt_depay_parent_class parent_class +G_DEFINE_TYPE (GstRtpCELTDepay, gst_rtp_celt_depay, GST_TYPE_BASE_RTP_DEPAYLOAD); static void -gst_rtp_celt_depay_base_init (gpointer klass) +gst_rtp_celt_depay_class_init (GstRtpCELTDepayClass * klass) { - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_celt_depay_src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_celt_depay_sink_template)); - gst_element_class_set_details_simple (element_class, "RTP CELT depayloader", - "Codec/Depayloader/Network/RTP", - "Extracts CELT audio from RTP packets", - "Wim Taymans "); + GstElementClass *gstelement_class; + GstBaseRTPDepayloadClass *gstbasertpdepayload_class; GST_DEBUG_CATEGORY_INIT (rtpceltdepay_debug, "rtpceltdepay", 0, "CELT RTP Depayloader"); -} - -static void -gst_rtp_celt_depay_class_init (GstRtpCELTDepayClass * klass) -{ - GstBaseRTPDepayloadClass *gstbasertpdepayload_class; + gstelement_class = (GstElementClass *) klass; gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_celt_depay_src_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_celt_depay_sink_template)); + + gst_element_class_set_details_simple (gstelement_class, + "RTP CELT depayloader", "Codec/Depayloader/Network/RTP", + "Extracts CELT audio from RTP packets", + "Wim Taymans "); + gstbasertpdepayload_class->process = gst_rtp_celt_depay_process; gstbasertpdepayload_class->set_caps = gst_rtp_celt_depay_setcaps; } static void -gst_rtp_celt_depay_init (GstRtpCELTDepay * rtpceltdepay, - GstRtpCELTDepayClass * klass) +gst_rtp_celt_depay_init (GstRtpCELTDepay * rtpceltdepay) { } diff --git a/gst/rtp/gstrtpceltpay.c b/gst/rtp/gstrtpceltpay.c index 5d32be9..6c8f0b9 100644 --- a/gst/rtp/gstrtpceltpay.c +++ b/gst/rtp/gstrtpceltpay.c @@ -62,26 +62,8 @@ static GstCaps *gst_rtp_celt_pay_getcaps (GstBaseRTPPayload * payload, static GstFlowReturn gst_rtp_celt_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer); -GST_BOILERPLATE (GstRtpCELTPay, gst_rtp_celt_pay, GstBaseRTPPayload, - GST_TYPE_BASE_RTP_PAYLOAD); - -static void -gst_rtp_celt_pay_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_celt_pay_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_celt_pay_src_template)); - gst_element_class_set_details_simple (element_class, "RTP CELT payloader", - "Codec/Payloader/Network/RTP", - "Payload-encodes CELT audio into a RTP packet", - "Wim Taymans "); - - GST_DEBUG_CATEGORY_INIT (rtpceltpay_debug, "rtpceltpay", 0, - "CELT RTP Payloader"); -} +#define gst_rtp_celt_pay_parent_class parent_class +G_DEFINE_TYPE (GstRtpCELTPay, gst_rtp_celt_pay, GST_TYPE_BASE_RTP_PAYLOAD); static void gst_rtp_celt_pay_class_init (GstRtpCELTPayClass * klass) @@ -90,6 +72,9 @@ gst_rtp_celt_pay_class_init (GstRtpCELTPayClass * klass) GstElementClass *gstelement_class; GstBaseRTPPayloadClass *gstbasertppayload_class; + GST_DEBUG_CATEGORY_INIT (rtpceltpay_debug, "rtpceltpay", 0, + "CELT RTP Payloader"); + gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; @@ -98,13 +83,23 @@ gst_rtp_celt_pay_class_init (GstRtpCELTPayClass * klass) gstelement_class->change_state = gst_rtp_celt_pay_change_state; + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_celt_pay_sink_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_celt_pay_src_template)); + + gst_element_class_set_details_simple (gstelement_class, "RTP CELT payloader", + "Codec/Payloader/Network/RTP", + "Payload-encodes CELT audio into a RTP packet", + "Wim Taymans "); + gstbasertppayload_class->set_caps = gst_rtp_celt_pay_setcaps; gstbasertppayload_class->get_caps = gst_rtp_celt_pay_getcaps; gstbasertppayload_class->handle_buffer = gst_rtp_celt_pay_handle_buffer; } static void -gst_rtp_celt_pay_init (GstRtpCELTPay * rtpceltpay, GstRtpCELTPayClass * klass) +gst_rtp_celt_pay_init (GstRtpCELTPay * rtpceltpay) { rtpceltpay->queue = g_queue_new (); } diff --git a/gst/rtp/gstrtpdepay.c b/gst/rtp/gstrtpdepay.c index d94d9b1..cabdcda 100644 --- a/gst/rtp/gstrtpdepay.c +++ b/gst/rtp/gstrtpdepay.c @@ -56,13 +56,15 @@ static GstFlowReturn gst_rtp_depay_chain_rtp (GstPad * pad, GstBuffer * buffer); static GstFlowReturn gst_rtp_depay_chain_rtcp (GstPad * pad, GstBuffer * buffer); -GST_BOILERPLATE (GstRTPDepay, gst_rtp_depay, GstElement, GST_TYPE_ELEMENT); +G_DEFINE_TYPE (GstRTPDepay, gst_rtp_depay, GST_TYPE_ELEMENT); static void -gst_rtp_depay_base_init (gpointer klass) +gst_rtp_depay_class_init (GstRTPDepayClass * klass) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); + GST_DEBUG_CATEGORY_INIT (rtpdepay_debug, "rtpdepay", 0, "RTP decoder"); + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_depay_src_rtp_template)); gst_element_class_add_pad_template (gstelement_class, @@ -71,6 +73,7 @@ gst_rtp_depay_base_init (gpointer klass) gst_static_pad_template_get (&gst_rtp_depay_sink_rtp_template)); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_depay_sink_rtcp_template)); + gst_element_class_set_details_simple (gstelement_class, "Dummy RTP session manager", "Codec/Depayloader/Network/RTP", "Accepts raw RTP and RTCP packets and sends them forward", @@ -78,13 +81,7 @@ gst_rtp_depay_base_init (gpointer klass) } static void -gst_rtp_depay_class_init (GstRTPDepayClass * klass) -{ - GST_DEBUG_CATEGORY_INIT (rtpdepay_debug, "rtpdepay", 0, "RTP decoder"); -} - -static void -gst_rtp_depay_init (GstRTPDepay * rtpdepay, GstRTPDepayClass * klass) +gst_rtp_depay_init (GstRTPDepay * rtpdepay) { /* the input rtp pad */ rtpdepay->sink_rtp = diff --git a/gst/rtp/gstrtpdvdepay.c b/gst/rtp/gstrtpdvdepay.c index 25ebc1a..6134477 100644 --- a/gst/rtp/gstrtpdvdepay.c +++ b/gst/rtp/gstrtpdvdepay.c @@ -80,25 +80,10 @@ static GstBuffer *gst_rtp_dv_depay_process (GstBaseRTPDepayload * base, static gboolean gst_rtp_dv_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps); -GST_BOILERPLATE (GstRTPDVDepay, gst_rtp_dv_depay, GstBaseRTPDepayload, - GST_TYPE_BASE_RTP_DEPAYLOAD) +#define gst_rtp_dv_depay_parent_class parent_class +G_DEFINE_TYPE (GstRTPDVDepay, gst_rtp_dv_depay, GST_TYPE_BASE_RTP_DEPAYLOAD); - static void gst_rtp_dv_depay_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory)); - gst_element_class_set_details_simple (element_class, "RTP DV Depayloader", - "Codec/Depayloader/Network/RTP", - "Depayloads DV from RTP packets (RFC 3189)", - "Marcel Moreaux , Wim Taymans "); -} - -/* initialize the plugin's class */ static void gst_rtp_dv_depay_class_init (GstRTPDVDepayClass * klass) { @@ -106,16 +91,26 @@ gst_rtp_dv_depay_class_init (GstRTPDVDepayClass * klass) GstBaseRTPDepayloadClass *gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; + GST_DEBUG_CATEGORY_INIT (rtpdvdepay_debug, "rtpdvdepay", 0, + "DV RTP Depayloader"); + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_rtp_dv_depay_change_state); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&src_factory)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sink_factory)); + + gst_element_class_set_details_simple (gstelement_class, "RTP DV Depayloader", + "Codec/Depayloader/Network/RTP", + "Depayloads DV from RTP packets (RFC 3189)", + "Marcel Moreaux , Wim Taymans "); + gstbasertpdepayload_class->process = GST_DEBUG_FUNCPTR (gst_rtp_dv_depay_process); gstbasertpdepayload_class->set_caps = GST_DEBUG_FUNCPTR (gst_rtp_dv_depay_setcaps); - - GST_DEBUG_CATEGORY_INIT (rtpdvdepay_debug, "rtpdvdepay", 0, - "DV RTP Depayloader"); } /* initialize the new element @@ -124,7 +119,7 @@ gst_rtp_dv_depay_class_init (GstRTPDVDepayClass * klass) * initialize structure */ static void -gst_rtp_dv_depay_init (GstRTPDVDepay * filter, GstRTPDVDepayClass * klass) +gst_rtp_dv_depay_init (GstRTPDVDepay * filter) { } diff --git a/gst/rtp/gstrtpdvpay.c b/gst/rtp/gstrtpdvpay.c index bd87d70..10690ab 100644 --- a/gst/rtp/gstrtpdvpay.c +++ b/gst/rtp/gstrtpdvpay.c @@ -94,49 +94,47 @@ static void gst_dv_pay_set_property (GObject * object, static void gst_dv_pay_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -GST_BOILERPLATE (GstRTPDVPay, gst_rtp_dv_pay, GstBaseRTPPayload, - GST_TYPE_BASE_RTP_PAYLOAD) - - static void gst_rtp_dv_pay_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_dv_pay_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_dv_pay_src_template)); - gst_element_class_set_details_simple (element_class, "RTP DV Payloader", - "Codec/Payloader/Network/RTP", - "Payloads DV into RTP packets (RFC 3189)", - "Marcel Moreaux , Wim Taymans "); -} +#define gst_rtp_dv_pay_parent_class parent_class +G_DEFINE_TYPE (GstRTPDVPay, gst_rtp_dv_pay, GST_TYPE_BASE_RTP_PAYLOAD); static void gst_rtp_dv_pay_class_init (GstRTPDVPayClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstBaseRTPPayloadClass *gstbasertppayload_class; + GST_DEBUG_CATEGORY_INIT (rtpdvpay_debug, "rtpdvpay", 0, "DV RTP Payloader"); + gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; gobject_class->set_property = gst_dv_pay_set_property; gobject_class->get_property = gst_dv_pay_get_property; - gstbasertppayload_class->set_caps = gst_rtp_dv_pay_setcaps; - gstbasertppayload_class->handle_buffer = gst_rtp_dv_pay_handle_buffer; - g_object_class_install_property (gobject_class, PROP_MODE, g_param_spec_enum ("mode", "Mode", "The payload mode of payloading", GST_TYPE_DV_PAY_MODE, DEFAULT_MODE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - GST_DEBUG_CATEGORY_INIT (rtpdvpay_debug, "rtpdvpay", 0, "DV RTP Payloader"); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_dv_pay_sink_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_dv_pay_src_template)); + + gst_element_class_set_details_simple (gstelement_class, "RTP DV Payloader", + "Codec/Payloader/Network/RTP", + "Payloads DV into RTP packets (RFC 3189)", + "Marcel Moreaux , Wim Taymans "); + + gstbasertppayload_class->set_caps = gst_rtp_dv_pay_setcaps; + gstbasertppayload_class->handle_buffer = gst_rtp_dv_pay_handle_buffer; } static void -gst_rtp_dv_pay_init (GstRTPDVPay * rtpdvpay, GstRTPDVPayClass * klass) +gst_rtp_dv_pay_init (GstRTPDVPay * rtpdvpay) { } diff --git a/gst/rtp/gstrtpgstdepay.c b/gst/rtp/gstrtpgstdepay.c index 9b8c438..19b732d 100644 --- a/gst/rtp/gstrtpgstdepay.c +++ b/gst/rtp/gstrtpgstdepay.c @@ -45,8 +45,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", "clock-rate = (int) 90000, " "encoding-name = (string) \"X-GST\"") ); -GST_BOILERPLATE (GstRtpGSTDepay, gst_rtp_gst_depay, GstBaseRTPDepayload, - GST_TYPE_BASE_RTP_DEPAYLOAD); +#define gst_rtp_gst_depay_parent_class parent_class +G_DEFINE_TYPE (GstRtpGSTDepay, gst_rtp_gst_depay, GST_TYPE_BASE_RTP_DEPAYLOAD); static void gst_rtp_gst_depay_finalize (GObject * object); @@ -60,28 +60,15 @@ static GstBuffer *gst_rtp_gst_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf); static void -gst_rtp_gst_depay_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_gst_depay_src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_gst_depay_sink_template)); - - gst_element_class_set_details_simple (element_class, - "GStreamer depayloader", "Codec/Depayloader/Network", - "Extracts GStreamer buffers from RTP packets", - "Wim Taymans "); -} - -static void gst_rtp_gst_depay_class_init (GstRtpGSTDepayClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; GstBaseRTPDepayloadClass *gstbasertpdepayload_class; + GST_DEBUG_CATEGORY_INIT (rtpgstdepay_debug, "rtpgstdepay", 0, + "Gstreamer RTP Depayloader"); + gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; @@ -90,16 +77,22 @@ gst_rtp_gst_depay_class_init (GstRtpGSTDepayClass * klass) gstelement_class->change_state = gst_rtp_gst_depay_change_state; + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_gst_depay_src_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_gst_depay_sink_template)); + + gst_element_class_set_details_simple (gstelement_class, + "GStreamer depayloader", "Codec/Depayloader/Network", + "Extracts GStreamer buffers from RTP packets", + "Wim Taymans "); + gstbasertpdepayload_class->set_caps = gst_rtp_gst_depay_setcaps; gstbasertpdepayload_class->process = gst_rtp_gst_depay_process; - - GST_DEBUG_CATEGORY_INIT (rtpgstdepay_debug, "rtpgstdepay", 0, - "Gstreamer RTP Depayloader"); } static void -gst_rtp_gst_depay_init (GstRtpGSTDepay * rtpgstdepay, - GstRtpGSTDepayClass * klass) +gst_rtp_gst_depay_init (GstRtpGSTDepay * rtpgstdepay) { rtpgstdepay->adapter = gst_adapter_new (); } diff --git a/gst/rtp/gstrtpgstpay.c b/gst/rtp/gstrtpgstpay.c index dd3ef42..f8c6ccc 100644 --- a/gst/rtp/gstrtpgstpay.c +++ b/gst/rtp/gstrtpgstpay.c @@ -73,37 +73,34 @@ static gboolean gst_rtp_gst_pay_setcaps (GstBaseRTPPayload * payload, static GstFlowReturn gst_rtp_gst_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer); -GST_BOILERPLATE (GstRtpGSTPay, gst_rtp_gst_pay, GstBaseRTPPayload, - GST_TYPE_BASE_RTP_PAYLOAD) +#define gst_rtp_gst_pay_parent_class parent_class +G_DEFINE_TYPE (GstRtpGSTPay, gst_rtp_gst_pay, GST_TYPE_BASE_RTP_PAYLOAD); - static void gst_rtp_gst_pay_base_init (gpointer klass) +static void +gst_rtp_gst_pay_class_init (GstRtpGSTPayClass * klass) { - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstElementClass *gstelement_class; + GstBaseRTPPayloadClass *gstbasertppayload_class; - gst_element_class_add_pad_template (element_class, + gstelement_class = (GstElementClass *) klass; + gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; + + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_gst_pay_src_template)); - gst_element_class_add_pad_template (element_class, + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_gst_pay_sink_template)); - gst_element_class_set_details_simple (element_class, + gst_element_class_set_details_simple (gstelement_class, "RTP GStreamer payloader", "Codec/Payloader/Network/RTP", "Payload GStreamer buffers as RTP packets", "Wim Taymans "); -} - -static void -gst_rtp_gst_pay_class_init (GstRtpGSTPayClass * klass) -{ - GstBaseRTPPayloadClass *gstbasertppayload_class; - - gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; gstbasertppayload_class->set_caps = gst_rtp_gst_pay_setcaps; gstbasertppayload_class->handle_buffer = gst_rtp_gst_pay_handle_buffer; } static void -gst_rtp_gst_pay_init (GstRtpGSTPay * rtpgstpay, GstRtpGSTPayClass * klass) +gst_rtp_gst_pay_init (GstRtpGSTPay * rtpgstpay) { } diff --git a/gst/rtp/gstrtpilbcdepay.c b/gst/rtp/gstrtpilbcdepay.c index d5512dd..6c22596 100644 --- a/gst/rtp/gstrtpilbcdepay.c +++ b/gst/rtp/gstrtpilbcdepay.c @@ -71,7 +71,8 @@ static GstBuffer *gst_rtp_ilbc_depay_process (GstBaseRTPDepayload * depayload, static gboolean gst_rtp_ilbc_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps); -GST_BOILERPLATE (GstRTPiLBCDepay, gst_rtp_ilbc_depay, GstBaseRTPDepayload, +#define gst_rtp_ilbc_depay_parent_class parent_class +G_DEFINE_TYPE (GstRTPiLBCDepay, gst_rtp_ilbc_depay, GST_TYPE_BASE_RTP_DEPAYLOAD); #define GST_TYPE_ILBC_MODE (gst_ilbc_mode_get_type()) @@ -92,27 +93,14 @@ gst_ilbc_mode_get_type (void) } static void -gst_rtp_ilbc_depay_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_ilbc_depay_src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_ilbc_depay_sink_template)); - gst_element_class_set_details_simple (element_class, "RTP iLBC depayloader", - "Codec/Depayloader/Network/RTP", - "Extracts iLBC audio from RTP packets (RFC 3952)", - "Philippe Kalaf "); -} - -static void gst_rtp_ilbc_depay_class_init (GstRTPiLBCDepayClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstBaseRTPDepayloadClass *gstbasertpdepayload_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; gobject_class->set_property = gst_ilbc_depay_set_property; @@ -124,13 +112,22 @@ gst_rtp_ilbc_depay_class_init (GstRTPiLBCDepayClass * klass) GST_TYPE_ILBC_MODE, DEFAULT_MODE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_ilbc_depay_src_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_ilbc_depay_sink_template)); + + gst_element_class_set_details_simple (gstelement_class, + "RTP iLBC depayloader", "Codec/Depayloader/Network/RTP", + "Extracts iLBC audio from RTP packets (RFC 3952)", + "Philippe Kalaf "); + gstbasertpdepayload_class->process = gst_rtp_ilbc_depay_process; gstbasertpdepayload_class->set_caps = gst_rtp_ilbc_depay_setcaps; } static void -gst_rtp_ilbc_depay_init (GstRTPiLBCDepay * rtpilbcdepay, - GstRTPiLBCDepayClass * klass) +gst_rtp_ilbc_depay_init (GstRTPiLBCDepay * rtpilbcdepay) { /* Set default mode */ rtpilbcdepay->mode = DEFAULT_MODE; diff --git a/gst/rtp/gstrtpilbcpay.c b/gst/rtp/gstrtpilbcpay.c index c070d6c..0fb0429 100644 --- a/gst/rtp/gstrtpilbcpay.c +++ b/gst/rtp/gstrtpilbcpay.c @@ -53,40 +53,38 @@ static GstCaps *gst_rtp_ilbc_pay_sink_getcaps (GstBaseRTPPayload * payload, static gboolean gst_rtp_ilbc_pay_sink_setcaps (GstBaseRTPPayload * payload, GstCaps * caps); -GST_BOILERPLATE (GstRTPILBCPay, gst_rtp_ilbc_pay, GstBaseRTPAudioPayload, +#define gst_rtp_ilbc_pay_parent_class parent_class +G_DEFINE_TYPE (GstRTPILBCPay, gst_rtp_ilbc_pay, GST_TYPE_BASE_RTP_AUDIO_PAYLOAD); static void -gst_rtp_ilbc_pay_base_init (gpointer klass) +gst_rtp_ilbc_pay_class_init (GstRTPILBCPayClass * klass) { - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstElementClass *gstelement_class; + GstBaseRTPPayloadClass *gstbasertppayload_class; + + GST_DEBUG_CATEGORY_INIT (rtpilbcpay_debug, "rtpilbcpay", 0, + "iLBC audio RTP payloader"); - gst_element_class_add_pad_template (element_class, + gstelement_class = (GstElementClass *) klass; + gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; + + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_ilbc_pay_sink_template)); - gst_element_class_add_pad_template (element_class, + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_ilbc_pay_src_template)); - gst_element_class_set_details_simple (element_class, "RTP iLBC Payloader", + + gst_element_class_set_details_simple (gstelement_class, "RTP iLBC Payloader", "Codec/Payloader/Network/RTP", "Packetize iLBC audio streams into RTP packets", "Philippe Kalaf "); -} - -static void -gst_rtp_ilbc_pay_class_init (GstRTPILBCPayClass * klass) -{ - GstBaseRTPPayloadClass *gstbasertppayload_class; - - gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; gstbasertppayload_class->set_caps = gst_rtp_ilbc_pay_sink_setcaps; gstbasertppayload_class->get_caps = gst_rtp_ilbc_pay_sink_getcaps; - - GST_DEBUG_CATEGORY_INIT (rtpilbcpay_debug, "rtpilbcpay", 0, - "iLBC audio RTP payloader"); } static void -gst_rtp_ilbc_pay_init (GstRTPILBCPay * rtpilbcpay, GstRTPILBCPayClass * klass) +gst_rtp_ilbc_pay_init (GstRTPILBCPay * rtpilbcpay) { GstBaseRTPPayload *basertppayload; GstBaseRTPAudioPayload *basertpaudiopayload; diff --git a/gst/rtp/gstrtpmpadepay.c b/gst/rtp/gstrtpmpadepay.c index 8eae3a7..45240f9 100644 --- a/gst/rtp/gstrtpmpadepay.c +++ b/gst/rtp/gstrtpmpadepay.c @@ -50,8 +50,8 @@ static GstStaticPadTemplate gst_rtp_mpa_depay_sink_template = "clock-rate = (int) 90000") ); -GST_BOILERPLATE (GstRtpMPADepay, gst_rtp_mpa_depay, GstBaseRTPDepayload, - GST_TYPE_BASE_RTP_DEPAYLOAD); +#define gst_rtp_mpa_depay_parent_class parent_class +G_DEFINE_TYPE (GstRtpMPADepay, gst_rtp_mpa_depay, GST_TYPE_BASE_RTP_DEPAYLOAD); static gboolean gst_rtp_mpa_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps); @@ -59,38 +59,33 @@ static GstBuffer *gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf); static void -gst_rtp_mpa_depay_base_init (gpointer klass) +gst_rtp_mpa_depay_class_init (GstRtpMPADepayClass * klass) { - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstElementClass *gstelement_class; + GstBaseRTPDepayloadClass *gstbasertpdepayload_class; + + GST_DEBUG_CATEGORY_INIT (rtpmpadepay_debug, "rtpmpadepay", 0, + "MPEG Audio RTP Depayloader"); - gst_element_class_add_pad_template (element_class, + gstelement_class = (GstElementClass *) klass; + gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; + + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_mpa_depay_src_template)); - gst_element_class_add_pad_template (element_class, + gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&gst_rtp_mpa_depay_sink_template)); - gst_element_class_set_details_simple (element_class, + gst_element_class_set_details_simple (gstelement_class, "RTP MPEG audio depayloader", "Codec/Depayloader/Network/RTP", "Extracts MPEG audio from RTP packets (RFC 2038)", "Wim Taymans "); -} - -static void -gst_rtp_mpa_depay_class_init (GstRtpMPADepayClass * klass) -{ - GstBaseRTPDepayloadClass *gstbasertpdepayload_class; - - gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; gstbasertpdepayload_class->set_caps = gst_rtp_mpa_depay_setcaps; gstbasertpdepayload_class->process = gst_rtp_mpa_depay_process; - - GST_DEBUG_CATEGORY_INIT (rtpmpadepay_debug, "rtpmpadepay", 0, - "MPEG Audio RTP Depayloader"); } static void -gst_rtp_mpa_depay_init (GstRtpMPADepay * rtpmpadepay, - GstRtpMPADepayClass * klass) +gst_rtp_mpa_depay_init (GstRtpMPADepay * rtpmpadepay) { /* needed because of GST_BOILERPLATE */ } diff --git a/gst/rtp/gstrtpmpapay.c b/gst/rtp/gstrtpmpapay.c index 3b0970a..4bfd55f 100644 --- a/gst/rtp/gstrtpmpapay.c +++ b/gst/rtp/gstrtpmpapay.c @@ -63,23 +63,8 @@ static GstFlowReturn gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay); static GstFlowReturn gst_rtp_mpa_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer); -GST_BOILERPLATE (GstRtpMPAPay, gst_rtp_mpa_pay, GstBaseRTPPayload, - GST_TYPE_BASE_RTP_PAYLOAD) - - static void gst_rtp_mpa_pay_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_mpa_pay_src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtp_mpa_pay_sink_template)); - - gst_element_class_set_details_simple (element_class, - "RTP MPEG audio payloader", "Codec/Payloader/Network/RTP", - "Payload MPEG audio as RTP packets (RFC 2038)", - "Wim Taymans "); -} +#define gst_rtp_mpa_pay_parent_class parent_class +G_DEFINE_TYPE (GstRtpMPAPay, gst_rtp_mpa_pay, GST_TYPE_BASE_RTP_PAYLOAD); static void gst_rtp_mpa_pay_class_init (GstRtpMPAPayClass * klass) @@ -88,6 +73,9 @@ gst_rtp_mpa_pay_class_init (GstRtpMPAPayClass * klass) GstElementClass *gstelement_class; GstBaseRTPPayloadClass *gstbasertppayload_class; + GST_DEBUG_CATEGORY_INIT (rtpmpapay_debug, "rtpmpapay", 0, + "MPEG Audio RTP Depayloader"); + gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; @@ -96,16 +84,23 @@ gst_rtp_mpa_pay_class_init (GstRtpMPAPayClass * klass) gstelement_class->change_state = gst_rtp_mpa_pay_change_state; + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_mpa_pay_src_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_rtp_mpa_pay_sink_template)); + + gst_element_class_set_details_simple (gstelement_class, + "RTP MPEG audio payloader", "Codec/Payloader/Network/RTP", + "Payload MPEG audio as RTP packets (RFC 2038)", + "Wim Taymans "); + gstbasertppayload_class->set_caps = gst_rtp_mpa_pay_setcaps; gstbasertppayload_class->handle_event = gst_rtp_mpa_pay_handle_event; gstbasertppayload_class->handle_buffer = gst_rtp_mpa_pay_handle_buffer; - - GST_DEBUG_CATEGORY_INIT (rtpmpapay_debug, "rtpmpapay", 0, - "MPEG Audio RTP Depayloader"); } static void -gst_rtp_mpa_pay_init (GstRtpMPAPay * rtpmpapay, GstRtpMPAPayClass * klass) +gst_rtp_mpa_pay_init (GstRtpMPAPay * rtpmpapay) { rtpmpapay->adapter = gst_adapter_new (); } -- 2.7.4