summaryrefslogtreecommitdiff
path: root/gst/playback/gsturidecodebin.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/playback/gsturidecodebin.c')
-rw-r--r--gst/playback/gsturidecodebin.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c
index 5bbbe1fa9..28b985023 100644
--- a/gst/playback/gsturidecodebin.c
+++ b/gst/playback/gsturidecodebin.c
@@ -86,6 +86,7 @@ struct _GstURIDecodeBin
gboolean use_buffering;
GstElement *source;
+ GstElement *queue;
GstElement *typefind;
guint have_type_id; /* have-type signal id from typefind */
GSList *decodebins;
@@ -1076,7 +1077,7 @@ analyse_source (GstURIDecodeBin * decoder, gboolean * is_raw,
GstPad *sinkpad;
/* insert a queue element right before the raw pad */
- outelem = gst_element_factory_make ("queue2", "queue");
+ outelem = gst_element_factory_make ("queue2", NULL);
gst_bin_add (GST_BIN_CAST (decoder), outelem);
sinkpad = gst_element_get_static_pad (outelem, "sink");
@@ -1084,6 +1085,9 @@ analyse_source (GstURIDecodeBin * decoder, gboolean * is_raw,
gst_object_unref (sinkpad);
gst_object_unref (pad);
+ /* save queue pointer so we can remove it later */
+ decoder->queue = outelem;
+
/* get the new raw srcpad */
pad = gst_element_get_static_pad (outelem, "src");
} else {
@@ -1482,10 +1486,12 @@ could_not_link:
{
GST_ELEMENT_ERROR (decoder, CORE, NEGOTIATION,
(NULL), ("Can't link source to typefind element"));
+ gst_bin_remove (GST_BIN_CAST (decoder), typefind);
return FALSE;
}
}
+/* remove source and all related elements */
static void
remove_source (GstURIDecodeBin * bin)
{
@@ -1506,6 +1512,18 @@ remove_source (GstURIDecodeBin * bin)
}
bin->source = NULL;
}
+ if (bin->queue) {
+ GST_DEBUG_OBJECT (bin, "removing old queue element");
+ gst_element_set_state (bin->queue, GST_STATE_NULL);
+ gst_bin_remove (GST_BIN_CAST (bin), bin->queue);
+ bin->queue = NULL;
+ }
+ if (bin->typefind) {
+ GST_DEBUG_OBJECT (bin, "removing old typefind element");
+ gst_element_set_state (bin->typefind, GST_STATE_NULL);
+ gst_bin_remove (GST_BIN_CAST (bin), bin->typefind);
+ bin->typefind = NULL;
+ }
}
/* is called when a dynamic source element created a new pad. */