[Ffmpeg-devel] Bug: wav decoder decodes garbage at end of file
Michael Niedermayer
michaelni
Tue Jun 27 15:50:08 CEST 2006
Hi
On Tue, Jun 27, 2006 at 10:39:54AM +0200, Ulrich von Zadow wrote:
> 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?
cat wave1.wav wave2.wav > doublewave.wav :)
>
> 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.
you will have too set wave_chunk_len or better wave_chunk_end too if another
wave chunk is found
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is
More information about the ffmpeg-devel
mailing list