Commit 84b9f118 authored by Michael Smith's avatar Michael Smith

gst/autodetect/: Set state of elements to NULL before removing from bins.

Original commit message from CVS:
* gst/autodetect/gstautoaudiosink.c: (gst_auto_audio_sink_reset),
(gst_auto_audio_sink_find_best), (gst_auto_audio_sink_detect):
* gst/autodetect/gstautovideosink.c: (gst_auto_video_sink_reset),
(gst_auto_video_sink_find_best), (gst_auto_video_sink_detect):
Set state of elements to NULL before removing from bins.
Set state of test element to NULL if we failed to move it to READY
parent 3ec9e676
2005-10-04 Michael Smith <msmith@fluendo.com>
* gst/autodetect/gstautoaudiosink.c: (gst_auto_audio_sink_reset),
(gst_auto_audio_sink_find_best), (gst_auto_audio_sink_detect):
* gst/autodetect/gstautovideosink.c: (gst_auto_video_sink_reset),
(gst_auto_video_sink_find_best), (gst_auto_video_sink_detect):
Set state of elements to NULL before removing from bins.
Set state of test element to NULL if we failed to move it to READY
2005-10-04 Edward Hervey <edward@fluendo.com> 2005-10-04 Edward Hervey <edward@fluendo.com>
* ext/dv/Makefile.am: * ext/dv/Makefile.am:
......
...@@ -72,6 +72,7 @@ gst_auto_audio_sink_reset (GstAutoAudioSink * sink) ...@@ -72,6 +72,7 @@ gst_auto_audio_sink_reset (GstAutoAudioSink * sink)
/* fakesink placeholder */ /* fakesink placeholder */
if (sink->kid) { if (sink->kid) {
gst_element_set_state (sink->kid, GST_STATE_NULL);
gst_bin_remove (GST_BIN (sink), sink->kid); gst_bin_remove (GST_BIN (sink), sink->kid);
} }
sink->kid = gst_element_factory_make ("fakesink", "tempsink"); sink->kid = gst_element_factory_make ("fakesink", "tempsink");
...@@ -179,6 +180,8 @@ gst_auto_audio_sink_find_best (GstAutoAudioSink * sink) ...@@ -179,6 +180,8 @@ gst_auto_audio_sink_find_best (GstAutoAudioSink * sink)
GST_LOG ("This worked!"); GST_LOG ("This worked!");
choice = el; choice = el;
goto done; goto done;
} else {
gst_element_set_state (el, GST_STATE_NULL);
} }
} }
...@@ -205,6 +208,7 @@ gst_auto_audio_sink_detect (GstAutoAudioSink * sink) ...@@ -205,6 +208,7 @@ gst_auto_audio_sink_detect (GstAutoAudioSink * sink)
GstPad *targetpad; GstPad *targetpad;
if (sink->kid) { if (sink->kid) {
gst_element_set_state (sink->kid, GST_STATE_NULL);
gst_bin_remove (GST_BIN (sink), sink->kid); gst_bin_remove (GST_BIN (sink), sink->kid);
sink->kid = NULL; sink->kid = NULL;
} }
......
...@@ -72,6 +72,7 @@ gst_auto_video_sink_reset (GstAutoVideoSink * sink) ...@@ -72,6 +72,7 @@ gst_auto_video_sink_reset (GstAutoVideoSink * sink)
/* fakesink placeholder */ /* fakesink placeholder */
if (sink->kid) { if (sink->kid) {
gst_element_set_state (sink->kid, GST_STATE_NULL);
gst_bin_remove (GST_BIN (sink), sink->kid); gst_bin_remove (GST_BIN (sink), sink->kid);
} }
sink->kid = gst_element_factory_make ("fakesink", "tempsink"); sink->kid = gst_element_factory_make ("fakesink", "tempsink");
...@@ -145,13 +146,22 @@ gst_auto_video_sink_find_best (GstAutoVideoSink * sink) ...@@ -145,13 +146,22 @@ gst_auto_video_sink_find_best (GstAutoVideoSink * sink)
GST_DEBUG_OBJECT (sink, "Trying %s", GST_PLUGIN_FEATURE (f)->name); GST_DEBUG_OBJECT (sink, "Trying %s", GST_PLUGIN_FEATURE (f)->name);
if ((el = gst_element_factory_create (f, "actual-sink"))) { if ((el = gst_element_factory_create (f, "actual-sink"))) {
GstStateChangeReturn ret;
GST_DEBUG_OBJECT (sink, "Changing state to READY"); GST_DEBUG_OBJECT (sink, "Changing state to READY");
if (gst_element_set_state (el,
GST_STATE_READY) == GST_STATE_CHANGE_SUCCESS) { ret = gst_element_set_state (el, GST_STATE_READY);
if (ret == GST_STATE_CHANGE_SUCCESS) {
GST_DEBUG_OBJECT (sink, "success"); GST_DEBUG_OBJECT (sink, "success");
return el; return el;
} }
GST_WARNING_OBJECT (sink, "Couldn't set READY: %d", ret);
ret = gst_element_set_state (el, GST_STATE_NULL);
if (ret != GST_STATE_CHANGE_SUCCESS)
GST_WARNING_OBJECT (sink,
"Couldn't set element to NULL prior to disposal.");
gst_object_unref (GST_OBJECT (el)); gst_object_unref (GST_OBJECT (el));
} }
} }
...@@ -166,6 +176,7 @@ gst_auto_video_sink_detect (GstAutoVideoSink * sink) ...@@ -166,6 +176,7 @@ gst_auto_video_sink_detect (GstAutoVideoSink * sink)
GstPad *targetpad; GstPad *targetpad;
if (sink->kid) { if (sink->kid) {
gst_element_set_state (sink->kid, GST_STATE_NULL);
gst_bin_remove (GST_BIN (sink), sink->kid); gst_bin_remove (GST_BIN (sink), sink->kid);
sink->kid = NULL; sink->kid = NULL;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment