summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2007-06-19 21:29:34 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2007-06-19 21:29:34 +0000
commit95d414542c434043afbba51a566ebe66fc39949c (patch)
tree3f0eb088b4455fef1080af43bb6008c680516e31 /apps/plugins/mpegplayer
parent8dc1a67bbafc80f07ce2c8926e751c499427b4da (diff)
move button_loop to prepare for the next commit
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13677 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer')
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c214
1 files changed, 107 insertions, 107 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 881baa925e..4618706210 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -283,113 +283,6 @@ volatile int videostatus IBSS_ATTR;
static void pcm_playback_play_pause(bool play);
-static void button_loop(void)
-{
- bool result;
- int vol, minvol, maxvol;
- int button = rb->button_get(false);
-
- switch (button)
- {
- case MPEG_VOLUP:
- case MPEG_VOLUP|BUTTON_REPEAT:
-#ifdef MPEG_VOLUP2
- case MPEG_VOLUP2:
- case MPEG_VOLUP2|BUTTON_REPEAT:
-#endif
- vol = rb->global_settings->volume;
- maxvol = rb->sound_max(SOUND_VOLUME);
-
- if (vol < maxvol) {
- vol++;
- rb->sound_set(SOUND_VOLUME, vol);
- rb->global_settings->volume = vol;
- }
- break;
-
- case MPEG_VOLDOWN:
- case MPEG_VOLDOWN|BUTTON_REPEAT:
-#ifdef MPEG_VOLDOWN2
- case MPEG_VOLDOWN2:
- case MPEG_VOLDOWN2|BUTTON_REPEAT:
-#endif
- vol = rb->global_settings->volume;
- minvol = rb->sound_min(SOUND_VOLUME);
-
- if (vol > minvol) {
- vol--;
- rb->sound_set(SOUND_VOLUME, vol);
- rb->global_settings->volume = vol;
- }
- break;
-
- case MPEG_MENU:
- pcm_playback_play_pause(false);
- if (videostatus != STREAM_DONE) {
- videostatus=PLEASE_PAUSE;
-
- /* Wait for video thread to stop */
- while (videostatus == PLEASE_PAUSE) { rb->sleep(HZ/25); }
- }
-
-#ifndef HAVE_LCD_COLOR
- gray_show(false);
-#endif
- result = mpeg_menu();
-
-#ifndef HAVE_LCD_COLOR
- gray_show(true);
-#endif
-
- /* The menu can change the font, so restore */
- rb->lcd_setfont(FONT_SYSFIXED);
-
- if (result) {
- audiostatus = PLEASE_STOP;
- if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP;
- } else {
- if (videostatus != STREAM_DONE) videostatus = STREAM_PLAYING;
- pcm_playback_play_pause(true);
- }
- break;
-
- case MPEG_STOP:
- audiostatus = PLEASE_STOP;
- if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP;
- break;
-
- case MPEG_PAUSE:
- if (videostatus != STREAM_DONE) videostatus=PLEASE_PAUSE;
- pcm_playback_play_pause(false);
-
- button = BUTTON_NONE;
-#ifdef HAVE_ADJUSTABLE_CPU_FREQ
- rb->cpu_boost(false);
-#endif
- do {
- button = rb->button_get(true);
- if (button == MPEG_STOP) {
- audiostatus = PLEASE_STOP;
- if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP;
- return;
- }
- } while (button != MPEG_PAUSE);
-
- if (videostatus != STREAM_DONE) videostatus = STREAM_PLAYING;
- pcm_playback_play_pause(true);
-#ifdef HAVE_ADJUSTABLE_CPU_FREQ
- rb->cpu_boost(true);
-#endif
- break;
-
- default:
- if(rb->default_event_handler(button) == SYS_USB_CONNECTED) {
- audiostatus = PLEASE_STOP;
- if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP;
- }
- }
-}
-
/* libmad related functions/definitions */
#define INPUT_CHUNK_SIZE 8192
@@ -960,6 +853,113 @@ static inline int32_t clip_sample(int32_t sample)
return sample;
}
+static void button_loop(void)
+{
+ bool result;
+ int vol, minvol, maxvol;
+ int button = rb->button_get(false);
+
+ switch (button)
+ {
+ case MPEG_VOLUP:
+ case MPEG_VOLUP|BUTTON_REPEAT:
+#ifdef MPEG_VOLUP2
+ case MPEG_VOLUP2:
+ case MPEG_VOLUP2|BUTTON_REPEAT:
+#endif
+ vol = rb->global_settings->volume;
+ maxvol = rb->sound_max(SOUND_VOLUME);
+
+ if (vol < maxvol) {
+ vol++;
+ rb->sound_set(SOUND_VOLUME, vol);
+ rb->global_settings->volume = vol;
+ }
+ break;
+
+ case MPEG_VOLDOWN:
+ case MPEG_VOLDOWN|BUTTON_REPEAT:
+#ifdef MPEG_VOLDOWN2
+ case MPEG_VOLDOWN2:
+ case MPEG_VOLDOWN2|BUTTON_REPEAT:
+#endif
+ vol = rb->global_settings->volume;
+ minvol = rb->sound_min(SOUND_VOLUME);
+
+ if (vol > minvol) {
+ vol--;
+ rb->sound_set(SOUND_VOLUME, vol);
+ rb->global_settings->volume = vol;
+ }
+ break;
+
+ case MPEG_MENU:
+ pcm_playback_play_pause(false);
+ if (videostatus != STREAM_DONE) {
+ videostatus=PLEASE_PAUSE;
+
+ /* Wait for video thread to stop */
+ while (videostatus == PLEASE_PAUSE) { rb->sleep(HZ/25); }
+ }
+
+#ifndef HAVE_LCD_COLOR
+ gray_show(false);
+#endif
+ result = mpeg_menu();
+
+#ifndef HAVE_LCD_COLOR
+ gray_show(true);
+#endif
+
+ /* The menu can change the font, so restore */
+ rb->lcd_setfont(FONT_SYSFIXED);
+
+ if (result) {
+ audiostatus = PLEASE_STOP;
+ if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP;
+ } else {
+ if (videostatus != STREAM_DONE) videostatus = STREAM_PLAYING;
+ pcm_playback_play_pause(true);
+ }
+ break;
+
+ case MPEG_STOP:
+ audiostatus = PLEASE_STOP;
+ if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP;
+ break;
+
+ case MPEG_PAUSE:
+ if (videostatus != STREAM_DONE) videostatus=PLEASE_PAUSE;
+ pcm_playback_play_pause(false);
+
+ button = BUTTON_NONE;
+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
+ rb->cpu_boost(false);
+#endif
+ do {
+ button = rb->button_get(true);
+ if (button == MPEG_STOP) {
+ audiostatus = PLEASE_STOP;
+ if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP;
+ return;
+ }
+ } while (button != MPEG_PAUSE);
+
+ if (videostatus != STREAM_DONE) videostatus = STREAM_PLAYING;
+ pcm_playback_play_pause(true);
+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
+ rb->cpu_boost(true);
+#endif
+ break;
+
+ default:
+ if(rb->default_event_handler(button) == SYS_USB_CONNECTED) {
+ audiostatus = PLEASE_STOP;
+ if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP;
+ }
+ }
+}
+
static void audio_thread(void)
{
uint8_t *mpabuf = mpa_buffer;