FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiMP3Test.c @ 3:67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:33:10 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:3a14ee9a9843 | 3:67bfe9f274f6 |
---|---|
1 /******************************************************************************* | |
2 | |
3 Texas Instruments | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Texas Instruments and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: MMI Application to test the different Audio file formats. | |
13 $Module: Test Audio Player | |
14 $File: MmiMp3Test.c | |
15 $Revision: 1.0 | |
16 | |
17 $Author: Elsa Armanet-Said Texas Instruments Nice | |
18 $Date: 17/05/04 | |
19 | |
20 ******************************************************************************** | |
21 | |
22 Description: | |
23 | |
24 This provides the MP3 Test Application interface. | |
25 | |
26 ******************************************************************************** | |
27 $History: MmiMp3Test.c | |
28 | |
29 Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
30 Description: midi and mp3 files is not being populated on accessing corresponding menu, but only during bootup | |
31 Solution: Populate files on accessing the "browse files" list | |
32 | |
33 Jun 06, 2006 REF: ERT OMAPS00070659 x0039928 | |
34 Bug:MP3 RWD and FWD function - MOT | |
35 Fix: Forward and Rewind functionalities are handled. | |
36 | |
37 Jun 02,2006 REF: DR OMAPS00079746 x0039928 | |
38 Bug:MMI displays 'Playing' when trying to play a wrong file | |
39 Fix: MP3 playback error is handled. | |
40 | |
41 Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
42 Bug:MP3: The screen is not refreshed after the mp3 file completes playing | |
43 Fix: The window is destroyed in mmi_mp3_test_start_cb() after AUDIO_OK | |
44 event is received in the mfw callback. | |
45 | |
46 17/05/04 | |
47 Sep 29,2005 REF: SPR 34407 xdeepadh | |
48 Bug:Back soft key takes more time to return to the previous screen in MP3 application | |
49 Fix:The list creation for MP3 files has been modified | |
50 | |
51 | |
52 Sep 27,2005 REF: SPR 34402 xdeepadh | |
53 Bug:Mono option is always highlighted even when Stereo is selected | |
54 Fix:The channel setting will be saved in the FFS, which will be retrieved | |
55 later and the selected channel will be higlighted. | |
56 | |
57 Jul 18, 2005 REF: SPR 31695 xdeepadh | |
58 Bug:Problems with MP3 test application | |
59 Fix:The window handling of MP3 Test Application has been done properly. | |
60 | |
61 $End | |
62 | |
63 *******************************************************************************/ | |
64 | |
65 | |
66 | |
67 | |
68 /******************************************************************************* | |
69 | |
70 Include files | |
71 | |
72 *******************************************************************************/ | |
73 #define ENTITY_MFW | |
74 | |
75 /* includes */ | |
76 | |
77 #include <string.h> | |
78 #include <stdio.h> | |
79 #include <stdlib.h> | |
80 | |
81 #include "typedefs.h" | |
82 #include "vsi.h" | |
83 #include "pei.h" | |
84 #include "custom.h" | |
85 | |
86 #if defined (NEW_FRAME) | |
87 | |
88 #include "typedefs.h" | |
89 #include "vsi.h" | |
90 #include "pei.h" | |
91 #include "custom.h" | |
92 #include "gsm.h" | |
93 #include "prim.h" | |
94 | |
95 #else | |
96 | |
97 #include "STDDEFS.H" | |
98 #include "custom.h" | |
99 #include "gsm.h" | |
100 #include "vsi.h" | |
101 | |
102 #endif | |
103 | |
104 #include "message.h" /* included for aci_cmh.h .... */ | |
105 #include "aci_cmh.h" /* included for mfw_sat.h, included for MmiDummy.h, included for MmiMenu.h */ | |
106 | |
107 #include "mfw_mfw.h" | |
108 #include "mfw_win.h" | |
109 #include "mfw_icn.h" /* included for mfw_mnu.h */ | |
110 #include "mfw_mnu.h" | |
111 #include "mfw_tim.h" | |
112 #include "mfw_kbd.h" | |
113 #include "mfw_sat.h" /* included for MmiDummy.h, included for MmiMenu.h */ | |
114 #include "mfw_mp3test.h" | |
115 | |
116 #include "MmiBlkLangDB.h" | |
117 #include "mmiColours.h" | |
118 #include "MmiDialogs.h" | |
119 | |
120 #include "MmiDummy.h" /* included for MmiMenu.h */ | |
121 #include "MmiLists.h" | |
122 #include "MmiMenu.h" | |
123 #include "MmiSoftKeys.h" | |
124 #include "MmiMP3Test.h" | |
125 #include "MmiMain.h" | |
126 #include "Mmiicons.h" | |
127 #include "Icons\IcnDefs.h" | |
128 //Sep 27,2005 REF: SPR 34402 xdeepadh | |
129 #include "MmiBookShared.h" | |
130 #include "mfw_ffs.h" | |
131 | |
132 /******************************************************************************* | |
133 | |
134 internal data | |
135 | |
136 *******************************************************************************/ | |
137 | |
138 /* | |
139 * Internal events | |
140 */ | |
141 // E_INIT event definition | |
142 #define E_INIT 1 | |
143 | |
144 #if (BOARD == 71) | |
145 #define MP3_INIT 1 | |
146 #define MP3_RETURN 2 | |
147 #endif | |
148 | |
149 //Sep 27,2005 REF: SPR 34402 xdeepadh | |
150 //defines for channels | |
151 #define PLAYER_CHANNEL_MONO 0 | |
152 #define PLAYER_CHANNEL_STEREO 1 | |
153 | |
154 //Jul 18, 2005 REF: SPR 31695 xdeepadh | |
155 //Defines for Player events | |
156 #define PLAYER_INIT 500 | |
157 #define PLAYER_DESTROY 501 | |
158 #define PLAYER_PLAY 502 | |
159 | |
160 /*local defines*/ | |
161 #define PLAYER_INFO_SCRN_TIMEOUT 1500 | |
162 | |
163 #if (BOARD == 71) | |
164 #define MP3_FORWARD_REWIND_TIME 10 | |
165 #endif | |
166 | |
167 typedef struct | |
168 { | |
169 T_MMI_CONTROL mmi_control; | |
170 MfwHnd win; | |
171 MfwHnd info_win; //Jul 18, 2005 REF: SPR 31695 xdeepadh | |
172 MfwHnd parent_win;//Jul 18, 2005 REF: SPR 31695 xdeepadh | |
173 MfwHnd mfwwin; | |
174 MfwHnd callwin; | |
175 MfwHnd kbd; | |
176 #if (BOARD == 71) | |
177 MfwHnd menu; | |
178 #endif | |
179 } T_MMI_Player_Win_data; | |
180 | |
181 /*menu data structure definition*/ | |
182 typedef struct | |
183 { | |
184 T_MMI_CONTROL mmi_control; | |
185 T_MFW_HND win; | |
186 T_MFW_HND parent; //Jul 18, 2005 REF: SPR 31695 xdeepadh | |
187 T_MFW_HND kbd; | |
188 T_MFW_HND kbd_long; | |
189 T_MFW_HND player_menu; | |
190 T_VOID_FUNC func_cb; | |
191 UBYTE player_num_file; | |
192 UBYTE player_file_count; | |
193 ListCbFunc player_list_cb; | |
194 UBYTE player_list_idx; | |
195 ListMenuData * menu_list_data; //Sep 29,2005 REF: SPR 34407 xdeepadh | |
196 }T_player_menu; | |
197 | |
198 // Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
199 // Global variable that holds the mmi return path and is found in mfw_mp3test.c | |
200 extern MMI_RETURN_PATH mmi_audio_player_return_path; | |
201 | |
202 /*global menu data*/ | |
203 T_player_menu player_menu_data = {0}; | |
204 /*Boolean to check whether file being played is paused.*/ | |
205 BOOL IsPaused = FALSE; | |
206 //UBYTE IsMfwInit = 0; | |
207 extern char* inputFileName; // input file | |
208 extern UBYTE IsMP3On; | |
209 extern int audio_player_currently_playing_idx ; | |
210 | |
211 #if (BOARD == 71) | |
212 static T_MFW_HND optionwin; | |
213 #endif | |
214 | |
215 /******************************************************************************* | |
216 | |
217 Local prototypes | |
218 | |
219 *******************************************************************************/ | |
220 static void mmi_audio_player_menu_list_listmnu_cb(T_MFW_HND Parent, ListMenuData * ListData); | |
221 static MfwHnd mmi_audio_player_show_info(T_MFW_HND parent, int str1, int str2, T_VOID_FUNC callback); | |
222 //Sep 29,2005 REF: SPR 34407 xdeepadh | |
223 static T_MFW_HND mmi_audio_player_build_player_Menu( MfwHnd parent_window); | |
224 | |
225 | |
226 /*default static menu*/ | |
227 static MfwMnuAttr menuPlayerSearchListAttr = | |
228 { | |
229 &menuArea, | |
230 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */ | |
231 (U8)-1, /* use default font */ | |
232 NULL, /* with these items (filled in later) */ | |
233 0, /* number of items (filled in leter) */ | |
234 COLOUR_LIST_XX, /* Colour */ | |
235 TxtNull, /* Hdr Id */ | |
236 NULL, /* Background */ | |
237 MNUATTRSPARE /* unused */ | |
238 }; | |
239 | |
240 #if (BOARD == 71) | |
241 static const MfwMnuItem Mmi_mp3_OPTItems [] = | |
242 { | |
243 {0,0,0,(char *)TxtPlayerPause,0,(MenuFunc)M_exePause,item_flag_none}, | |
244 {0,0,0,(char *)TxtPlayerForward,0,(MenuFunc)M_exeForward,item_flag_none}, | |
245 {0,0,0,(char *)TxtPlayerRewind,0,(MenuFunc)M_exeRewind,item_flag_none} | |
246 }; | |
247 | |
248 | |
249 static const MfwMnuAttr Mmi_mp3_OPTAttrib = | |
250 { | |
251 &SmsSend_R_OPTArea, | |
252 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */ | |
253 (U8)-1, /* use default font */ | |
254 (MfwMnuItem*)Mmi_mp3_OPTItems, /* with these items */ | |
255 sizeof(Mmi_mp3_OPTItems)/sizeof(MfwMnuItem), /* number of items */ | |
256 COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE | |
257 | |
258 }; | |
259 | |
260 /******************************************************************************* | |
261 | |
262 $Function: mmi_mp3_test_opt_win_cb | |
263 | |
264 $Description: | |
265 | |
266 $Returns: MFW_EVENT_CONSUMED | |
267 | |
268 $Arguments: event - window handle event | |
269 win - Camera window | |
270 | |
271 *******************************************************************************/ | |
272 int mmi_mp3_test_opt_win_cb (MfwEvt evt, MfwHnd win) | |
273 { | |
274 switch (evt) | |
275 { | |
276 case MfwWinVisible: /* window is visible */ | |
277 displaySoftKeys(TxtSoftSelect,TxtSoftBack); | |
278 break; | |
279 case MfwWinFocussed: /* input focus / selected */ | |
280 case MfwWinDelete: /* window will be deleted */ | |
281 default: | |
282 return MFW_EVENT_REJECTED; | |
283 } | |
284 return MFW_EVENT_CONSUMED; | |
285 | |
286 } | |
287 | |
288 /******************************************************************************* | |
289 | |
290 $Function: mmi_mp3_test_opt_kbd_cb | |
291 | |
292 $Description: | |
293 | |
294 $Returns: execution status | |
295 | |
296 $Arguments: e - event id | |
297 k - keyboard info | |
298 *******************************************************************************/ | |
299 | |
300 static int mmi_mp3_test_opt_kbd_cb (MfwEvt e, MfwKbd *k) | |
301 { | |
302 T_MFW_HND win = mfwParent(mfw_header()); | |
303 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
304 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)win_data->user; | |
305 | |
306 | |
307 if (e & KEY_LONG) | |
308 { | |
309 switch (k->code) | |
310 { | |
311 case KCD_HUP: /* back to previous menu */ | |
312 mnuEscape(data->menu); | |
313 break; | |
314 case KCD_RIGHT: /* Power Down */ | |
315 return MFW_EVENT_REJECTED; /* handled by idle */ | |
316 default: /* no response to all other keys */ | |
317 return MFW_EVENT_CONSUMED; | |
318 } | |
319 } | |
320 else | |
321 { | |
322 switch (k->code) | |
323 { | |
324 case KCD_MNUUP: /* highlight previous entry */ | |
325 mnuUp(data->menu); | |
326 break; | |
327 case KCD_MNUDOWN: /* highlight next entry */ | |
328 mnuDown(data->menu); | |
329 break; | |
330 case KCD_MNUSELECT: | |
331 case KCD_LEFT: /* activate this entry */ | |
332 mnuSelect(data->menu); | |
333 break; | |
334 case KCD_HUP: /* back to previous menu */ | |
335 case KCD_RIGHT: /* back to previous menu */ | |
336 mnuEscape(data->menu); | |
337 break; | |
338 default: /* no response to all other keys */ | |
339 return MFW_EVENT_CONSUMED; | |
340 } | |
341 } | |
342 return MFW_EVENT_CONSUMED; | |
343 } | |
344 | |
345 /******************************************************************************* | |
346 | |
347 $Function: mmi_mp3_test_opt_mnu_cb | |
348 | |
349 $Description: Menu callback function for the Option window | |
350 | |
351 $Returns: Execution status | |
352 | |
353 $Arguments: e - event id | |
354 m - menu handle | |
355 *******************************************************************************/ | |
356 | |
357 static int mmi_mp3_test_opt_mnu_cb (MfwEvt e, MfwMnu *m) | |
358 { | |
359 switch (e) | |
360 { | |
361 case E_MNU_ESCAPE: /* back to previous menu */ | |
362 TRACE_EVENT("E_MNU_ESCAPE"); | |
363 SEND_EVENT (optionwin, MP3_RETURN, NULL, NULL); | |
364 break; | |
365 default: /* in mnuCreate() only E_MNU_ESCAPE has been enabled! */ | |
366 return MFW_EVENT_REJECTED; | |
367 } | |
368 return MFW_EVENT_CONSUMED; | |
369 } | |
370 | |
371 /******************************************************************************* | |
372 | |
373 $Function: mmi_mp3_test_opt_destroy | |
374 | |
375 $Description: Destroy the Camera Option window | |
376 | |
377 $Returns: mfw window handle | |
378 | |
379 $Arguments: own_window - current window | |
380 | |
381 *******************************************************************************/ | |
382 | |
383 static void mmi_mp3_test_opt_destroy(MfwHnd own_window) | |
384 { | |
385 T_MFW_WIN * win_data; | |
386 T_MMI_Player_Win_data * data; | |
387 | |
388 if (own_window) | |
389 { | |
390 win_data = ((T_MFW_HDR *)own_window)->data; | |
391 data = (T_MMI_Player_Win_data *)win_data->user; | |
392 | |
393 if (data) | |
394 { | |
395 | |
396 /* | |
397 ** Failed to start : Free Memory, and exit | |
398 */ | |
399 | |
400 if(data->kbd != NULL) | |
401 { | |
402 kbdDelete (data->kbd); | |
403 } | |
404 | |
405 if(data->menu!= NULL) | |
406 { | |
407 mnuDelete(data->menu); | |
408 } | |
409 | |
410 // Delete WIN handler | |
411 | |
412 win_delete (data->win); | |
413 | |
414 // Free Memory | |
415 | |
416 FREE_MEMORY ((void *)data, sizeof (T_MMI_Player_Win_data)); | |
417 } | |
418 else | |
419 { | |
420 TRACE_EVENT ("mmi_mp3_test_opt_destroy() called twice"); | |
421 } | |
422 } | |
423 } | |
424 | |
425 | |
426 /******************************************************************************* | |
427 | |
428 $Function: mmi_mp3_test_opt_exec_cb | |
429 | |
430 $Description: | |
431 $Returns: None | |
432 | |
433 $Arguments: win : The pointer to the window handler, so the function can reference the | |
434 dynamic user data, if any. | |
435 event : The incoming event | |
436 value : Generic incoming Parameter, it will be 'event' dependant | |
437 parameter : Generic incoming Parameter, it will be 'event' dependant | |
438 | |
439 *******************************************************************************/ | |
440 void mmi_mp3_test_opt_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
441 { | |
442 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
443 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)win_data->user; | |
444 TRACE_FUNCTION ("mmi_mp3_test_opt_exec_cb()"); | |
445 switch (event) | |
446 { | |
447 case MP3_INIT: | |
448 /* initialization of administrative data */ | |
449 data->kbd = kbdCreate(data->win,KEY_ALL, (MfwCb)mmi_mp3_test_opt_kbd_cb); | |
450 data->menu = mnuCreate(data->win,(MfwMnuAttr *)&Mmi_mp3_OPTAttrib, E_MNU_ESCAPE, (MfwCb)mmi_mp3_test_opt_mnu_cb); | |
451 mnuLang(data->menu,mainMmiLng); | |
452 | |
453 /* put the (new) dialog window on top of the window stack */ | |
454 mnuUnhide(data->menu); | |
455 winShow(data->win); | |
456 break; | |
457 | |
458 case MP3_RETURN: | |
459 mmi_mp3_test_opt_destroy(optionwin); | |
460 optionwin = NULL; | |
461 dspl_ClearAll(); | |
462 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayerResume); | |
463 displaySoftKeys(TxtSoftOptions, TxtStop); | |
464 break; | |
465 | |
466 default: | |
467 return; | |
468 } | |
469 } | |
470 | |
471 | |
472 /******************************************************************************* | |
473 | |
474 $Function: mmi_mp3_test_opt_win_create | |
475 | |
476 $Description: | |
477 | |
478 $Returns: | |
479 | |
480 $Arguments: parent : pointer to the parent window. | |
481 | |
482 *******************************************************************************/ | |
483 T_MFW_HND mmi_mp3_test_opt_create(T_MFW_HND parent) | |
484 { | |
485 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)ALLOC_MEMORY (sizeof (T_MMI_Player_Win_data)); | |
486 T_MFW_WIN * win; | |
487 | |
488 TRACE_FUNCTION ("mmi_mp3_test_opt_create()"); | |
489 | |
490 /* | |
491 * Create window handler | |
492 */ | |
493 | |
494 data->win = | |
495 win_create (parent, 0, E_WIN_VISIBLE, (T_MFW_CB)mmi_mp3_test_opt_win_cb); | |
496 if (data->win EQ NULL) | |
497 { | |
498 return NULL; | |
499 } | |
500 /* | |
501 * connect the dialog data to the MFW-window | |
502 */ | |
503 | |
504 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_mp3_test_opt_exec_cb; | |
505 data->mmi_control.data = data; | |
506 win = ((T_MFW_HDR *)data->win)->data; | |
507 win->user = (void *)data; | |
508 data->parent_win = parent; | |
509 | |
510 /* | |
511 * return window handle | |
512 */ | |
513 | |
514 return data->win; | |
515 } | |
516 | |
517 /******************************************************************************* | |
518 | |
519 $Function: mmi_mp3_test_opt_start | |
520 | |
521 $Description: | |
522 | |
523 $Returns: | |
524 | |
525 $Arguments: parent_window -parent window handle | |
526 menuAttr - Menu attributes. | |
527 | |
528 *******************************************************************************/ | |
529 | |
530 T_MFW_HND mmi_mp3_test_opt_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr) | |
531 { | |
532 // T_MFW_HND win; | |
533 | |
534 TRACE_FUNCTION ("mmi_mp3_test_opt_start()"); | |
535 | |
536 optionwin = (T_MFW_HND)mmi_mp3_test_opt_create (parent_window); | |
537 | |
538 if (optionwin NEQ NULL) | |
539 { | |
540 SEND_EVENT (optionwin, MP3_INIT, NULL, (void *)menuAttr); | |
541 } | |
542 return optionwin; | |
543 } | |
544 | |
545 #endif | |
546 /******************************************************************************* | |
547 | |
548 $Function: mmi_audio_player_menu_destroy | |
549 | |
550 $Description: destroy menu window | |
551 | |
552 $Returns: | |
553 | |
554 $Arguments: | |
555 | |
556 *******************************************************************************/ | |
557 static void mmi_audio_player_menu_destroy(MfwHnd window) | |
558 { | |
559 T_MFW_WIN * win_data = ((T_MFW_HDR *)window)->data; | |
560 T_player_menu * data = (T_player_menu *)win_data->user; | |
561 TRACE_FUNCTION ("mmi_audio_player_menu_destroy()"); | |
562 | |
563 | |
564 if (window == NULL) | |
565 { | |
566 return; | |
567 } | |
568 | |
569 if (data) | |
570 { | |
571 win_delete(data->win); | |
572 | |
573 /* | |
574 ** Free Memory | |
575 */ | |
576 mfwFree((void *)data, sizeof (T_player_menu)); | |
577 | |
578 } | |
579 | |
580 } | |
581 //Sep 29,2005 REF: SPR 34407 xdeepadh | |
582 /******************************************************************************* | |
583 $Function: mmi_audio_player_menu_list_listmnu_cb | |
584 | |
585 $Description: destroy lists and menu in case of back softkey or menu exit | |
586 | |
587 $Returns: | |
588 | |
589 $Arguments: | |
590 | |
591 *******************************************************************************/ | |
592 static void mmi_audio_player_menu_list_listmnu_cb(T_MFW_HND Parent, ListMenuData * ListData) | |
593 { | |
594 T_MFW_WIN *win_data = ((T_MFW_HDR *)Parent)->data; | |
595 T_player_menu *data = (T_player_menu *)win_data->user; | |
596 char *fileExt; | |
597 | |
598 TRACE_FUNCTION ("mmi_audio_player_menu_list_listmnu_cb()"); | |
599 | |
600 if ((ListData->Reason EQ LISTS_REASON_BACK) || | |
601 (ListData->Reason EQ LISTS_REASON_CLEAR) || | |
602 (ListData->Reason EQ LISTS_REASON_HANGUP)) | |
603 { | |
604 /* | |
605 ** Destroy the window --- Not sure if this is required! ... leave it out for now | |
606 */ | |
607 listsDestroy(ListData->win); | |
608 | |
609 /* | |
610 ** Free the memory set aside for ALL the devices to be listed. | |
611 */ | |
612 if (data->menu_list_data != NULL) | |
613 { | |
614 FREE_MEMORY ((void *)data->menu_list_data->List, (U16)(data->player_num_file* sizeof (T_MFW_MNU_ITEM))); | |
615 FREE_MEMORY ((void *)data->menu_list_data, sizeof (ListMenuData)); | |
616 } | |
617 | |
618 mmi_audio_player_menu_destroy(data->win); | |
619 | |
620 | |
621 } | |
622 //Sep 29,2005 REF: SPR 34407 xdeepadh | |
623 else if(ListData->Reason EQ LISTS_REASON_SELECT) | |
624 { | |
625 TRACE_EVENT_P1("list position is %d",ListData->ListPosition); | |
626 //call mfw to save selected index | |
627 mfw_audio_player_save_selected_file_idx(ListData->ListPosition); | |
628 fileExt =(char*) mfw_audio_player_GetExtension(inputFileName); | |
629 | |
630 //Decide whether to play Mp3 or AAC | |
631 if ( (strcmp(fileExt, "mp3") == 0)) | |
632 { | |
633 IsMP3On = MFW_PLAYER_MP3; | |
634 } | |
635 #ifdef FF_MMI_TEST_AAC | |
636 else if ( (strcmp(fileExt, "aac") == 0)) | |
637 { | |
638 IsMP3On = MFW_PLAYER_AAC; | |
639 } | |
640 #endif | |
641 data->player_list_idx = ListData->ListPosition; | |
642 mmi_audio_player_show_info(0, TxtPlayerFileSelected, TxtNull, NULL); | |
643 } | |
644 | |
645 return; | |
646 } | |
647 | |
648 /******************************************************************************* | |
649 | |
650 $Function: mmi_audio_player_files_win_cb | |
651 | |
652 $Description: Window event handler | |
653 | |
654 $Returns: MFW_EVENT_REJECTED: | |
655 MFW_EVENT_CONSUMED: | |
656 | |
657 $Arguments: | |
658 | |
659 *******************************************************************************/ | |
660 static int mmi_audio_player_files_win_cb (MfwEvt e, MfwWin *w) | |
661 { | |
662 TRACE_FUNCTION ("mmi_audio_player_files_win_cb()"); | |
663 switch (e) | |
664 { | |
665 case MfwWinVisible: /* window is visible */ | |
666 break; | |
667 case MfwWinFocussed: /* input focus / selected */ | |
668 case MfwWinDelete: /* window will be deleted */ | |
669 | |
670 default: | |
671 return MFW_EVENT_REJECTED; | |
672 } | |
673 return MFW_EVENT_CONSUMED; | |
674 } | |
675 | |
676 /******************************************************************************* | |
677 | |
678 $Function: mmi_audio_player_files_exec_cb | |
679 | |
680 $Description: Call back function | |
681 | |
682 $Returns: none | |
683 | |
684 $Arguments: | |
685 | |
686 *******************************************************************************/ | |
687 void mmi_audio_player_files_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
688 { | |
689 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
690 T_player_menu * data = (T_player_menu *)win_data->user; | |
691 int max_file_number; | |
692 int i; | |
693 | |
694 TRACE_FUNCTION ("mmi_audio_player_files_exec_cb"); | |
695 | |
696 switch (event) | |
697 { | |
698 case E_INIT: | |
699 | |
700 TRACE_EVENT(">>>> mmi_audio_player_files_exec_cb() Event:E_INIT"); | |
701 | |
702 /* initialization of administrative data */ | |
703 | |
704 data->menu_list_data = (ListMenuData *)ALLOC_MEMORY(sizeof(ListMenuData)); | |
705 | |
706 if(data->menu_list_data == 0) | |
707 { | |
708 TRACE_EVENT("Failed memory alloc 1 "); | |
709 return; | |
710 } | |
711 | |
712 max_file_number = mfw_audio_player_return_file_number(); | |
713 //In case no files have been loaded display info message | |
714 //In case no files have been loaded return info message | |
715 if(max_file_number == 0) | |
716 { | |
717 mmi_audio_player_show_info(0, TxtPlayerFileNotLoaded, TxtNull, NULL); | |
718 return; | |
719 } | |
720 | |
721 | |
722 data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( max_file_number * sizeof(T_MFW_MNU_ITEM) ); | |
723 | |
724 if(data->menu_list_data->List == 0) | |
725 { | |
726 TRACE_EVENT("Failed memory alloc 2"); | |
727 return; | |
728 } | |
729 //Sep 29,2005 REF: SPR 34407 xdeepadh | |
730 for (i = 0; i < max_file_number ; i++) | |
731 { | |
732 mnuInitDataItem(&data->menu_list_data->List[i]); | |
733 data->menu_list_data->List[i].flagFunc = item_flag_none; | |
734 //Display the Player file names in the list | |
735 data->menu_list_data->List[i].str = (char *)mfw_audio_player_return_file_name(data->player_file_count++); | |
736 } | |
737 | |
738 data->menu_list_data->ListLength =max_file_number; | |
739 data->menu_list_data->ListPosition = 1; | |
740 data->menu_list_data->CursorPosition = 1; | |
741 data->menu_list_data->SnapshotSize = max_file_number; | |
742 data->menu_list_data->Font = 0; | |
743 data->menu_list_data->LeftSoftKey = TxtSoftSelect; | |
744 data->menu_list_data->RightSoftKey = TxtSoftBack; | |
745 data->menu_list_data->KeyEvents = KEY_ALL; | |
746 data->menu_list_data->Reason = 0; | |
747 data->menu_list_data->Strings = TRUE; | |
748 data->menu_list_data->Attr = (MfwMnuAttr*)&menuPlayerSearchListAttr; | |
749 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
750 | |
751 data->menu_list_data->Attr->hdrId = TxtPlayerTest; | |
752 data->menu_list_data->autoDestroy = FALSE; | |
753 listDisplayListMenu(win, data->menu_list_data,(ListCbFunc)mmi_audio_player_menu_list_listmnu_cb,0); | |
754 | |
755 break; | |
756 | |
757 | |
758 default: | |
759 break; | |
760 } | |
761 | |
762 } | |
763 | |
764 | |
765 /******************************************************************************* | |
766 | |
767 $Function: mmi_audio_player_files_browse | |
768 | |
769 $Description: This function is called when the user selects "Browse Player Files" option | |
770 | |
771 $Returns: MFW_EVENT_CONSUMED | |
772 | |
773 $Arguments: | |
774 | |
775 | |
776 *******************************************************************************/ | |
777 GLOBAL int mmi_audio_player_files_browse( MfwMnu *m, MfwMnuItem *i ) | |
778 { | |
779 T_MFW_HND win; | |
780 T_MFW_HND parent_win = mfw_parent(mfw_header()); | |
781 int numberOfMelodies=0; | |
782 | |
783 TRACE_FUNCTION ("mmi_audio_player_files_browse"); | |
784 //Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
785 mfw_audio_player_init(); | |
786 | |
787 numberOfMelodies = mfw_audio_player_return_file_number(); | |
788 TRACE_EVENT_P1("numberOfMelodies is %d",numberOfMelodies); | |
789 | |
790 if(numberOfMelodies <= 0) | |
791 { | |
792 mmi_audio_player_show_info(0, TxtPlayerFileNotLoaded, TxtNull, NULL); | |
793 | |
794 } | |
795 else | |
796 { | |
797 win = mmi_audio_player_build_player_Menu(parent_win); | |
798 | |
799 if (win NEQ NULL) | |
800 { | |
801 SEND_EVENT (win, E_INIT, 0, 0); | |
802 } | |
803 | |
804 } | |
805 return MFW_EVENT_CONSUMED; | |
806 } | |
807 | |
808 | |
809 //Sep 29,2005 REF: SPR 34407 xdeepadh | |
810 /******************************************************************************* | |
811 | |
812 $Function: mmi_audio_player_build_player_Menu | |
813 | |
814 $Description: To hold list window | |
815 | |
816 $Returns: Window handle | |
817 | |
818 $Arguments: | |
819 *******************************************************************************/ | |
820 | |
821 static T_MFW_HND mmi_audio_player_build_player_Menu( MfwHnd parent_window) | |
822 { | |
823 T_player_menu * data = (T_player_menu *)mfwAlloc(sizeof (T_player_menu)); | |
824 T_MFW_WIN * win; | |
825 | |
826 TRACE_FUNCTION ("mmi_audio_player_build_player_Menu"); | |
827 | |
828 /* | |
829 * Create window handler | |
830 */ | |
831 | |
832 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)mmi_audio_player_files_win_cb); | |
833 if (data->win EQ NULL) | |
834 { | |
835 return NULL; | |
836 } | |
837 | |
838 TRACE_EVENT("list holder window created: " ); | |
839 /* | |
840 * connect the dialog data to the MFW-window | |
841 */ | |
842 | |
843 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_audio_player_files_exec_cb; | |
844 data->mmi_control.data = data; | |
845 win = ((T_MFW_HDR *)data->win)->data; | |
846 win->user = (void *)data; | |
847 data->parent = parent_window; | |
848 winShow(data->win); | |
849 /* | |
850 * return window handle | |
851 */ | |
852 | |
853 return data->win; | |
854 } | |
855 | |
856 //Sep 27,2005 REF: SPR 34402 xdeepadh | |
857 /******************************************************************************* | |
858 | |
859 $Function: mmi_audio_player_set_cur_selected_channels | |
860 | |
861 $Description: The Menu for Player channels will be displayed, | |
862 by highlighting the selected menu item. | |
863 | |
864 $Returns:None | |
865 | |
866 $Arguments:None | |
867 | |
868 *******************************************************************************/ | |
869 | |
870 void mmi_audio_player_set_cur_selected_channels(void) | |
871 { | |
872 UBYTE CurSel; | |
873 T_MFW_HND setting_win; | |
874 T_MFW_HND win = mfw_parent(mfw_header()); | |
875 | |
876 setting_win =(T_MFW_HND) bookMenuStart(win, (MfwMnuAttr*)PlayerChannelAttributes(), 0); | |
877 | |
878 CurSel = FFS_flashData.player_channel_state; | |
879 SEND_EVENT(setting_win, DEFAULT_OPTION, NULL, &CurSel); | |
880 } | |
881 | |
882 #if (BOARD == 71) | |
883 /******************************************************************************* | |
884 | |
885 $Function: mmi_audio_player_pause | |
886 | |
887 $Description: set player to pause | |
888 | |
889 $Returns: | |
890 | |
891 $Arguments: | |
892 | |
893 *******************************************************************************/ | |
894 int M_exePause (MfwMnu* m, MfwMnuItem* i) | |
895 { | |
896 | |
897 mfw_audio_player_pause(); | |
898 IsPaused=TRUE; | |
899 mmi_mp3_test_opt_destroy(optionwin); | |
900 optionwin = NULL; | |
901 dspl_ClearAll(); | |
902 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayerPause); | |
903 displaySoftKeys(TxtPlayerResume, TxtStop); | |
904 | |
905 | |
906 return 1; | |
907 } | |
908 | |
909 | |
910 /******************************************************************************* | |
911 | |
912 $Function: mmi_audio_player_forward | |
913 | |
914 $Description: set player to forward | |
915 | |
916 $Returns: | |
917 | |
918 $Arguments: | |
919 | |
920 *******************************************************************************/ | |
921 int M_exeForward (MfwMnu* m, MfwMnuItem* i) | |
922 { | |
923 | |
924 mmi_mp3_test_opt_destroy(optionwin); | |
925 optionwin = NULL; | |
926 dspl_ClearAll(); | |
927 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayerResume); | |
928 displaySoftKeys(TxtSoftOptions, TxtStop); | |
929 mfw_audio_player_forward(MP3_FORWARD_REWIND_TIME); | |
930 mmi_audio_player_show_info(0, TxtPlayerForwarding, TxtNull, NULL); | |
931 | |
932 return 1; | |
933 } | |
934 | |
935 /******************************************************************************* | |
936 | |
937 $Function: mmi_audio_player_rewind | |
938 | |
939 $Description: set player to rewind | |
940 | |
941 $Returns: | |
942 | |
943 $Arguments: | |
944 | |
945 *******************************************************************************/ | |
946 int M_exeRewind (MfwMnu* m, MfwMnuItem* i) | |
947 { | |
948 mmi_mp3_test_opt_destroy(optionwin); | |
949 optionwin = NULL; | |
950 dspl_ClearAll(); | |
951 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayerResume); | |
952 displaySoftKeys(TxtSoftOptions, TxtStop); | |
953 mfw_audio_player_rewind(MP3_FORWARD_REWIND_TIME); | |
954 mmi_audio_player_show_info(0, TxtPlayerRewinding, TxtNull, NULL); | |
955 | |
956 return 1; | |
957 } | |
958 #endif | |
959 | |
960 /******************************************************************************* | |
961 | |
962 $Function: mmi_audio_player_set_channel_mono | |
963 | |
964 $Description: set channels to mono | |
965 | |
966 $Returns: | |
967 | |
968 $Arguments: | |
969 | |
970 *******************************************************************************/ | |
971 GLOBAL int mmi_audio_player_set_channel_mono (MfwMnu* m, MfwMnuItem* i) | |
972 { | |
973 | |
974 SHORT mfw_audio_player_retVal; | |
975 | |
976 TRACE_FUNCTION ("mmi_audio_player_set_channel_mono()"); | |
977 | |
978 mfw_audio_player_retVal = mfw_audio_player_set_channel_mono(); | |
979 if(mfw_audio_player_retVal != MFW_PLAYER_TEST_OK) | |
980 { | |
981 TRACE_FUNCTION ("mmi_audio_player_set_channel_mono(): Riviera Failed"); | |
982 mmi_audio_player_show_info(0, TxtPlayerTest, TxtNull, NULL); | |
983 } | |
984 else | |
985 { | |
986 // Sep 27,2005 REF: SPR 34402 xdeepadh | |
987 // The channel state will be written into the flash. | |
988 FFS_flashData.player_channel_state = PLAYER_CHANNEL_MONO ; | |
989 flash_write(); | |
990 mmi_audio_player_show_info(0, TxtPlayerMonoChannel, TxtNull, NULL); | |
991 } | |
992 | |
993 return 1; | |
994 } | |
995 | |
996 /******************************************************************************* | |
997 | |
998 $Function: mmi_audio_player_set_channel_stereo | |
999 | |
1000 $Description: set channels to stereo | |
1001 | |
1002 $Returns: | |
1003 | |
1004 $Arguments: | |
1005 | |
1006 *******************************************************************************/ | |
1007 GLOBAL int mmi_audio_player_set_channel_stereo (MfwMnu* m, MfwMnuItem* i) | |
1008 { | |
1009 | |
1010 SHORT mfw_audio_player_retVal; | |
1011 | |
1012 TRACE_FUNCTION ("mmi_audio_player_set_channel_stereo()"); | |
1013 mfw_audio_player_retVal = mfw_audio_player_set_channel_stereo(); | |
1014 if(mfw_audio_player_retVal != MFW_PLAYER_TEST_OK) | |
1015 { | |
1016 TRACE_FUNCTION ("mmi_audio_player_set_channel_stereo(): Riviera Failed"); | |
1017 mmi_audio_player_show_info(0, TxtPlayerTest, TxtNull, NULL); | |
1018 } | |
1019 else | |
1020 { | |
1021 // Sep 27,2005 REF: SPR 34402 xdeepadh | |
1022 // The channel state will be written into the flash. | |
1023 FFS_flashData.player_channel_state = PLAYER_CHANNEL_STEREO; | |
1024 flash_write(); | |
1025 mmi_audio_player_show_info(0, TxtPlayerStereoChannel, TxtNull, NULL); | |
1026 } | |
1027 | |
1028 return 1; | |
1029 } | |
1030 | |
1031 | |
1032 /******************************************************************************* | |
1033 | |
1034 $Function: mmi_audio_player_show_info | |
1035 | |
1036 $Description: | |
1037 | |
1038 $Returns: | |
1039 | |
1040 $Arguments: | |
1041 | |
1042 *******************************************************************************/ | |
1043 static MfwHnd mmi_audio_player_show_info(T_MFW_HND parent, int str1, int str2, T_VOID_FUNC callback) | |
1044 { | |
1045 T_DISPLAY_DATA display_info; | |
1046 | |
1047 TRACE_FUNCTION ("mmi_audio_player_show_info()"); | |
1048 | |
1049 /* | |
1050 ** Create a timed dialog to display the Message "Failed" | |
1051 */ | |
1052 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, str1, str2, COLOUR_STATUS); | |
1053 dlg_initDisplayData_events( &display_info, callback, PLAYER_INFO_SCRN_TIMEOUT, KEY_LEFT | KEY_CLEAR | KEY_HUP); | |
1054 | |
1055 return info_dialog(parent, &display_info); | |
1056 } | |
1057 | |
1058 | |
1059 //Jul 18, 2005 REF: SPR 31695 xdeepadh | |
1060 | |
1061 /******************************************************************************* | |
1062 | |
1063 $Function: mmi_audio_player_play_destroy | |
1064 | |
1065 $Description: Destruction of an dialog | |
1066 | |
1067 $Returns: void | |
1068 | |
1069 $Arguments: win | |
1070 | |
1071 *******************************************************************************/ | |
1072 void mmi_audio_player_play_destroy (T_MFW_HND own_window) | |
1073 { | |
1074 T_MFW_WIN * win = ((T_MFW_HDR *)own_window)->data; | |
1075 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)win->user; | |
1076 | |
1077 TRACE_FUNCTION ("mmi_audio_player_play_destroy()"); | |
1078 | |
1079 if (own_window == NULL) | |
1080 { | |
1081 TRACE_EVENT ("Error : Called with NULL Pointer"); | |
1082 return; | |
1083 } | |
1084 | |
1085 if (data) | |
1086 { | |
1087 /* | |
1088 * Exit KEYBOARD Handle | |
1089 */ | |
1090 kbd_delete (data->kbd); | |
1091 | |
1092 /* | |
1093 * Delete WIN Handler | |
1094 */ | |
1095 win_delete (data->info_win); | |
1096 /* | |
1097 * Free Memory | |
1098 */ | |
1099 FREE_MEMORY ((void *)data, sizeof (T_MMI_Player_Win_data)); | |
1100 } | |
1101 } | |
1102 | |
1103 //Jul 18, 2005 REF: SPR 31695 xdeepadh | |
1104 | |
1105 /******************************************************************************* | |
1106 | |
1107 $Function: mmi_audio_player_play_kbd_cb | |
1108 | |
1109 $Description: Keyboard event handler | |
1110 | |
1111 $Returns: status int | |
1112 | |
1113 $Arguments: window handle event, keyboard control block | |
1114 | |
1115 *******************************************************************************/ | |
1116 | |
1117 static int mmi_audio_player_play_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
1118 { | |
1119 T_MFW_HND win = mfw_parent (mfw_header()); | |
1120 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
1121 T_MMI_Player_Win_data *data = (T_MMI_Player_Win_data *)win_data->user; | |
1122 | |
1123 TRACE_FUNCTION("mmi_audio_player_play_kbd_cb"); | |
1124 | |
1125 switch (keyboard->code) | |
1126 { | |
1127 | |
1128 case KCD_LEFT: | |
1129 | |
1130 if(IsPaused == FALSE) | |
1131 { | |
1132 #if (BOARD == 71) | |
1133 if(IsMP3On == MFW_PLAYER_AAC) | |
1134 { | |
1135 #endif | |
1136 mfw_audio_player_pause(); | |
1137 /* | |
1138 * Clear Screen | |
1139 */ | |
1140 dspl_ClearAll(); | |
1141 /* | |
1142 * Print the information screen | |
1143 */ | |
1144 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayerPause); | |
1145 /* | |
1146 * Print softkeys | |
1147 */ | |
1148 displaySoftKeys(TxtPlayerResume, TxtStop); | |
1149 IsPaused=TRUE; | |
1150 #if (BOARD == 71) | |
1151 } | |
1152 else | |
1153 { | |
1154 mmi_mp3_test_opt_start(data->win,(MfwMnuAttr*)&Mmi_mp3_OPTAttrib); | |
1155 } | |
1156 #endif | |
1157 } | |
1158 else | |
1159 { | |
1160 | |
1161 /* | |
1162 * Clear Screen | |
1163 */ | |
1164 dspl_ClearAll(); | |
1165 mfw_audio_player_resume(); | |
1166 /* | |
1167 * Print the information screen | |
1168 */ | |
1169 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayerResume); | |
1170 | |
1171 /* | |
1172 * Print softkeys | |
1173 */ | |
1174 #if (BOARD == 71) | |
1175 if(IsMP3On == MFW_PLAYER_AAC) | |
1176 #endif | |
1177 displaySoftKeys(TxtPlayerPause, TxtStop); | |
1178 #if (BOARD == 71) | |
1179 else | |
1180 displaySoftKeys(TxtSoftOptions, TxtStop); | |
1181 #endif | |
1182 IsPaused = FALSE; | |
1183 } | |
1184 break; | |
1185 case KCD_HUP: | |
1186 case KCD_RIGHT: | |
1187 mfw_audio_player_stop(); | |
1188 IsPaused = FALSE;/*a0393213 warnings removal- == made =*/ | |
1189 //go back to the previous dialog | |
1190 SEND_EVENT (win, PLAYER_DESTROY, 0, 0); | |
1191 break; | |
1192 | |
1193 default: | |
1194 break; | |
1195 } | |
1196 return MFW_EVENT_CONSUMED; | |
1197 } | |
1198 //Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
1199 /******************************************************************************* | |
1200 | |
1201 $Function: mmi_audio_player_start_cb | |
1202 | |
1203 $Description: Mmi callback function for mp3 test application | |
1204 | |
1205 $Returns: void | |
1206 | |
1207 $Arguments: win, window handle | |
1208 | |
1209 *******************************************************************************/ | |
1210 void mmi_audio_player_start_cb(T_MFW_HND win, SHORT value) | |
1211 { | |
1212 // Jun 02,2006 REF: DR OMAPS00079746 x0039928 | |
1213 // Fix: MP3 playback error is handled. | |
1214 if (value < 0) | |
1215 mmi_audio_player_show_info(0, TxtError, TxtNull, NULL); | |
1216 | |
1217 #if (BOARD == 71) | |
1218 if(optionwin != NULL) | |
1219 { mmi_mp3_test_opt_destroy(optionwin); | |
1220 optionwin = NULL; | |
1221 } | |
1222 #endif | |
1223 | |
1224 IsPaused = FALSE;/*a0393213 warnings removal- '==' made '='*/ | |
1225 mmi_audio_player_play_destroy(win); | |
1226 dspl_Enable(TRUE); | |
1227 } | |
1228 | |
1229 //Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
1230 /******************************************************************************* | |
1231 | |
1232 $Function: mmi_audio_player_callback_init | |
1233 | |
1234 $Description: Initializes the mmi return callback path. | |
1235 | |
1236 $Returns: void | |
1237 | |
1238 $Arguments: window handle, callback function | |
1239 | |
1240 *******************************************************************************/ | |
1241 //Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
1242 static void mmi_audio_player_callback_init(T_MFW_HND win, void (*callback)(T_MFW_HND, SHORT )) | |
1243 { | |
1244 mmi_audio_player_return_path.focus_win = win; | |
1245 mmi_audio_player_return_path.callback = callback; | |
1246 } | |
1247 | |
1248 //Jul 18, 2005 REF: SPR 31695 xdeepadh | |
1249 /******************************************************************************* | |
1250 | |
1251 $Function: mmi_audio_player_play_exec_cb | |
1252 | |
1253 $Description: Dialog function for Player test app dialog | |
1254 | |
1255 $Returns: void | |
1256 | |
1257 $Arguments: win, window handle event, value, parameter | |
1258 | |
1259 *******************************************************************************/ | |
1260 void mmi_audio_player_play_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
1261 { | |
1262 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1263 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)win_data->user; | |
1264 | |
1265 TRACE_FUNCTION ("mmi_audio_player_play_exec_cb()"); | |
1266 | |
1267 | |
1268 switch (event) | |
1269 { | |
1270 case PLAYER_INIT: | |
1271 TRACE_EVENT ("PLAYER_INIT()"); | |
1272 // Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
1273 // Initialize the callback function to the return path. | |
1274 mmi_audio_player_callback_init(win, mmi_audio_player_start_cb); | |
1275 | |
1276 | |
1277 | |
1278 // Initialize dialog | |
1279 //Create keyboard handler | |
1280 data->kbd = kbd_create (win, KEY_ALL, (T_MFW_CB)mmi_audio_player_play_kbd_cb); | |
1281 if (value EQ PLAYER_PLAY) | |
1282 { | |
1283 TRACE_EVENT ("PLAYER_PLAY()"); | |
1284 | |
1285 mfw_audio_player_play(); | |
1286 win_show (win); | |
1287 } | |
1288 break; | |
1289 | |
1290 case PLAYER_DESTROY: | |
1291 mmi_audio_player_play_destroy(win); | |
1292 break; | |
1293 } | |
1294 } | |
1295 | |
1296 //Jul 18, 2005 REF: SPR 31695 xdeepadh | |
1297 | |
1298 /******************************************************************************* | |
1299 | |
1300 $Function: mmi_audio_player_play_win_cb | |
1301 | |
1302 $Description: Callback function for information dialog | |
1303 | |
1304 $Returns: void | |
1305 | |
1306 $Arguments: window handle event, win | |
1307 *******************************************************************************/ | |
1308 static int mmi_audio_player_play_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) | |
1309 { | |
1310 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)win->user; | |
1311 | |
1312 TRACE_FUNCTION ("mmi_audio_player_play_win_cb()"); | |
1313 | |
1314 if (data EQ NULL) | |
1315 return NULL; | |
1316 | |
1317 switch (event) | |
1318 { | |
1319 case E_WIN_VISIBLE: | |
1320 if (win->flags & E_WIN_VISIBLE) | |
1321 { | |
1322 /* | |
1323 * Clear Screen | |
1324 */ | |
1325 dspl_ClearAll(); | |
1326 /* | |
1327 * Print the information screen | |
1328 */ | |
1329 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayerPlaying); | |
1330 /* | |
1331 * Print softkeys | |
1332 */ | |
1333 #if (BOARD == 71) | |
1334 if(IsMP3On == MFW_PLAYER_AAC) | |
1335 #endif | |
1336 displaySoftKeys(TxtPlayerPause, TxtStop); | |
1337 #if (BOARD == 71) | |
1338 else | |
1339 displaySoftKeys(TxtSoftOptions,TxtStop ); | |
1340 #endif | |
1341 } | |
1342 break; | |
1343 | |
1344 default: | |
1345 return 0; | |
1346 } | |
1347 return 1; | |
1348 } | |
1349 | |
1350 //Jul 18, 2005 REF: SPR 31695 xdeepadh | |
1351 /******************************************************************************* | |
1352 | |
1353 $Function: mmi_audio_player_play_create | |
1354 | |
1355 $Description: Creation of window | |
1356 | |
1357 $Returns: Dialogue info win | |
1358 | |
1359 $Arguments: parent win | |
1360 | |
1361 *******************************************************************************/ | |
1362 static T_MFW_HND mmi_audio_player_play_create (T_MFW_HND parent_win) | |
1363 { | |
1364 T_MFW_WIN * win_data; | |
1365 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)ALLOC_MEMORY (sizeof (T_MMI_Player_Win_data)); | |
1366 | |
1367 TRACE_FUNCTION ("mmi_audio_player_play_create()"); | |
1368 | |
1369 data->info_win = win_create (parent_win, 0, E_WIN_VISIBLE, (T_MFW_CB)mmi_audio_player_play_win_cb); | |
1370 | |
1371 if (data->info_win EQ NULL) | |
1372 return NULL; | |
1373 | |
1374 /* | |
1375 * Create window handler | |
1376 */ | |
1377 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_audio_player_play_exec_cb; | |
1378 data->mmi_control.data = data; | |
1379 data->parent_win = parent_win; | |
1380 win_data = ((T_MFW_HDR *)data->info_win)->data; | |
1381 win_data->user = (void *)data; | |
1382 | |
1383 /* | |
1384 * return window handle | |
1385 */ | |
1386 return data->info_win; | |
1387 } | |
1388 | |
1389 //Jul 18, 2005 REF: SPR 31695 xdeepadh | |
1390 /******************************************************************************* | |
1391 | |
1392 $Function: mmi_audio_player_play_start | |
1393 | |
1394 $Description: create a new voicememo dialog | |
1395 | |
1396 $Returns: Dialogue info win | |
1397 | |
1398 $Arguments: parent win, display info | |
1399 | |
1400 *******************************************************************************/ | |
1401 T_MFW_HND mmi_audio_player_play_start (T_MFW_HND parent_win, SHORT ID) | |
1402 { | |
1403 T_MFW_HND win; | |
1404 | |
1405 win = mmi_audio_player_play_create (parent_win); | |
1406 | |
1407 | |
1408 if (win NEQ NULL) | |
1409 { | |
1410 SEND_EVENT (win, PLAYER_INIT, ID, 0); | |
1411 } | |
1412 return win; | |
1413 } | |
1414 | |
1415 | |
1416 //Jul 18, 2005 REF: SPR 31695 xdeepadh | |
1417 | |
1418 /******************************************************************************* | |
1419 | |
1420 $Function: mmi_audio_player_play | |
1421 | |
1422 $Description: | |
1423 | |
1424 $Returns: | |
1425 | |
1426 $Arguments: | |
1427 | |
1428 *******************************************************************************/ | |
1429 GLOBAL int mmi_audio_player_play (MfwMnu* m, MfwMnuItem* i) | |
1430 { | |
1431 T_MFW_HND win = mfw_parent(mfw_header()); | |
1432 int max_file_number; | |
1433 | |
1434 TRACE_FUNCTION ("mmi_audio_player_play()"); | |
1435 | |
1436 //If no file is selected inform the user | |
1437 //retrieve from MFW number of files loaded | |
1438 max_file_number = mfw_audio_player_return_file_number(); | |
1439 //In case no files have been loaded return info message | |
1440 if(max_file_number == 0) | |
1441 { | |
1442 mmi_audio_player_show_info(0, TxtPlayerFileNotLoaded, TxtNull, NULL); | |
1443 } | |
1444 //If no file is selected inform the user | |
1445 else if(audio_player_currently_playing_idx < 0) | |
1446 | |
1447 { | |
1448 mmi_audio_player_show_info(0, TxtPlayerSelectFile, TxtNull, NULL); | |
1449 | |
1450 } | |
1451 else | |
1452 { | |
1453 //create a new Player playing screen | |
1454 mmi_audio_player_play_start (win, PLAYER_PLAY); | |
1455 } | |
1456 | |
1457 return 1; | |
1458 } | |
1459 | |
1460 //Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
1461 /******************************************************************************* | |
1462 | |
1463 $Function: mmi_audio_player_Application_cb | |
1464 | |
1465 $Description: Callback function called on exiting the audio player appilcation | |
1466 | |
1467 $Returns: None | |
1468 | |
1469 $Arguments: parent_win : Parent window | |
1470 identifier : | |
1471 reason: | |
1472 *******************************************************************************/ | |
1473 static void mmi_audio_player_Application_cb(T_MFW_HND parent_win, UBYTE identifier, UBYTE reason) | |
1474 { | |
1475 TRACE_FUNCTION("mmi_audio_player_Application_cb"); | |
1476 mfw_audio_player_unpopulate_files(); | |
1477 } | |
1478 /******************************************************************************* | |
1479 | |
1480 $Function: mmi_audio_player_Application | |
1481 | |
1482 $Description: Launcing the audio player application menu | |
1483 | |
1484 $Returns: | |
1485 | |
1486 $Arguments: m : pointer to the mnu data for the menu which caused this function to be called. | |
1487 i : pointer to the item data from the menu. | |
1488 | |
1489 *******************************************************************************/ | |
1490 | |
1491 GLOBAL int mmi_audio_player_Application (MfwMnu* m, MfwMnuItem* i) | |
1492 { | |
1493 T_MFW_HND win; | |
1494 T_MFW_HND parent_win = mfw_parent(mfw_header()); | |
1495 TRACE_FUNCTION("mmi_audio_player_Application"); | |
1496 win=bookMenuStart(parent_win, AudioPlayerAppMenuAttributes(),0); | |
1497 SEND_EVENT(win, ADD_CALLBACK, NULL, (void *)mmi_audio_player_Application_cb); | |
1498 return MFW_EVENT_CONSUMED; | |
1499 } | |
1500 |