diff --git a/ext/annodex/gstcmmldec.c b/ext/annodex/gstcmmldec.c index ed7072daf6..2e435cb338 100644 --- a/ext/annodex/gstcmmldec.c +++ b/ext/annodex/gstcmmldec.c @@ -92,12 +92,14 @@ static void gst_cmml_dec_set_property (GObject * dec, guint property_id, const GValue * value, GParamSpec * pspec); static gboolean gst_cmml_dec_sink_query (GstPad * pad, GstObject * parent, GstQuery * query); -static gboolean gst_cmml_dec_sink_event (GstPad * pad, GstEvent * event); +static gboolean gst_cmml_dec_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); static gboolean gst_cmml_dec_convert (GstPad * pad, GstFormat src_fmt, gint64 src_val, GstFormat * dest_fmt, gint64 * dest_val); static GstStateChangeReturn gst_cmml_dec_change_state (GstElement * element, GstStateChange transition); -static GstFlowReturn gst_cmml_dec_chain (GstPad * pad, GstBuffer * buffer); +static GstFlowReturn gst_cmml_dec_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); static GstCmmlPacketType gst_cmml_dec_parse_packet_type (GstCmmlDec * dec, gchar * data, gsize size); @@ -306,9 +308,9 @@ gst_cmml_dec_convert (GstPad * pad, } static gboolean -gst_cmml_dec_sink_event (GstPad * pad, GstEvent * event) +gst_cmml_dec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { - GstCmmlDec *dec = GST_CMML_DEC (GST_PAD_PARENT (pad)); + GstCmmlDec *dec = GST_CMML_DEC (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: @@ -348,13 +350,13 @@ gst_cmml_dec_sink_event (GstPad * pad, GstEvent * event) break; } - return gst_pad_event_default (pad, event); + return gst_pad_event_default (pad, parent, event); } static GstFlowReturn -gst_cmml_dec_chain (GstPad * pad, GstBuffer * buffer) +gst_cmml_dec_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { - GstCmmlDec *dec = GST_CMML_DEC (GST_PAD_PARENT (pad)); + GstCmmlDec *dec = GST_CMML_DEC (parent); GstCmmlPacketType packet; guint8 *data; gsize size; diff --git a/ext/annodex/gstcmmlenc.c b/ext/annodex/gstcmmlenc.c index 4b7356ce9b..57675581f2 100644 --- a/ext/annodex/gstcmmlenc.c +++ b/ext/annodex/gstcmmlenc.c @@ -86,12 +86,14 @@ static void gst_cmml_enc_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void gst_cmml_enc_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -static gboolean gst_cmml_enc_sink_event (GstPad * pad, GstEvent * event); +static gboolean gst_cmml_enc_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstStateChangeReturn gst_cmml_enc_change_state (GstElement * element, GstStateChange transition); -static GstFlowReturn gst_cmml_enc_chain (GstPad * pad, GstBuffer * buffer); -static void gst_cmml_enc_parse_preamble (GstCmmlEnc * enc, - guchar * preamble, guchar * processing_instruction); +static GstFlowReturn gst_cmml_enc_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); +static void gst_cmml_enc_parse_preamble (GstCmmlEnc * enc, guchar * preamble, + guchar * processing_instruction); static void gst_cmml_enc_parse_end_tag (GstCmmlEnc * enc); static void gst_cmml_enc_parse_tag_head (GstCmmlEnc * enc, GstCmmlTagHead * head); @@ -267,9 +269,9 @@ gst_cmml_enc_change_state (GstElement * element, GstStateChange transition) } static gboolean -gst_cmml_enc_sink_event (GstPad * pad, GstEvent * event) +gst_cmml_enc_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { - GstCmmlEnc *enc = GST_CMML_ENC (GST_PAD_PARENT (pad)); + GstCmmlEnc *enc = GST_CMML_ENC (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: @@ -283,7 +285,7 @@ gst_cmml_enc_sink_event (GstPad * pad, GstEvent * event) break; } - return gst_pad_event_default (pad, event); + return gst_pad_event_default (pad, parent, event); } static GstFlowReturn @@ -592,10 +594,10 @@ gst_cmml_enc_push (GstCmmlEnc * enc, GstBuffer * buffer) } static GstFlowReturn -gst_cmml_enc_chain (GstPad * pad, GstBuffer * buffer) +gst_cmml_enc_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GError *err = NULL; - GstCmmlEnc *enc = GST_CMML_ENC (GST_PAD_PARENT (pad)); + GstCmmlEnc *enc = GST_CMML_ENC (parent); gchar *data; gsize size; diff --git a/ext/flac/gstflactag.c b/ext/flac/gstflactag.c index d7df97e888..ebca96b4d2 100644 --- a/ext/flac/gstflactag.c +++ b/ext/flac/gstflactag.c @@ -89,12 +89,14 @@ enum static void gst_flac_tag_dispose (GObject * object); -static GstFlowReturn gst_flac_tag_chain (GstPad * pad, GstBuffer * buffer); +static GstFlowReturn gst_flac_tag_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); static GstStateChangeReturn gst_flac_tag_change_state (GstElement * element, GstStateChange transition); -static gboolean gst_flac_tag_sink_event (GstPad * pad, GstEvent * event); +static gboolean gst_flac_tag_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); #define gst_flac_tag_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstFlacTag, gst_flac_tag, GST_TYPE_ELEMENT, @@ -168,13 +170,13 @@ gst_flac_tag_init (GstFlacTag * tag) } static gboolean -gst_flac_tag_sink_event (GstPad * pad, GstEvent * event) +gst_flac_tag_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { gboolean ret; switch (GST_EVENT_TYPE (event)) { default: - ret = gst_pad_event_default (pad, event); + ret = gst_pad_event_default (pad, parent, event); break; } @@ -185,7 +187,7 @@ gst_flac_tag_sink_event (GstPad * pad, GstEvent * event) #define FLAC_MAGIC_SIZE (sizeof (FLAC_MAGIC) - 1) static GstFlowReturn -gst_flac_tag_chain (GstPad * pad, GstBuffer * buffer) +gst_flac_tag_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GstFlacTag *tag; GstFlowReturn ret; @@ -193,7 +195,7 @@ gst_flac_tag_chain (GstPad * pad, GstBuffer * buffer) gsize size; ret = GST_FLOW_OK; - tag = GST_FLAC_TAG (gst_pad_get_parent (pad)); + tag = GST_FLAC_TAG (parent); gst_adapter_push (tag->adapter, buffer); @@ -424,7 +426,6 @@ gst_flac_tag_chain (GstPad * pad, GstBuffer * buffer) } cleanup: - gst_object_unref (tag); return ret; diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c index 5528c094ca..e1ec259141 100644 --- a/ext/jpeg/gstjpegdec.c +++ b/ext/jpeg/gstjpegdec.c @@ -93,12 +93,15 @@ static void gst_jpeg_dec_set_property (GObject * object, guint prop_id, static void gst_jpeg_dec_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstFlowReturn gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buffer); +static GstFlowReturn gst_jpeg_dec_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); static GstCaps *gst_jpeg_dec_getcaps (GstPad * pad, GstCaps * filter); static gboolean gst_jpeg_dec_sink_query (GstPad * pad, GstObject * parent, GstQuery * query); -static gboolean gst_jpeg_dec_sink_event (GstPad * pad, GstEvent * event); -static gboolean gst_jpeg_dec_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_jpeg_dec_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static gboolean gst_jpeg_dec_src_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstStateChangeReturn gst_jpeg_dec_change_state (GstElement * element, GstStateChange transition); static void gst_jpeg_dec_update_qos (GstJpegDec * dec, gdouble proportion, @@ -1308,7 +1311,7 @@ gst_jpeg_dec_negotiate (GstJpegDec * dec, gint width, gint height, gint clrspc) } static GstFlowReturn -gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf) +gst_jpeg_dec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstFlowReturn ret = GST_FLOW_OK; GstJpegDec *dec; @@ -1320,7 +1323,7 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf) GstClockTime timestamp, duration; GstVideoFrame frame; - dec = GST_JPEG_DEC (GST_PAD_PARENT (pad)); + dec = GST_JPEG_DEC (parent); timestamp = GST_BUFFER_TIMESTAMP (buf); duration = GST_BUFFER_DURATION (buf); @@ -1698,16 +1701,12 @@ invalid_yuvrgbgrayscale: } static gboolean -gst_jpeg_dec_src_event (GstPad * pad, GstEvent * event) +gst_jpeg_dec_src_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstJpegDec *dec; gboolean res; - dec = GST_JPEG_DEC (gst_pad_get_parent (pad)); - if (G_UNLIKELY (dec == NULL)) { - gst_event_unref (event); - return FALSE; - } + dec = GST_JPEG_DEC (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_QOS:{ @@ -1726,15 +1725,14 @@ gst_jpeg_dec_src_event (GstPad * pad, GstEvent * event) res = gst_pad_push_event (dec->sinkpad, event); - gst_object_unref (dec); return res; } static gboolean -gst_jpeg_dec_sink_event (GstPad * pad, GstEvent * event) +gst_jpeg_dec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { gboolean ret = TRUE, forward = TRUE; - GstJpegDec *dec = GST_JPEG_DEC (GST_OBJECT_PARENT (pad)); + GstJpegDec *dec = GST_JPEG_DEC (parent); GST_DEBUG_OBJECT (dec, "event : %s", GST_EVENT_TYPE_NAME (event)); diff --git a/ext/jpeg/gstjpegenc.c b/ext/jpeg/gstjpegenc.c index d9619446bf..9250619ede 100644 --- a/ext/jpeg/gstjpegenc.c +++ b/ext/jpeg/gstjpegenc.c @@ -69,8 +69,10 @@ enum static void gst_jpegenc_reset (GstJpegEnc * enc); static void gst_jpegenc_finalize (GObject * object); -static GstFlowReturn gst_jpegenc_chain (GstPad * pad, GstBuffer * buf); -static gboolean gst_jpegenc_sink_event (GstPad * pad, GstEvent * event); +static GstFlowReturn gst_jpegenc_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf); +static gboolean gst_jpegenc_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstCaps *gst_jpegenc_getcaps (GstPad * pad, GstCaps * filter); static gboolean gst_jpegenc_sink_query (GstPad * pad, GstObject * parent, GstQuery * query); @@ -442,10 +444,10 @@ refuse_caps: } static gboolean -gst_jpegenc_sink_event (GstPad * pad, GstEvent * event) +gst_jpegenc_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { gboolean res; - GstJpegEnc *enc = GST_JPEGENC (gst_pad_get_parent (pad)); + GstJpegEnc *enc = GST_JPEGENC (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -454,15 +456,14 @@ gst_jpegenc_sink_event (GstPad * pad, GstEvent * event) gst_event_parse_caps (event, &caps); res = gst_jpegenc_setcaps (enc, caps); + gst_event_unref (event); break; } default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } - gst_object_unref (enc); - return res; } @@ -533,7 +534,7 @@ gst_jpegenc_resync (GstJpegEnc * jpegenc) } static GstFlowReturn -gst_jpegenc_chain (GstPad * pad, GstBuffer * buf) +gst_jpegenc_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstFlowReturn ret; GstJpegEnc *jpegenc; @@ -544,7 +545,7 @@ gst_jpegenc_chain (GstPad * pad, GstBuffer * buf) GstBuffer *outbuf; GstVideoFrame frame; - jpegenc = GST_JPEGENC (GST_OBJECT_PARENT (pad)); + jpegenc = GST_JPEGENC (parent); if (G_UNLIKELY (GST_VIDEO_INFO_FORMAT (&jpegenc->info) == GST_VIDEO_FORMAT_UNKNOWN)) diff --git a/ext/pulse/pulseaudiosink.c b/ext/pulse/pulseaudiosink.c index e17c2a6c22..0a24875fdf 100644 --- a/ext/pulse/pulseaudiosink.c +++ b/ext/pulse/pulseaudiosink.c @@ -111,9 +111,10 @@ static void gst_pulse_audio_sink_get_property (GObject * object, guint prop_id, static void gst_pulse_audio_sink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_pulse_audio_sink_dispose (GObject * object); -static gboolean gst_pulse_audio_sink_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_pulse_audio_sink_src_event (GstPad * pad, + GstObject * parent, GstEvent * event); static gboolean gst_pulse_audio_sink_sink_event (GstPad * pad, - GstEvent * event); + GstObject * parent, GstEvent * event); static gboolean gst_pulse_audio_sink_sink_query (GstPad * pad, GstObject * parent, GstQuery * query); static gboolean gst_pulse_audio_sink_sink_acceptcaps (GstPulseAudioSink * pbin, @@ -688,13 +689,14 @@ done: } static gboolean -gst_pulse_audio_sink_src_event (GstPad * pad, GstEvent * event) +gst_pulse_audio_sink_src_event (GstPad * pad, GstObject * parent, + GstEvent * event) { GstPulseAudioSink *pbin = NULL; GstPad *ghostpad = NULL; gboolean ret = FALSE; - ghostpad = GST_PAD_CAST (gst_pad_get_parent (pad)); + ghostpad = GST_PAD_CAST (parent); if (G_UNLIKELY (!ghostpad)) { GST_WARNING_OBJECT (pad, "Could not get ghostpad"); goto out; @@ -724,13 +726,11 @@ gst_pulse_audio_sink_src_event (GstPad * pad, GstEvent * event) ret = TRUE; } else if (pbin->proxypad_old_eventfunc) { - ret = pbin->proxypad_old_eventfunc (pad, event); + ret = pbin->proxypad_old_eventfunc (pad, parent, event); event = NULL; } out: - if (ghostpad) - gst_object_unref (ghostpad); if (pbin) gst_object_unref (pbin); if (event) @@ -740,9 +740,10 @@ out: } static gboolean -gst_pulse_audio_sink_sink_event (GstPad * pad, GstEvent * event) +gst_pulse_audio_sink_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event) { - GstPulseAudioSink *pbin = GST_PULSE_AUDIO_SINK (gst_pad_get_parent (pad)); + GstPulseAudioSink *pbin = GST_PULSE_AUDIO_SINK (parent); gboolean ret; gboolean forward = TRUE; @@ -788,12 +789,10 @@ gst_pulse_audio_sink_sink_event (GstPad * pad, GstEvent * event) } if (forward) - ret = pbin->sinkpad_old_eventfunc (pad, event); + ret = pbin->sinkpad_old_eventfunc (pad, parent, event); else gst_event_unref (event); - gst_object_unref (pbin); - return ret; } diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c index a73bd3fe88..6fc5b01498 100644 --- a/gst/auparse/gstauparse.c +++ b/gst/auparse/gstauparse.c @@ -76,14 +76,17 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", static void gst_au_parse_dispose (GObject * object); -static GstFlowReturn gst_au_parse_chain (GstPad * pad, GstBuffer * buf); +static GstFlowReturn gst_au_parse_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf); static GstStateChangeReturn gst_au_parse_change_state (GstElement * element, GstStateChange transition); static void gst_au_parse_reset (GstAuParse * auparse); static gboolean gst_au_parse_src_query (GstPad * pad, GstObject * parent, GstQuery * query); -static gboolean gst_au_parse_src_event (GstPad * pad, GstEvent * event); -static gboolean gst_au_parse_sink_event (GstPad * pad, GstEvent * event); +static gboolean gst_au_parse_src_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static gboolean gst_au_parse_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); static gboolean gst_au_parse_src_convert (GstAuParse * auparse, GstFormat src_format, gint64 srcval, GstFormat dest_format, gint64 * destval); @@ -391,7 +394,7 @@ unknown_format: #define AU_HEADER_SIZE 24 static GstFlowReturn -gst_au_parse_chain (GstPad * pad, GstBuffer * buf) +gst_au_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstFlowReturn ret = GST_FLOW_OK; GstAuParse *auparse; @@ -401,7 +404,7 @@ gst_au_parse_chain (GstPad * pad, GstBuffer * buf) gint64 offset; GstSegment segment; - auparse = GST_AU_PARSE (gst_pad_get_parent (pad)); + auparse = GST_AU_PARSE (parent); GST_LOG_OBJECT (auparse, "got buffer of size %u", gst_buffer_get_size (buf)); @@ -465,7 +468,6 @@ gst_au_parse_chain (GstPad * pad, GstBuffer * buf) out: - gst_object_unref (auparse); return ret; } @@ -650,12 +652,12 @@ gst_au_parse_handle_seek (GstAuParse * auparse, GstEvent * event) } static gboolean -gst_au_parse_sink_event (GstPad * pad, GstEvent * event) +gst_au_parse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstAuParse *auparse; gboolean ret = TRUE; - auparse = GST_AU_PARSE (gst_pad_get_parent (pad)); + auparse = GST_AU_PARSE (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -716,32 +718,30 @@ gst_au_parse_sink_event (GstPad * pad, GstEvent * event) } /* fall-through */ default: - ret = gst_pad_event_default (pad, event); + ret = gst_pad_event_default (pad, parent, event); break; } - gst_object_unref (auparse); return ret; } static gboolean -gst_au_parse_src_event (GstPad * pad, GstEvent * event) +gst_au_parse_src_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstAuParse *auparse; gboolean ret; - auparse = GST_AU_PARSE (gst_pad_get_parent (pad)); + auparse = GST_AU_PARSE (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: ret = gst_au_parse_handle_seek (auparse, event); break; default: - ret = gst_pad_event_default (pad, event); + ret = gst_pad_event_default (pad, parent, event); break; } - gst_object_unref (auparse); return ret; } diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 54323912f6..6d063b126e 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -79,9 +79,10 @@ static void gst_avi_demux_reset (GstAviDemux * avi); #if 0 static const GstEventMask *gst_avi_demux_get_event_mask (GstPad * pad); #endif -static gboolean gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_avi_demux_handle_src_event (GstPad * pad, + GstObject * parent, GstEvent * event); static gboolean gst_avi_demux_handle_sink_event (GstPad * pad, - GstEvent * event); + GstObject * parent, GstEvent * event); static gboolean gst_avi_demux_push_event (GstAviDemux * avi, GstEvent * event); #if 0 @@ -102,7 +103,8 @@ static gboolean gst_avi_demux_sink_activate (GstPad * sinkpad); static gboolean gst_avi_demux_sink_activate_pull (GstPad * sinkpad, gboolean active); static gboolean gst_avi_demux_activate_push (GstPad * pad, gboolean active); -static GstFlowReturn gst_avi_demux_chain (GstPad * pad, GstBuffer * buf); +static GstFlowReturn gst_avi_demux_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf); static void gst_avi_demux_set_index (GstElement * element, GstIndex * index); static GstIndex *gst_avi_demux_get_index (GstElement * element); @@ -692,10 +694,11 @@ gst_avi_demux_seek_streams_index (GstAviDemux * avi, guint64 offset, #define GST_AVI_SEEK_PUSH_DISPLACE (4 * GST_SECOND) static gboolean -gst_avi_demux_handle_sink_event (GstPad * pad, GstEvent * event) +gst_avi_demux_handle_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event) { gboolean res = TRUE; - GstAviDemux *avi = GST_AVI_DEMUX (gst_pad_get_parent (pad)); + GstAviDemux *avi = GST_AVI_DEMUX (parent); GST_DEBUG_OBJECT (avi, "have event type %s: %p on sink pad", GST_EVENT_TYPE_NAME (event), event); @@ -850,20 +853,19 @@ gst_avi_demux_handle_sink_event (GstPad * pad, GstEvent * event) /* fall through to default case so that the event gets passed downstream */ } default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } - gst_object_unref (avi); - return res; } static gboolean -gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event) +gst_avi_demux_handle_src_event (GstPad * pad, GstObject * parent, + GstEvent * event) { gboolean res = TRUE; - GstAviDemux *avi = GST_AVI_DEMUX (gst_pad_get_parent (pad)); + GstAviDemux *avi = GST_AVI_DEMUX (parent); GST_DEBUG_OBJECT (avi, "have event type %s: %p on src pad", GST_EVENT_TYPE_NAME (event), event); @@ -883,12 +885,10 @@ gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event) gst_event_unref (event); break; default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } - gst_object_unref (avi); - return res; } @@ -5154,10 +5154,10 @@ pause:{ static GstFlowReturn -gst_avi_demux_chain (GstPad * pad, GstBuffer * buf) +gst_avi_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstFlowReturn res; - GstAviDemux *avi = GST_AVI_DEMUX (GST_PAD_PARENT (pad)); + GstAviDemux *avi = GST_AVI_DEMUX (parent); gint i; if (GST_BUFFER_IS_DISCONT (buf)) { diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c index ee099c0d95..9561bd7f3e 100644 --- a/gst/avi/gstavimux.c +++ b/gst/avi/gstavimux.c @@ -192,7 +192,8 @@ static void gst_avi_mux_pad_reset (GstAviPad * avipad, gboolean free); static GstFlowReturn gst_avi_mux_collect_pads (GstCollectPads * pads, GstAviMux * avimux); -static gboolean gst_avi_mux_handle_event (GstPad * pad, GstEvent * event); +static gboolean gst_avi_mux_handle_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstPad *gst_avi_mux_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name, const GstCaps * caps); static void gst_avi_mux_release_pad (GstElement * element, GstPad * pad); @@ -982,7 +983,7 @@ gst_avi_mux_request_new_pad (GstElement * element, /* FIXME: hacked way to override/extend the event function of * GstCollectPads; because it sets its own event function giving the * element no access to events */ - avimux->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad); + avimux->collect_event = GST_PAD_EVENTFUNC (newpad); gst_pad_set_event_function (newpad, GST_DEBUG_FUNCPTR (gst_avi_mux_handle_event)); @@ -1832,12 +1833,12 @@ gst_avi_mux_restart_file (GstAviMux * avimux) /* handle events (search) */ static gboolean -gst_avi_mux_handle_event (GstPad * pad, GstEvent * event) +gst_avi_mux_handle_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstAviMux *avimux; gboolean ret = TRUE; - avimux = GST_AVI_MUX (gst_pad_get_parent (pad)); + avimux = GST_AVI_MUX (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -1876,9 +1877,7 @@ gst_avi_mux_handle_event (GstPad * pad, GstEvent * event) /* now GstCollectPads can take care of the rest, e.g. EOS */ if (ret) - ret = avimux->collect_event (pad, event); - - gst_object_unref (avimux); + ret = avimux->collect_event (pad, parent, event); return ret; } diff --git a/gst/avi/gstavisubtitle.c b/gst/avi/gstavisubtitle.c index 8e79836cc2..ed1dddaa05 100644 --- a/gst/avi/gstavisubtitle.c +++ b/gst/avi/gstavisubtitle.c @@ -75,7 +75,8 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", ); static void gst_avi_subtitle_title_tag (GstAviSubtitle * sub, gchar * title); -static GstFlowReturn gst_avi_subtitle_chain (GstPad * pad, GstBuffer * buffer); +static GstFlowReturn gst_avi_subtitle_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); static GstStateChangeReturn gst_avi_subtitle_change_state (GstElement * element, GstStateChange transition); static gboolean gst_avi_subtitle_send_event (GstElement * element, @@ -272,9 +273,9 @@ extract_failed: } static GstFlowReturn -gst_avi_subtitle_chain (GstPad * pad, GstBuffer * buffer) +gst_avi_subtitle_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { - GstAviSubtitle *sub = GST_AVI_SUBTITLE (GST_PAD_PARENT (pad)); + GstAviSubtitle *sub = GST_AVI_SUBTITLE (parent); GstFlowReturn ret; if (sub->subfile != NULL) { diff --git a/gst/cutter/gstcutter.c b/gst/cutter/gstcutter.c index 2168a285f9..c1d7c47f1e 100644 --- a/gst/cutter/gstcutter.c +++ b/gst/cutter/gstcutter.c @@ -100,8 +100,10 @@ static void gst_cutter_set_property (GObject * object, guint prop_id, static void gst_cutter_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static gboolean gst_cutter_event (GstPad * pad, GstEvent * event); -static GstFlowReturn gst_cutter_chain (GstPad * pad, GstBuffer * buffer); +static gboolean gst_cutter_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static GstFlowReturn gst_cutter_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); static void gst_cutter_class_init (GstCutterClass * klass) @@ -236,12 +238,12 @@ gst_cutter_setcaps (GstCutter * filter, GstCaps * caps) } static gboolean -gst_cutter_event (GstPad * pad, GstEvent * event) +gst_cutter_event (GstPad * pad, GstObject * parent, GstEvent * event) { gboolean ret; GstCutter *filter; - filter = GST_CUTTER (GST_OBJECT_PARENT (pad)); + filter = GST_CUTTER (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -250,17 +252,18 @@ gst_cutter_event (GstPad * pad, GstEvent * event) gst_event_parse_caps (event, &caps); ret = gst_cutter_setcaps (filter, caps); + gst_event_unref (event); break; } default: - ret = gst_pad_event_default (pad, event); + ret = gst_pad_event_default (pad, parent, event); break; } return ret; } static GstFlowReturn -gst_cutter_chain (GstPad * pad, GstBuffer * buf) +gst_cutter_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstFlowReturn ret = GST_FLOW_OK; GstCutter *filter; @@ -274,7 +277,7 @@ gst_cutter_chain (GstPad * pad, GstBuffer * buf) GstBuffer *prebuf; /* pointer to a prebuffer element */ GstClockTime duration; - filter = GST_CUTTER (GST_OBJECT_PARENT (pad)); + filter = GST_CUTTER (parent); if (GST_AUDIO_INFO_FORMAT (&filter->info) == GST_AUDIO_FORMAT_UNKNOWN) goto not_negotiated; diff --git a/gst/debugutils/gstnavigationtest.c b/gst/debugutils/gstnavigationtest.c index a9ed4438bb..68881fe7d0 100644 --- a/gst/debugutils/gstnavigationtest.c +++ b/gst/debugutils/gstnavigationtest.c @@ -49,15 +49,16 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420")) ); -static GstVideoFilterClass *parent_class = NULL; +#define gst_navigationtest_parent_class parent_class +G_DEFINE_TYPE (GstNavigationtest, gst_navigationtest, GST_TYPE_VIDEO_FILTER); static gboolean -gst_navigationtest_handle_src_event (GstPad * pad, GstEvent * event) +gst_navigationtest_src_event (GstBaseTransform * trans, GstEvent * event) { GstNavigationtest *navtest; const gchar *type; - navtest = GST_NAVIGATIONTEST (GST_PAD_PARENT (pad)); + navtest = GST_NAVIGATIONTEST (trans); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_NAVIGATION: @@ -100,7 +101,7 @@ gst_navigationtest_handle_src_event (GstPad * pad, GstEvent * event) default: break; } - return gst_pad_event_default (pad, event); + return GST_BASE_TRANSFORM_CLASS (parent_class)->src_event (trans, event); } /* Useful macros */ @@ -289,23 +290,7 @@ gst_navigationtest_change_state (GstElement * element, } static void -gst_navigationtest_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (element_class, "Video navigation test", - "Filter/Effect/Video", - "Handle navigation events showing a black square following mouse pointer", - "David Schleef "); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_navigationtest_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_navigationtest_src_template)); -} - -static void -gst_navigationtest_class_init (gpointer klass, gpointer class_data) +gst_navigationtest_class_init (GstNavigationtestClass * klass) { GstElementClass *element_class; GstBaseTransformClass *trans_class; @@ -318,49 +303,30 @@ gst_navigationtest_class_init (gpointer klass, gpointer class_data) element_class->change_state = GST_DEBUG_FUNCPTR (gst_navigationtest_change_state); + gst_element_class_set_details_simple (element_class, "Video navigation test", + "Filter/Effect/Video", + "Handle navigation events showing a black square following mouse pointer", + "David Schleef "); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_navigationtest_sink_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_navigationtest_src_template)); + trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_navigationtest_set_caps); trans_class->get_unit_size = GST_DEBUG_FUNCPTR (gst_navigationtest_get_unit_size); trans_class->transform = GST_DEBUG_FUNCPTR (gst_navigationtest_transform); + trans_class->src_event = GST_DEBUG_FUNCPTR (gst_navigationtest_src_event); } static void -gst_navigationtest_init (GTypeInstance * instance, gpointer g_class) +gst_navigationtest_init (GstNavigationtest * navtest) { - GstNavigationtest *navtest = GST_NAVIGATIONTEST (instance); - GstBaseTransform *btrans = GST_BASE_TRANSFORM (instance); - - gst_pad_set_event_function (btrans->srcpad, - GST_DEBUG_FUNCPTR (gst_navigationtest_handle_src_event)); - navtest->x = -1; navtest->y = -1; } -GType -gst_navigationtest_get_type (void) -{ - static GType navigationtest_type = 0; - - if (!navigationtest_type) { - static const GTypeInfo navigationtest_info = { - sizeof (GstNavigationtestClass), - gst_navigationtest_base_init, - NULL, - gst_navigationtest_class_init, - NULL, - NULL, - sizeof (GstNavigationtest), - 0, - gst_navigationtest_init, - }; - - navigationtest_type = g_type_register_static (GST_TYPE_VIDEO_FILTER, - "GstNavigationtest", &navigationtest_info, 0); - } - return navigationtest_type; -} - static gboolean plugin_init (GstPlugin * plugin) { diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c index f6929aeb4e..2e429829ba 100644 --- a/gst/flv/gstflvdemux.c +++ b/gst/flv/gstflvdemux.c @@ -95,7 +95,8 @@ static gboolean gst_flv_demux_handle_seek_pull (GstFlvDemux * demux, static gboolean gst_flv_demux_query (GstPad * pad, GstObject * parent, GstQuery * query); -static gboolean gst_flv_demux_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_flv_demux_src_event (GstPad * pad, GstObject * parent, + GstEvent * event); static void @@ -1768,12 +1769,12 @@ flv_demux_seek_to_offset (GstFlvDemux * demux, guint64 offset) } static GstFlowReturn -gst_flv_demux_chain (GstPad * pad, GstBuffer * buffer) +gst_flv_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GstFlowReturn ret = GST_FLOW_OK; GstFlvDemux *demux = NULL; - demux = GST_FLV_DEMUX (gst_pad_get_parent (pad)); + demux = GST_FLV_DEMUX (parent); GST_LOG_OBJECT (demux, "received buffer of %d bytes at offset %" G_GUINT64_FORMAT, gst_buffer_get_size (buffer), @@ -1983,8 +1984,6 @@ beach: } } - gst_object_unref (demux); - return ret; /* ERRORS */ @@ -2867,12 +2866,12 @@ gst_flv_demux_sink_activate_pull (GstPad * sinkpad, gboolean active) } static gboolean -gst_flv_demux_sink_event (GstPad * pad, GstEvent * event) +gst_flv_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstFlvDemux *demux; gboolean ret = FALSE; - demux = GST_FLV_DEMUX (gst_pad_get_parent (pad)); + demux = GST_FLV_DEMUX (parent); GST_DEBUG_OBJECT (demux, "handling event %s", GST_EVENT_TYPE_NAME (event)); @@ -2933,18 +2932,16 @@ gst_flv_demux_sink_event (GstPad * pad, GstEvent * event) break; } - gst_object_unref (demux); - return ret; } static gboolean -gst_flv_demux_src_event (GstPad * pad, GstEvent * event) +gst_flv_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstFlvDemux *demux; gboolean ret = FALSE; - demux = GST_FLV_DEMUX (gst_pad_get_parent (pad)); + demux = GST_FLV_DEMUX (parent); GST_DEBUG_OBJECT (demux, "handling event %s", GST_EVENT_TYPE_NAME (event)); @@ -2961,8 +2958,6 @@ gst_flv_demux_src_event (GstPad * pad, GstEvent * event) break; } - gst_object_unref (demux); - return ret; } diff --git a/gst/flv/gstflvmux.c b/gst/flv/gstflvmux.c index b8bf9144e1..e002f9ec92 100644 --- a/gst/flv/gstflvmux.c +++ b/gst/flv/gstflvmux.c @@ -91,7 +91,8 @@ static void gst_flv_mux_finalize (GObject * object); static GstFlowReturn gst_flv_mux_collected (GstCollectPads * pads, gpointer user_data); -static gboolean gst_flv_mux_handle_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_flv_mux_handle_src_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstPad *gst_flv_mux_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps); static void gst_flv_mux_release_pad (GstElement * element, GstPad * pad); @@ -253,7 +254,8 @@ gst_flv_mux_reset (GstElement * element) } static gboolean -gst_flv_mux_handle_src_event (GstPad * pad, GstEvent * event) +gst_flv_mux_handle_src_event (GstPad * pad, GstObject * parent, + GstEvent * event) { GstEventType type; @@ -267,13 +269,14 @@ gst_flv_mux_handle_src_event (GstPad * pad, GstEvent * event) break; } - return gst_pad_event_default (pad, event); + return gst_pad_event_default (pad, parent, event); } static gboolean -gst_flv_mux_handle_sink_event (GstPad * pad, GstEvent * event) +gst_flv_mux_handle_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event) { - GstFlvMux *mux = GST_FLV_MUX (gst_pad_get_parent (pad)); + GstFlvMux *mux = GST_FLV_MUX (parent); gboolean ret = TRUE; switch (GST_EVENT_TYPE (event)) { @@ -314,8 +317,7 @@ gst_flv_mux_handle_sink_event (GstPad * pad, GstEvent * event) /* now GstCollectPads can take care of the rest, e.g. EOS */ if (ret) - ret = mux->collect_event (pad, event); - gst_object_unref (mux); + ret = mux->collect_event (pad, parent, event); return ret; } diff --git a/gst/goom/gstgoom.c b/gst/goom/gstgoom.c index 6faf603cc8..41cd20bbb4 100644 --- a/gst/goom/gstgoom.c +++ b/gst/goom/gstgoom.c @@ -94,9 +94,12 @@ static void gst_goom_finalize (GObject * object); static GstStateChangeReturn gst_goom_change_state (GstElement * element, GstStateChange transition); -static GstFlowReturn gst_goom_chain (GstPad * pad, GstBuffer * buffer); -static gboolean gst_goom_src_event (GstPad * pad, GstEvent * event); -static gboolean gst_goom_sink_event (GstPad * pad, GstEvent * event); +static GstFlowReturn gst_goom_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); +static gboolean gst_goom_src_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static gboolean gst_goom_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); static gboolean gst_goom_src_query (GstPad * pad, GstObject * parent, GstQuery * query); @@ -320,12 +323,12 @@ no_format: } static gboolean -gst_goom_src_event (GstPad * pad, GstEvent * event) +gst_goom_src_event (GstPad * pad, GstObject * parent, GstEvent * event) { gboolean res; GstGoom *goom; - goom = GST_GOOM (GST_PAD_PARENT (pad)); + goom = GST_GOOM (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_QOS: @@ -359,12 +362,12 @@ gst_goom_src_event (GstPad * pad, GstEvent * event) } static gboolean -gst_goom_sink_event (GstPad * pad, GstEvent * event) +gst_goom_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { gboolean res; GstGoom *goom; - goom = GST_GOOM (GST_PAD_PARENT (pad)); + goom = GST_GOOM (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -476,13 +479,13 @@ ensure_negotiated (GstGoom * goom) static GstFlowReturn -gst_goom_chain (GstPad * pad, GstBuffer * buffer) +gst_goom_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GstGoom *goom; GstFlowReturn ret; GstBuffer *outbuf = NULL; - goom = GST_GOOM (GST_PAD_PARENT (pad)); + goom = GST_GOOM (parent); if (goom->bps == 0) { ret = GST_FLOW_NOT_NEGOTIATED; goto beach; diff --git a/gst/icydemux/gsticydemux.c b/gst/icydemux/gsticydemux.c index ac93dd119c..ccde6480ea 100644 --- a/gst/icydemux/gsticydemux.c +++ b/gst/icydemux/gsticydemux.c @@ -68,8 +68,10 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", static void gst_icydemux_dispose (GObject * object); -static GstFlowReturn gst_icydemux_chain (GstPad * pad, GstBuffer * buf); -static gboolean gst_icydemux_handle_event (GstPad * pad, GstEvent * event); +static GstFlowReturn gst_icydemux_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf); +static gboolean gst_icydemux_handle_event (GstPad * pad, GstObject * parent, + GstEvent * event); static gboolean gst_icydemux_add_srcpad (GstICYDemux * icydemux, GstCaps * new_caps); @@ -341,9 +343,9 @@ gst_icydemux_parse_and_send_tags (GstICYDemux * icydemux) } static gboolean -gst_icydemux_handle_event (GstPad * pad, GstEvent * event) +gst_icydemux_handle_event (GstPad * pad, GstObject * parent, GstEvent * event) { - GstICYDemux *icydemux = GST_ICYDEMUX (GST_PAD_PARENT (pad)); + GstICYDemux *icydemux = GST_ICYDEMUX (parent); gboolean result; switch (GST_EVENT_TYPE (event)) { @@ -377,14 +379,14 @@ gst_icydemux_handle_event (GstPad * pad, GstEvent * event) g_list_free (icydemux->cached_events); icydemux->cached_events = NULL; - return gst_pad_event_default (pad, event); + return gst_pad_event_default (pad, parent, event); default: icydemux->cached_events = g_list_append (icydemux->cached_events, event); return TRUE; } } else { - return gst_pad_event_default (pad, event); + return gst_pad_event_default (pad, parent, event); } } @@ -503,14 +505,14 @@ gst_icydemux_add_meta (GstICYDemux * icydemux, GstBuffer * buf) } static GstFlowReturn -gst_icydemux_chain (GstPad * pad, GstBuffer * buf) +gst_icydemux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstICYDemux *icydemux; guint size, chunk, offset; GstBuffer *sub; GstFlowReturn ret = GST_FLOW_OK; - icydemux = GST_ICYDEMUX (GST_PAD_PARENT (pad)); + icydemux = GST_ICYDEMUX (parent); if (G_UNLIKELY (icydemux->meta_interval < 0)) goto not_negotiated; diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c index ba298627aa..f42442e3fe 100644 --- a/gst/isomp4/gstqtmux.c +++ b/gst/isomp4/gstqtmux.c @@ -225,7 +225,8 @@ static GstPad *gst_qt_mux_request_new_pad (GstElement * element, static void gst_qt_mux_release_pad (GstElement * element, GstPad * pad); /* event */ -static gboolean gst_qt_mux_sink_event (GstPad * pad, GstEvent * event); +static gboolean gst_qt_mux_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstFlowReturn gst_qt_mux_collected (GstCollectPads * pads, gpointer user_data); @@ -3294,13 +3295,13 @@ refuse_renegotiation: } static gboolean -gst_qt_mux_sink_event (GstPad * pad, GstEvent * event) +gst_qt_mux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { gboolean ret; GstQTMux *qtmux; guint32 avg_bitrate = 0, max_bitrate = 0; - qtmux = GST_QT_MUX_CAST (gst_pad_get_parent (pad)); + qtmux = GST_QT_MUX_CAST (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -3349,8 +3350,7 @@ gst_qt_mux_sink_event (GstPad * pad, GstEvent * event) break; } - ret = qtmux->collect_event (pad, event); - gst_object_unref (qtmux); + ret = qtmux->collect_event (pad, parent, event); return ret; } diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index b0ffc0b8b5..c33d4ddb8d 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -405,8 +405,10 @@ static gboolean qtdemux_sink_activate_pull (GstPad * sinkpad, gboolean active); static gboolean qtdemux_sink_activate_push (GstPad * sinkpad, gboolean active); static void gst_qtdemux_loop (GstPad * pad); -static GstFlowReturn gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf); -static gboolean gst_qtdemux_handle_sink_event (GstPad * pad, GstEvent * event); +static GstFlowReturn gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, + GstBuffer * inbuf); +static gboolean gst_qtdemux_handle_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); static gboolean qtdemux_parse_moov (GstQTDemux * qtdemux, const guint8 * buffer, guint length); @@ -1454,10 +1456,11 @@ parse_error: } static gboolean -gst_qtdemux_handle_src_event (GstPad * pad, GstEvent * event) +gst_qtdemux_handle_src_event (GstPad * pad, GstObject * parent, + GstEvent * event) { gboolean res = TRUE; - GstQTDemux *qtdemux = GST_QTDEMUX (gst_pad_get_parent (pad)); + GstQTDemux *qtdemux = GST_QTDEMUX (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: @@ -1494,12 +1497,10 @@ gst_qtdemux_handle_src_event (GstPad * pad, GstEvent * event) gst_event_unref (event); break; default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } - gst_object_unref (qtdemux); - done: return res; @@ -1586,9 +1587,10 @@ gst_qtdemux_find_sample (GstQTDemux * qtdemux, gint64 byte_pos, gboolean fw, } static gboolean -gst_qtdemux_handle_sink_event (GstPad * sinkpad, GstEvent * event) +gst_qtdemux_handle_sink_event (GstPad * sinkpad, GstObject * parent, + GstEvent * event) { - GstQTDemux *demux = GST_QTDEMUX (GST_PAD_PARENT (sinkpad)); + GstQTDemux *demux = GST_QTDEMUX (parent); gboolean res; GST_LOG_OBJECT (demux, "handling %s event", GST_EVENT_TYPE_NAME (event)); @@ -1716,7 +1718,7 @@ gst_qtdemux_handle_sink_event (GstPad * sinkpad, GstEvent * event) break; } - res = gst_pad_event_default (demux->sinkpad, event); + res = gst_pad_event_default (demux->sinkpad, parent, event); drop: return res; @@ -4013,12 +4015,12 @@ done: /* FIXME, unverified after edit list updates */ static GstFlowReturn -gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf) +gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf) { GstQTDemux *demux; GstFlowReturn ret = GST_FLOW_OK; - demux = GST_QTDEMUX (gst_pad_get_parent (sinkpad)); + demux = GST_QTDEMUX (parent); gst_adapter_push (demux->adapter, inbuf); @@ -4385,7 +4387,6 @@ gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf) demux->neededbytes); } done: - gst_object_unref (demux); return ret; diff --git a/gst/law/alaw-decode.c b/gst/law/alaw-decode.c index 02a31c35be..4d7d7bd6cf 100644 --- a/gst/law/alaw-decode.c +++ b/gst/law/alaw-decode.c @@ -37,8 +37,10 @@ GST_DEBUG_CATEGORY_STATIC (alaw_dec_debug); static GstStateChangeReturn gst_alaw_dec_change_state (GstElement * element, GstStateChange transition); -static gboolean gst_alaw_dec_event (GstPad * pad, GstEvent * event); -static GstFlowReturn gst_alaw_dec_chain (GstPad * pad, GstBuffer * buffer); +static gboolean gst_alaw_dec_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static GstFlowReturn gst_alaw_dec_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); #define gst_alaw_dec_parent_class parent_class G_DEFINE_TYPE (GstALawDec, gst_alaw_dec, GST_TYPE_ELEMENT); @@ -273,12 +275,12 @@ gst_alaw_dec_init (GstALawDec * alawdec) } static gboolean -gst_alaw_dec_event (GstPad * pad, GstEvent * event) +gst_alaw_dec_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstALawDec *alawdec; gboolean res; - alawdec = GST_ALAW_DEC (GST_PAD_PARENT (pad)); + alawdec = GST_ALAW_DEC (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -293,14 +295,14 @@ gst_alaw_dec_event (GstPad * pad, GstEvent * event) break; } default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } return res; } static GstFlowReturn -gst_alaw_dec_chain (GstPad * pad, GstBuffer * buffer) +gst_alaw_dec_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GstALawDec *alawdec; gint16 *linear_data; @@ -310,7 +312,7 @@ gst_alaw_dec_chain (GstPad * pad, GstBuffer * buffer) gint i; GstFlowReturn ret; - alawdec = GST_ALAW_DEC (GST_PAD_PARENT (pad)); + alawdec = GST_ALAW_DEC (parent); if (G_UNLIKELY (alawdec->rate == 0)) goto not_negotiated; diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c index c21be7d379..a115534f30 100644 --- a/gst/law/alaw-encode.c +++ b/gst/law/alaw-encode.c @@ -34,8 +34,10 @@ GST_DEBUG_CATEGORY_STATIC (alaw_enc_debug); extern GstStaticPadTemplate alaw_enc_src_factory; extern GstStaticPadTemplate alaw_enc_sink_factory; -static gboolean gst_alaw_enc_event (GstPad * pad, GstEvent * event); -static GstFlowReturn gst_alaw_enc_chain (GstPad * pad, GstBuffer * buffer); +static gboolean gst_alaw_enc_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static GstFlowReturn gst_alaw_enc_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); G_DEFINE_TYPE (GstALawEnc, gst_alaw_enc, GST_TYPE_ELEMENT); @@ -455,12 +457,12 @@ gst_alaw_enc_init (GstALawEnc * alawenc) } static gboolean -gst_alaw_enc_event (GstPad * pad, GstEvent * event) +gst_alaw_enc_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstALawEnc *alawenc; gboolean res; - alawenc = GST_ALAW_ENC (GST_PAD_PARENT (pad)); + alawenc = GST_ALAW_ENC (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -475,14 +477,14 @@ gst_alaw_enc_event (GstPad * pad, GstEvent * event) break; } default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } return res; } static GstFlowReturn -gst_alaw_enc_chain (GstPad * pad, GstBuffer * buffer) +gst_alaw_enc_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GstALawEnc *alawenc; gint16 *linear_data; @@ -494,7 +496,7 @@ gst_alaw_enc_chain (GstPad * pad, GstBuffer * buffer) GstFlowReturn ret; GstClockTime timestamp, duration; - alawenc = GST_ALAW_ENC (GST_PAD_PARENT (pad)); + alawenc = GST_ALAW_ENC (parent); if (G_UNLIKELY (alawenc->rate == 0 || alawenc->channels == 0)) goto not_negotiated; diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c index 81c34f323a..e5fb33dafd 100644 --- a/gst/law/mulaw-decode.c +++ b/gst/law/mulaw-decode.c @@ -54,8 +54,10 @@ enum static GstStateChangeReturn gst_mulawdec_change_state (GstElement * element, GstStateChange transition); -static gboolean gst_mulawdec_event (GstPad * pad, GstEvent * event); -static GstFlowReturn gst_mulawdec_chain (GstPad * pad, GstBuffer * buffer); +static gboolean gst_mulawdec_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static GstFlowReturn gst_mulawdec_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); #define gst_mulawdec_parent_class parent_class G_DEFINE_TYPE (GstMuLawDec, gst_mulawdec, GST_TYPE_ELEMENT); @@ -206,12 +208,12 @@ gst_mulawdec_init (GstMuLawDec * mulawdec) } static gboolean -gst_mulawdec_event (GstPad * pad, GstEvent * event) +gst_mulawdec_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstMuLawDec *mulawdec; gboolean res; - mulawdec = GST_MULAWDEC (GST_PAD_PARENT (pad)); + mulawdec = GST_MULAWDEC (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -226,14 +228,14 @@ gst_mulawdec_event (GstPad * pad, GstEvent * event) break; } default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } return res; } static GstFlowReturn -gst_mulawdec_chain (GstPad * pad, GstBuffer * buffer) +gst_mulawdec_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GstMuLawDec *mulawdec; gint16 *linear_data; @@ -242,7 +244,7 @@ gst_mulawdec_chain (GstPad * pad, GstBuffer * buffer) GstBuffer *outbuf; GstFlowReturn ret; - mulawdec = GST_MULAWDEC (GST_PAD_PARENT (pad)); + mulawdec = GST_MULAWDEC (parent); if (G_UNLIKELY (mulawdec->rate == 0)) goto not_negotiated; diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c index 149e7c38ba..7517f624b7 100644 --- a/gst/law/mulaw-encode.c +++ b/gst/law/mulaw-encode.c @@ -44,8 +44,10 @@ enum ARG_0 }; -static gboolean gst_mulawenc_event (GstPad * pad, GstEvent * event); -static GstFlowReturn gst_mulawenc_chain (GstPad * pad, GstBuffer * buffer); +static gboolean gst_mulawenc_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static GstFlowReturn gst_mulawenc_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); #define gst_mulawenc_parent_class parent_class G_DEFINE_TYPE (GstMuLawEnc, gst_mulawenc, GST_TYPE_ELEMENT); @@ -200,12 +202,12 @@ gst_mulawenc_init (GstMuLawEnc * mulawenc) } static gboolean -gst_mulawenc_event (GstPad * pad, GstEvent * event) +gst_mulawenc_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstMuLawEnc *mulawenc; gboolean res; - mulawenc = GST_MULAWENC (GST_PAD_PARENT (pad)); + mulawenc = GST_MULAWENC (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -220,14 +222,14 @@ gst_mulawenc_event (GstPad * pad, GstEvent * event) break; } default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } return res; } static GstFlowReturn -gst_mulawenc_chain (GstPad * pad, GstBuffer * buffer) +gst_mulawenc_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GstMuLawEnc *mulawenc; gint16 *linear_data; @@ -238,7 +240,7 @@ gst_mulawenc_chain (GstPad * pad, GstBuffer * buffer) GstFlowReturn ret; GstClockTime timestamp, duration; - mulawenc = GST_MULAWENC (gst_pad_get_parent (pad)); + mulawenc = GST_MULAWENC (parent); if (!mulawenc->rate || !mulawenc->channels) goto not_negotiated; @@ -275,7 +277,6 @@ gst_mulawenc_chain (GstPad * pad, GstBuffer * buffer) ret = gst_pad_push (mulawenc->srcpad, outbuf); done: - gst_object_unref (mulawenc); return ret; diff --git a/gst/multipart/multipartdemux.c b/gst/multipart/multipartdemux.c index 4b6c21234d..b4a0de0175 100644 --- a/gst/multipart/multipartdemux.c +++ b/gst/multipart/multipartdemux.c @@ -113,7 +113,8 @@ static const GstNamesMap gstnames[] = { }; -static GstFlowReturn gst_multipart_demux_chain (GstPad * pad, GstBuffer * buf); +static GstFlowReturn gst_multipart_demux_chain (GstPad * pad, + GstObject * parent, GstBuffer * buf); static GstStateChangeReturn gst_multipart_demux_change_state (GstElement * element, GstStateChange transition); @@ -546,7 +547,7 @@ multipart_find_boundary (GstMultipartDemux * multipart, gint * datalen) } static GstFlowReturn -gst_multipart_demux_chain (GstPad * pad, GstBuffer * buf) +gst_multipart_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstMultipartDemux *multipart; GstAdapter *adapter; @@ -554,7 +555,7 @@ gst_multipart_demux_chain (GstPad * pad, GstBuffer * buf) gint size = 1; GstFlowReturn res; - multipart = GST_MULTIPART_DEMUX (gst_pad_get_parent (pad)); + multipart = GST_MULTIPART_DEMUX (parent); adapter = multipart->adapter; res = GST_FLOW_OK; @@ -625,8 +626,6 @@ gst_multipart_demux_chain (GstPad * pad, GstBuffer * buf) } nodata: - gst_object_unref (multipart); - if (G_UNLIKELY (size == MULTIPART_DATA_ERROR)) return GST_FLOW_ERROR; if (G_UNLIKELY (size == MULTIPART_DATA_EOS)) diff --git a/gst/multipart/multipartmux.c b/gst/multipart/multipartmux.c index 5ae7cca9e4..46da9319c1 100644 --- a/gst/multipart/multipartmux.c +++ b/gst/multipart/multipartmux.c @@ -78,7 +78,7 @@ static const MimeTypeMap mimetypes[] = { static void gst_multipart_mux_finalize (GObject * object); static gboolean gst_multipart_mux_handle_src_event (GstPad * pad, - GstEvent * event); + GstObject * parent, GstEvent * event); static GstPad *gst_multipart_mux_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name, const GstCaps * caps); static GstStateChangeReturn gst_multipart_mux_change_state (GstElement * @@ -218,13 +218,11 @@ wrong_template: /* handle events */ static gboolean -gst_multipart_mux_handle_src_event (GstPad * pad, GstEvent * event) +gst_multipart_mux_handle_src_event (GstPad * pad, GstObject * parent, + GstEvent * event) { - GstMultipartMux *multipart_mux; GstEventType type; - multipart_mux = GST_MULTIPART_MUX (gst_pad_get_parent (pad)); - type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN; switch (type) { @@ -235,9 +233,7 @@ gst_multipart_mux_handle_src_event (GstPad * pad, GstEvent * event) break; } - gst_object_unref (multipart_mux); - - return gst_pad_event_default (pad, event); + return gst_pad_event_default (pad, parent, event); } static const gchar * diff --git a/gst/replaygain/gstrgvolume.c b/gst/replaygain/gstrgvolume.c index bd2cf18894..0372ca7df2 100644 --- a/gst/replaygain/gstrgvolume.c +++ b/gst/replaygain/gstrgvolume.c @@ -124,7 +124,8 @@ static void gst_rg_volume_dispose (GObject * object); static GstStateChangeReturn gst_rg_volume_change_state (GstElement * element, GstStateChange transition); -static gboolean gst_rg_volume_sink_event (GstPad * pad, GstEvent * event); +static gboolean gst_rg_volume_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstEvent *gst_rg_volume_tag_event (GstRgVolume * self, GstEvent * event); static void gst_rg_volume_reset (GstRgVolume * self); @@ -442,14 +443,14 @@ gst_rg_volume_change_state (GstElement * element, GstStateChange transition) /* Event function for the ghost sink pad. */ static gboolean -gst_rg_volume_sink_event (GstPad * pad, GstEvent * event) +gst_rg_volume_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstRgVolume *self; GstPad *volume_sink_pad; GstEvent *send_event = event; gboolean res; - self = GST_RG_VOLUME (gst_pad_get_parent_element (pad)); + self = GST_RG_VOLUME (parent); volume_sink_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad)); switch (GST_EVENT_TYPE (event)) { @@ -479,7 +480,7 @@ gst_rg_volume_sink_event (GstPad * pad, GstEvent * event) res = TRUE; gst_object_unref (volume_sink_pad); - gst_object_unref (self); + return res; } diff --git a/gst/rtp/gstasteriskh263.c b/gst/rtp/gstasteriskh263.c index 2cd075c14a..286edf5f47 100644 --- a/gst/rtp/gstasteriskh263.c +++ b/gst/rtp/gstasteriskh263.c @@ -66,7 +66,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", static void gst_asteriskh263_finalize (GObject * object); -static GstFlowReturn gst_asteriskh263_chain (GstPad * pad, GstBuffer * buffer); +static GstFlowReturn gst_asteriskh263_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer); static GstStateChangeReturn gst_asteriskh263_change_state (GstElement * element, GstStateChange transition); @@ -128,13 +129,13 @@ gst_asteriskh263_finalize (GObject * object) } static GstFlowReturn -gst_asteriskh263_chain (GstPad * pad, GstBuffer * buf) +gst_asteriskh263_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstAsteriskh263 *asteriskh263; GstBuffer *outbuf; GstFlowReturn ret; - asteriskh263 = GST_ASTERISK_H263 (GST_OBJECT_PARENT (pad)); + asteriskh263 = GST_ASTERISK_H263 (parent); if (!gst_rtp_buffer_validate (buf)) goto bad_packet; diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 218bab1807..eaad36ffff 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -244,23 +244,23 @@ static GstIterator *gst_rtp_jitter_buffer_iterate_internal_links (GstPad * pad, /* sinkpad overrides */ static gboolean gst_rtp_jitter_buffer_sink_event (GstPad * pad, - GstEvent * event); + GstObject * parent, GstEvent * event); static GstFlowReturn gst_rtp_jitter_buffer_chain (GstPad * pad, - GstBuffer * buffer); + GstObject * parent, GstBuffer * buffer); static gboolean gst_rtp_jitter_buffer_sink_rtcp_event (GstPad * pad, - GstEvent * event); + GstObject * parent, GstEvent * event); static GstFlowReturn gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad, - GstBuffer * buffer); + GstObject * parent, GstBuffer * buffer); static gboolean gst_rtp_jitter_buffer_sink_query (GstPad * pad, GstObject * parent, GstQuery * query); /* srcpad overrides */ static gboolean gst_rtp_jitter_buffer_src_event (GstPad * pad, - GstEvent * event); -static gboolean -gst_rtp_jitter_buffer_src_activate_push (GstPad * pad, gboolean active); + GstObject * parent, GstEvent * event); +static gboolean gst_rtp_jitter_buffer_src_activate_push (GstPad * pad, + gboolean active); static void gst_rtp_jitter_buffer_loop (GstRtpJitterBuffer * jitterbuffer); static gboolean gst_rtp_jitter_buffer_src_query (GstPad * pad, GstObject * parent, GstQuery * query); @@ -977,17 +977,14 @@ gst_rtp_jitter_buffer_change_state (GstElement * element, } static gboolean -gst_rtp_jitter_buffer_src_event (GstPad * pad, GstEvent * event) +gst_rtp_jitter_buffer_src_event (GstPad * pad, GstObject * parent, + GstEvent * event) { gboolean ret = TRUE; GstRtpJitterBuffer *jitterbuffer; GstRtpJitterBufferPrivate *priv; - jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad)); - if (G_UNLIKELY (jitterbuffer == NULL)) { - gst_event_unref (event); - return FALSE; - } + jitterbuffer = GST_RTP_JITTER_BUFFER (parent); priv = jitterbuffer->priv; GST_DEBUG_OBJECT (jitterbuffer, "received %s", GST_EVENT_TYPE_NAME (event)); @@ -1016,23 +1013,19 @@ gst_rtp_jitter_buffer_src_event (GstPad * pad, GstEvent * event) ret = gst_pad_push_event (priv->sinkpad, event); break; } - gst_object_unref (jitterbuffer); return ret; } static gboolean -gst_rtp_jitter_buffer_sink_event (GstPad * pad, GstEvent * event) +gst_rtp_jitter_buffer_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event) { gboolean ret = TRUE; GstRtpJitterBuffer *jitterbuffer; GstRtpJitterBufferPrivate *priv; - jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad)); - if (G_UNLIKELY (jitterbuffer == NULL)) { - gst_event_unref (event); - return FALSE; - } + jitterbuffer = GST_RTP_JITTER_BUFFER (parent); priv = jitterbuffer->priv; GST_DEBUG_OBJECT (jitterbuffer, "received %s", GST_EVENT_TYPE_NAME (event)); @@ -1105,7 +1098,6 @@ gst_rtp_jitter_buffer_sink_event (GstPad * pad, GstEvent * event) } done: - gst_object_unref (jitterbuffer); return ret; @@ -1120,11 +1112,12 @@ newseg_wrong_format: } static gboolean -gst_rtp_jitter_buffer_sink_rtcp_event (GstPad * pad, GstEvent * event) +gst_rtp_jitter_buffer_sink_rtcp_event (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRtpJitterBuffer *jitterbuffer; - jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad)); + jitterbuffer = GST_RTP_JITTER_BUFFER (parent); GST_DEBUG_OBJECT (jitterbuffer, "received %s", GST_EVENT_TYPE_NAME (event)); @@ -1137,7 +1130,6 @@ gst_rtp_jitter_buffer_sink_rtcp_event (GstPad * pad, GstEvent * event) break; } gst_event_unref (event); - gst_object_unref (jitterbuffer); return TRUE; } @@ -1232,7 +1224,8 @@ post_buffering_percent (GstRtpJitterBuffer * jitterbuffer, gint percent) } static GstFlowReturn -gst_rtp_jitter_buffer_chain (GstPad * pad, GstBuffer * buffer) +gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer) { GstRtpJitterBuffer *jitterbuffer; GstRtpJitterBufferPrivate *priv; @@ -1245,7 +1238,7 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstBuffer * buffer) guint8 pt; GstRTPBuffer rtp = { NULL }; - jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad)); + jitterbuffer = GST_RTP_JITTER_BUFFER (parent); if (G_UNLIKELY (!gst_rtp_buffer_validate (buffer))) goto invalid_buffer; @@ -1404,8 +1397,6 @@ finished: if (percent != -1) post_buffering_percent (jitterbuffer, percent); - gst_object_unref (jitterbuffer); - return ret; /* ERRORS */ @@ -1415,7 +1406,6 @@ invalid_buffer: GST_ELEMENT_WARNING (jitterbuffer, STREAM, DECODE, (NULL), ("Received invalid RTP payload, dropping")); gst_buffer_unref (buffer); - gst_object_unref (jitterbuffer); return GST_FLOW_OK; } no_clock_rate: @@ -1945,7 +1935,8 @@ pause: } static GstFlowReturn -gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad, GstBuffer * buffer) +gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad, GstObject * parent, + GstBuffer * buffer) { GstRtpJitterBuffer *jitterbuffer; GstRtpJitterBufferPrivate *priv; @@ -1961,7 +1952,7 @@ gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad, GstBuffer * buffer) GstRTCPBuffer rtcp = { NULL }; guint64 clock_base; - jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad)); + jitterbuffer = GST_RTP_JITTER_BUFFER (parent); if (G_UNLIKELY (!gst_rtcp_buffer_validate (buffer))) goto invalid_buffer; @@ -2055,7 +2046,6 @@ gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad, GstBuffer * buffer) done: gst_buffer_unref (buffer); - gst_object_unref (jitterbuffer); return ret; diff --git a/gst/rtpmanager/gstrtpptdemux.c b/gst/rtpmanager/gstrtpptdemux.c index cbb5f013e1..d505905181 100644 --- a/gst/rtpmanager/gstrtpptdemux.c +++ b/gst/rtpmanager/gstrtpptdemux.c @@ -125,15 +125,18 @@ static void gst_rtp_pt_demux_finalize (GObject * object); static void gst_rtp_pt_demux_release (GstRtpPtDemux * ptdemux); static gboolean gst_rtp_pt_demux_setup (GstRtpPtDemux * ptdemux); -static gboolean gst_rtp_pt_demux_sink_event (GstPad * pad, GstEvent * event); -static GstFlowReturn gst_rtp_pt_demux_chain (GstPad * pad, GstBuffer * buf); +static gboolean gst_rtp_pt_demux_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static GstFlowReturn gst_rtp_pt_demux_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf); static GstStateChangeReturn gst_rtp_pt_demux_change_state (GstElement * element, GstStateChange transition); static void gst_rtp_pt_demux_clear_pt_map (GstRtpPtDemux * rtpdemux); static GstRtpPtDemuxPad *find_pad_for_pt (GstRtpPtDemux * rtpdemux, guint8 pt); -static gboolean gst_rtp_pt_demux_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_rtp_pt_demux_src_event (GstPad * pad, GstObject * parent, + GstEvent * event); static guint gst_rtp_pt_demux_signals[LAST_SIGNAL] = { 0 }; @@ -293,18 +296,17 @@ gst_rtp_pt_demux_clear_pt_map (GstRtpPtDemux * rtpdemux) } static GstFlowReturn -gst_rtp_pt_demux_chain (GstPad * pad, GstBuffer * buf) +gst_rtp_pt_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstFlowReturn ret = GST_FLOW_OK; GstRtpPtDemux *rtpdemux; - GstElement *element = GST_ELEMENT (GST_OBJECT_PARENT (pad)); guint8 pt; GstPad *srcpad; GstRtpPtDemuxPad *rtpdemuxpad; GstCaps *caps; GstRTPBuffer rtp; - rtpdemux = GST_RTP_PT_DEMUX (GST_OBJECT_PARENT (pad)); + rtpdemux = GST_RTP_PT_DEMUX (parent); if (!gst_rtp_buffer_validate (buf)) goto invalid_buffer; @@ -349,7 +351,7 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstBuffer * buf) GST_OBJECT_UNLOCK (rtpdemux); gst_pad_set_active (srcpad, TRUE); - gst_element_add_pad (element, srcpad); + gst_element_add_pad (GST_ELEMENT_CAST (rtpdemux), srcpad); GST_DEBUG ("emitting new-payload-type for pt %d", pt); g_signal_emit (G_OBJECT (rtpdemux), @@ -422,16 +424,12 @@ find_pad_for_pt (GstRtpPtDemux * rtpdemux, guint8 pt) } static gboolean -gst_rtp_pt_demux_sink_event (GstPad * pad, GstEvent * event) +gst_rtp_pt_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstRtpPtDemux *rtpdemux; gboolean res = FALSE; - rtpdemux = GST_RTP_PT_DEMUX (gst_pad_get_parent (pad)); - if (G_UNLIKELY (rtpdemux == NULL)) { - gst_event_unref (event); - return FALSE; - } + rtpdemux = GST_RTP_PT_DEMUX (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CUSTOM_DOWNSTREAM: @@ -450,27 +448,26 @@ gst_rtp_pt_demux_sink_event (GstPad * pad, GstEvent * event) gst_event_unref (event); } else { - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); } break; } default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } - gst_object_unref (rtpdemux); return res; } static gboolean -gst_rtp_pt_demux_src_event (GstPad * pad, GstEvent * event) +gst_rtp_pt_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstRtpPtDemux *demux; const GstStructure *s; - demux = GST_RTP_PT_DEMUX (gst_pad_get_parent (pad)); + demux = GST_RTP_PT_DEMUX (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CUSTOM_UPSTREAM: @@ -500,13 +497,9 @@ gst_rtp_pt_demux_src_event (GstPad * pad, GstEvent * event) break; } - gst_object_unref (demux); - - return gst_pad_event_default (pad, event); + return gst_pad_event_default (pad, parent, event); } - - /* * Reserves resources for the object. */ diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c index 7e9140d7c1..90a4c33875 100644 --- a/gst/rtpmanager/gstrtpsession.c +++ b/gst/rtpmanager/gstrtpsession.c @@ -1317,16 +1317,13 @@ gst_rtp_session_reconsider (RTPSession * sess, gpointer user_data) } static gboolean -gst_rtp_session_event_recv_rtp_sink (GstPad * pad, GstEvent * event) +gst_rtp_session_event_recv_rtp_sink (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRtpSession *rtpsession; gboolean ret = FALSE; - rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); - if (G_UNLIKELY (rtpsession == NULL)) { - gst_event_unref (event); - return FALSE; - } + rtpsession = GST_RTP_SESSION (parent); GST_DEBUG_OBJECT (rtpsession, "received event %s", GST_EVENT_TYPE_NAME (event)); @@ -1371,7 +1368,6 @@ gst_rtp_session_event_recv_rtp_sink (GstPad * pad, GstEvent * event) ret = gst_pad_push_event (rtpsession->recv_rtp_src, event); break; } - gst_object_unref (rtpsession); return ret; @@ -1406,7 +1402,8 @@ gst_rtp_session_request_remote_key_unit (GstRtpSession * rtpsession, } static gboolean -gst_rtp_session_event_recv_rtp_src (GstPad * pad, GstEvent * event) +gst_rtp_session_event_recv_rtp_src (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRtpSession *rtpsession; gboolean forward = TRUE; @@ -1415,11 +1412,7 @@ gst_rtp_session_event_recv_rtp_src (GstPad * pad, GstEvent * event) guint32 ssrc; guint pt; - rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); - if (G_UNLIKELY (rtpsession == NULL)) { - gst_event_unref (event); - return FALSE; - } + rtpsession = GST_RTP_SESSION (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CUSTOM_UPSTREAM: @@ -1442,8 +1435,6 @@ gst_rtp_session_event_recv_rtp_src (GstPad * pad, GstEvent * event) if (forward) ret = gst_pad_push_event (rtpsession->recv_rtp_sink, event); - gst_object_unref (rtpsession); - return ret; } @@ -1502,7 +1493,8 @@ gst_rtp_session_sink_setcaps (GstPad * pad, GstCaps * caps) * forward the packet on the rtp_src pad */ static GstFlowReturn -gst_rtp_session_chain_recv_rtp (GstPad * pad, GstBuffer * buffer) +gst_rtp_session_chain_recv_rtp (GstPad * pad, GstObject * parent, + GstBuffer * buffer) { GstRtpSession *rtpsession; GstRtpSessionPrivate *priv; @@ -1510,7 +1502,7 @@ gst_rtp_session_chain_recv_rtp (GstPad * pad, GstBuffer * buffer) GstClockTime current_time, running_time; GstClockTime timestamp; - rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); + rtpsession = GST_RTP_SESSION (parent); priv = rtpsession->priv; GST_LOG_OBJECT (rtpsession, "received RTP packet"); @@ -1533,7 +1525,6 @@ gst_rtp_session_chain_recv_rtp (GstPad * pad, GstBuffer * buffer) goto push_error; done: - gst_object_unref (rtpsession); return ret; @@ -1547,12 +1538,13 @@ push_error: } static gboolean -gst_rtp_session_event_recv_rtcp_sink (GstPad * pad, GstEvent * event) +gst_rtp_session_event_recv_rtcp_sink (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRtpSession *rtpsession; gboolean ret = FALSE; - rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); + rtpsession = GST_RTP_SESSION (parent); GST_DEBUG_OBJECT (rtpsession, "received event %s", GST_EVENT_TYPE_NAME (event)); @@ -1562,7 +1554,6 @@ gst_rtp_session_event_recv_rtcp_sink (GstPad * pad, GstEvent * event) ret = gst_pad_push_event (rtpsession->sync_src, event); break; } - gst_object_unref (rtpsession); return ret; } @@ -1571,14 +1562,15 @@ gst_rtp_session_event_recv_rtcp_sink (GstPad * pad, GstEvent * event) * forward the SR packets to the sync_src pad. */ static GstFlowReturn -gst_rtp_session_chain_recv_rtcp (GstPad * pad, GstBuffer * buffer) +gst_rtp_session_chain_recv_rtcp (GstPad * pad, GstObject * parent, + GstBuffer * buffer) { GstRtpSession *rtpsession; GstRtpSessionPrivate *priv; GstClockTime current_time; guint64 ntpnstime; - rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); + rtpsession = GST_RTP_SESSION (parent); priv = rtpsession->priv; GST_LOG_OBJECT (rtpsession, "received RTCP packet"); @@ -1588,8 +1580,6 @@ gst_rtp_session_chain_recv_rtcp (GstPad * pad, GstBuffer * buffer) rtp_session_process_rtcp (priv->session, buffer, current_time, ntpnstime); - gst_object_unref (rtpsession); - return GST_FLOW_OK; /* always return OK */ } @@ -1619,16 +1609,13 @@ gst_rtp_session_query_send_rtcp_src (GstPad * pad, GstObject * parent, } static gboolean -gst_rtp_session_event_send_rtcp_src (GstPad * pad, GstEvent * event) +gst_rtp_session_event_send_rtcp_src (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRtpSession *rtpsession; gboolean ret = TRUE; - rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); - if (G_UNLIKELY (rtpsession == NULL)) { - gst_event_unref (event); - return FALSE; - } + rtpsession = GST_RTP_SESSION (parent); GST_DEBUG_OBJECT (rtpsession, "received EVENT"); switch (GST_EVENT_TYPE (event)) { @@ -1644,18 +1631,18 @@ gst_rtp_session_event_send_rtcp_src (GstPad * pad, GstEvent * event) break; } - gst_object_unref (rtpsession); return ret; } static gboolean -gst_rtp_session_event_send_rtp_sink (GstPad * pad, GstEvent * event) +gst_rtp_session_event_send_rtp_sink (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRtpSession *rtpsession; gboolean ret = FALSE; - rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); + rtpsession = GST_RTP_SESSION (parent); GST_DEBUG_OBJECT (rtpsession, "received event"); @@ -1722,7 +1709,6 @@ gst_rtp_session_event_send_rtp_sink (GstPad * pad, GstEvent * event) break; } } - gst_object_unref (rtpsession); return ret; } @@ -1814,16 +1800,14 @@ gst_rtp_session_setcaps_send_rtp (GstPad * pad, GstCaps * caps) * send to RTP session manager and forward to send_rtp_src. */ static GstFlowReturn -gst_rtp_session_chain_send_rtp_common (GstPad * pad, gpointer data, - gboolean is_list) +gst_rtp_session_chain_send_rtp_common (GstRtpSession * rtpsession, + gpointer data, gboolean is_list) { - GstRtpSession *rtpsession; GstRtpSessionPrivate *priv; GstFlowReturn ret; GstClockTime timestamp, running_time; GstClockTime current_time; - rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); priv = rtpsession->priv; GST_LOG_OBJECT (rtpsession, "received RTP %s", is_list ? "list" : "packet"); @@ -1860,7 +1844,6 @@ gst_rtp_session_chain_send_rtp_common (GstPad * pad, gpointer data, goto push_error; done: - gst_object_unref (rtpsession); return ret; @@ -1874,15 +1857,21 @@ push_error: } static GstFlowReturn -gst_rtp_session_chain_send_rtp (GstPad * pad, GstBuffer * buffer) +gst_rtp_session_chain_send_rtp (GstPad * pad, GstObject * parent, + GstBuffer * buffer) { - return gst_rtp_session_chain_send_rtp_common (pad, buffer, FALSE); + GstRtpSession *rtpsession = GST_RTP_SESSION (parent); + + return gst_rtp_session_chain_send_rtp_common (rtpsession, buffer, FALSE); } static GstFlowReturn -gst_rtp_session_chain_send_rtp_list (GstPad * pad, GstBufferList * list) +gst_rtp_session_chain_send_rtp_list (GstPad * pad, GstObject * parent, + GstBufferList * list) { - return gst_rtp_session_chain_send_rtp_common (pad, list, TRUE); + GstRtpSession *rtpsession = GST_RTP_SESSION (parent); + + return gst_rtp_session_chain_send_rtp_common (rtpsession, list, TRUE); } /* Create sinkpad to receive RTP packets from senders. This will also create a diff --git a/gst/rtpmanager/gstrtpssrcdemux.c b/gst/rtpmanager/gstrtpssrcdemux.c index 30e992d091..7ab71637b2 100644 --- a/gst/rtpmanager/gstrtpssrcdemux.c +++ b/gst/rtpmanager/gstrtpssrcdemux.c @@ -110,20 +110,23 @@ static void gst_rtp_ssrc_demux_clear_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc); /* sinkpad stuff */ -static GstFlowReturn gst_rtp_ssrc_demux_chain (GstPad * pad, GstBuffer * buf); -static gboolean gst_rtp_ssrc_demux_sink_event (GstPad * pad, GstEvent * event); +static GstFlowReturn gst_rtp_ssrc_demux_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf); +static gboolean gst_rtp_ssrc_demux_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstFlowReturn gst_rtp_ssrc_demux_rtcp_chain (GstPad * pad, - GstBuffer * buf); + GstObject * parent, GstBuffer * buf); static gboolean gst_rtp_ssrc_demux_rtcp_sink_event (GstPad * pad, - GstEvent * event); + GstObject * parent, GstEvent * event); static GstIterator *gst_rtp_ssrc_demux_iterate_internal_links_sink (GstPad * pad, GstObject * parent); /* srcpad stuff */ -static gboolean gst_rtp_ssrc_demux_src_event (GstPad * pad, GstEvent * event); -static GstIterator *gst_rtp_ssrc_demux_iterate_internal_links_src (GstPad * - pad, GstObject * parent); +static gboolean gst_rtp_ssrc_demux_src_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static GstIterator *gst_rtp_ssrc_demux_iterate_internal_links_src (GstPad * pad, + GstObject * parent); static gboolean gst_rtp_ssrc_demux_src_query (GstPad * pad, GstObject * parent, GstQuery * query); @@ -417,16 +420,13 @@ unknown_pad: } static gboolean -gst_rtp_ssrc_demux_sink_event (GstPad * pad, GstEvent * event) +gst_rtp_ssrc_demux_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRtpSsrcDemux *demux; gboolean res = FALSE; - demux = GST_RTP_SSRC_DEMUX (gst_pad_get_parent (pad)); - if (G_UNLIKELY (demux == NULL)) { - gst_event_unref (event); - return FALSE; - } + demux = GST_RTP_SSRC_DEMUX (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_FLUSH_STOP: @@ -461,17 +461,17 @@ gst_rtp_ssrc_demux_sink_event (GstPad * pad, GstEvent * event) } } - gst_object_unref (demux); return res; } static gboolean -gst_rtp_ssrc_demux_rtcp_sink_event (GstPad * pad, GstEvent * event) +gst_rtp_ssrc_demux_rtcp_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRtpSsrcDemux *demux; gboolean res = FALSE; - demux = GST_RTP_SSRC_DEMUX (gst_pad_get_parent (pad)); + demux = GST_RTP_SSRC_DEMUX (parent); switch (GST_EVENT_TYPE (event)) { default: @@ -499,12 +499,11 @@ gst_rtp_ssrc_demux_rtcp_sink_event (GstPad * pad, GstEvent * event) break; } } - gst_object_unref (demux); return res; } static GstFlowReturn -gst_rtp_ssrc_demux_chain (GstPad * pad, GstBuffer * buf) +gst_rtp_ssrc_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstFlowReturn ret; GstRtpSsrcDemux *demux; @@ -513,7 +512,7 @@ gst_rtp_ssrc_demux_chain (GstPad * pad, GstBuffer * buf) GstRTPBuffer rtp; GstPad *srcpad; - demux = GST_RTP_SSRC_DEMUX (GST_OBJECT_PARENT (pad)); + demux = GST_RTP_SSRC_DEMUX (parent); if (!gst_rtp_buffer_validate (buf)) goto invalid_payload; @@ -559,7 +558,8 @@ create_failed: } static GstFlowReturn -gst_rtp_ssrc_demux_rtcp_chain (GstPad * pad, GstBuffer * buf) +gst_rtp_ssrc_demux_rtcp_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf) { GstFlowReturn ret; GstRtpSsrcDemux *demux; @@ -569,7 +569,7 @@ gst_rtp_ssrc_demux_rtcp_chain (GstPad * pad, GstBuffer * buf) GstRTCPBuffer rtcp; GstPad *srcpad; - demux = GST_RTP_SSRC_DEMUX (GST_OBJECT_PARENT (pad)); + demux = GST_RTP_SSRC_DEMUX (parent); if (!gst_rtcp_buffer_validate (buf)) goto invalid_rtcp; @@ -635,12 +635,13 @@ create_failed: } static gboolean -gst_rtp_ssrc_demux_src_event (GstPad * pad, GstEvent * event) +gst_rtp_ssrc_demux_src_event (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRtpSsrcDemux *demux; const GstStructure *s; - demux = GST_RTP_SSRC_DEMUX (gst_pad_get_parent (pad)); + demux = GST_RTP_SSRC_DEMUX (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CUSTOM_UPSTREAM: @@ -670,9 +671,7 @@ gst_rtp_ssrc_demux_src_event (GstPad * pad, GstEvent * event) break; } - gst_object_unref (demux); - - return gst_pad_event_default (pad, event); + return gst_pad_event_default (pad, parent, event); } static GstIterator * diff --git a/gst/rtsp/gstrtpdec.c b/gst/rtsp/gstrtpdec.c index 513f3569d7..7f2486bbe8 100644 --- a/gst/rtsp/gstrtpdec.c +++ b/gst/rtsp/gstrtpdec.c @@ -127,8 +127,10 @@ static GstPad *gst_rtp_dec_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name, const GstCaps * caps); static void gst_rtp_dec_release_pad (GstElement * element, GstPad * pad); -static GstFlowReturn gst_rtp_dec_chain_rtp (GstPad * pad, GstBuffer * buffer); -static GstFlowReturn gst_rtp_dec_chain_rtcp (GstPad * pad, GstBuffer * buffer); +static GstFlowReturn gst_rtp_dec_chain_rtp (GstPad * pad, GstObject * parent, + GstBuffer * buffer); +static GstFlowReturn gst_rtp_dec_chain_rtcp (GstPad * pad, GstObject * parent, + GstBuffer * buffer); /* Manages the receiving end of the packets. @@ -453,7 +455,7 @@ gst_rtp_dec_query_src (GstPad * pad, GstObject * parent, GstQuery * query) } static GstFlowReturn -gst_rtp_dec_chain_rtp (GstPad * pad, GstBuffer * buffer) +gst_rtp_dec_chain_rtp (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GstFlowReturn res; GstRTPDec *rtpdec; @@ -462,7 +464,7 @@ gst_rtp_dec_chain_rtp (GstPad * pad, GstBuffer * buffer) guint8 pt; GstRTPBuffer rtp = { NULL, }; - rtpdec = GST_RTP_DEC (GST_PAD_PARENT (pad)); + rtpdec = GST_RTP_DEC (parent); GST_DEBUG_OBJECT (rtpdec, "got rtp packet"); @@ -542,7 +544,7 @@ bad_packet: } static GstFlowReturn -gst_rtp_dec_chain_rtcp (GstPad * pad, GstBuffer * buffer) +gst_rtp_dec_chain_rtcp (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GstRTPDec *src; @@ -552,7 +554,7 @@ gst_rtp_dec_chain_rtcp (GstPad * pad, GstBuffer * buffer) gboolean more; #endif - src = GST_RTP_DEC (GST_PAD_PARENT (pad)); + src = GST_RTP_DEC (parent); GST_DEBUG_OBJECT (src, "got rtcp packet"); diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 29ad495644..04bc187760 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -1925,13 +1925,14 @@ no_format: } static gboolean -gst_rtspsrc_handle_src_event (GstPad * pad, GstEvent * event) +gst_rtspsrc_handle_src_event (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRTSPSrc *src; gboolean res = TRUE; gboolean forward; - src = GST_RTSPSRC_CAST (gst_pad_get_parent (pad)); + src = GST_RTSPSRC_CAST (parent); GST_DEBUG_OBJECT (src, "pad %s:%s received event %s", GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE_NAME (event)); @@ -1960,7 +1961,6 @@ gst_rtspsrc_handle_src_event (GstPad * pad, GstEvent * event) } else { gst_event_unref (event); } - gst_object_unref (src); return res; } @@ -1968,7 +1968,8 @@ gst_rtspsrc_handle_src_event (GstPad * pad, GstEvent * event) /* this is the final event function we receive on the internal source pad when * we deal with TCP connections */ static gboolean -gst_rtspsrc_handle_internal_src_event (GstPad * pad, GstEvent * event) +gst_rtspsrc_handle_internal_src_event (GstPad * pad, GstObject * parent, + GstEvent * event) { GstRTSPSrc *src; gboolean res; @@ -2110,7 +2111,7 @@ gst_rtspsrc_handle_src_query (GstPad * pad, GstObject * parent, /* callback for RTCP messages to be sent to the server when operating in TCP * mode. */ static GstFlowReturn -gst_rtspsrc_sink_chain (GstPad * pad, GstBuffer * buffer) +gst_rtspsrc_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) { GstRTSPSrc *src; GstRTSPStream *stream; diff --git a/gst/shapewipe/gstshapewipe.c b/gst/shapewipe/gstshapewipe.c index c0b4d045b8..1a4d860240 100644 --- a/gst/shapewipe/gstshapewipe.c +++ b/gst/shapewipe/gstshapewipe.c @@ -65,9 +65,9 @@ static GstStateChangeReturn gst_shape_wipe_change_state (GstElement * element, GstStateChange transition); static GstFlowReturn gst_shape_wipe_video_sink_chain (GstPad * pad, - GstBuffer * buffer); + GstObject * parent, GstBuffer * buffer); static gboolean gst_shape_wipe_video_sink_event (GstPad * pad, - GstEvent * event); + GstObject * parent, GstEvent * event); static gboolean gst_shape_wipe_video_sink_setcaps (GstShapeWipe * self, GstCaps * caps); static GstCaps *gst_shape_wipe_video_sink_getcaps (GstPad * pad, @@ -75,15 +75,17 @@ static GstCaps *gst_shape_wipe_video_sink_getcaps (GstPad * pad, static gboolean gst_shape_wipe_video_sink_query (GstPad * pad, GstObject * parent, GstQuery * query); static GstFlowReturn gst_shape_wipe_mask_sink_chain (GstPad * pad, - GstBuffer * buffer); -static gboolean gst_shape_wipe_mask_sink_event (GstPad * pad, GstEvent * event); + GstObject * parent, GstBuffer * buffer); +static gboolean gst_shape_wipe_mask_sink_event (GstPad * pad, + GstObject * parent, GstEvent * event); static gboolean gst_shape_wipe_mask_sink_setcaps (GstShapeWipe * self, GstCaps * caps); static GstCaps *gst_shape_wipe_mask_sink_getcaps (GstPad * pad, GstCaps * filter); static gboolean gst_shape_wipe_mask_sink_query (GstPad * pad, GstObject * parent, GstQuery * query); -static gboolean gst_shape_wipe_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_shape_wipe_src_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstCaps *gst_shape_wipe_src_getcaps (GstPad * pad, GstCaps * filter); static gboolean gst_shape_wipe_src_query (GstPad * pad, GstObject * parent, GstQuery * query); @@ -830,9 +832,10 @@ CREATE_ARGB_FUNCTIONS (16, bgra, 0, 3, 2, 1, 0); CREATE_ARGB_FUNCTIONS (8, bgra, 8, 3, 2, 1, 0); static GstFlowReturn -gst_shape_wipe_video_sink_chain (GstPad * pad, GstBuffer * buffer) +gst_shape_wipe_video_sink_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer) { - GstShapeWipe *self = GST_SHAPE_WIPE (GST_PAD_PARENT (pad)); + GstShapeWipe *self = GST_SHAPE_WIPE (parent); GstFlowReturn ret = GST_FLOW_OK; GstBuffer *mask = NULL, *outbuf = NULL; GstClockTime timestamp; @@ -949,9 +952,10 @@ push_failed: } static GstFlowReturn -gst_shape_wipe_mask_sink_chain (GstPad * pad, GstBuffer * buffer) +gst_shape_wipe_mask_sink_chain (GstPad * pad, GstObject * parent, + GstBuffer * buffer) { - GstShapeWipe *self = GST_SHAPE_WIPE (GST_PAD_PARENT (pad)); + GstShapeWipe *self = GST_SHAPE_WIPE (parent); GstFlowReturn ret = GST_FLOW_OK; g_mutex_lock (self->mask_mutex); @@ -1002,9 +1006,10 @@ gst_shape_wipe_change_state (GstElement * element, GstStateChange transition) } static gboolean -gst_shape_wipe_video_sink_event (GstPad * pad, GstEvent * event) +gst_shape_wipe_video_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event) { - GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad)); + GstShapeWipe *self = GST_SHAPE_WIPE (parent); gboolean ret; GST_LOG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event)); @@ -1041,14 +1046,14 @@ gst_shape_wipe_video_sink_event (GstPad * pad, GstEvent * event) break; } - gst_object_unref (self); return ret; } static gboolean -gst_shape_wipe_mask_sink_event (GstPad * pad, GstEvent * event) +gst_shape_wipe_mask_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event) { - GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad)); + GstShapeWipe *self = GST_SHAPE_WIPE (parent); GST_LOG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event)); @@ -1073,7 +1078,6 @@ gst_shape_wipe_mask_sink_event (GstPad * pad, GstEvent * event) /* Dropping all events here */ gst_event_unref (event); - gst_object_unref (self); return TRUE; } @@ -1108,9 +1112,9 @@ gst_shape_wipe_mask_sink_query (GstPad * pad, GstObject * parent, static gboolean -gst_shape_wipe_src_event (GstPad * pad, GstEvent * event) +gst_shape_wipe_src_event (GstPad * pad, GstObject * parent, GstEvent * event) { - GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad)); + GstShapeWipe *self = GST_SHAPE_WIPE (parent); gboolean ret; GST_LOG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event)); @@ -1132,7 +1136,6 @@ gst_shape_wipe_src_event (GstPad * pad, GstEvent * event) break; } - gst_object_unref (self); return ret; } diff --git a/gst/videocrop/gstaspectratiocrop.c b/gst/videocrop/gstaspectratiocrop.c index d66b39f99c..eb0ece2bfe 100644 --- a/gst/videocrop/gstaspectratiocrop.c +++ b/gst/videocrop/gstaspectratiocrop.c @@ -84,7 +84,8 @@ static gboolean gst_aspect_ratio_crop_src_query (GstPad * pad, GstObject * parent, GstQuery * query); static gboolean gst_aspect_ratio_crop_set_caps (GstAspectRatioCrop * aspect_ratio_crop, GstCaps * caps); -static gboolean gst_aspect_ratio_crop_sink_event (GstPad * pad, GstEvent * evt); +static gboolean gst_aspect_ratio_crop_sink_event (GstPad * pad, + GstObject * parent, GstEvent * evt); static void gst_aspect_ratio_crop_finalize (GObject * object); static void gst_aspect_ratio_transform_structure (GstAspectRatioCrop * aspect_ratio_crop, GstStructure * structure, GstStructure ** new_structure, @@ -145,13 +146,15 @@ gst_aspect_ratio_crop_set_caps (GstAspectRatioCrop * aspect_ratio_crop, } static gboolean -gst_aspect_ratio_crop_sink_event (GstPad * pad, GstEvent * evt) +gst_aspect_ratio_crop_sink_event (GstPad * pad, GstObject * parent, + GstEvent * evt) { gboolean ret; - GstAspectRatioCrop *aspect_ratio_crop = - GST_ASPECT_RATIO_CROP (gst_pad_get_parent (pad)); + GstAspectRatioCrop *aspect_ratio_crop = GST_ASPECT_RATIO_CROP (parent); - ret = aspect_ratio_crop->sinkpad_old_eventfunc (pad, gst_event_ref (evt)); + ret = + aspect_ratio_crop->sinkpad_old_eventfunc (pad, parent, + gst_event_ref (evt)); switch (GST_EVENT_TYPE (evt)) { case GST_EVENT_CAPS: @@ -166,9 +169,8 @@ gst_aspect_ratio_crop_sink_event (GstPad * pad, GstEvent * evt) default: break; } - - gst_object_unref (aspect_ratio_crop); gst_event_unref (evt); + return ret; } diff --git a/gst/wavenc/gstwavenc.c b/gst/wavenc/gstwavenc.c index a186082112..ffb5952c02 100644 --- a/gst/wavenc/gstwavenc.c +++ b/gst/wavenc/gstwavenc.c @@ -107,8 +107,10 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", #define gst_wavenc_parent_class parent_class G_DEFINE_TYPE (GstWavEnc, gst_wavenc, GST_TYPE_ELEMENT); -static GstFlowReturn gst_wavenc_chain (GstPad * pad, GstBuffer * buf); -static gboolean gst_wavenc_event (GstPad * pad, GstEvent * event); +static GstFlowReturn gst_wavenc_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf); +static gboolean gst_wavenc_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstStateChangeReturn gst_wavenc_change_state (GstElement * element, GstStateChange transition); static gboolean gst_wavenc_sink_setcaps (GstPad * pad, GstCaps * caps); @@ -582,12 +584,12 @@ write_labels (GstWavEnc * wavenc) #endif static gboolean -gst_wavenc_event (GstPad * pad, GstEvent * event) +gst_wavenc_event (GstPad * pad, GstObject * parent, GstEvent * event) { gboolean res = TRUE; GstWavEnc *wavenc; - wavenc = GST_WAVENC (gst_pad_get_parent (pad)); + wavenc = GST_WAVENC (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -618,7 +620,7 @@ gst_wavenc_event (GstPad * pad, GstEvent * event) wavenc->finished_properly = TRUE; /* and forward the EOS event */ - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } case GST_EVENT_SEGMENT: @@ -627,18 +629,17 @@ gst_wavenc_event (GstPad * pad, GstEvent * event) gst_event_unref (event); break; default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } - gst_object_unref (wavenc); return res; } static GstFlowReturn -gst_wavenc_chain (GstPad * pad, GstBuffer * buf) +gst_wavenc_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { - GstWavEnc *wavenc = GST_WAVENC (GST_PAD_PARENT (pad)); + GstWavEnc *wavenc = GST_WAVENC (parent); GstFlowReturn flow = GST_FLOW_OK; g_return_val_if_fail (wavenc->channels > 0, GST_FLOW_WRONG_STATE); diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index 1ef7a51908..3bea339a6a 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -76,10 +76,13 @@ static gboolean gst_wavparse_pad_query (GstPad * pad, GstObject * parent, static gboolean gst_wavparse_pad_convert (GstPad * pad, GstFormat src_format, gint64 src_value, GstFormat * dest_format, gint64 * dest_value); -static GstFlowReturn gst_wavparse_chain (GstPad * pad, GstBuffer * buf); -static gboolean gst_wavparse_sink_event (GstPad * pad, GstEvent * event); +static GstFlowReturn gst_wavparse_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf); +static gboolean gst_wavparse_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); static void gst_wavparse_loop (GstPad * pad); -static gboolean gst_wavparse_srcpad_event (GstPad * pad, GstEvent * event); +static gboolean gst_wavparse_srcpad_event (GstPad * pad, GstObject * parent, + GstEvent * event); static GstStaticPadTemplate sink_template_factory = GST_STATIC_PAD_TEMPLATE ("sink", @@ -2076,10 +2079,10 @@ pause: } static GstFlowReturn -gst_wavparse_chain (GstPad * pad, GstBuffer * buf) +gst_wavparse_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstFlowReturn ret; - GstWavParse *wav = GST_WAVPARSE (GST_PAD_PARENT (pad)); + GstWavParse *wav = GST_WAVPARSE (parent); GST_LOG_OBJECT (wav, "adapter_push %u bytes", gst_buffer_get_size (buf)); @@ -2143,9 +2146,9 @@ gst_wavparse_flush_data (GstWavParse * wav) } static gboolean -gst_wavparse_sink_event (GstPad * pad, GstEvent * event) +gst_wavparse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { - GstWavParse *wav = GST_WAVPARSE (GST_PAD_PARENT (pad)); + GstWavParse *wav = GST_WAVPARSE (parent); gboolean ret = TRUE; GST_LOG_OBJECT (wav, "handling %s event", GST_EVENT_TYPE_NAME (event)); @@ -2268,7 +2271,7 @@ gst_wavparse_sink_event (GstPad * pad, GstEvent * event) /* fall-through */ } default: - ret = gst_pad_event_default (wav->sinkpad, event); + ret = gst_pad_event_default (wav->sinkpad, parent, event); break; } @@ -2511,9 +2514,9 @@ gst_wavparse_pad_query (GstPad * pad, GstObject * parent, GstQuery * query) } static gboolean -gst_wavparse_srcpad_event (GstPad * pad, GstEvent * event) +gst_wavparse_srcpad_event (GstPad * pad, GstObject * parent, GstEvent * event) { - GstWavParse *wavparse = GST_WAVPARSE (gst_pad_get_parent (pad)); + GstWavParse *wavparse = GST_WAVPARSE (parent); gboolean res = FALSE; GST_DEBUG_OBJECT (wavparse, "%s event", GST_EVENT_TYPE_NAME (event)); @@ -2530,7 +2533,6 @@ gst_wavparse_srcpad_event (GstPad * pad, GstEvent * event) res = gst_pad_push_event (wavparse->sinkpad, event); break; } - gst_object_unref (wavparse); return res; } diff --git a/gst/y4m/gsty4mencode.c b/gst/y4m/gsty4mencode.c index ed49fc61e5..d05a4ae582 100644 --- a/gst/y4m/gsty4mencode.c +++ b/gst/y4m/gsty4mencode.c @@ -81,8 +81,10 @@ static void gst_y4m_encode_get_property (GObject * object, static void gst_y4m_encode_reset (GstY4mEncode * filter); -static gboolean gst_y4m_encode_sink_event (GstPad * pad, GstEvent * event); -static GstFlowReturn gst_y4m_encode_chain (GstPad * pad, GstBuffer * buf); +static gboolean gst_y4m_encode_sink_event (GstPad * pad, GstObject * parent, + GstEvent * event); +static GstFlowReturn gst_y4m_encode_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf); static GstStateChangeReturn gst_y4m_encode_change_state (GstElement * element, GstStateChange transition); @@ -189,7 +191,7 @@ invalid_format: } static gboolean -gst_y4m_encode_sink_event (GstPad * pad, GstEvent * event) +gst_y4m_encode_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { gboolean res; @@ -204,7 +206,7 @@ gst_y4m_encode_sink_event (GstPad * pad, GstEvent * event) break; } default: - res = gst_pad_event_default (pad, event); + res = gst_pad_event_default (pad, parent, event); break; } return res; @@ -261,9 +263,9 @@ gst_y4m_encode_get_frame_header (GstY4mEncode * filter) } static GstFlowReturn -gst_y4m_encode_chain (GstPad * pad, GstBuffer * buf) +gst_y4m_encode_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { - GstY4mEncode *filter = GST_Y4M_ENCODE (GST_PAD_PARENT (pad)); + GstY4mEncode *filter = GST_Y4M_ENCODE (parent); GstBuffer *outbuf; GstClockTime timestamp;