gst-libs/gst/riff/riff-media.c: Set codec_name for WAVEFORMATEX as well. When we have 'normal PCM' with 4 or 6 channe...

Original commit message from CVS:
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps):
Set codec_name for WAVEFORMATEX as well. When we have 'normal PCM'
with 4 or 6 channels, assume a default channel layout to make things
work (not sure there's anything else we can do in those cases).
This commit is contained in:
Tim-Philipp Müller 2006-02-16 20:19:51 +00:00
parent 9490d413c0
commit 8914180cb7
2 changed files with 42 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2006-02-16 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps):
Set codec_name for WAVEFORMATEX as well. When we have 'normal PCM'
with 4 or 6 channels, assume a default channel layout to make things
work (not sure there's anything else we can do in those cases).
2006-02-16 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/audio/multichannel.c:

View file

@ -667,10 +667,38 @@ gst_riff_create_audio_caps (guint16 codec_id,
gint ch = strf->channels;
gint ws = strf->size;
caps = gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
caps = gst_caps_new_simple ("audio/x-raw-int", "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, "channels", G_TYPE_INT, ch, /* needed for _add_layout() */
"width", G_TYPE_INT, (int) (ba * 8 / ch),
"depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, ws != 8, 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-int, "
@ -837,6 +865,11 @@ gst_riff_create_audio_caps (guint16 codec_id,
caps = NULL;
}
rate_chan = FALSE;
if (codec_name) {
*codec_name = g_strdup_printf ("Uncompressed %d-bit PCM audio",
strf->size);
}
}
} else if (subformat_guid[0] == 0x00000003) {
GST_DEBUG ("FIXME: handle IEEE float format");