From b28c5061219af12042463822a9d3373dfb2bb9c9 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 10 Jul 2014 15:48:50 +0200 Subject: [PATCH] composition: Factor out a function to seek the current stack Co-Authored by: Mathieu Duponchelle --- gnl/gnlcomposition.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c index 6e51f49cbb..641a8aa790 100644 --- a/gnl/gnlcomposition.c +++ b/gnl/gnlcomposition.c @@ -1473,6 +1473,26 @@ update_operations_base_time (GnlComposition * comp, gboolean reverse) (GNodeTraverseFunc) update_base_time, ×tamp); } + +static gboolean +_seek_current_stack (GnlComposition * comp, GstEvent * event) +{ + gboolean res; + GnlCompositionPrivate *priv = comp->priv; + GstPad *peer = gst_pad_get_peer (GNL_OBJECT_SRC (comp)); + + GST_INFO_OBJECT (comp, "Seeking itself %" GST_PTR_FORMAT, event); + + priv->seeking_itself = TRUE; + res = gst_pad_push_event (peer, event); + priv->seeking_itself = FALSE; + gst_object_unref (peer); + + GST_DEBUG_OBJECT (comp, "Done seeking"); + + return res; +} + /* Figures out if pipeline needs updating. Updates it and sends the seek event. @@ -2966,18 +2986,10 @@ update_pipeline (GnlComposition * comp, GstClockTime currenttime, } /* Activate stack */ - if (!samestack) { + if (!samestack) return _activate_new_stack (comp); - } else { - gboolean res; - GstPad *peer = gst_pad_get_peer (GNL_OBJECT_SRC (comp)); - - priv->seeking_itself = TRUE; - res = gst_pad_push_event (peer, toplevel_seek); - priv->seeking_itself = FALSE; - - return res; - } + else + return _seek_current_stack (comp, toplevel_seek); } static gboolean