mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
test_codec: Allow user to abort tests using target-defined TESTCODEC_EXITBUTTON.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29881 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7b3e05b346
commit
c949d69f4b
1 changed files with 22 additions and 5 deletions
|
@ -135,6 +135,7 @@ static uint32_t crc32;
|
||||||
|
|
||||||
static volatile unsigned int elapsed;
|
static volatile unsigned int elapsed;
|
||||||
static volatile bool codec_playing;
|
static volatile bool codec_playing;
|
||||||
|
static volatile enum codec_command_action codec_action;
|
||||||
static volatile long endtick;
|
static volatile long endtick;
|
||||||
static volatile long rebuffertick;
|
static volatile long rebuffertick;
|
||||||
struct wavinfo_t wavinfo;
|
struct wavinfo_t wavinfo;
|
||||||
|
@ -504,7 +505,7 @@ static void seek_complete(void)
|
||||||
static enum codec_command_action get_command(intptr_t *param)
|
static enum codec_command_action get_command(intptr_t *param)
|
||||||
{
|
{
|
||||||
rb->yield();
|
rb->yield();
|
||||||
return CODEC_ACTION_NULL; /* just continue processing */
|
return codec_action;
|
||||||
(void)param;
|
(void)param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,13 +719,19 @@ static enum plugin_status test_track(const char* filename)
|
||||||
starttick = *rb->current_tick;
|
starttick = *rb->current_tick;
|
||||||
|
|
||||||
codec_playing = true;
|
codec_playing = true;
|
||||||
|
codec_action = CODEC_ACTION_NULL;
|
||||||
|
|
||||||
rb->codec_thread_do_callback(codec_thread, NULL);
|
rb->codec_thread_do_callback(codec_thread, NULL);
|
||||||
|
|
||||||
/* Wait for codec thread to die */
|
/* Wait for codec thread to die */
|
||||||
while (codec_playing)
|
while (codec_playing)
|
||||||
{
|
{
|
||||||
rb->sleep(HZ);
|
if (rb->button_get_w_tmo(HZ) == TESTCODEC_EXITBUTTON)
|
||||||
|
{
|
||||||
|
codec_action = CODEC_ACTION_HALT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
rb->snprintf(str,sizeof(str),"%d of %d",elapsed,(int)track.id3.length);
|
rb->snprintf(str,sizeof(str),"%d of %d",elapsed,(int)track.id3.length);
|
||||||
log_text(str,false);
|
log_text(str,false);
|
||||||
}
|
}
|
||||||
|
@ -735,7 +742,11 @@ static enum plugin_status test_track(const char* filename)
|
||||||
rb->backlight_on();
|
rb->backlight_on();
|
||||||
log_text(str,true);
|
log_text(str,true);
|
||||||
|
|
||||||
if (checksum)
|
if (codec_action == CODEC_ACTION_HALT)
|
||||||
|
{
|
||||||
|
/* User aborted test */
|
||||||
|
}
|
||||||
|
else if (checksum)
|
||||||
{
|
{
|
||||||
rb->snprintf(str, sizeof(str), "CRC32 - %08x", (unsigned)crc32);
|
rb->snprintf(str, sizeof(str), "CRC32 - %08x", (unsigned)crc32);
|
||||||
log_text(str,true);
|
log_text(str,true);
|
||||||
|
@ -940,6 +951,10 @@ menu:
|
||||||
if (!(info.attribute & ATTR_DIRECTORY)) {
|
if (!(info.attribute & ATTR_DIRECTORY)) {
|
||||||
rb->snprintf(filename,sizeof(filename),"%s%s",dirpath,entry->d_name);
|
rb->snprintf(filename,sizeof(filename),"%s%s",dirpath,entry->d_name);
|
||||||
test_track(filename);
|
test_track(filename);
|
||||||
|
|
||||||
|
if (codec_action == CODEC_ACTION_HALT)
|
||||||
|
break;
|
||||||
|
|
||||||
log_text("", true);
|
log_text("", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -958,7 +973,9 @@ menu:
|
||||||
close_wav();
|
close_wav();
|
||||||
log_text("Wrote /test.wav",true);
|
log_text("Wrote /test.wav",true);
|
||||||
}
|
}
|
||||||
while (rb->button_get(true) != TESTCODEC_EXITBUTTON);
|
|
||||||
|
while (codec_action != CODEC_ACTION_HALT &&
|
||||||
|
rb->button_get(true) != TESTCODEC_EXITBUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue