Disable AAC-SBR, AAC-SSR, and AAC-PS on Sansa clip. Clean up warnings introduced...
[kugel-rb.git] / apps / keymaps / keymap-ipod.c
blob02854524d2840ae9dfdf679a75a766a6032fb555
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 /* Button Code Definitions for ipod target */
24 #include "config.h"
25 #include "action.h"
26 #include "button.h"
27 #include "settings.h"
29 /*
30 * The format of the list is as follows
31 * { Action Code, Button code, Prereq button code }
32 * if there's no need to check the previous button's value, use BUTTON_NONE
33 * Insert LAST_ITEM_IN_LIST at the end of each mapping
36 /* CONTEXT_CUSTOM's used in this file...
38 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
43 static const struct button_mapping button_context_standard[] = {
44 { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
45 { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
46 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
47 { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
48 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
49 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
51 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
52 { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
53 { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
54 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
55 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
57 LAST_ITEM_IN_LIST
58 }; /* button_context_standard */
59 static const struct button_mapping button_context_tree[] = {
60 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
61 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
63 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
64 }; /* button_context_tree */
66 static const struct button_mapping button_context_tree_scroll_lr[] = {
67 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
68 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
69 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
70 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
71 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
72 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
73 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
74 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
75 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
76 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
79 static const struct button_mapping button_context_wps[] = {
80 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
81 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
82 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
83 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
84 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
85 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
86 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
87 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
88 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
89 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
90 { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE },
91 { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
92 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
93 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
94 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
95 { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
97 LAST_ITEM_IN_LIST,
98 }; /* button_context_wps */
100 static const struct button_mapping button_context_settings[] = {
101 { ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
102 { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
103 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
104 { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
105 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
106 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
107 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
108 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
109 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
110 { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
112 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
113 }; /* button_context_settings */
115 static const struct button_mapping button_context_yesno[] = {
116 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
117 LAST_ITEM_IN_LIST
118 }; /* button_context_settings_yesno */
120 static const struct button_mapping button_context_bmark[] = {
121 { ACTION_BMS_DELETE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
122 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
123 }; /* button_context_settings_bmark */
125 static const struct button_mapping button_context_quickscreen[] = {
126 { ACTION_QS_DOWN, BUTTON_PLAY, BUTTON_NONE },
127 { ACTION_QS_DOWN, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
128 { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
129 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
130 { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
131 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
132 { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
134 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
135 }; /* button_context_quickscreen */
137 static const struct button_mapping button_context_pitchscreen[] = {
138 { ACTION_PS_INC_SMALL, BUTTON_SCROLL_FWD, BUTTON_NONE },
139 { ACTION_PS_INC_BIG, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
140 { ACTION_PS_DEC_SMALL, BUTTON_SCROLL_BACK, BUTTON_NONE },
141 { ACTION_PS_DEC_BIG, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
142 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
143 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
144 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
145 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
146 { ACTION_PS_TOGGLE_MODE, BUTTON_PLAY, BUTTON_NONE },
147 { ACTION_PS_RESET, BUTTON_MENU, BUTTON_NONE },
148 { ACTION_PS_EXIT, BUTTON_SELECT, BUTTON_NONE },
150 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
151 }; /* button_context_pitchscreen */
153 static const struct button_mapping button_context_keyboard[] = {
154 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
155 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
156 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
157 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
158 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
159 { ACTION_KBD_DONE, BUTTON_PLAY, BUTTON_NONE },
160 { ACTION_KBD_ABORT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
161 { ACTION_KBD_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
162 { ACTION_KBD_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
163 { ACTION_KBD_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
164 { ACTION_KBD_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
165 { ACTION_KBD_MORSE_INPUT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
166 { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
167 LAST_ITEM_IN_LIST
168 }; /* button_context_keyboard */
170 #ifdef HAVE_RECORDING
171 const struct button_mapping button_context_recscreen[] = {
173 { ACTION_REC_NEWFILE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
174 { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
175 { ACTION_STD_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
176 { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
177 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
178 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
179 { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
180 { ACTION_STD_PREV, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
181 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
182 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
183 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
184 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
186 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
187 }; /* button_context_recscreen */
188 #endif
190 #if BUTTON_REMOTE != 0
191 /*****************************************************************************
192 * Remote control mappings
193 *****************************************************************************/
195 static const struct button_mapping remote_button_context_standard[] = {
196 { ACTION_STD_PREV, BUTTON_RC_LEFT, BUTTON_NONE },
197 { ACTION_STD_NEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
198 { ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
199 { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
201 LAST_ITEM_IN_LIST
204 static const struct button_mapping remote_button_context_wps[] = {
205 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
206 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
207 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
208 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
210 { ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
211 { ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
212 { ACTION_WPS_SKIPNEXT, BUTTON_RC_RIGHT|BUTTON_REL, BUTTON_RC_RIGHT },
213 { ACTION_WPS_SEEKFWD, BUTTON_RC_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
214 { ACTION_WPS_STOPSEEK, BUTTON_RC_RIGHT|BUTTON_REL, BUTTON_RC_RIGHT|BUTTON_REPEAT },
215 { ACTION_WPS_SKIPPREV, BUTTON_RC_LEFT|BUTTON_REL, BUTTON_RC_LEFT },
216 { ACTION_WPS_SEEKBACK, BUTTON_RC_LEFT|BUTTON_REPEAT, BUTTON_NONE },
217 { ACTION_WPS_STOPSEEK, BUTTON_RC_LEFT|BUTTON_REL, BUTTON_RC_LEFT|BUTTON_REPEAT },
219 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
223 static const struct button_mapping* get_context_mapping_remote( int context )
225 context ^= CONTEXT_REMOTE;
227 switch (context)
229 case CONTEXT_WPS:
230 return remote_button_context_wps;
232 default:
233 return remote_button_context_standard;
236 #endif /* BUTTON_REMOTE != 0 */
238 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
239 const struct button_mapping* get_context_mapping(int context)
241 #if BUTTON_REMOTE != 0
242 if (context&CONTEXT_REMOTE)
243 return get_context_mapping_remote(context);
244 #endif
246 switch (context)
248 case CONTEXT_STD:
249 return button_context_standard;
250 case CONTEXT_WPS:
251 return button_context_wps;
253 case CONTEXT_TREE:
254 case CONTEXT_MAINMENU:
255 if (global_settings.hold_lr_for_scroll_in_list)
256 return button_context_tree_scroll_lr;
257 /* else fall through to CUSTOM|CONTEXT_TREE */
258 case CONTEXT_CUSTOM|CONTEXT_TREE:
259 return button_context_tree;
261 case CONTEXT_LIST:
262 return button_context_standard;
264 case CONTEXT_SETTINGS_EQ:
265 case CONTEXT_SETTINGS_COLOURCHOOSER:
266 case CONTEXT_SETTINGS_TIME:
267 case CONTEXT_SETTINGS:
268 case CONTEXT_SETTINGS_RECTRIGGER:
269 return button_context_settings;
270 case CONTEXT_YESNOSCREEN:
271 return button_context_yesno;
272 case CONTEXT_BOOKMARKSCREEN:
273 return button_context_bmark;
274 case CONTEXT_QUICKSCREEN:
275 return button_context_quickscreen;
276 case CONTEXT_PITCHSCREEN:
277 return button_context_pitchscreen;
278 case CONTEXT_KEYBOARD:
279 return button_context_keyboard;
280 #ifdef HAVE_RECORDING
281 case CONTEXT_RECSCREEN:
282 return button_context_recscreen;
283 #endif
284 default:
285 return button_context_standard;
287 return button_context_standard;