[Ffmpeg-devel] Bug: wav decoder decodes garbage at end of file
Ulrich von Zadow
coder
Tue Jun 27 10:39:54 CEST 2006
Michael Niedermayer wrote:
> well, i see no reason to ignore the data after the first chunk, whatever
> it might be, if for example theres more audio data then the current code
> will besides some "click" sound play it fine while your solution will
> truncate the file
> so no, i will not accpet anything but the correct solution, even if that
> means no patch
Fair enough, I'll try. You do realize, though, that this code will be completely
untested unless someone finds a real-world wav file with more than one WAVE chunk?
Right now, this is my idea of an implementation:
- Define a WAVContext struct in wav.c that contains a single member
wave_chunk_len.
- Change wav_iformat so memory for the WAVContext is allocated.
- In wav_read_header, set wave_chunk_len
- In wav_read_packet, compare s->data_offset+wave_chunk_len to url_ftell() to
determine how many bytes are left to read. If none are left, use find_tag to
skip to the next WAVE chunk and continue reading there. If find_tag doesn't
find another WAVE chunk, it'll return -1 and set the eof flag, so reading will
terminate.
Cheers,
Uli
More information about the ffmpeg-devel
mailing list