mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
avidemux: use GstFlowCombiner
Removes flow return combination code to use the newly added GstFlowCombiner
This commit is contained in:
parent
4b0ce7dc30
commit
da3c031627
2 changed files with 7 additions and 27 deletions
|
@ -196,6 +196,7 @@ gst_avi_demux_init (GstAviDemux * avi)
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (avi), avi->sinkpad);
|
gst_element_add_pad (GST_ELEMENT_CAST (avi), avi->sinkpad);
|
||||||
|
|
||||||
avi->adapter = gst_adapter_new ();
|
avi->adapter = gst_adapter_new ();
|
||||||
|
avi->flowcombiner = gst_flow_combiner_new ();
|
||||||
|
|
||||||
gst_avi_demux_reset (avi);
|
gst_avi_demux_reset (avi);
|
||||||
|
|
||||||
|
@ -232,6 +233,7 @@ gst_avi_demux_reset_stream (GstAviDemux * avi, GstAviStream * stream)
|
||||||
if (stream->exposed) {
|
if (stream->exposed) {
|
||||||
gst_pad_set_active (stream->pad, FALSE);
|
gst_pad_set_active (stream->pad, FALSE);
|
||||||
gst_element_remove_pad (GST_ELEMENT_CAST (avi), stream->pad);
|
gst_element_remove_pad (GST_ELEMENT_CAST (avi), stream->pad);
|
||||||
|
gst_flow_combiner_remove_pad (avi->flowcombiner, stream->pad);
|
||||||
} else
|
} else
|
||||||
gst_object_unref (stream->pad);
|
gst_object_unref (stream->pad);
|
||||||
}
|
}
|
||||||
|
@ -1886,6 +1888,7 @@ gst_avi_demux_expose_streams (GstAviDemux * avi, gboolean force)
|
||||||
if (force || stream->idx_n != 0) {
|
if (force || stream->idx_n != 0) {
|
||||||
GST_LOG_OBJECT (avi, "Adding pad %s", GST_PAD_NAME (stream->pad));
|
GST_LOG_OBJECT (avi, "Adding pad %s", GST_PAD_NAME (stream->pad));
|
||||||
gst_element_add_pad ((GstElement *) avi, stream->pad);
|
gst_element_add_pad ((GstElement *) avi, stream->pad);
|
||||||
|
gst_flow_combiner_add_pad (avi->flowcombiner, stream->pad);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (avi->element_index)
|
if (avi->element_index)
|
||||||
|
@ -5003,35 +5006,9 @@ static GstFlowReturn
|
||||||
gst_avi_demux_combine_flows (GstAviDemux * avi, GstAviStream * stream,
|
gst_avi_demux_combine_flows (GstAviDemux * avi, GstAviStream * stream,
|
||||||
GstFlowReturn ret)
|
GstFlowReturn ret)
|
||||||
{
|
{
|
||||||
guint i;
|
|
||||||
gboolean unexpected = FALSE, not_linked = TRUE;
|
|
||||||
|
|
||||||
/* store the value */
|
/* store the value */
|
||||||
stream->last_flow = ret;
|
stream->last_flow = ret;
|
||||||
|
ret = gst_flow_combiner_update_flow (avi->flowcombiner, ret);
|
||||||
/* any other error that is not-linked or eos can be returned right away */
|
|
||||||
if (G_LIKELY (ret != GST_FLOW_EOS && ret != GST_FLOW_NOT_LINKED))
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
/* only return NOT_LINKED if all other pads returned NOT_LINKED */
|
|
||||||
for (i = 0; i < avi->num_streams; i++) {
|
|
||||||
GstAviStream *ostream = &avi->stream[i];
|
|
||||||
|
|
||||||
ret = ostream->last_flow;
|
|
||||||
/* 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)
|
|
||||||
ret = GST_FLOW_NOT_LINKED;
|
|
||||||
else if (unexpected)
|
|
||||||
ret = GST_FLOW_EOS;
|
|
||||||
done:
|
|
||||||
GST_LOG_OBJECT (avi, "combined %s to return %s",
|
GST_LOG_OBJECT (avi, "combined %s to return %s",
|
||||||
gst_flow_get_name (stream->last_flow), gst_flow_get_name (ret));
|
gst_flow_get_name (stream->last_flow), gst_flow_get_name (ret));
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "gst/riff/riff-ids.h"
|
#include "gst/riff/riff-ids.h"
|
||||||
#include "gst/riff/riff-read.h"
|
#include "gst/riff/riff-read.h"
|
||||||
#include <gst/base/gstadapter.h>
|
#include <gst/base/gstadapter.h>
|
||||||
|
#include <gst/base/gstflowcombiner.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -165,6 +166,8 @@ typedef struct _GstAviDemux {
|
||||||
|
|
||||||
guint main_stream; /* used for seeking */
|
guint main_stream; /* used for seeking */
|
||||||
|
|
||||||
|
GstFlowCombiner *flowcombiner;
|
||||||
|
|
||||||
gboolean have_group_id;
|
gboolean have_group_id;
|
||||||
guint group_id;
|
guint group_id;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue