[MPlayer-dev-eng] [PATCH] demux_audio - be stricter when recognizing WAV format
Daniel Verkamp
daniel at drv.nu
Wed Sep 9 00:23:59 CEST 2009
Hi,
Currently, demux_audio picks up Sony Wave64 files as plain WAV due to
the fmt chunk being recognized. The attached patch adds an extra
check so that the RIFF and WAVE chunks must be seen first to recognize
a fmt chunk as indicating a WAV-format file. This allows W64 files to
fall through to lavf.
Thanks,
-- Daniel Verkamp
-------------- next part --------------
Index: libmpdemux/demux_audio.c
===================================================================
--- libmpdemux/demux_audio.c (revision 29664)
+++ libmpdemux/demux_audio.c (working copy)
@@ -268,6 +268,7 @@
// mp3_hdrs list is sorted first by next_frame_pos and then by frame_pos
mp3_hdr_t *mp3_hdrs = NULL, *mp3_found = NULL;
da_priv_t* priv;
+ int wave_found = 0;
s = demuxer->stream;
@@ -286,10 +287,12 @@
break;
if(hdr[0] != 'W' || hdr[1] != 'A' || hdr[2] != 'V' || hdr[3] != 'E' )
stream_skip(s,-8);
- else
+ else {
// We found wav header. Now we can have 'fmt ' or a mp3 header
// empty the buffer
step = 4;
+ wave_found = 1;
+ }
} else if( hdr[0] == 'I' && hdr[1] == 'D' && hdr[2] == '3' && (hdr[3] >= 2)) {
int len;
stream_skip(s,2);
@@ -298,8 +301,10 @@
stream_skip(s,len);
step = 4;
} else if( hdr[0] == 'f' && hdr[1] == 'm' && hdr[2] == 't' && hdr[3] == ' ' ) {
+ if (wave_found) {
frmt = WAV;
break;
+ }
} else if((mp3_flen = mp_get_mp3_header(hdr, &mp3_chans, &mp3_freq,
&mpa_spf, &mpa_layer, &mpa_br)) > 0) {
mp3_found = add_mp3_hdr(&mp3_hdrs, st_pos, mp3_chans, mp3_freq,
More information about the MPlayer-dev-eng
mailing list