Commit 10565012 authored by Wim Taymans's avatar Wim Taymans

add parent to pad functions

parent 8643d1ca
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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));
......
......@@ -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))
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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)) {
......
......@@ -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;
}
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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 <ds@schleef.org>");
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",