From 04b4d30f2cf7f8196703e14647cbb88b7ec1ad37 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Mon, 16 Apr 2012 16:37:49 +0200 Subject: [PATCH] misc: chain up to collectpads event handler --- gst/avi/gstavimux.c | 14 ++++++-------- gst/flv/gstflvmux.c | 13 ++++++------- gst/interleave/interleave.c | 7 +++++-- gst/isomp4/gstqtmux.c | 13 ++++++------- gst/matroska/matroska-mux.c | 22 ++++------------------ gst/smpte/gstsmpte.c | 6 ++++-- gst/videomixer/videomixer2.c | 15 ++++----------- 7 files changed, 35 insertions(+), 55 deletions(-) diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c index 7f23e6727d..32084d50ce 100644 --- a/gst/avi/gstavimux.c +++ b/gst/avi/gstavimux.c @@ -1835,7 +1835,7 @@ gst_avi_mux_handle_event (GstCollectPads2 * pads, GstCollectData2 * data, GstEvent * event, gpointer user_data) { GstAviMux *avimux; - gboolean ret = FALSE; + gboolean ret = TRUE; avimux = GST_AVI_MUX (user_data); @@ -1860,6 +1860,7 @@ gst_avi_mux_handle_event (GstCollectPads2 * pads, GstCollectData2 * data, ret = gst_avi_mux_audsink_set_caps (data->pad, caps); } gst_event_unref (event); + event = NULL; break; } case GST_EVENT_TAG:{ @@ -1870,19 +1871,16 @@ gst_avi_mux_handle_event (GstCollectPads2 * pads, GstCollectData2 * data, gst_event_parse_tag (event, &list); gst_tag_setter_merge_tags (setter, list, mode); gst_event_unref (event); - ret = TRUE; + event = NULL; break; } - case GST_EVENT_EOS: - case GST_EVENT_SEGMENT: - gst_event_unref (event); - ret = TRUE; - break; default: - ret = gst_pad_event_default (data->pad, GST_OBJECT (avimux), event); break; } + if (event != NULL) + return gst_collect_pads2_event_default (pads, data, event, FALSE); + return ret; } diff --git a/gst/flv/gstflvmux.c b/gst/flv/gstflvmux.c index b28087144e..8b10cd5fa3 100644 --- a/gst/flv/gstflvmux.c +++ b/gst/flv/gstflvmux.c @@ -287,7 +287,7 @@ gst_flv_mux_handle_sink_event (GstCollectPads2 * pads, GstCollectData2 * data, GstEvent * event, gpointer user_data) { GstFlvMux *mux = GST_FLV_MUX (user_data); - gboolean ret = FALSE; + gboolean ret = TRUE; switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: @@ -308,6 +308,7 @@ gst_flv_mux_handle_sink_event (GstCollectPads2 * pads, GstCollectData2 * data, } /* and eat */ gst_event_unref (event); + event = NULL; break; } case GST_EVENT_TAG:{ @@ -320,18 +321,16 @@ gst_flv_mux_handle_sink_event (GstCollectPads2 * pads, GstCollectData2 * data, mux->new_tags = TRUE; ret = TRUE; gst_event_unref (event); + event = NULL; break; } - case GST_EVENT_EOS: - case GST_EVENT_SEGMENT: - gst_event_unref (event); - ret = TRUE; - break; default: - ret = gst_pad_event_default (data->pad, GST_OBJECT (mux), event); break; } + if (event != NULL) + return gst_collect_pads2_event_default (pads, data, event, FALSE); + return ret; } diff --git a/gst/interleave/interleave.c b/gst/interleave/interleave.c index e51490a0d3..5d8b1e1f4d 100644 --- a/gst/interleave/interleave.c +++ b/gst/interleave/interleave.c @@ -816,7 +816,7 @@ gst_interleave_sink_event (GstCollectPads2 * pads, GstCollectData2 * data, GstEvent * event, gpointer user_data) { GstInterleave *self = GST_INTERLEAVE (user_data); - gboolean ret = FALSE; + gboolean ret = TRUE; GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event), GST_DEBUG_PAD_NAME (data->pad)); @@ -838,14 +838,17 @@ gst_interleave_sink_event (GstCollectPads2 * pads, GstCollectData2 * data, gst_event_parse_caps (event, &caps); ret = gst_interleave_sink_setcaps (self, data->pad, caps); gst_event_unref (event); + event = NULL; break; } default: - ret = gst_pad_event_default (data->pad, GST_OBJECT (self), event); break; } /* now GstCollectPads2 can take care of the rest, e.g. EOS */ + if (event != NULL) + return gst_collect_pads2_event_default (pads, data, event, FALSE); + return ret; } diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c index 4d4b9c9395..37bf9164c0 100644 --- a/gst/isomp4/gstqtmux.c +++ b/gst/isomp4/gstqtmux.c @@ -3280,7 +3280,7 @@ gst_qt_mux_sink_event (GstCollectPads2 * pads, GstCollectData2 * data, GstQTMux *qtmux; guint32 avg_bitrate = 0, max_bitrate = 0; GstPad *pad = data->pad; - gboolean ret = FALSE; + gboolean ret = TRUE; qtmux = GST_QT_MUX_CAST (user_data); switch (GST_EVENT_TYPE (event)) { @@ -3298,6 +3298,7 @@ gst_qt_mux_sink_event (GstCollectPads2 * pads, GstCollectData2 * data, ret = collect_pad->set_caps (pad, caps); gst_event_unref (event); + event = NULL; break; } case GST_EVENT_TAG:{ @@ -3327,19 +3328,17 @@ gst_qt_mux_sink_event (GstCollectPads2 * pads, GstCollectData2 * data, } gst_event_unref (event); + event = NULL; ret = TRUE; break; } default: - ret = gst_pad_event_default (data->pad, GST_OBJECT (qtmux), event); - break; - case GST_EVENT_EOS: - case GST_EVENT_SEGMENT: - gst_event_unref (event); - ret = TRUE; break; } + if (event != NULL) + return gst_collect_pads2_event_default (pads, data, event, FALSE); + return ret; } diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index 67c5668e19..4cb87da7f0 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -746,7 +746,7 @@ gst_matroska_mux_handle_sink_event (GstCollectPads2 * pads, GstMatroskaMux *mux; GstPad *pad; GstTagList *list; - gboolean ret = FALSE; + gboolean ret = TRUE; mux = GST_MATROSKA_MUX (user_data); collect_pad = (GstMatroskaPad *) data; @@ -796,18 +796,6 @@ gst_matroska_mux_handle_sink_event (GstCollectPads2 * pads, ret = TRUE; break; } - case GST_EVENT_SEGMENT:{ - const GstSegment *segment; - - gst_event_parse_segment (event, &segment); - if (segment->format != GST_FORMAT_TIME) { - ret = FALSE; - } - gst_event_unref (event); - event = NULL; - ret = TRUE; - break; - } case GST_EVENT_TOC:{ GstToc *toc; @@ -869,14 +857,12 @@ gst_matroska_mux_handle_sink_event (GstCollectPads2 * pads, } /* fall through */ default: - ret = gst_pad_event_default (data->pad, GST_OBJECT (mux), event); - break; - case GST_EVENT_EOS: - gst_event_unref (event); - ret = TRUE; break; } + if (event != NULL) + return gst_collect_pads2_event_default (pads, data, event, FALSE); + return ret; } diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c index 7d1b9c7287..c399011a03 100644 --- a/gst/smpte/gstsmpte.c +++ b/gst/smpte/gstsmpte.c @@ -333,10 +333,12 @@ gst_smpte_sink_event (GstCollectPads2 * pads, break; } default: - ret = gst_pad_event_default (pad, - GST_OBJECT_CAST (GST_PAD_PARENT (pad)), event); + break; } + if (event != NULL) + return gst_collect_pads2_event_default (pads, data, event, FALSE); + return ret; } diff --git a/gst/videomixer/videomixer2.c b/gst/videomixer/videomixer2.c index 6a49f93365..e559221ffc 100644 --- a/gst/videomixer/videomixer2.c +++ b/gst/videomixer/videomixer2.c @@ -1631,7 +1631,6 @@ gst_videomixer2_sink_event (GstCollectPads2 * pads, GstCollectData2 * cdata, GST_DEBUG_OBJECT (pad, "Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event), GST_DEBUG_PAD_NAME (pad)); - /* return FALSE => event will be forwarded */ switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: { @@ -1642,6 +1641,7 @@ gst_videomixer2_sink_event (GstCollectPads2 * pads, GstCollectData2 * cdata, gst_videomixer2_pad_sink_setcaps (GST_PAD (pad), GST_OBJECT (mix), caps); gst_event_unref (event); + event = NULL; break; } case GST_EVENT_SEGMENT:{ @@ -1649,9 +1649,6 @@ gst_videomixer2_sink_event (GstCollectPads2 * pads, GstCollectData2 * cdata, gst_event_copy_segment (event, &seg); g_assert (seg.format == GST_FORMAT_TIME); - /* eat SEGMENT events */ - ret = TRUE; - gst_event_unref (event); break; } case GST_EVENT_FLUSH_STOP: @@ -1666,18 +1663,14 @@ gst_videomixer2_sink_event (GstCollectPads2 * pads, GstCollectData2 * cdata, mix->segment.position = -1; mix->ts_offset = 0; mix->nframes = 0; - - ret = gst_pad_event_default (cdata->pad, GST_OBJECT (mix), event); - break; - case GST_EVENT_EOS: - gst_event_unref (event); - ret = TRUE; break; default: - ret = gst_pad_event_default (cdata->pad, GST_OBJECT (mix), event); break; } + if (event != NULL) + return gst_collect_pads2_event_default (pads, cdata, event, FALSE); + return ret; }