diff options
author | Marcoen Hirschberg <marcoen@gmail.com> | 2007-06-19 21:29:34 +0000 |
---|---|---|
committer | Marcoen Hirschberg <marcoen@gmail.com> | 2007-06-19 21:29:34 +0000 |
commit | 95d414542c434043afbba51a566ebe66fc39949c (patch) | |
tree | 3f0eb088b4455fef1080af43bb6008c680516e31 /apps | |
parent | 8dc1a67bbafc80f07ce2c8926e751c499427b4da (diff) | |
download | rockbox-95d414542c434043afbba51a566ebe66fc39949c.tar.gz rockbox-95d414542c434043afbba51a566ebe66fc39949c.zip |
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')
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 214 |
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; | |||
283 | 283 | ||
284 | static void pcm_playback_play_pause(bool play); | 284 | static void pcm_playback_play_pause(bool play); |
285 | 285 | ||
286 | static void button_loop(void) | ||
287 | { | ||
288 | bool result; | ||
289 | int vol, minvol, maxvol; | ||
290 | int button = rb->button_get(false); | ||
291 | |||
292 | switch (button) | ||
293 | { | ||
294 | case MPEG_VOLUP: | ||
295 | case MPEG_VOLUP|BUTTON_REPEAT: | ||
296 | #ifdef MPEG_VOLUP2 | ||
297 | case MPEG_VOLUP2: | ||
298 | case MPEG_VOLUP2|BUTTON_REPEAT: | ||
299 | #endif | ||
300 | vol = rb->global_settings->volume; | ||
301 | maxvol = rb->sound_max(SOUND_VOLUME); | ||
302 | |||
303 | if (vol < maxvol) { | ||
304 | vol++; | ||
305 | rb->sound_set(SOUND_VOLUME, vol); | ||
306 | rb->global_settings->volume = vol; | ||
307 | } | ||
308 | break; | ||
309 | |||
310 | case MPEG_VOLDOWN: | ||
311 | case MPEG_VOLDOWN|BUTTON_REPEAT: | ||
312 | #ifdef MPEG_VOLDOWN2 | ||
313 | case MPEG_VOLDOWN2: | ||
314 | case MPEG_VOLDOWN2|BUTTON_REPEAT: | ||
315 | #endif | ||
316 | vol = rb->global_settings->volume; | ||
317 | minvol = rb->sound_min(SOUND_VOLUME); | ||
318 | |||
319 | if (vol > minvol) { | ||
320 | vol--; | ||
321 | rb->sound_set(SOUND_VOLUME, vol); | ||
322 | rb->global_settings->volume = vol; | ||
323 | } | ||
324 | break; | ||
325 | |||
326 | case MPEG_MENU: | ||
327 | pcm_playback_play_pause(false); | ||
328 | if (videostatus != STREAM_DONE) { | ||
329 | videostatus=PLEASE_PAUSE; | ||
330 | |||
331 | /* Wait for video thread to stop */ | ||
332 | while (videostatus == PLEASE_PAUSE) { rb->sleep(HZ/25); } | ||
333 | } | ||
334 | |||
335 | #ifndef HAVE_LCD_COLOR | ||
336 | gray_show(false); | ||
337 | #endif | ||
338 | result = mpeg_menu(); | ||
339 | |||
340 | #ifndef HAVE_LCD_COLOR | ||
341 | gray_show(true); | ||
342 | #endif | ||
343 | |||
344 | /* The menu can change the font, so restore */ | ||
345 | rb->lcd_setfont(FONT_SYSFIXED); | ||
346 | |||
347 | if (result) { | ||
348 | audiostatus = PLEASE_STOP; | ||
349 | if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP; | ||
350 | } else { | ||
351 | if (videostatus != STREAM_DONE) videostatus = STREAM_PLAYING; | ||
352 | pcm_playback_play_pause(true); | ||
353 | } | ||
354 | break; | ||
355 | |||
356 | case MPEG_STOP: | ||
357 | audiostatus = PLEASE_STOP; | ||
358 | if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP; | ||
359 | break; | ||
360 | |||
361 | case MPEG_PAUSE: | ||
362 | if (videostatus != STREAM_DONE) videostatus=PLEASE_PAUSE; | ||
363 | pcm_playback_play_pause(false); | ||
364 | |||
365 | button = BUTTON_NONE; | ||
366 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
367 | rb->cpu_boost(false); | ||
368 | #endif | ||
369 | do { | ||
370 | button = rb->button_get(true); | ||
371 | if (button == MPEG_STOP) { | ||
372 | audiostatus = PLEASE_STOP; | ||
373 | if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP; | ||
374 | return; | ||
375 | } | ||
376 | } while (button != MPEG_PAUSE); | ||
377 | |||
378 | if (videostatus != STREAM_DONE) videostatus = STREAM_PLAYING; | ||
379 | pcm_playback_play_pause(true); | ||
380 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
381 | rb->cpu_boost(true); | ||
382 | #endif | ||
383 | break; | ||
384 | |||
385 | default: | ||
386 | if(rb->default_event_handler(button) == SYS_USB_CONNECTED) { | ||
387 | audiostatus = PLEASE_STOP; | ||
388 | if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP; | ||
389 | } | ||
390 | } | ||
391 | } | ||
392 | |||
393 | /* libmad related functions/definitions */ | 286 | /* libmad related functions/definitions */ |
394 | #define INPUT_CHUNK_SIZE 8192 | 287 | #define INPUT_CHUNK_SIZE 8192 |
395 | 288 | ||
@@ -960,6 +853,113 @@ static inline int32_t clip_sample(int32_t sample) | |||
960 | return sample; | 853 | return sample; |
961 | } | 854 | } |
962 | 855 | ||
856 | static void button_loop(void) | ||
857 | { | ||
858 | bool result; | ||
859 | int vol, minvol, maxvol; | ||
860 | int button = rb->button_get(false); | ||
861 | |||
862 | switch (button) | ||
863 | { | ||
864 | case MPEG_VOLUP: | ||
865 | case MPEG_VOLUP|BUTTON_REPEAT: | ||
866 | #ifdef MPEG_VOLUP2 | ||
867 | case MPEG_VOLUP2: | ||
868 | case MPEG_VOLUP2|BUTTON_REPEAT: | ||
869 | #endif | ||
870 | vol = rb->global_settings->volume; | ||
871 | maxvol = rb->sound_max(SOUND_VOLUME); | ||
872 | |||
873 | if (vol < maxvol) { | ||
874 | vol++; | ||
875 | rb->sound_set(SOUND_VOLUME, vol); | ||
876 | rb->global_settings->volume = vol; | ||
877 | } | ||
878 | break; | ||
879 | |||
880 | case MPEG_VOLDOWN: | ||
881 | case MPEG_VOLDOWN|BUTTON_REPEAT: | ||
882 | #ifdef MPEG_VOLDOWN2 | ||
883 | case MPEG_VOLDOWN2: | ||
884 | case MPEG_VOLDOWN2|BUTTON_REPEAT: | ||
885 | #endif | ||
886 | vol = rb->global_settings->volume; | ||
887 | minvol = rb->sound_min(SOUND_VOLUME); | ||
888 | |||
889 | if (vol > minvol) { | ||
890 | vol--; | ||
891 | rb->sound_set(SOUND_VOLUME, vol); | ||
892 | rb->global_settings->volume = vol; | ||
893 | } | ||
894 | break; | ||
895 | |||
896 | case MPEG_MENU: | ||
897 | pcm_playback_play_pause(false); | ||
898 | if (videostatus != STREAM_DONE) { | ||
899 | videostatus=PLEASE_PAUSE; | ||
900 | |||
901 | /* Wait for video thread to stop */ | ||
902 | while (videostatus == PLEASE_PAUSE) { rb->sleep(HZ/25); } | ||
903 | } | ||
904 | |||
905 | #ifndef HAVE_LCD_COLOR | ||
906 | gray_show(false); | ||
907 | #endif | ||
908 | result = mpeg_menu(); | ||
909 | |||
910 | #ifndef HAVE_LCD_COLOR | ||
911 | gray_show(true); | ||
912 | #endif | ||
913 | |||
914 | /* The menu can change the font, so restore */ | ||
915 | rb->lcd_setfont(FONT_SYSFIXED); | ||
916 | |||
917 | if (result) { | ||
918 | audiostatus = PLEASE_STOP; | ||
919 | if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP; | ||
920 | } else { | ||
921 | if (videostatus != STREAM_DONE) videostatus = STREAM_PLAYING; | ||
922 | pcm_playback_play_pause(true); | ||
923 | } | ||
924 | break; | ||
925 | |||
926 | case MPEG_STOP: | ||
927 | audiostatus = PLEASE_STOP; | ||
928 | if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP; | ||
929 | break; | ||
930 | |||
931 | case MPEG_PAUSE: | ||
932 | if (videostatus != STREAM_DONE) videostatus=PLEASE_PAUSE; | ||
933 | pcm_playback_play_pause(false); | ||
934 | |||
935 | button = BUTTON_NONE; | ||
936 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
937 | rb->cpu_boost(false); | ||
938 | #endif | ||
939 | do { | ||
940 | button = rb->button_get(true); | ||
941 | if (button == MPEG_STOP) { | ||
942 | audiostatus = PLEASE_STOP; | ||
943 | if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP; | ||
944 | return; | ||
945 | } | ||
946 | } while (button != MPEG_PAUSE); | ||
947 | |||
948 | if (videostatus != STREAM_DONE) videostatus = STREAM_PLAYING; | ||
949 | pcm_playback_play_pause(true); | ||
950 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
951 | rb->cpu_boost(true); | ||
952 | #endif | ||
953 | break; | ||
954 | |||
955 | default: | ||
956 | if(rb->default_event_handler(button) == SYS_USB_CONNECTED) { | ||
957 | audiostatus = PLEASE_STOP; | ||
958 | if (videostatus != STREAM_DONE) videostatus = PLEASE_STOP; | ||
959 | } | ||
960 | } | ||
961 | } | ||
962 | |||
963 | static void audio_thread(void) | 963 | static void audio_thread(void) |
964 | { | 964 | { |
965 | uint8_t *mpabuf = mpa_buffer; | 965 | uint8_t *mpabuf = mpa_buffer; |