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-14 12:51:39 -0300 |
commit | 241a4107fffd20c37b1e2943d3810a0f4a852195 (patch) | |
tree | 6a06d6fb205c06a02209ddf3540ec799c3112505 | |
parent | 4f968d3b5400f01c59ee9256849a3384b37b294c (diff) |
tee: use GstFlowCombinerflowcombiner-hashtable
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 | 23 | ||||
-rw-r--r-- | plugins/elements/gsttee.h | 2 |
2 files changed, 16 insertions, 9 deletions
diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index a6d4b9dac..d8f7f412d 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,7 @@ 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 (); gst_pad_set_event_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_sink_event)); @@ -370,7 +373,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_pad (tee->flowcombiner, srcpad); return srcpad; @@ -417,6 +422,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_pad (tee->flowcombiner, pad); gst_pad_set_active (pad, FALSE); GST_TEE_DYN_UNLOCK (tee); @@ -568,6 +574,7 @@ clear_pads (GstPad * pad, GstTee * tee) { GST_TEE_PAD_CAST (pad)->pushed = FALSE; GST_TEE_PAD_CAST (pad)->result = GST_FLOW_NOT_LINKED; + gst_flow_combiner_set_flow (tee->flowcombiner, pad, GST_FLOW_NOT_LINKED); } static GstFlowReturn @@ -600,6 +607,7 @@ gst_tee_handle_data (GstTee * tee, gpointer data, gboolean is_list) } else { ret = gst_pad_push (pad, GST_BUFFER_CAST (data)); } + gst_flow_combiner_set_flow (tee->flowcombiner, pad, ret); return ret; } @@ -652,15 +660,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 +679,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; |