gst-libs/gst/riff/riff-media.c: Add audio/x-raw-float support, now that audioconvert...
authorSebastian Dröge <slomo@circular-chaos.org>
Fri, 30 Mar 2007 17:05:23 +0000 (17:05 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Fri, 30 Mar 2007 17:05:23 +0000 (17:05 +0000)
Original commit message from CVS:
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps):
Add audio/x-raw-float support, now that audioconvert support
non-native endianness floats.

ChangeLog
gst-libs/gst/riff/riff-media.c

index 3c98f6e1de3a2f9b24919e7389700e462cc5b178..0bbc4e6e13d00164dcea2366e19603624082aea5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-03-30  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps):
+       Add audio/x-raw-float support, now that audioconvert support
+       non-native endianness floats.
+
 2007-03-30  Tim-Philipp Müller  <tim at centricular dot net>
 
        * docs/libs/gst-plugins-base-libs-docs.sgml:
index 96d9f89547aa73d23b7edcd60b1ff3acf85d2ed9..c0c34f54bef64a3f647c74dff5c86c50246f0864 100644 (file)
@@ -813,6 +813,54 @@ gst_riff_create_audio_caps (guint16 codec_id,
       block_align = TRUE;
       break;
 
+    case GST_RIFF_WAVE_FORMAT_IEEE_FLOAT:
+      if (strf != NULL) {
+        gint ba = strf->blockalign;
+        gint ch = strf->channels;
+        gint wd = ba * 8 / ch;
+
+        caps = gst_caps_new_simple ("audio/x-raw-float",
+            "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+            "channels", G_TYPE_INT, ch, "width", G_TYPE_INT, wd, NULL);
+
+        /* Add default MS channel layout if we have more than 2 channels,
+         * but the layout isn't specified like with WAVEEXT below. Not sure
+         * if this is right, but at least it makes sound output work at all
+         * in those cases. Somebody with a a 5.1 setup should double-check
+         * with chan-id.wav */
+        if (ch > 2) {
+          guint32 channel_mask;
+
+          switch (ch) {
+            case 4:
+              channel_mask = 0x33;
+              break;
+            case 6:
+              channel_mask = 0x3f;
+              break;
+            default:
+              GST_WARNING ("don't know default layout for %d channels", ch);
+              channel_mask = 0;
+              break;
+          }
+
+          if (channel_mask) {
+            GST_DEBUG ("using default channel layout for %d channels", ch);
+            if (!gst_riff_wavext_add_channel_layout (caps, channel_mask)) {
+              GST_WARNING ("failed to add channel layout");
+            }
+          }
+        }
+      } else {
+        /* FIXME: this is pretty useless - we need fixed caps */
+        caps = gst_caps_from_string ("audio/x-raw-float, "
+            "endianness = (int) LITTLE_ENDIAN, " "width = (int) { 32, 64 }");
+      }
+      if (codec_name && strf)
+        *codec_name = g_strdup_printf ("Uncompressed %d-bit IEEE float audio",
+            strf->size);
+      break;
+
     case GST_RIFF_WAVE_FORMAT_IBM_CVSD:
       goto unknown;