gst/playback/: Handle case where we can't create the volume element a bit better...
authorTim-Philipp Müller <tim@centricular.net>
Mon, 11 Feb 2008 18:31:43 +0000 (18:31 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Mon, 11 Feb 2008 18:31:43 +0000 (18:31 +0000)
Original commit message from CVS:
* gst/playback/gstplaybin.c: (gen_audio_element):
* gst/playback/gstplaysink.c: (gen_audio_chain):
Handle case where we can't create the volume element a bit
better (#514307).

ChangeLog
gst/playback/gstplaybin.c
gst/playback/gstplaysink.c

index db2ec85..a064bce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-02-11  Tim-Philipp Müller  <tim at centricular dot net>
 
+       * gst/playback/gstplaybin.c: (gen_audio_element):
+       * gst/playback/gstplaysink.c: (gen_audio_chain):
+         Handle case where we can't create the volume element a bit
+         better (#514307).
+
+2008-02-11  Tim-Philipp Müller  <tim at centricular dot net>
+
        * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_check_get_range):
        * ext/gnomevfs/gstgnomevfsuri.c: (gst_gnomevfs_get_supported_uris):
          Add support for https protocol. Fixes #510229.
index c5ddf00..47e9f2c 100644 (file)
@@ -1052,6 +1052,8 @@ gen_audio_element (GstPlayBin * play_bin)
   gst_bin_add (GST_BIN_CAST (element), scale);
 
   volume = gst_element_factory_make ("volume", "volume");
+  if (volume == NULL)
+    goto no_volume;
   g_object_set (G_OBJECT (volume), "volume", play_bin->volume, NULL);
   play_bin->volume_element = volume;
   gst_bin_add (GST_BIN_CAST (element), volume);
@@ -1092,7 +1094,6 @@ no_audioconvert:
     gst_object_unref (element);
     return NULL;
   }
-
 no_audioresample:
   {
     post_missing_element_message (play_bin, "audioresample");
@@ -1102,6 +1103,15 @@ no_audioresample:
     gst_object_unref (element);
     return NULL;
   }
+no_volume:
+  {
+    post_missing_element_message (play_bin, "volume");
+    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
+        (_("Missing element '%s' - check your GStreamer installation."),
+            "volume"), ("possibly a liboil version mismatch?"));
+    gst_object_unref (element);
+    return NULL;
+  }
 link_failed:
   {
     GST_ELEMENT_ERROR (play_bin, CORE, PAD,
index 8eedf00..a4da99c 100644 (file)
@@ -946,6 +946,8 @@ gen_audio_chain (GstPlaySink * playsink, gboolean raw)
 
     if (playsink->flags & GST_PLAY_FLAG_SOFT_VOLUME) {
       chain->volume = gst_element_factory_make ("volume", "volume");
+      if (chain->volume == NULL)
+        goto no_volume;
       /* configure with the latest volume */
       g_object_set (G_OBJECT (chain->volume), "volume", playsink->volume, NULL);
       gst_bin_add (bin, chain->volume);
@@ -987,7 +989,6 @@ no_audioconvert:
     free_chain ((GstPlayChain *) chain);
     return NULL;
   }
-
 no_audioresample:
   {
     post_missing_element_message (playsink, "audioresample");
@@ -997,6 +998,15 @@ no_audioresample:
     free_chain ((GstPlayChain *) chain);
     return NULL;
   }
+no_volume:
+  {
+    post_missing_element_message (playsink, "volume");
+    GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
+        (_("Missing element '%s' - check your GStreamer installation."),
+            "volume"), ("possibly a liboil version mismatch?"));
+    free_chain ((GstPlayChain *) chain);
+    return NULL;
+  }
 link_failed:
   {
     GST_ELEMENT_ERROR (playsink, CORE, PAD,