summaryrefslogtreecommitdiff
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
parent7c4b786851ec90364c0335b46d093fb6dba1af01 (diff)
downloadrockbox-dfa9f440349d7532423373b2bac5993ee5e958a9.tar.gz
rockbox-dfa9f440349d7532423373b2bac5993ee5e958a9.zip
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
-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)
40 { "Skip frames", NULL }, 40 { "Skip frames", NULL },
41 { "Quit mpegplayer", NULL }, 41 { "Quit mpegplayer", NULL },
42 }; 42 };
43 43
44 m = rb->menu_init(items, sizeof(items) / sizeof(*items), 44 m = rb->menu_init(items, sizeof(items) / sizeof(*items),
45 NULL, NULL, NULL, NULL); 45 NULL, NULL, NULL, NULL);
46 46
@@ -52,19 +52,21 @@ bool mpeg_menu(void)
52 switch(result) 52 switch(result)
53 { 53 {
54 case 0: /* Show FPS */ 54 case 0: /* Show FPS */
55 rb->set_option("Display FPS",&settings.showfps,INT, 55 rb->set_option("Display FPS",&settings.showfps,INT,
56 noyes, 2, NULL); 56 noyes, 2, NULL);
57 break; 57 break;
58 case 1: /* Limit FPS */ 58 case 1: /* Limit FPS */
59 rb->set_option("Limit FPS",&settings.limitfps,INT, 59 rb->set_option("Limit FPS",&settings.limitfps,INT,
60 noyes, 2, NULL); 60 noyes, 2, NULL);
61 break; 61 break;
62 case 2: /* Skip frames */ 62 case 2: /* Skip frames */
63 rb->set_option("Skip frames",&settings.skipframes,INT, 63 rb->set_option("Skip frames",&settings.skipframes,INT,
64 noyes, 2, NULL); 64 noyes, 2, NULL);
65 break; 65 break;
66 default: 66 default:
67 menu_quit=1; 67 menu_quit=1;
68 if (result == MENU_ATTACHED_USB)
69 result = 3;
68 break; 70 break;
69 } 71 }
70 } 72 }
@@ -99,7 +101,7 @@ void init_settings(void)
99 SETTINGS_VERSION); 101 SETTINGS_VERSION);
100 } 102 }
101 103
102 /* Keep a copy of the saved version of the settings - so we can check if 104 /* Keep a copy of the saved version of the settings - so we can check if
103 the settings have changed when we quit */ 105 the settings have changed when we quit */
104 old_settings = settings; 106 old_settings = settings;
105} 107}
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)
929 return sample; 929 return sample;
930} 930}
931 931
932static void audio_thread(void) __attribute__((noreturn));
933static void audio_thread(void) 932static void audio_thread(void)
934{ 933{
935 uint8_t *mpabuf = mpa_buffer; 934 uint8_t *mpabuf = mpa_buffer;
@@ -1197,12 +1196,10 @@ done:
1197 rb->sleep(HZ/4); 1196 rb->sleep(HZ/4);
1198 } 1197 }
1199 1198
1200 /* Don't really terminate but just signal that it's ok for this thread 1199 pcm_playback_stop();
1201 to be killed */
1202 audiostatus = THREAD_TERMINATED;
1203 1200
1204 while (1) 1201 audiostatus = THREAD_TERMINATED;
1205 rb->yield(); 1202 rb->remove_thread(NULL);
1206} 1203}
1207 1204
1208/* End of libmad stuff */ 1205/* End of libmad stuff */
@@ -1744,20 +1741,21 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1744#endif 1741#endif
1745 1742
1746 /* Stop the threads and wait for them to terminate */ 1743 /* Stop the threads and wait for them to terminate */
1747 if (audiothread_id != NULL) 1744 if (videostatus != THREAD_TERMINATED)
1748 audiostatus = PLEASE_STOP; 1745 {
1749
1750 if (videothread_id != NULL)
1751 videostatus = PLEASE_STOP; 1746 videostatus = PLEASE_STOP;
1747 while (videostatus != THREAD_TERMINATED)
1748 rb->yield();
1749 }
1752 1750
1753 while (audiostatus != THREAD_TERMINATED || 1751 if (audiostatus != THREAD_TERMINATED)
1754 videostatus != THREAD_TERMINATED) 1752 {
1755 rb->yield(); 1753 audiostatus = PLEASE_STOP;
1756 1754 while (audiostatus != THREAD_TERMINATED)
1757 if (audiothread_id != NULL) 1755 rb->yield();
1758 rb->remove_thread(audiothread_id); 1756 }
1759 1757
1760 pcm_playback_stop(); 1758 rb->sleep(HZ/10);
1761 1759
1762 rb->lcd_clear_display(); 1760 rb->lcd_clear_display();
1763 rb->lcd_update(); 1761 rb->lcd_update();