diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 5bee6f9f88..87565349ac 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -121,9 +121,6 @@ struct _TSDemuxStream /* TRUE if we are waiting for a valid timestamp */ gboolean pending_ts; - /* the return of the latest push */ - GstFlowReturn flow_return; - /* Output data */ PendingPacketState state; @@ -701,15 +698,6 @@ push_event (MpegTSBase * base, GstEvent * event) return TRUE; } -static GstFlowReturn -tsdemux_combine_flows (GstTSDemux * demux, TSDemuxStream * stream, - GstFlowReturn ret) -{ - /* Store the value */ - stream->flow_return = ret; - return gst_flow_combiner_update_flow (demux->flowcombiner, ret); -} - static inline void add_iso639_language_to_tags (TSDemuxStream * stream, gchar * lang_code) { @@ -1161,7 +1149,6 @@ gst_ts_demux_stream_added (MpegTSBase * base, MpegTSBaseStream * bstream, stream->first_dts = GST_CLOCK_TIME_NONE; stream->continuity_counter = CONTINUITY_UNSET; } - stream->flow_return = GST_FLOW_OK; } static void @@ -1187,7 +1174,6 @@ gst_ts_demux_stream_removed (MpegTSBase * base, MpegTSBaseStream * bstream) stream->pad = NULL; } gst_ts_demux_stream_flush (stream, GST_TS_DEMUX_CAST (base)); - stream->flow_return = GST_FLOW_NOT_LINKED; } static void @@ -1240,9 +1226,6 @@ gst_ts_demux_stream_flush (TSDemuxStream * stream, GstTSDemux * tsdemux) stream->first_dts = GST_CLOCK_TIME_NONE; stream->raw_pts = -1; stream->raw_dts = -1; - if (stream->flow_return == GST_FLOW_FLUSHING) { - stream->flow_return = GST_FLOW_OK; - } stream->continuity_counter = CONTINUITY_UNSET; } @@ -1834,7 +1817,7 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream) res = gst_pad_push (stream->pad, buffer); GST_DEBUG_OBJECT (stream->pad, "Returned %s", gst_flow_get_name (res)); - res = tsdemux_combine_flows (demux, stream, res); + res = gst_flow_combiner_update_flow (demux->flowcombiner, res); GST_DEBUG_OBJECT (stream->pad, "combined %s", gst_flow_get_name (res)); beach: diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index eb7fd4aca6..eb87a92c27 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -128,7 +128,8 @@ G_DEFINE_TYPE (GstMXFDemux, gst_mxf_demux, GST_TYPE_ELEMENT); static void gst_mxf_demux_remove_pad (GstMXFDemuxPad * pad, GstMXFDemux * demux) { - gst_element_remove_pad (GST_ELEMENT (demux), GST_PAD (pad)); + gst_flow_combiner_remove_pad (demux->flowcombiner, GST_PAD_CAST (pad)); + gst_element_remove_pad (GST_ELEMENT (demux), GST_PAD_CAST (pad)); } static void @@ -286,31 +287,11 @@ static GstFlowReturn gst_mxf_demux_combine_flows (GstMXFDemux * demux, GstMXFDemuxPad * pad, GstFlowReturn ret) { - guint i; - /* store the value */ pad->last_flow = ret; - /* any other error that is not-linked can be returned right away */ - if (ret != GST_FLOW_NOT_LINKED) - goto done; + ret = gst_flow_combiner_update_flow (demux->flowcombiner, ret); - /* only return NOT_LINKED if all other pads returned NOT_LINKED */ - for (i = 0; i < demux->src->len; i++) { - GstMXFDemuxPad *opad = g_ptr_array_index (demux->src, i); - - if (opad == NULL) - continue; - - ret = opad->last_flow; - /* some other return value (must be SUCCESS but we can return - * other values as well) */ - if (ret != GST_FLOW_NOT_LINKED) - goto done; - } - /* if we get here, all other pads were unlinked and we return - * NOT_LINKED then */ -done: GST_LOG_OBJECT (demux, "combined return %s", gst_flow_get_name (ret)); return ret; } @@ -1271,8 +1252,10 @@ gst_mxf_demux_update_tracks (GstMXFDemux * demux) g_rw_lock_writer_unlock (&demux->metadata_lock); - for (l = pads; l; l = l->next) + for (l = pads; l; l = l->next) { + gst_flow_combiner_add_pad (demux->flowcombiner, l->data); gst_element_add_pad (GST_ELEMENT_CAST (demux), l->data); + } g_list_free (pads); if (first_run) @@ -4106,6 +4089,11 @@ gst_mxf_demux_finalize (GObject * object) demux->adapter = NULL; } + if (demux->flowcombiner) { + gst_flow_combiner_free (demux->flowcombiner); + demux->flowcombiner = NULL; + } + if (demux->close_seg_event) { gst_event_unref (demux->close_seg_event); demux->close_seg_event = NULL; @@ -4191,6 +4179,7 @@ gst_mxf_demux_init (GstMXFDemux * demux) demux->max_drift = 500 * GST_MSECOND; demux->adapter = gst_adapter_new (); + demux->flowcombiner = gst_flow_combiner_new (); g_rw_lock_init (&demux->metadata_lock); demux->src = g_ptr_array_new (); diff --git a/gst/mxf/mxfdemux.h b/gst/mxf/mxfdemux.h index f31d96477f..12ac555041 100644 --- a/gst/mxf/mxfdemux.h +++ b/gst/mxf/mxfdemux.h @@ -22,6 +22,7 @@ #include #include +#include #include "mxfessence.h" @@ -131,6 +132,8 @@ struct _GstMXFDemux GstAdapter *adapter; + GstFlowCombiner *flowcombiner; + GstSegment segment; guint32 seqnum;