From 66cafcc34d12812fd6f738c004dc56133bc25497 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 13 Dec 2012 11:31:28 +0100 Subject: [PATCH] playsink: fix vis switch with format change Block the pad before the resample and convertor elements to give the a chance to negotiate new caps with the newly switched vis plugin. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=679976 --- gst/playback/gstplaysink.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c index 80c6238c7e..475ae2fa43 100644 --- a/gst/playback/gstplaysink.c +++ b/gst/playback/gstplaysink.c @@ -133,7 +133,8 @@ typedef struct GstElement *queue; GstElement *conv; GstElement *resample; - GstPad *blockpad; /* srcpad of resample, used for switching the vis */ + GstPad *blockpad; /* srcpad of queue, used for blocking the vis */ + GstPad *vispeerpad; /* srcpad of resample, used for unlinking the vis */ GstPad *vissinkpad; /* visualisation sinkpad, */ GstElement *vis; GstPad *vissrcpad; /* visualisation srcpad, */ @@ -911,7 +912,7 @@ gst_play_sink_vis_blocked (GstPad * tee_pad, GstPadProbeInfo * info, goto done; /* unlink the old plugin and unghost the pad */ - gst_pad_unlink (chain->blockpad, chain->vissinkpad); + gst_pad_unlink (chain->vispeerpad, chain->vissinkpad); gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (chain->srcpad), NULL); /* set the old plugin to NULL and remove */ @@ -928,7 +929,7 @@ gst_play_sink_vis_blocked (GstPad * tee_pad, GstPadProbeInfo * info, chain->vissrcpad = gst_element_get_static_pad (chain->vis, "src"); /* link pads */ - gst_pad_link_full (chain->blockpad, chain->vissinkpad, + gst_pad_link_full (chain->vispeerpad, chain->vissinkpad, GST_PAD_LINK_CHECK_NOTHING); gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (chain->srcpad), chain->vissrcpad); @@ -2846,8 +2847,12 @@ gen_vis_chain (GstPlaySink * playsink) gst_bin_add (bin, chain->resample); /* this pad will be used for blocking the dataflow and switching the vis + * plugin, we block right after the queue, this makes it possible for the + * resample and convert to convert to a format supported by the new vis * plugin */ - chain->blockpad = gst_element_get_static_pad (chain->resample, "src"); + chain->blockpad = gst_element_get_static_pad (chain->queue, "src"); + /* this is the pad where the vis is linked to */ + chain->vispeerpad = gst_element_get_static_pad (chain->resample, "src"); if (playsink->visualisation) { GST_DEBUG_OBJECT (playsink, "trying configure vis");