forked from len0rd/rockbox
fix bug: WAV file playback does not resume (FS#11077)
Not only WAV but also Sun audio, SMAF, vox and WAV64 can resume. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25289 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
20fccd8489
commit
7a3822c8b0
17 changed files with 188 additions and 69 deletions
|
@ -135,6 +135,9 @@ next_track:
|
|||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
/* Need to save offset for later use (cleared indirectly by advance_buffer) */
|
||||
bytesdone = ci->id3->offset;
|
||||
|
||||
ci->memset(&format, 0, sizeof(struct pcm_format));
|
||||
format.is_signed = true;
|
||||
format.is_little_endian = false;
|
||||
|
@ -191,7 +194,6 @@ next_track:
|
|||
|
||||
decodedsamples = 0;
|
||||
codec = 0;
|
||||
bytesdone = 0;
|
||||
|
||||
/* get codec */
|
||||
codec = get_au_codec(format.formattag);
|
||||
|
@ -236,6 +238,25 @@ next_track:
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* make sure we're at the correct offset */
|
||||
if (bytesdone > (uint32_t) firstblockposn) {
|
||||
/* Round down to previous block */
|
||||
struct pcm_pos *newpos = codec->get_seek_pos(bytesdone - firstblockposn,
|
||||
PCM_SEEK_POS, NULL);
|
||||
|
||||
if (newpos->pos > format.numbytes)
|
||||
goto done;
|
||||
if (ci->seek_buffer(firstblockposn + newpos->pos))
|
||||
{
|
||||
bytesdone = newpos->pos;
|
||||
decodedsamples = newpos->samples;
|
||||
}
|
||||
ci->seek_complete();
|
||||
} else {
|
||||
/* already where we need to be */
|
||||
bytesdone = 0;
|
||||
}
|
||||
|
||||
/* The main decoder loop */
|
||||
endofstream = 0;
|
||||
|
||||
|
@ -246,8 +267,8 @@ next_track:
|
|||
}
|
||||
|
||||
if (ci->seek_time) {
|
||||
/* 2nd args(read_buffer) is unnecessary in the format which Sun Audio supports. */
|
||||
struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, NULL);
|
||||
/* 3rd args(read_buffer) is unnecessary in the format which Sun Audio supports. */
|
||||
struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, PCM_SEEK_TIME, NULL);
|
||||
|
||||
if (newpos->pos > format.numbytes)
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue