diff options
Diffstat (limited to 'gst/mxf/mxfdemux.c')
-rw-r--r-- | gst/mxf/mxfdemux.c | 56 |
1 files changed, 15 insertions, 41 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index eb7fd4ac..1c093b40 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -103,7 +103,6 @@ gst_mxf_demux_pad_class_init (GstMXFDemuxPadClass * klass) static void gst_mxf_demux_pad_init (GstMXFDemuxPad * pad) { - pad->last_flow = GST_FLOW_OK; pad->position = 0; } @@ -128,7 +127,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 @@ -283,39 +283,6 @@ gst_mxf_demux_reset (GstMXFDemux * demux) } 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; - - /* 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; -} - -static GstFlowReturn gst_mxf_demux_pull_range (GstMXFDemux * demux, guint64 offset, guint size, GstBuffer ** buffer) { @@ -376,8 +343,8 @@ gst_mxf_demux_get_earliest_pad (GstMXFDemux * demux) for (i = 0; i < demux->src->len; i++) { GstMXFDemuxPad *p = g_ptr_array_index (demux->src, i); - if (!p->eos && p->last_flow < earliest) { - earliest = p->last_flow; + if (!p->eos && p->position < earliest) { + earliest = p->position; pad = p; } } @@ -1271,8 +1238,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) @@ -1856,7 +1825,8 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux, ret = gst_pad_push (GST_PAD_CAST (pad), outbuf); outbuf = NULL; - ret = gst_mxf_demux_combine_flows (demux, pad, ret); + ret = gst_flow_combiner_update_flow (demux->flowcombiner, ret); + GST_LOG_OBJECT (demux, "combined return %s", gst_flow_get_name (ret)); if (pad->position > demux->segment.position) demux->segment.position = pad->position; @@ -3256,7 +3226,6 @@ gst_mxf_demux_seek_push (GstMXFDemux * demux, GstEvent * event) /* Reset EOS flag on all pads */ p->eos = FALSE; - p->last_flow = GST_FLOW_OK; gst_mxf_demux_pad_set_position (demux, p, start); position = p->current_essence_track_position; @@ -3420,7 +3389,6 @@ gst_mxf_demux_seek_pull (GstMXFDemux * demux, GstEvent * event) /* Reset EOS flag on all pads */ p->eos = FALSE; - p->last_flow = GST_FLOW_OK; gst_mxf_demux_pad_set_position (demux, p, start); /* we always want to send data starting with a key unit */ @@ -4106,6 +4074,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 +4164,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 (); |