osxaudiosink: Only fix up channels/layout for PCM caps while probing
authorArun Raghavan <git@arunraghavan.net>
Mon, 1 Dec 2014 15:02:04 +0000 (20:32 +0530)
committerArun Raghavan <git@arunraghavan.net>
Mon, 15 Dec 2014 05:49:52 +0000 (11:19 +0530)
It's unlikely that setting a channel layout will do much for AC3/DTS
streams. If we find at some point that it does make sense, we can
perform the structure copying unconditionally (i.e., the current code is
wrong, since AC3/DTS will get two structures now - one with the channel
layout, one without).

https://bugzilla.gnome.org/show_bug.cgi?id=740987

sys/osxaudio/gstosxaudiosink.c

index eb937bd..5ab648a 100644 (file)
@@ -691,13 +691,14 @@ gst_osx_audio_sink_probe_caps (GstOsxAudioSink * osxsink)
       if (spdif_allowed) {
         gst_caps_append_structure (caps, gst_structure_copy (in_s));
       }
+    } else {
+      gst_audio_channel_positions_to_mask (pos, channels, false, &channel_mask);
+      out_s = gst_structure_copy (in_s);
+      gst_structure_remove_fields (out_s, "channels", "channel-mask", NULL);
+      gst_structure_set (out_s, "channels", G_TYPE_INT, channels,
+          "channel-mask", GST_TYPE_BITMASK, channel_mask, NULL);
+      gst_caps_append_structure (caps, out_s);
     }
-    gst_audio_channel_positions_to_mask (pos, channels, false, &channel_mask);
-    out_s = gst_structure_copy (in_s);
-    gst_structure_remove_fields (out_s, "channels", "channel-mask", NULL);
-    gst_structure_set (out_s, "channels", G_TYPE_INT, channels,
-        "channel-mask", GST_TYPE_BITMASK, channel_mask, NULL);
-    gst_caps_append_structure (caps, out_s);
   }
 
   if (osxsink->cached_caps) {