misc: chain up to collectpads event handler

This commit is contained in:
Mark Nauwelaerts 2012-04-16 16:37:49 +02:00
parent 531142c7e4
commit 04b4d30f2c
7 changed files with 35 additions and 55 deletions

View file

@ -1835,7 +1835,7 @@ gst_avi_mux_handle_event (GstCollectPads2 * pads, GstCollectData2 * data,
GstEvent * event, gpointer user_data) GstEvent * event, gpointer user_data)
{ {
GstAviMux *avimux; GstAviMux *avimux;
gboolean ret = FALSE; gboolean ret = TRUE;
avimux = GST_AVI_MUX (user_data); 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); ret = gst_avi_mux_audsink_set_caps (data->pad, caps);
} }
gst_event_unref (event); gst_event_unref (event);
event = NULL;
break; break;
} }
case GST_EVENT_TAG:{ case GST_EVENT_TAG:{
@ -1870,19 +1871,16 @@ gst_avi_mux_handle_event (GstCollectPads2 * pads, GstCollectData2 * data,
gst_event_parse_tag (event, &list); gst_event_parse_tag (event, &list);
gst_tag_setter_merge_tags (setter, list, mode); gst_tag_setter_merge_tags (setter, list, mode);
gst_event_unref (event); gst_event_unref (event);
ret = TRUE; event = NULL;
break; break;
} }
case GST_EVENT_EOS:
case GST_EVENT_SEGMENT:
gst_event_unref (event);
ret = TRUE;
break;
default: default:
ret = gst_pad_event_default (data->pad, GST_OBJECT (avimux), event);
break; break;
} }
if (event != NULL)
return gst_collect_pads2_event_default (pads, data, event, FALSE);
return ret; return ret;
} }

View file

@ -287,7 +287,7 @@ gst_flv_mux_handle_sink_event (GstCollectPads2 * pads, GstCollectData2 * data,
GstEvent * event, gpointer user_data) GstEvent * event, gpointer user_data)
{ {
GstFlvMux *mux = GST_FLV_MUX (user_data); GstFlvMux *mux = GST_FLV_MUX (user_data);
gboolean ret = FALSE; gboolean ret = TRUE;
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_CAPS: case GST_EVENT_CAPS:
@ -308,6 +308,7 @@ gst_flv_mux_handle_sink_event (GstCollectPads2 * pads, GstCollectData2 * data,
} }
/* and eat */ /* and eat */
gst_event_unref (event); gst_event_unref (event);
event = NULL;
break; break;
} }
case GST_EVENT_TAG:{ case GST_EVENT_TAG:{
@ -320,18 +321,16 @@ gst_flv_mux_handle_sink_event (GstCollectPads2 * pads, GstCollectData2 * data,
mux->new_tags = TRUE; mux->new_tags = TRUE;
ret = TRUE; ret = TRUE;
gst_event_unref (event); gst_event_unref (event);
event = NULL;
break; break;
} }
case GST_EVENT_EOS:
case GST_EVENT_SEGMENT:
gst_event_unref (event);
ret = TRUE;
break;
default: default:
ret = gst_pad_event_default (data->pad, GST_OBJECT (mux), event);
break; break;
} }
if (event != NULL)
return gst_collect_pads2_event_default (pads, data, event, FALSE);
return ret; return ret;
} }

View file

@ -816,7 +816,7 @@ gst_interleave_sink_event (GstCollectPads2 * pads, GstCollectData2 * data,
GstEvent * event, gpointer user_data) GstEvent * event, gpointer user_data)
{ {
GstInterleave *self = GST_INTERLEAVE (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 ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event),
GST_DEBUG_PAD_NAME (data->pad)); GST_DEBUG_PAD_NAME (data->pad));
@ -838,14 +838,17 @@ gst_interleave_sink_event (GstCollectPads2 * pads, GstCollectData2 * data,
gst_event_parse_caps (event, &caps); gst_event_parse_caps (event, &caps);
ret = gst_interleave_sink_setcaps (self, data->pad, caps); ret = gst_interleave_sink_setcaps (self, data->pad, caps);
gst_event_unref (event); gst_event_unref (event);
event = NULL;
break; break;
} }
default: default:
ret = gst_pad_event_default (data->pad, GST_OBJECT (self), event);
break; break;
} }
/* now GstCollectPads2 can take care of the rest, e.g. EOS */ /* 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; return ret;
} }

View file

@ -3280,7 +3280,7 @@ gst_qt_mux_sink_event (GstCollectPads2 * pads, GstCollectData2 * data,
GstQTMux *qtmux; GstQTMux *qtmux;
guint32 avg_bitrate = 0, max_bitrate = 0; guint32 avg_bitrate = 0, max_bitrate = 0;
GstPad *pad = data->pad; GstPad *pad = data->pad;
gboolean ret = FALSE; gboolean ret = TRUE;
qtmux = GST_QT_MUX_CAST (user_data); qtmux = GST_QT_MUX_CAST (user_data);
switch (GST_EVENT_TYPE (event)) { 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); ret = collect_pad->set_caps (pad, caps);
gst_event_unref (event); gst_event_unref (event);
event = NULL;
break; break;
} }
case GST_EVENT_TAG:{ case GST_EVENT_TAG:{
@ -3327,19 +3328,17 @@ gst_qt_mux_sink_event (GstCollectPads2 * pads, GstCollectData2 * data,
} }
gst_event_unref (event); gst_event_unref (event);
event = NULL;
ret = TRUE; ret = TRUE;
break; break;
} }
default: 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; break;
} }
if (event != NULL)
return gst_collect_pads2_event_default (pads, data, event, FALSE);
return ret; return ret;
} }

View file

@ -746,7 +746,7 @@ gst_matroska_mux_handle_sink_event (GstCollectPads2 * pads,
GstMatroskaMux *mux; GstMatroskaMux *mux;
GstPad *pad; GstPad *pad;
GstTagList *list; GstTagList *list;
gboolean ret = FALSE; gboolean ret = TRUE;
mux = GST_MATROSKA_MUX (user_data); mux = GST_MATROSKA_MUX (user_data);
collect_pad = (GstMatroskaPad *) data; collect_pad = (GstMatroskaPad *) data;
@ -796,18 +796,6 @@ gst_matroska_mux_handle_sink_event (GstCollectPads2 * pads,
ret = TRUE; ret = TRUE;
break; 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:{ case GST_EVENT_TOC:{
GstToc *toc; GstToc *toc;
@ -869,14 +857,12 @@ gst_matroska_mux_handle_sink_event (GstCollectPads2 * pads,
} }
/* fall through */ /* fall through */
default: default:
ret = gst_pad_event_default (data->pad, GST_OBJECT (mux), event);
break;
case GST_EVENT_EOS:
gst_event_unref (event);
ret = TRUE;
break; break;
} }
if (event != NULL)
return gst_collect_pads2_event_default (pads, data, event, FALSE);
return ret; return ret;
} }

View file

@ -333,10 +333,12 @@ gst_smpte_sink_event (GstCollectPads2 * pads,
break; break;
} }
default: default:
ret = gst_pad_event_default (pad, break;
GST_OBJECT_CAST (GST_PAD_PARENT (pad)), event);
} }
if (event != NULL)
return gst_collect_pads2_event_default (pads, data, event, FALSE);
return ret; return ret;
} }

View file

@ -1631,7 +1631,6 @@ gst_videomixer2_sink_event (GstCollectPads2 * pads, GstCollectData2 * cdata,
GST_DEBUG_OBJECT (pad, "Got %s event on pad %s:%s", GST_DEBUG_OBJECT (pad, "Got %s event on pad %s:%s",
GST_EVENT_TYPE_NAME (event), GST_DEBUG_PAD_NAME (pad)); GST_EVENT_TYPE_NAME (event), GST_DEBUG_PAD_NAME (pad));
/* return FALSE => event will be forwarded */
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_CAPS: 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), gst_videomixer2_pad_sink_setcaps (GST_PAD (pad), GST_OBJECT (mix),
caps); caps);
gst_event_unref (event); gst_event_unref (event);
event = NULL;
break; break;
} }
case GST_EVENT_SEGMENT:{ case GST_EVENT_SEGMENT:{
@ -1649,9 +1649,6 @@ gst_videomixer2_sink_event (GstCollectPads2 * pads, GstCollectData2 * cdata,
gst_event_copy_segment (event, &seg); gst_event_copy_segment (event, &seg);
g_assert (seg.format == GST_FORMAT_TIME); g_assert (seg.format == GST_FORMAT_TIME);
/* eat SEGMENT events */
ret = TRUE;
gst_event_unref (event);
break; break;
} }
case GST_EVENT_FLUSH_STOP: case GST_EVENT_FLUSH_STOP:
@ -1666,18 +1663,14 @@ gst_videomixer2_sink_event (GstCollectPads2 * pads, GstCollectData2 * cdata,
mix->segment.position = -1; mix->segment.position = -1;
mix->ts_offset = 0; mix->ts_offset = 0;
mix->nframes = 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; break;
default: default:
ret = gst_pad_event_default (cdata->pad, GST_OBJECT (mix), event);
break; break;
} }
if (event != NULL)
return gst_collect_pads2_event_default (pads, cdata, event, FALSE);
return ret; return ret;
} }