gst/playback/: Refuse to change state to READY when we failed to create any of the required elements in our instance ...

Original commit message from CVS:
* 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.
This commit is contained in:
Tim-Philipp Müller 2006-12-16 12:22:57 +00:00
parent 20862a8523
commit 95f46c1fee
3 changed files with 21 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2006-12-16 Tim-Philipp Müller <tim at centricular dot net>
* 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 <tim at centricular dot net>
* docs/libs/gst-plugins-base-libs-sections.txt:

View file

@ -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:

View file

@ -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;