1
0
Fork 0
forked from len0rd/rockbox

Commit FS#12069 - Playback rework - first stages. Gives as thorough as possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2011-04-27 03:08:23 +00:00
parent dcf0f8de4a
commit c537d5958e
62 changed files with 6047 additions and 4221 deletions

View file

@ -1218,47 +1218,37 @@ void synthrender(int32_t *renderbuffer, int samplecount)
}
}
/* this is the codec entry point */
enum codec_status codec_main(enum codec_entry_call_reason reason)
{
if (reason == CODEC_LOAD) {
/* Make use of 44.1khz */
ci->configure(DSP_SET_FREQUENCY, 44100);
/* Sample depth is 28 bit host endian */
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
/* Stereo output */
ci->configure(DSP_SET_STEREO_MODE, STEREO_INTERLEAVED);
}
enum codec_status codec_main(void)
return CODEC_OK;
}
/* this is called for each file to process */
enum codec_status codec_run(void)
{
size_t n;
unsigned char *modfile;
int old_patterntableposition;
int bytesdone;
intptr_t param;
next_track:
if (codec_init()) {
return CODEC_ERROR;
}
if (codec_wait_taginfo() != 0)
goto request_next_track;
codec_set_replaygain(ci->id3);
/* Load MOD file */
/*
* This is the save way
size_t bytesfree;
unsigned int filesize;
p = modfile;
bytesfree=sizeof(modfile);
while ((n = ci->read_filebuf(p, bytesfree)) > 0) {
p += n;
bytesfree -= n;
if (bytesfree == 0)
return CODEC_ERROR;
}
filesize = p-modfile;
if (filesize == 0)
return CODEC_ERROR;
*/
/* Directly use mod in buffer */
ci->seek_buffer(0);
modfile = ci->request_buffer(&n, ci->filesize);
if (!modfile || n < (size_t)ci->filesize) {
@ -1268,27 +1258,22 @@ next_track:
initmodplayer();
loadmod(modfile);
/* Make use of 44.1khz */
ci->configure(DSP_SET_FREQUENCY, 44100);
/* Sample depth is 28 bit host endian */
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
/* Stereo output */
ci->configure(DSP_SET_STEREO_MODE, STEREO_INTERLEAVED);
/* The main decoder loop */
ci->set_elapsed(0);
bytesdone = 0;
old_patterntableposition = 0;
while (1) {
ci->yield();
if (ci->stop_codec || ci->new_track)
enum codec_command_action action = ci->get_command(&param);
if (action == CODEC_ACTION_HALT)
break;
if (ci->seek_time) {
/* New time is ready in ci->seek_time */
modplayer.patterntableposition = ci->seek_time/1000;
if (action == CODEC_ACTION_SEEK_TIME) {
/* New time is ready in param */
modplayer.patterntableposition = param/1000;
modplayer.currentline = 0;
ci->set_elapsed(modplayer.patterntableposition*1000+500);
ci->seek_complete();
}
@ -1305,9 +1290,5 @@ next_track:
}
request_next_track:
if (ci->request_next_track())
goto next_track;
return CODEC_OK;
}