From 61b9e2fc478f11aa4fe54ca7fe6995b145e0fa63 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Sat, 20 Mar 2004 00:54:20 +0000 Subject: use offset, and a bunch of debugger crud git-svn-id: https://svn.musicpd.org/mpd/trunk@318 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/mp4_decode.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mp4_decode.c b/src/mp4_decode.c index 71df9daa7..16821b179 100644 --- a/src/mp4_decode.c +++ b/src/mp4_decode.c @@ -97,6 +97,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) { float * seekTable; long seekTableEnd = -1; int seekPositionFound = 0; + long offset; fh = fopen(dc->file,"r"); if(!fh) { @@ -187,6 +188,8 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) { } dur = mp4ff_get_sample_duration(mp4fh,track,sampleId); + offset = mp4ff_get_sample_offset(mp4fh,track,sampleId); + dur-=offset; if(sampleId>seekTableEnd) { seekTable[sampleId] = time; @@ -222,6 +225,11 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) { if(sampleCount>0) initial =0; sampleBufferLen = sampleCount*2; + + sampleBuffer+=offset*channels*2; + + printf("dur=%li offset=%li frameInfo.samples=%li\n",dur,offset, + frameInfo.samples); while(sampleBufferLen>0 && !dc->seek) { size_t size = sampleBufferLen>CHUNK_SIZE-chunkLen ? -- cgit v1.2.3