gst-libs/gst/riff/riff-media.c: Yet another fix for broken software that produce files with an empty blockalign field...

Original commit message from CVS:
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps):
Yet another fix for broken software that produce files with an empty
blockalign field. Instead of completely failing, make a second attempt
at guessing the width/depth by looking at strf->size.
This commit is contained in:
Edward Hervey 2007-12-17 00:01:00 +00:00
parent aa47d077c1
commit 80d1fbac43
2 changed files with 16 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2007-12-17 Edward Hervey <edward.hervey@collabora.co.uk>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps):
Yet another fix for broken software that produce files with an empty
blockalign field. Instead of completely failing, make a second attempt
at guessing the width/depth by looking at strf->size.
2007-12-16 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_do_seek),

View file

@ -859,14 +859,21 @@ gst_riff_create_audio_caps (guint16 codec_id,
if (strf != NULL) {
gint ba = strf->blockalign;
gint ch = strf->channels;
gint wd = ba * 8 / ch;
gint ws;
gint wd, ws;
/* If we have an empty blockalign, we take the width contained in
* strf->size */
if (ba != 0)
wd = ba * 8 / ch;
else
wd = strf->size;
if (strf->size > 32) {
GST_WARNING ("invalid depth (%d) of pcm audio, overwriting.",
strf->size);
strf->size = 8 * ((wd + 7) / 8);
}
/* in riff, the depth is stored in the size field but it just means that
* the _least_ significant bits are cleared. We can therefore just play
* the sample as if it had a depth == width */