summaryrefslogtreecommitdiff
path: root/apps/plugins/test_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/test_codec.c')
-rw-r--r--apps/plugins/test_codec.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index 3e13842cfb..6d915d66e4 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -21,33 +21,14 @@
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/pluginlib_touchscreen.h" 22#include "lib/pluginlib_touchscreen.h"
23#include "lib/pluginlib_exit.h" 23#include "lib/pluginlib_exit.h"
24#include "lib/pluginlib_actions.h"
25
26/* this set the context to use with PLA */
27static const struct button_mapping *plugin_contexts[] = { pla_main_ctx };
28
29#define TESTCODEC_EXITBUTTON PLA_EXIT
30#define TESTCODEC_EXITBUTTON2 PLA_CANCEL
24 31
25/* All swcodec targets have BUTTON_SELECT apart from the H10 and M3 */
26
27#if CONFIG_KEYPAD == IRIVER_H10_PAD
28#define TESTCODEC_EXITBUTTON BUTTON_RIGHT
29#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
30#define TESTCODEC_EXITBUTTON BUTTON_RC_PLAY
31#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
32#define TESTCODEC_EXITBUTTON BUTTON_PLAY
33#elif CONFIG_KEYPAD == COWON_D2_PAD || CONFIG_KEYPAD == ONDAVX747_PAD \
34 || CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
35#define TESTCODEC_EXITBUTTON BUTTON_POWER
36#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
37#define TESTCODEC_EXITBUTTON BUTTON_REC
38#elif CONFIG_KEYPAD == MPIO_HD200_PAD
39#define TESTCODEC_EXITBUTTON (BUTTON_REC | BUTTON_PLAY)
40#elif CONFIG_KEYPAD == MPIO_HD300_PAD
41#define TESTCODEC_EXITBUTTON (BUTTON_REC | BUTTON_REPEAT)
42#elif CONFIG_KEYPAD == RK27XX_GENERIC_PAD
43#define TESTCODEC_EXITBUTTON (BUTTON_M | BUTTON_REPEAT)
44#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
45#define TESTCODEC_EXITBUTTON BUTTON_BACK
46#elif defined(HAVE_TOUCHSCREEN)
47#define TESTCODEC_EXITBUTTON (BUTTON_BOTTOMMIDDLE|BUTTON_REL)
48#else
49#define TESTCODEC_EXITBUTTON BUTTON_SELECT
50#endif
51 32
52#ifdef HAVE_ADJUSTABLE_CPU_FREQ 33#ifdef HAVE_ADJUSTABLE_CPU_FREQ
53static unsigned int boost =1; 34static unsigned int boost =1;
@@ -734,7 +715,9 @@ static enum plugin_status test_track(const char* filename)
734 /* Wait for codec thread to die */ 715 /* Wait for codec thread to die */
735 while (codec_playing) 716 while (codec_playing)
736 { 717 {
737 if (rb->button_get_w_tmo(HZ) == TESTCODEC_EXITBUTTON) 718 int button = pluginlib_getaction(HZ, plugin_contexts,
719 ARRAYLEN(plugin_contexts));
720 if ((button == TESTCODEC_EXITBUTTON) || (button == TESTCODEC_EXITBUTTON2))
738 { 721 {
739 codec_action = CODEC_ACTION_HALT; 722 codec_action = CODEC_ACTION_HALT;
740 break; 723 break;
@@ -848,9 +831,12 @@ void plugin_quit(void)
848 else 831 else
849#endif 832#endif
850 do { 833 do {
851 btn = rb->button_get(true); 834 btn = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts,
835 ARRAYLEN(plugin_contexts));
852 exit_on_usb(btn); 836 exit_on_usb(btn);
853 } while (codec_action != CODEC_ACTION_HALT && btn != TESTCODEC_EXITBUTTON); 837 } while ((codec_action != CODEC_ACTION_HALT)
838 && (btn != TESTCODEC_EXITBUTTON)
839 && (btn != TESTCODEC_EXITBUTTON2));
854} 840}
855 841
856/* plugin entry point */ 842/* plugin entry point */