1
0
Fork 0
forked from len0rd/rockbox

Implement time-based resume and playback start.

This complements offset-based resume and playback start funcionality.
The implementation is global on both HWCODEC and SWCODEC.

Basically, if either the specified elapsed or offset are non-zero,
it indicates a mid-track resume.

To resume by time only, set elapsed to nonzero and offset to zero.
To resume by offset only, set offset to nonzero and elapsed to zero.

Which one the codec uses and which has priority is up to the codec;
however, using an elapsed time covers more cases:

* Codecs not able to use an offset such as VGM or other atomic
formats

* Starting playback at a nonzero elapsed time from a source that
contains no offset, such as a cuesheet

The change re-versions pretty much everything from tagcache to nvram.

Change-Id: Ic7aebb24e99a03ae99585c5e236eba960d163f38
Reviewed-on: http://gerrit.rockbox.org/516
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
This commit is contained in:
Michael Sevakis 2013-07-14 07:59:39 -04:00
parent dda54b85da
commit 31b7122867
65 changed files with 724 additions and 297 deletions

View file

@ -56,14 +56,16 @@ enum codec_status codec_run(void)
uint32_t packet_count;
int scrambling_unit_size, num_units;
size_t resume_offset;
intptr_t param = 0;
enum codec_command_action action = CODEC_ACTION_NULL;
intptr_t param;
enum codec_command_action action;
if (codec_init()) {
DEBUGF("codec init failed\n");
return CODEC_ERROR;
}
action = CODEC_ACTION_NULL;
param = ci->id3->elapsed;
resume_offset = ci->id3->offset;
codec_set_replaygain(ci->id3);
@ -97,12 +99,15 @@ enum codec_status codec_run(void)
}
/* check for a mid-track resume and force a seek time accordingly */
if(resume_offset > rmctx.data_offset + DATA_HEADER_SIZE) {
resume_offset -= rmctx.data_offset + DATA_HEADER_SIZE;
if(resume_offset) {
resume_offset -= MIN(resume_offset, rmctx.data_offset + DATA_HEADER_SIZE);
num_units = (int)resume_offset / scrambling_unit_size;
/* put number of subpackets to skip in resume_offset */
resume_offset /= (sps + PACKET_HEADER_SIZE);
param = (int)resume_offset * ((sps * 8 * 1000)/rmctx.bit_rate);
}
if (param) {
action = CODEC_ACTION_SEEK_TIME;
}
else {