gst/playback/gstplaybasebin.c: Error out if we have only text or subtitles, but nothing else. Also error out if we ha...

Original commit message from CVS:
* 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.
This commit is contained in:
Tim-Philipp Müller 2006-02-07 13:11:31 +00:00
parent b14f57785e
commit 8c46daa929
2 changed files with 24 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2006-02-07 Tim-Philipp Müller <tim at centricular dot net>
* 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 <tim at centricular dot net>
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_create):

View file

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