mxfdemux: use GstFlowCombiner

Removes flow return combination code to use the newly added GstFlowCombiner

https://bugzilla.gnome.org/show_bug.cgi?id=709224
This commit is contained in:
Thiago Santos 2014-05-26 17:34:40 -03:00
parent 6dc571b5cf
commit ae839d8dc2
3 changed files with 16 additions and 41 deletions

View file

@ -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:

View file

@ -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 ();

View file

@ -22,6 +22,7 @@
#include <gst/gst.h>
#include <gst/base/gstadapter.h>
#include <gst/base/gstflowcombiner.h>
#include "mxfessence.h"
@ -131,6 +132,8 @@ struct _GstMXFDemux
GstAdapter *adapter;
GstFlowCombiner *flowcombiner;
GstSegment segment;
guint32 seqnum;