summaryrefslogtreecommitdiffstats
path: root/gst/autodetect
diff options
context:
space:
mode:
authorMichael Smith <msmith@xiph.org>2005-10-04 17:58:40 +0000
committerMichael Smith <msmith@xiph.org>2005-10-04 17:58:40 +0000
commit84b9f118e7c56b3f33fafce19e65adb4659334e0 (patch)
treee6ac59e61ad4c25bba6c302fe884e5825d11832c /gst/autodetect
parent3ec9e676e764b773aedd1d50b01cbebe60c31c91 (diff)
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
Diffstat (limited to 'gst/autodetect')
-rw-r--r--gst/autodetect/gstautoaudiosink.c4
-rw-r--r--gst/autodetect/gstautovideosink.c15
2 files changed, 17 insertions, 2 deletions
diff --git a/gst/autodetect/gstautoaudiosink.c b/gst/autodetect/gstautoaudiosink.c
index a7b522a8..0bbf63a1 100644
--- a/gst/autodetect/gstautoaudiosink.c
+++ b/gst/autodetect/gstautoaudiosink.c
@@ -72,6 +72,7 @@ gst_auto_audio_sink_reset (GstAutoAudioSink * sink)
/* fakesink placeholder */
if (sink->kid) {
+ gst_element_set_state (sink->kid, GST_STATE_NULL);
gst_bin_remove (GST_BIN (sink), sink->kid);
}
sink->kid = gst_element_factory_make ("fakesink", "tempsink");
@@ -179,6 +180,8 @@ gst_auto_audio_sink_find_best (GstAutoAudioSink * sink)
GST_LOG ("This worked!");
choice = el;
goto done;
+ } else {
+ gst_element_set_state (el, GST_STATE_NULL);
}
}
@@ -205,6 +208,7 @@ gst_auto_audio_sink_detect (GstAutoAudioSink * sink)
GstPad *targetpad;
if (sink->kid) {
+ gst_element_set_state (sink->kid, GST_STATE_NULL);
gst_bin_remove (GST_BIN (sink), sink->kid);
sink->kid = NULL;
}
diff --git a/gst/autodetect/gstautovideosink.c b/gst/autodetect/gstautovideosink.c
index ad355b5a..3df90098 100644
--- a/gst/autodetect/gstautovideosink.c
+++ b/gst/autodetect/gstautovideosink.c
@@ -72,6 +72,7 @@ gst_auto_video_sink_reset (GstAutoVideoSink * sink)
/* fakesink placeholder */
if (sink->kid) {
+ gst_element_set_state (sink->kid, GST_STATE_NULL);
gst_bin_remove (GST_BIN (sink), sink->kid);
}
sink->kid = gst_element_factory_make ("fakesink", "tempsink");
@@ -145,13 +146,22 @@ gst_auto_video_sink_find_best (GstAutoVideoSink * sink)
GST_DEBUG_OBJECT (sink, "Trying %s", GST_PLUGIN_FEATURE (f)->name);
if ((el = gst_element_factory_create (f, "actual-sink"))) {
+ GstStateChangeReturn ret;
+
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");
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));
}
}
@@ -166,6 +176,7 @@ gst_auto_video_sink_detect (GstAutoVideoSink * sink)
GstPad *targetpad;
if (sink->kid) {
+ gst_element_set_state (sink->kid, GST_STATE_NULL);
gst_bin_remove (GST_BIN (sink), sink->kid);
sink->kid = NULL;
}