summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-04-11 11:02:45 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-04-11 11:02:45 +0000
commitdfa9f440349d7532423373b2bac5993ee5e958a9 (patch)
tree1bdd5c62fbb48995948b24fdb939482a28399001 /apps/plugins/mpegplayer
parent7c4b786851ec90364c0335b46d093fb6dba1af01 (diff)
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
Diffstat (limited to 'apps/plugins/mpegplayer')
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c12
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c32
2 files changed, 22 insertions, 22 deletions
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index bf0b3d5a0c..c692edf861 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -40,7 +40,7 @@ bool mpeg_menu(void)
{ "Skip frames", NULL },
{ "Quit mpegplayer", NULL },
};
-
+
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
@@ -52,19 +52,21 @@ bool mpeg_menu(void)
switch(result)
{
case 0: /* Show FPS */
- rb->set_option("Display FPS",&settings.showfps,INT,
+ rb->set_option("Display FPS",&settings.showfps,INT,
noyes, 2, NULL);
break;
case 1: /* Limit FPS */
- rb->set_option("Limit FPS",&settings.limitfps,INT,
+ rb->set_option("Limit FPS",&settings.limitfps,INT,
noyes, 2, NULL);
break;
case 2: /* Skip frames */
- rb->set_option("Skip frames",&settings.skipframes,INT,
+ rb->set_option("Skip frames",&settings.skipframes,INT,
noyes, 2, NULL);
break;
default:
menu_quit=1;
+ if (result == MENU_ATTACHED_USB)
+ result = 3;
break;
}
}
@@ -99,7 +101,7 @@ void init_settings(void)
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 */
old_settings = settings;
}
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index b39f318ec3..440bbd721d 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -929,7 +929,6 @@ static inline int32_t clip_sample(int32_t sample)
return sample;
}
-static void audio_thread(void) __attribute__((noreturn));
static void audio_thread(void)
{
uint8_t *mpabuf = mpa_buffer;
@@ -1197,12 +1196,10 @@ done:
rb->sleep(HZ/4);
}
- /* Don't really terminate but just signal that it's ok for this thread
- to be killed */
- audiostatus = THREAD_TERMINATED;
+ pcm_playback_stop();
- while (1)
- rb->yield();
+ audiostatus = THREAD_TERMINATED;
+ rb->remove_thread(NULL);
}
/* End of libmad stuff */
@@ -1744,20 +1741,21 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#endif
/* Stop the threads and wait for them to terminate */
- if (audiothread_id != NULL)
- audiostatus = PLEASE_STOP;
-
- if (videothread_id != NULL)
+ if (videostatus != THREAD_TERMINATED)
+ {
videostatus = PLEASE_STOP;
+ while (videostatus != THREAD_TERMINATED)
+ rb->yield();
+ }
- while (audiostatus != THREAD_TERMINATED ||
- videostatus != THREAD_TERMINATED)
- rb->yield();
-
- if (audiothread_id != NULL)
- rb->remove_thread(audiothread_id);
+ if (audiostatus != THREAD_TERMINATED)
+ {
+ audiostatus = PLEASE_STOP;
+ while (audiostatus != THREAD_TERMINATED)
+ rb->yield();
+ }
- pcm_playback_stop();
+ rb->sleep(HZ/10);
rb->lcd_clear_display();
rb->lcd_update();