diff options
author | Thiago Santos <ts.santos@partner.samsung.com> | 2013-11-01 15:51:28 -0300 |
---|---|---|
committer | Thiago Santos <ts.santos@partner.samsung.com> | 2013-11-11 11:05:51 -0300 |
commit | 7e69800849ee7e35a355bb853a2154178b18f9db (patch) | |
tree | 9979ae05af335af3dca25635932725c71ced4593 | |
parent | 8b41e8fec1f0c06fc2fed6c1f690462292cbbae8 (diff) |
tee: use GstFlowCombinerflowcombiner_offsets
Use the newly added GstFlowCombiner to handle GstFlowReturn
combination
https://bugzilla.gnome.org/show_bug.cgi?id=709224
-rw-r--r-- | plugins/elements/gsttee.c | 22 | ||||
-rw-r--r-- | plugins/elements/gsttee.h | 2 |
2 files changed, 15 insertions, 9 deletions
diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index a6d4b9dac..8a17adfcd 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -208,6 +208,8 @@ restart: } } + gst_flow_combiner_free (GST_TEE_CAST (object)->flowcombiner); + G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -289,6 +291,8 @@ gst_tee_init (GstTee * tee) tee->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink"); tee->sink_mode = GST_PAD_MODE_NONE; + tee->flowcombiner = + gst_flow_combiner_new (G_STRUCT_OFFSET (GstTeePad, result)); gst_pad_set_event_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_sink_event)); @@ -370,7 +374,9 @@ gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ, /* Forward sticky events to the new srcpad */ gst_pad_sticky_events_foreach (tee->sinkpad, forward_sticky_events, srcpad); GST_OBJECT_FLAG_SET (srcpad, GST_PAD_FLAG_PROXY_CAPS); + gst_element_add_pad (GST_ELEMENT_CAST (tee), srcpad); + gst_flow_combiner_add_stream (tee->flowcombiner, srcpad); return srcpad; @@ -417,6 +423,7 @@ gst_tee_release_pad (GstElement * element, GstPad * pad) gst_object_ref (pad); gst_element_remove_pad (GST_ELEMENT_CAST (tee), pad); + gst_flow_combiner_remove_stream (tee->flowcombiner, pad); gst_pad_set_active (pad, FALSE); GST_TEE_DYN_UNLOCK (tee); @@ -652,15 +659,12 @@ restart: goto restart; } + cret = gst_flow_combiner_update_flow (tee->flowcombiner, pad, ret); + /* stop pushing more buffers when we have a fatal error */ - if (G_UNLIKELY (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED)) + if (G_UNLIKELY (cret != GST_FLOW_OK && cret != GST_FLOW_NOT_LINKED)) goto error; - /* keep all other return values, overwriting the previous one. */ - if (G_LIKELY (ret != GST_FLOW_NOT_LINKED)) { - GST_LOG_OBJECT (tee, "Replacing ret val %d with %d", cret, ret); - cret = ret; - } pads = g_list_next (pads); } GST_OBJECT_UNLOCK (tee); @@ -674,15 +678,15 @@ restart: no_pads: { GST_DEBUG_OBJECT (tee, "there are no pads, return not-linked"); - ret = GST_FLOW_NOT_LINKED; + cret = GST_FLOW_NOT_LINKED; goto error; } error: { - GST_DEBUG_OBJECT (tee, "received error %s", gst_flow_get_name (ret)); + GST_DEBUG_OBJECT (tee, "received error %s", gst_flow_get_name (cret)); GST_OBJECT_UNLOCK (tee); gst_mini_object_unref (GST_MINI_OBJECT_CAST (data)); - return ret; + return cret; } } diff --git a/plugins/elements/gsttee.h b/plugins/elements/gsttee.h index c092b8fac..23d9edc37 100644 --- a/plugins/elements/gsttee.h +++ b/plugins/elements/gsttee.h @@ -73,6 +73,8 @@ struct _GstTee { GstPad *allocpad; guint pad_counter; + GstFlowCombiner *flowcombiner; + gboolean has_chain; gboolean silent; gchar *last_message; |