mpegplayer: Hopefully help some problems on dual core. Make USB mode exit correctly.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13109 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2007-04-11 11:02:45 +00:00
parent 7c4b786851
commit dfa9f44034
2 changed files with 22 additions and 22 deletions

View file

@ -40,7 +40,7 @@ bool mpeg_menu(void)
{ "Skip frames", NULL }, { "Skip frames", NULL },
{ "Quit mpegplayer", NULL }, { "Quit mpegplayer", NULL },
}; };
m = rb->menu_init(items, sizeof(items) / sizeof(*items), m = rb->menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL);
@ -52,19 +52,21 @@ bool mpeg_menu(void)
switch(result) switch(result)
{ {
case 0: /* Show FPS */ case 0: /* Show FPS */
rb->set_option("Display FPS",&settings.showfps,INT, rb->set_option("Display FPS",&settings.showfps,INT,
noyes, 2, NULL); noyes, 2, NULL);
break; break;
case 1: /* Limit FPS */ case 1: /* Limit FPS */
rb->set_option("Limit FPS",&settings.limitfps,INT, rb->set_option("Limit FPS",&settings.limitfps,INT,
noyes, 2, NULL); noyes, 2, NULL);
break; break;
case 2: /* Skip frames */ case 2: /* Skip frames */
rb->set_option("Skip frames",&settings.skipframes,INT, rb->set_option("Skip frames",&settings.skipframes,INT,
noyes, 2, NULL); noyes, 2, NULL);
break; break;
default: default:
menu_quit=1; menu_quit=1;
if (result == MENU_ATTACHED_USB)
result = 3;
break; break;
} }
} }
@ -99,7 +101,7 @@ void init_settings(void)
SETTINGS_VERSION); SETTINGS_VERSION);
} }
/* Keep a copy of the saved version of the settings - so we can check if /* Keep a copy of the saved version of the settings - so we can check if
the settings have changed when we quit */ the settings have changed when we quit */
old_settings = settings; old_settings = settings;
} }

View file

@ -929,7 +929,6 @@ static inline int32_t clip_sample(int32_t sample)
return sample; return sample;
} }
static void audio_thread(void) __attribute__((noreturn));
static void audio_thread(void) static void audio_thread(void)
{ {
uint8_t *mpabuf = mpa_buffer; uint8_t *mpabuf = mpa_buffer;
@ -1197,12 +1196,10 @@ done:
rb->sleep(HZ/4); rb->sleep(HZ/4);
} }
/* Don't really terminate but just signal that it's ok for this thread pcm_playback_stop();
to be killed */
audiostatus = THREAD_TERMINATED;
while (1) audiostatus = THREAD_TERMINATED;
rb->yield(); rb->remove_thread(NULL);
} }
/* End of libmad stuff */ /* End of libmad stuff */
@ -1744,20 +1741,21 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#endif #endif
/* Stop the threads and wait for them to terminate */ /* Stop the threads and wait for them to terminate */
if (audiothread_id != NULL) if (videostatus != THREAD_TERMINATED)
audiostatus = PLEASE_STOP; {
if (videothread_id != NULL)
videostatus = PLEASE_STOP; videostatus = PLEASE_STOP;
while (videostatus != THREAD_TERMINATED)
rb->yield();
}
while (audiostatus != THREAD_TERMINATED || if (audiostatus != THREAD_TERMINATED)
videostatus != THREAD_TERMINATED) {
rb->yield(); audiostatus = PLEASE_STOP;
while (audiostatus != THREAD_TERMINATED)
rb->yield();
}
if (audiothread_id != NULL) rb->sleep(HZ/10);
rb->remove_thread(audiothread_id);
pcm_playback_stop();
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->lcd_update(); rb->lcd_update();