diff --git a/ChangeLog b/ChangeLog index db20c02b73..a841d77ffb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-02-07 Tim-Philipp Müller + + * gst/playback/gstplaybasebin.c: (prepare_output): + Error out if we have only text or subtitles, but nothing + else. Also error out if we have subtitles but no video + stream. + 2006-02-07 Tim-Philipp Müller * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_create): diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index b485d079e5..0f7d95d53e 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -1406,6 +1406,7 @@ prepare_output (GstPlayBaseBin * play_base_bin) { const GList *item; gboolean stream_found = FALSE, no_media = FALSE; + gboolean got_video = FALSE, got_subtitle = FALSE;; GstPlayBaseGroup *group; group = get_active_group (play_base_bin); @@ -1416,9 +1417,14 @@ prepare_output (GstPlayBaseBin * play_base_bin) for (item = group ? group->streaminfo : NULL; item != NULL; item = item->next) { GstStreamInfo *info = GST_STREAM_INFO (item->data); - if (info->type != GST_STREAM_TYPE_UNKNOWN) { + if (info->type == GST_STREAM_TYPE_VIDEO) { stream_found = TRUE; + got_video = TRUE; break; + } else if (info->type == GST_STREAM_TYPE_AUDIO) { + stream_found = TRUE; + } else if (info->type == GST_STREAM_TYPE_TEXT) { + got_subtitle = TRUE; } else if (!item->prev && !item->next) { /* We're no audio/video and the only stream... We could * be something not-media that's detected because then our @@ -1439,7 +1445,12 @@ prepare_output (GstPlayBaseBin * play_base_bin) } if (!stream_found) { - if (!no_media) { + if (got_subtitle) { + GST_ELEMENT_ERROR (play_base_bin, STREAM, WRONG_TYPE, + (_("Only a subtitle stream was detected. " + "Either you are loading a subtitle file or some other type of " + "text file, or the media file was not recognized.")), (NULL)); + } else if (!no_media) { GST_ELEMENT_ERROR (play_base_bin, STREAM, CODEC_NOT_FOUND, (_("You do not have a decoder installed to handle \"%s\". You might need to install the necessary plugins."), play_base_bin->uri), (NULL)); } else { @@ -1447,6 +1458,10 @@ prepare_output (GstPlayBaseBin * play_base_bin) (_("\"%s\" is not a media file"), play_base_bin->uri), (NULL)); } return FALSE; + } else if (got_subtitle && !got_video) { + GST_ELEMENT_ERROR (play_base_bin, STREAM, WRONG_TYPE, + (_("A subtitle stream was detected, but no video stream.")), (NULL)); + return FALSE; } return TRUE;