diff --git a/ChangeLog b/ChangeLog index e66452f039..ce41607583 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-12-16 Tim-Philipp Müller + + * gst/playback/gstdecodebin.c: (gst_decode_bin_change_state): + * gst/playback/gstdecodebin2.c: (gst_decode_bin_change_state): + Refuse to change state to READY when we failed to create any of the + required elements in our instance init function. + 2006-12-15 Tim-Philipp Müller * docs/libs/gst-plugins-base-libs-sections.txt: diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index ef43eb1517..ff28756c6f 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -1655,6 +1655,11 @@ gst_decode_bin_change_state (GstElement * element, GstStateChange transition) decode_bin->numpads = 0; decode_bin->numwaiting = 0; decode_bin->dynamics = NULL; + /* catch fatal errors that may have occured in the init function */ + if (decode_bin->typefind == NULL || decode_bin->fakesink == NULL) { + GST_ELEMENT_ERROR (decode_bin, CORE, MISSING_PLUGIN, (NULL), (NULL)); + return GST_STATE_CHANGE_FAILURE; + } break; case GST_STATE_CHANGE_READY_TO_PAUSED: GST_OBJECT_LOCK (decode_bin); @@ -1677,6 +1682,8 @@ gst_decode_bin_change_state (GstElement * element, GstStateChange transition) } ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + if (ret == GST_STATE_CHANGE_FAILURE) + return ret; switch (transition) { case GST_STATE_CHANGE_PLAYING_TO_PAUSED: diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 7c38dc77b1..83477e3e24 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -1786,6 +1786,13 @@ gst_decode_bin_change_state (GstElement * element, GstStateChange transition) GstDecodeBin *dbin = GST_DECODE_BIN (element); switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + /* catch fatal errors that may have occured in the init function */ + if (dbin->typefind == NULL || dbin->fakesink == NULL) { + GST_ELEMENT_ERROR (dbin, CORE, MISSING_PLUGIN, (NULL), (NULL)); + return GST_STATE_CHANGE_FAILURE; + } + break; case GST_STATE_CHANGE_READY_TO_PAUSED:{ add_fakesink (dbin); break;