mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
mpegdemux: 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:
parent
b66012a586
commit
6dc571b5cf
2 changed files with 13 additions and 38 deletions
|
@ -274,6 +274,7 @@ gst_flups_demux_init (GstFluPSDemux * demux)
|
||||||
|
|
||||||
demux->adapter = gst_adapter_new ();
|
demux->adapter = gst_adapter_new ();
|
||||||
demux->rev_adapter = gst_adapter_new ();
|
demux->rev_adapter = gst_adapter_new ();
|
||||||
|
demux->flowcombiner = gst_flow_combiner_new ();
|
||||||
|
|
||||||
gst_flups_demux_reset (demux);
|
gst_flups_demux_reset (demux);
|
||||||
}
|
}
|
||||||
|
@ -285,6 +286,7 @@ gst_flups_demux_finalize (GstFluPSDemux * demux)
|
||||||
g_free (demux->streams);
|
g_free (demux->streams);
|
||||||
g_free (demux->streams_found);
|
g_free (demux->streams_found);
|
||||||
|
|
||||||
|
gst_flow_combiner_free (demux->flowcombiner);
|
||||||
g_object_unref (demux->adapter);
|
g_object_unref (demux->adapter);
|
||||||
g_object_unref (demux->rev_adapter);
|
g_object_unref (demux->rev_adapter);
|
||||||
|
|
||||||
|
@ -301,8 +303,10 @@ gst_flups_demux_reset (GstFluPSDemux * demux)
|
||||||
GstFluPSStream *stream = demux->streams[i];
|
GstFluPSStream *stream = demux->streams[i];
|
||||||
|
|
||||||
if (stream != NULL) {
|
if (stream != NULL) {
|
||||||
if (stream->pad && GST_PAD_PARENT (stream->pad))
|
if (stream->pad && GST_PAD_PARENT (stream->pad)) {
|
||||||
|
gst_flow_combiner_remove_pad (demux->flowcombiner, stream->pad);
|
||||||
gst_element_remove_pad (GST_ELEMENT_CAST (demux), stream->pad);
|
gst_element_remove_pad (GST_ELEMENT_CAST (demux), stream->pad);
|
||||||
|
}
|
||||||
|
|
||||||
if (stream->pending_tags)
|
if (stream->pending_tags)
|
||||||
gst_tag_list_unref (stream->pending_tags);
|
gst_tag_list_unref (stream->pending_tags);
|
||||||
|
@ -455,7 +459,6 @@ gst_flups_demux_create_stream (GstFluPSDemux * demux, gint id, gint stream_type)
|
||||||
stream->discont = TRUE;
|
stream->discont = TRUE;
|
||||||
stream->need_segment = TRUE;
|
stream->need_segment = TRUE;
|
||||||
stream->notlinked = FALSE;
|
stream->notlinked = FALSE;
|
||||||
stream->last_flow = GST_FLOW_OK;
|
|
||||||
stream->type = stream_type;
|
stream->type = stream_type;
|
||||||
stream->pending_tags = NULL;
|
stream->pending_tags = NULL;
|
||||||
stream->pad = gst_pad_new_from_template (template, name);
|
stream->pad = gst_pad_new_from_template (template, name);
|
||||||
|
@ -522,6 +525,7 @@ gst_flups_demux_get_stream (GstFluPSDemux * demux, gint id, gint type)
|
||||||
|
|
||||||
if (demux->need_no_more_pads) {
|
if (demux->need_no_more_pads) {
|
||||||
gst_element_add_pad (GST_ELEMENT (demux), stream->pad);
|
gst_element_add_pad (GST_ELEMENT (demux), stream->pad);
|
||||||
|
gst_flow_combiner_add_pad (demux->flowcombiner, stream->pad);
|
||||||
} else {
|
} else {
|
||||||
/* only likely to confuse decodebin etc, so discard */
|
/* only likely to confuse decodebin etc, so discard */
|
||||||
/* FIXME should perform full switch protocol:
|
/* FIXME should perform full switch protocol:
|
||||||
|
@ -662,7 +666,7 @@ gst_flups_demux_send_data (GstFluPSDemux * demux, GstFluPSStream * stream,
|
||||||
GST_LOG_OBJECT (demux, "pushing stream id 0x%02x type 0x%02x, pts time: %"
|
GST_LOG_OBJECT (demux, "pushing stream id 0x%02x type 0x%02x, pts time: %"
|
||||||
GST_TIME_FORMAT ", size %" G_GSIZE_FORMAT,
|
GST_TIME_FORMAT ", size %" G_GSIZE_FORMAT,
|
||||||
stream->id, stream->type, GST_TIME_ARGS (pts), gst_buffer_get_size (buf));
|
stream->id, stream->type, GST_TIME_ARGS (pts), gst_buffer_get_size (buf));
|
||||||
stream->last_flow = result = gst_pad_push (stream->pad, buf);
|
result = gst_pad_push (stream->pad, buf);
|
||||||
GST_LOG_OBJECT (demux, "result: %s", gst_flow_get_name (result));
|
GST_LOG_OBJECT (demux, "result: %s", gst_flow_get_name (result));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -887,7 +891,6 @@ gst_flups_demux_clear_times (GstFluPSDemux * demux)
|
||||||
|
|
||||||
if (G_LIKELY (stream)) {
|
if (G_LIKELY (stream)) {
|
||||||
stream->last_ts = GST_CLOCK_TIME_NONE;
|
stream->last_ts = GST_CLOCK_TIME_NONE;
|
||||||
stream->last_flow = GST_FLOW_OK;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2259,7 +2262,6 @@ gst_flups_demux_data_cb (GstPESFilter * filter, gboolean first,
|
||||||
ret = gst_flups_demux_send_data (demux, demux->current_stream, out_buf);
|
ret = gst_flups_demux_send_data (demux, demux->current_stream, out_buf);
|
||||||
if (ret == GST_FLOW_NOT_LINKED) {
|
if (ret == GST_FLOW_NOT_LINKED) {
|
||||||
demux->current_stream->notlinked = TRUE;
|
demux->current_stream->notlinked = TRUE;
|
||||||
ret = GST_FLOW_OK;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3028,42 +3030,13 @@ gst_flups_demux_sink_activate_mode (GstPad * pad, GstObject * parent,
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_flups_demux_combine_flows (GstFluPSDemux * demux, GstFlowReturn ret)
|
gst_flups_demux_combine_flows (GstFluPSDemux * demux, GstFlowReturn ret)
|
||||||
{
|
{
|
||||||
gint i, count = demux->found_count, streams = 0;
|
|
||||||
gboolean unexpected = FALSE, not_linked = TRUE;
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (demux, "flow return: %s", gst_flow_get_name (ret));
|
GST_LOG_OBJECT (demux, "flow return: %s", gst_flow_get_name (ret));
|
||||||
|
|
||||||
/* only return NOT_LINKED if all other pads returned NOT_LINKED */
|
ret = gst_flow_combiner_update_flow (demux->flowcombiner, ret);
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
GstFluPSStream *stream = demux->streams_found[i];
|
|
||||||
|
|
||||||
if (G_UNLIKELY (!stream))
|
if (G_UNLIKELY (demux->need_no_more_pads && ret == GST_FLOW_NOT_LINKED))
|
||||||
continue;
|
ret = GST_FLOW_OK;
|
||||||
|
|
||||||
ret = stream->last_flow;
|
|
||||||
streams++;
|
|
||||||
|
|
||||||
/* some streams may still have to appear,
|
|
||||||
* and only those ones may end up linked */
|
|
||||||
if (G_UNLIKELY (demux->need_no_more_pads && ret == GST_FLOW_NOT_LINKED))
|
|
||||||
ret = GST_FLOW_OK;
|
|
||||||
|
|
||||||
/* no unexpected or unlinked, return */
|
|
||||||
if (G_LIKELY (ret != GST_FLOW_EOS && ret != GST_FLOW_NOT_LINKED))
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
/* we check to see if we have at least 1 unexpected or all unlinked */
|
|
||||||
unexpected |= (ret == GST_FLOW_EOS);
|
|
||||||
not_linked &= (ret == GST_FLOW_NOT_LINKED);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* when we get here, we all have unlinked or unexpected */
|
|
||||||
if (not_linked && streams)
|
|
||||||
ret = GST_FLOW_NOT_LINKED;
|
|
||||||
else if (unexpected)
|
|
||||||
ret = GST_FLOW_EOS;
|
|
||||||
|
|
||||||
done:
|
|
||||||
GST_LOG_OBJECT (demux, "combined flow return: %s", gst_flow_get_name (ret));
|
GST_LOG_OBJECT (demux, "combined flow return: %s", gst_flow_get_name (ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,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 "gstpesfilter.h"
|
#include "gstpesfilter.h"
|
||||||
|
|
||||||
|
@ -93,7 +94,6 @@ struct _GstFluPSStream
|
||||||
|
|
||||||
GstClockTime segment_thresh;
|
GstClockTime segment_thresh;
|
||||||
GstClockTime last_ts;
|
GstClockTime last_ts;
|
||||||
GstFlowReturn last_flow;
|
|
||||||
|
|
||||||
gboolean discont;
|
gboolean discont;
|
||||||
gboolean notlinked;
|
gboolean notlinked;
|
||||||
|
@ -152,6 +152,8 @@ struct _GstFluPSDemux
|
||||||
gint found_count;
|
gint found_count;
|
||||||
gboolean need_no_more_pads;
|
gboolean need_no_more_pads;
|
||||||
|
|
||||||
|
GstFlowCombiner *flowcombiner;
|
||||||
|
|
||||||
/* Indicates an MPEG-2 stream */
|
/* Indicates an MPEG-2 stream */
|
||||||
gboolean is_mpeg2_pack;
|
gboolean is_mpeg2_pack;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue