# HG changeset patch # User reimar # Date 1321032554 0 # Node ID 1802d9d74c26358b8624ec372c7544ff530b903a # Parent f4c0388ddc74015450d01edcc459b25ad0d3294c Make WAV format detection more restrictive so it does not incorrectly grab qcp files. diff -r f4c0388ddc74 -r 1802d9d74c26 libmpdemux/demux_audio.c --- a/libmpdemux/demux_audio.c Fri Nov 11 17:15:13 2011 +0000 +++ b/libmpdemux/demux_audio.c Fri Nov 11 17:29:14 2011 +0000 @@ -333,6 +333,7 @@ mp3_hdr_t *mp3_hdrs = NULL, *mp3_found = NULL; da_priv_t* priv; double duration; + int found_WAVE = 0; s = demuxer->stream; @@ -362,7 +363,7 @@ len = (hdr[0]<<21) | (hdr[1]<<14) | (hdr[2]<<7) | hdr[3]; stream_skip(s,len); step = 4; - } else if( hdr[0] == 'f' && hdr[1] == 'm' && hdr[2] == 't' && hdr[3] == ' ' ) { + } else if( found_WAVE && hdr[0] == 'f' && hdr[1] == 'm' && hdr[2] == 't' && hdr[3] == ' ' ) { frmt = WAV; break; } else if((mp3_flen = mp_get_mp3_header(hdr, &mp3_chans, &mp3_freq, @@ -378,6 +379,7 @@ if (!mp3_hdrs || mp3_hdrs->cons_hdrs < 3) break; } + found_WAVE = hdr[0] == 'W' && hdr[1] == 'A' && hdr[2] == 'V' && hdr[3] == 'E'; // Add here some other audio format detection if(step < HDR_SIZE) memmove(hdr,&hdr[step],HDR_SIZE-step);