From 80d1fbac43f678ce5752a91daf3a4ea5a4db443d Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 17 Dec 2007 00:01:00 +0000 Subject: [PATCH] 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. --- ChangeLog | 7 +++++++ gst-libs/gst/riff/riff-media.c | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1096fd84a..a717b8c6ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-12-17 Edward Hervey + + * 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 * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_do_seek), diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c index 6abea70cdf..d39e4dc11b 100644 --- a/gst-libs/gst/riff/riff-media.c +++ b/gst-libs/gst/riff/riff-media.c @@ -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 */