diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-03-22 18:44:15 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-03-22 18:44:15 +0000 |
commit | 395281c7a090bebaa3a27b112bd526cf8b42a788 (patch) | |
tree | 575984977abbc0496757b050eebbb0ec00d7adcc /src/mp4_decode.c | |
parent | 80e0fec6835f15e6a81ca1dd24db726c503a56be (diff) | |
download | mpd-395281c7a090bebaa3a27b112bd526cf8b42a788.tar.gz mpd-395281c7a090bebaa3a27b112bd526cf8b42a788.tar.xz mpd-395281c7a090bebaa3a27b112bd526cf8b42a788.zip |
fix error reporting for mp4 files
git-svn-id: https://svn.musicpd.org/mpd/trunk@370 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/mp4_decode.c')
-rw-r--r-- | src/mp4_decode.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mp4_decode.c b/src/mp4_decode.c index e9e3d22eb..6ecce1853 100644 --- a/src/mp4_decode.c +++ b/src/mp4_decode.c @@ -223,15 +223,6 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) { sampleBuffer = faacDecDecode(decoder,&frameInfo,mp4Buffer, mp4BufferSize); - if(dc->start) { - channels = frameInfo.channels; - scale = frameInfo.samplerate; - af->channels = frameInfo.channels; - af->sampleRate = frameInfo.samplerate; - dc->state = DECODE_STATE_DECODE; - dc->start = 0; - } - if(mp4Buffer) free(mp4Buffer); if(frameInfo.error > 0) { ERROR("error decoding MP4 file: %s\n",dc->file); @@ -241,6 +232,15 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) { break; } + if(dc->start) { + channels = frameInfo.channels; + scale = frameInfo.samplerate; + af->channels = frameInfo.channels; + af->sampleRate = frameInfo.samplerate; + dc->state = DECODE_STATE_DECODE; + dc->start = 0; + } + if(channels*(dur+offset) > frameInfo.samples) { dur = frameInfo.samples/channels; offset = 0; |