gst/playback/gstplaybasebin.c: Error out if we have only text or subtitles, but nothi...
authorTim-Philipp Müller <tim@centricular.net>
Tue, 7 Feb 2006 13:11:31 +0000 (13:11 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Tue, 7 Feb 2006 13:11:31 +0000 (13:11 +0000)
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.

ChangeLog
gst/playback/gstplaybasebin.c

index db20c02..a841d77 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 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):
          Treat GNOME_VFS_RESULT_EOF as EOS, not as error (#329194).
          Post an error message on the bus when we encounter an
index b485d07..0f7d95d 100644 (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;