asfdemux: 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-23 18:17:11 -03:00
parent 84b2009155
commit df4a98e510
2 changed files with 13 additions and 35 deletions

View file

@ -148,9 +148,10 @@ gst_asf_demux_free_stream (GstASFDemux * demux, AsfStream * stream)
stream->pending_tags = NULL; stream->pending_tags = NULL;
} }
if (stream->pad) { if (stream->pad) {
if (stream->active) if (stream->active) {
gst_element_remove_pad (GST_ELEMENT_CAST (demux), stream->pad); gst_element_remove_pad (GST_ELEMENT_CAST (demux), stream->pad);
else gst_flow_combiner_remove_pad (demux->flowcombiner, stream->pad);
} else
gst_object_unref (stream->pad); gst_object_unref (stream->pad);
stream->pad = NULL; stream->pad = NULL;
} }
@ -524,7 +525,6 @@ gst_asf_demux_reset_stream_state_after_discont (GstASFDemux * demux)
for (n = 0; n < demux->num_streams; n++) { for (n = 0; n < demux->num_streams; n++) {
demux->stream[n].discont = TRUE; demux->stream[n].discont = TRUE;
demux->stream[n].last_flow = GST_FLOW_OK;
while (demux->stream[n].payloads->len > 0) { while (demux->stream[n].payloads->len > 0) {
AsfPayload *payload; AsfPayload *payload;
@ -965,36 +965,6 @@ parse_failed:
} }
} }
static GstFlowReturn
gst_asf_demux_aggregate_flow_return (GstASFDemux * demux, AsfStream * stream,
GstFlowReturn flow)
{
int i;
GST_DEBUG_OBJECT (demux, "Aggregating");
/* Store the value */
stream->last_flow = flow;
/* any other error that is not not-linked can be returned right away */
if (flow != GST_FLOW_NOT_LINKED)
goto done;
for (i = 0; i < demux->num_streams; i++) {
if (demux->stream[i].active) {
flow = demux->stream[i].last_flow;
GST_DEBUG_OBJECT (demux, "Aggregating: flow %i return %s", i,
gst_flow_get_name (flow));
if (flow != GST_FLOW_NOT_LINKED)
goto done;
}
}
/* If we got here, then all our active streams are not linked */
done:
return flow;
}
static gboolean static gboolean
gst_asf_demux_pull_data (GstASFDemux * demux, guint64 offset, guint size, gst_asf_demux_pull_data (GstASFDemux * demux, guint64 offset, guint size,
GstBuffer ** p_buf, GstFlowReturn * p_flow) GstBuffer ** p_buf, GstFlowReturn * p_flow)
@ -1741,7 +1711,7 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
if (stream->active) { if (stream->active) {
ret = gst_pad_push (stream->pad, payload->buf); ret = gst_pad_push (stream->pad, payload->buf);
ret = gst_asf_demux_aggregate_flow_return (demux, stream, ret); ret = gst_flow_combiner_update_flow (demux->flowcombiner, ret);
} else { } else {
gst_buffer_unref (payload->buf); gst_buffer_unref (payload->buf);
ret = GST_FLOW_OK; ret = GST_FLOW_OK;
@ -2602,6 +2572,7 @@ gst_asf_demux_activate_stream (GstASFDemux * demux, AsfStream * stream)
gst_pad_set_caps (stream->pad, stream->caps); gst_pad_set_caps (stream->pad, stream->caps);
gst_element_add_pad (GST_ELEMENT_CAST (demux), stream->pad); gst_element_add_pad (GST_ELEMENT_CAST (demux), stream->pad);
gst_flow_combiner_add_pad (demux->flowcombiner, stream->pad);
stream->active = TRUE; stream->active = TRUE;
} }
} }
@ -4363,6 +4334,7 @@ gst_asf_demux_change_state (GstElement * element, GstStateChange transition)
demux->data_offset = 0; demux->data_offset = 0;
demux->index_offset = 0; demux->index_offset = 0;
demux->base_offset = 0; demux->base_offset = 0;
demux->flowcombiner = gst_flow_combiner_new ();
break; break;
} }
default: default:
@ -4375,8 +4347,13 @@ gst_asf_demux_change_state (GstElement * element, GstStateChange transition)
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_asf_demux_reset (demux, FALSE);
break;
case GST_STATE_CHANGE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
gst_asf_demux_reset (demux, FALSE); gst_asf_demux_reset (demux, FALSE);
gst_flow_combiner_free (demux->flowcombiner);
demux->flowcombiner = NULL;
break; break;
default: default:
break; break;

View file

@ -23,6 +23,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/base/gstadapter.h> #include <gst/base/gstadapter.h>
#include <gst/base/gstflowcombiner.h>
#include "asfheaders.h" #include "asfheaders.h"
@ -106,7 +107,6 @@ typedef struct
guint16 ds_data_size; guint16 ds_data_size;
/* for new parsing code */ /* for new parsing code */
GstFlowReturn last_flow; /* last flow return */
GArray *payloads; /* pending payloads */ GArray *payloads; /* pending payloads */
/* Video stream PAR & interlacing */ /* Video stream PAR & interlacing */
@ -168,6 +168,7 @@ struct _GstASFDemux {
guint32 num_streams; guint32 num_streams;
AsfStream stream[GST_ASF_DEMUX_NUM_STREAMS]; AsfStream stream[GST_ASF_DEMUX_NUM_STREAMS];
gboolean activated_streams; gboolean activated_streams;
GstFlowCombiner *flowcombiner;
/* for chained asf handling, we need to hold the old asf streams until /* for chained asf handling, we need to hold the old asf streams until
* we detect the new ones */ * we detect the new ones */