aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-03-19 01:24:20 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-03-19 01:24:20 +0000
commitcbfcd23d83f34c13add74e4f593c170a3afc62f1 (patch)
tree909d3e1d183f47bb26e451a5ffaa5e31ad314a5f
parentb87cc3c164e227fb72621b61034dea232b863cb3 (diff)
downloadmpd-cbfcd23d83f34c13add74e4f593c170a3afc62f1.tar.gz
mpd-cbfcd23d83f34c13add74e4f593c170a3afc62f1.tar.xz
mpd-cbfcd23d83f34c13add74e4f593c170a3afc62f1.zip
fix bug that prevented crosffading/gapless from working for mp4
git-svn-id: https://svn.musicpd.org/mpd/trunk@282 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/mp4_decode.c60
-rw-r--r--src/player.c5
2 files changed, 32 insertions, 33 deletions
diff --git a/src/mp4_decode.c b/src/mp4_decode.c
index 66505a38d..efe3d0527 100644
--- a/src/mp4_decode.c
+++ b/src/mp4_decode.c
@@ -186,10 +186,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
time = seekTable[sampleId];
}
- if((dur=mp4ff_get_sample_duration(mp4fh,track,sampleId))==0) {
- eof = 1;
- break;
- }
+ dur = mp4ff_get_sample_duration(mp4fh,track,sampleId);
if(sampleId>seekTableEnd) {
seekTable[sampleId] = time;
@@ -215,7 +212,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
&mp4BufferSize) == 0)
{
eof = 1;
- break;
+ continue;
}
sampleBuffer = faacDecDecode(decoder,&frameInfo,mp4Buffer,
@@ -238,33 +235,30 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
{
usleep(10000);
}
- if(dc->stop) {
- eof = 1;
- break;
- }
- else if(dc->seek) break;
-
- sampleBufferLen-=size;
- memcpy(cb->chunks+cb->end*CHUNK_SIZE+chunkLen,
- sampleBuffer,size);
- cb->times[cb->end] = time;
- sampleBuffer+=size;
- chunkLen+=size;
- if(chunkLen>=CHUNK_SIZE) {
- cb->chunkSize[cb->end] = CHUNK_SIZE;
- ++cb->end;
-
- if(cb->end>=buffered_chunks) {
- cb->end = 0;
- cb->wrap = 1;
+ if(dc->stop) eof = 1;
+ else if(!dc->seek) {
+ sampleBufferLen-=size;
+ memcpy(cb->chunks+cb->end*CHUNK_SIZE+chunkLen,
+ sampleBuffer,size);
+ cb->times[cb->end] = time;
+ sampleBuffer+=size;
+ chunkLen+=size;
+ if(chunkLen>=CHUNK_SIZE) {
+ cb->chunkSize[cb->end] = CHUNK_SIZE;
+ ++cb->end;
+
+ if(cb->end>=buffered_chunks) {
+ cb->end = 0;
+ cb->wrap = 1;
+ }
+ chunkLen = 0;
}
- chunkLen = 0;
}
}
}
- if(!dc->stop && !dc->seek && chunkLen) {
- cb->chunkSize[cb->end] = CHUNK_SIZE;
+ if(!dc->stop && !dc->seek && chunkLen>0) {
+ cb->chunkSize[cb->end] = chunkLen;
++cb->end;
if(cb->end>=buffered_chunks) {
@@ -274,6 +268,12 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
chunkLen = 0;
}
+ free(seekTable);
+ faacDecClose(decoder);
+ mp4ff_close(mp4fh);
+ fclose(fh);
+ free(mp4cb);
+
if(dc->seek) dc->seek = 0;
if(dc->stop) {
@@ -282,12 +282,6 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
}
else dc->state = DECODE_STATE_STOP;
- free(seekTable);
- faacDecClose(decoder);
- mp4ff_close(mp4fh);
- fclose(fh);
- free(mp4cb);
-
return 0;
}
diff --git a/src/player.c b/src/player.c
index fc906d1eb..d6a79b74a 100644
--- a/src/player.c
+++ b/src/player.c
@@ -335,6 +335,11 @@ int queueSong(char * utf8file) {
pc->decodeType = DECODE_TYPE_AUDIOFILE;
}
#endif
+#ifdef HAVE_AUDIOFILE
+ else if(isMp4(utf8file,NULL)) {
+ pc->decodeType = DECODE_TYPE_MP4;
+ }
+#endif
else return -1;
pc->queueState = PLAYER_QUEUE_FULL;
return 0;