comparison src/aci2/bmi/MmiMP3Test.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
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 Nov 16,2005 REF: DR OMAPS00049192 x0039928
30 Bug:MP3: The screen is not refreshed after the mp3 file completes playing
31 Fix: The window is destroyed in mmi_mp3_test_start_cb() after AUDIO_OK
32 event is received in the mfw callback.
33
34 17/05/04
35 Sep 29,2005 REF: SPR 34407 xdeepadh
36 Bug:Back soft key takes more time to return to the previous screen in MP3 application
37 Fix:The list creation for MP3 files has been modified
38
39
40 Sep 27,2005 REF: SPR 34402 xdeepadh
41 Bug:Mono option is always highlighted even when Stereo is selected
42 Fix:The channel setting will be saved in the FFS, which will be retrieved
43 later and the selected channel will be higlighted.
44
45 Jul 18, 2005 REF: SPR 31695 xdeepadh
46 Bug:Problems with MP3 test application
47 Fix:The window handling of MP3 Test Application has been done properly.
48
49 $End
50
51 *******************************************************************************/
52
53
54
55
56 /*******************************************************************************
57
58 Include files
59
60 *******************************************************************************/
61 #define ENTITY_MFW
62
63 /* includes */
64
65 #include <string.h>
66 #include <stdio.h>
67 #include <stdlib.h>
68
69 #include "typedefs.h"
70 #include "vsi.h"
71 #include "pei.h"
72 #include "custom.h"
73
74 #if defined (NEW_FRAME)
75
76 #include "typedefs.h"
77 #include "vsi.h"
78 #include "pei.h"
79 #include "custom.h"
80 #include "gsm.h"
81 #include "prim.h"
82
83 #else
84
85 #include "STDDEFS.H"
86 #include "custom.h"
87 #include "gsm.h"
88 #include "vsi.h"
89
90 #endif
91
92 #include "message.h" /* included for aci_cmh.h .... */
93 #include "aci_cmh.h" /* included for mfw_sat.h, included for MmiDummy.h, included for MmiMenu.h */
94
95 #include "mfw_mfw.h"
96 #include "mfw_win.h"
97 #include "mfw_icn.h" /* included for mfw_mnu.h */
98 #include "mfw_mnu.h"
99 #include "mfw_tim.h"
100 #include "mfw_kbd.h"
101 #include "mfw_sat.h" /* included for MmiDummy.h, included for MmiMenu.h */
102 #include "mfw_mp3test.h"
103
104 #include "MmiBlkLangDB.h"
105 #include "mmiColours.h"
106 #include "MmiDialogs.h"
107
108 #include "MmiDummy.h" /* included for MmiMenu.h */
109 #include "MmiLists.h"
110 #include "MmiMenu.h"
111 #include "MmiSoftKeys.h"
112 #include "MmiMP3Test.h"
113 #include "MmiMain.h"
114 #include "Mmiicons.h"
115 #include "Icons\IcnDefs.h"
116 //Sep 27,2005 REF: SPR 34402 xdeepadh
117 #include "MmiBookShared.h"
118 #include "mfw_ffs.h"
119
120 /*******************************************************************************
121
122 internal data
123
124 *******************************************************************************/
125
126 /*
127 * Internal events
128 */
129 // E_INIT event definition
130 #define E_INIT 1
131
132 //Sep 27,2005 REF: SPR 34402 xdeepadh
133 //defines for channels
134 #define PLAYER_CHANNEL_MONO 0
135 #define PLAYER_CHANNEL_STEREO 1
136
137 //Jul 18, 2005 REF: SPR 31695 xdeepadh
138 //Defines for Player events
139 #define PLAYER_INIT 500
140 #define PLAYER_DESTROY 501
141 #define PLAYER_PLAY 502
142
143 /*local defines*/
144 #define PLAYER_INFO_SCRN_TIMEOUT 1500
145
146 typedef struct
147 {
148 T_MMI_CONTROL mmi_control;
149 MfwHnd win;
150 MfwHnd info_win; //Jul 18, 2005 REF: SPR 31695 xdeepadh
151 MfwHnd parent_win;//Jul 18, 2005 REF: SPR 31695 xdeepadh
152 MfwHnd mfwwin;
153 MfwHnd callwin;
154 MfwHnd kbd;
155 } T_MMI_Player_Win_data;
156
157 /*menu data structure definition*/
158 typedef struct
159 {
160 T_MMI_CONTROL mmi_control;
161 T_MFW_HND win;
162 T_MFW_HND parent; //Jul 18, 2005 REF: SPR 31695 xdeepadh
163 T_MFW_HND kbd;
164 T_MFW_HND kbd_long;
165 T_MFW_HND player_menu;
166 T_VOID_FUNC func_cb;
167 UBYTE player_num_file;
168 UBYTE player_file_count;
169 ListCbFunc player_list_cb;
170 UBYTE player_list_idx;
171 ListMenuData * menu_list_data; //Sep 29,2005 REF: SPR 34407 xdeepadh
172 }T_player_menu;
173
174 // Nov 16,2005 REF: DR OMAPS00049192 x0039928
175 // Global variable that holds the mmi return path and is found in mfw_mp3test.c
176 extern MMI_RETURN_PATH mmi_audio_player_return_path;
177
178 /*global menu data*/
179 T_player_menu player_menu_data = {0};
180 /*Boolean to check whether file being played is paused.*/
181 BOOL IsPaused = FALSE;
182 UBYTE IsMfwInit = 0;
183 extern char* inputFileName; // input file
184 extern UBYTE IsMP3On;
185 extern int audio_player_currently_playing_idx ;
186
187
188 /*******************************************************************************
189
190 Local prototypes
191
192 *******************************************************************************/
193 static void mmi_audio_player_menu_list_listmnu_cb(T_MFW_HND Parent, ListMenuData * ListData);
194 static MfwHnd mmi_audio_player_show_info(T_MFW_HND parent, int str1, int str2, T_VOID_FUNC callback);
195 //Sep 29,2005 REF: SPR 34407 xdeepadh
196 static T_MFW_HND mmi_audio_player_build_player_Menu( MfwHnd parent_window);
197
198
199 /*default static menu*/
200 static MfwMnuAttr menuPlayerSearchListAttr =
201 {
202 &menuArea,
203 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
204 -1, /* use default font */
205 NULL, /* with these items (filled in later) */
206 0, /* number of items (filled in leter) */
207 COLOUR_LIST_XX, /* Colour */
208 TxtNull, /* Hdr Id */
209 NULL, /* Background */
210 MNUATTRSPARE /* unused */
211 };
212
213
214 /*******************************************************************************
215
216 $Function: mmi_audio_player_menu_destroy
217
218 $Description: destroy menu window
219
220 $Returns:
221
222 $Arguments:
223
224 *******************************************************************************/
225 static void mmi_audio_player_menu_destroy(MfwHnd window)
226 {
227 T_MFW_WIN * win_data = ((T_MFW_HDR *)window)->data;
228 T_player_menu * data = (T_player_menu *)win_data->user;
229
230 TRACE_FUNCTION ("mmi_audio_player_menu_destroy()");
231
232
233 if (window == NULL)
234 {
235 return;
236 }
237
238 if (data)
239 {
240 win_delete(data->win);
241
242 /*
243 ** Free Memory
244 */
245 mfwFree((void *)data, sizeof (T_player_menu));
246
247 }
248 }
249 //Sep 29,2005 REF: SPR 34407 xdeepadh
250 /*******************************************************************************
251 $Function: mmi_audio_player_menu_list_listmnu_cb
252
253 $Description: destroy lists and menu in case of back softkey or menu exit
254
255 $Returns:
256
257 $Arguments:
258
259 *******************************************************************************/
260 static void mmi_audio_player_menu_list_listmnu_cb(T_MFW_HND Parent, ListMenuData * ListData)
261 {
262 T_MFW_WIN *win_data = ((T_MFW_HDR *)Parent)->data;
263 T_player_menu *data = (T_player_menu *)win_data->user;
264 char *fileExt;
265
266 TRACE_FUNCTION ("mmi_audio_player_menu_list_listmnu_cb()");
267
268 if ((ListData->Reason EQ LISTS_REASON_BACK) ||
269 (ListData->Reason EQ LISTS_REASON_CLEAR) ||
270 (ListData->Reason EQ LISTS_REASON_HANGUP))
271 {
272 /*
273 ** Destroy the window --- Not sure if this is required! ... leave it out for now
274 */
275 listsDestroy(ListData->win);
276
277 /*
278 ** Free the memory set aside for ALL the devices to be listed.
279 */
280 if (data->menu_list_data != NULL)
281 {
282 FREE_MEMORY ((void *)data->menu_list_data->List, (U16)(data->player_num_file* sizeof (T_MFW_MNU_ITEM)));
283 FREE_MEMORY ((void *)data->menu_list_data, sizeof (ListMenuData));
284 }
285
286 mmi_audio_player_menu_destroy(data->win);
287
288
289 }
290 //Sep 29,2005 REF: SPR 34407 xdeepadh
291 else if(ListData->Reason EQ LISTS_REASON_SELECT)
292 {
293 TRACE_EVENT_P1("list position is %d",ListData->ListPosition);
294 //call mfw to save selected index
295 mfw_audio_player_save_selected_file_idx(ListData->ListPosition);
296 fileExt =(char*) mfw_audio_player_GetExtension(inputFileName);
297
298 //Decide whether to play Mp3 or AAC
299 if ( (strcmp(fileExt, "mp3") == 0))
300 {
301 IsMP3On = MFW_PLAYER_MP3;
302 }
303 #ifdef FF_MMI_TEST_AAC
304 else if ( (strcmp(fileExt, "aac") == 0))
305 {
306 IsMP3On = MFW_PLAYER_AAC;
307 }
308 #endif
309 data->player_list_idx = ListData->ListPosition;
310 mmi_audio_player_show_info(0, TxtPlayerFileSelected, TxtNull, NULL);
311 }
312
313 return;
314 }
315
316 /*******************************************************************************
317
318 $Function: mmi_audio_player_files_win_cb
319
320 $Description: Window event handler
321
322 $Returns: MFW_EVENT_REJECTED:
323 MFW_EVENT_CONSUMED:
324
325 $Arguments:
326
327 *******************************************************************************/
328 static int mmi_audio_player_files_win_cb (MfwEvt e, MfwWin *w)
329 {
330 TRACE_FUNCTION ("mmi_audio_player_files_win_cb()");
331 switch (e)
332 {
333 case MfwWinVisible: /* window is visible */
334 break;
335 case MfwWinFocussed: /* input focus / selected */
336 case MfwWinDelete: /* window will be deleted */
337
338 default:
339 return MFW_EVENT_REJECTED;
340 }
341 return MFW_EVENT_CONSUMED;
342 }
343
344 /*******************************************************************************
345
346 $Function: mmi_audio_player_files_exec_cb
347
348 $Description: Call back function
349
350 $Returns: none
351
352 $Arguments:
353
354 *******************************************************************************/
355 void mmi_audio_player_files_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
356 {
357 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
358 T_player_menu * data = (T_player_menu *)win_data->user;
359 SHORT mfw_audio_player_retVal;
360 int line;
361 int max_file_number;
362 int i;
363
364
365 ListWinInfo * mnu_data = (ListWinInfo *)parameter;
366
367 TRACE_FUNCTION ("mmi_audio_player_files_exec_cb");
368
369 switch (event)
370 {
371 case E_INIT:
372
373 TRACE_EVENT(">>>> mmi_audio_player_files_exec_cb() Event:E_INIT");
374
375 /* initialization of administrative data */
376
377 data->menu_list_data = (ListMenuData *)ALLOC_MEMORY(sizeof(ListMenuData));
378
379 if(data->menu_list_data == 0)
380 {
381 TRACE_EVENT("Failed memory alloc 1 ");
382 return;
383 }
384
385 max_file_number = mfw_audio_player_return_file_number();
386 //In case no files have been loaded display info message
387 //In case no files have been loaded return info message
388 if(max_file_number == 0)
389 {
390 mmi_audio_player_show_info(0, TxtPlayerFileNotLoaded, TxtNull, NULL);
391 return;
392 }
393
394
395 data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( max_file_number * sizeof(T_MFW_MNU_ITEM) );
396
397 if(data->menu_list_data->List == 0)
398 {
399 TRACE_EVENT("Failed memory alloc 2");
400 return;
401 }
402 //Sep 29,2005 REF: SPR 34407 xdeepadh
403 for (i = 0; i < max_file_number ; i++)
404 {
405 mnuInitDataItem(&data->menu_list_data->List[i]);
406 data->menu_list_data->List[i].flagFunc = item_flag_none;
407 //Display the Player file names in the list
408 data->menu_list_data->List[i].str = (char *)mfw_audio_player_return_file_name(data->player_file_count++);
409 }
410
411 data->menu_list_data->ListLength =max_file_number;
412 data->menu_list_data->ListPosition = 1;
413 data->menu_list_data->CursorPosition = 1;
414 data->menu_list_data->SnapshotSize = max_file_number;
415 data->menu_list_data->Font = 0;
416 data->menu_list_data->LeftSoftKey = TxtSoftSelect;
417 data->menu_list_data->RightSoftKey = TxtSoftBack;
418 data->menu_list_data->KeyEvents = KEY_ALL;
419 data->menu_list_data->Reason = 0;
420 data->menu_list_data->Strings = TRUE;
421 data->menu_list_data->Attr = (MfwMnuAttr*)&menuPlayerSearchListAttr;
422 //Apr 05, 2005 REF: ENH 29994 xdeepadh
423
424 data->menu_list_data->Attr->hdrId = TxtPlayerTest;
425 data->menu_list_data->autoDestroy = FALSE;
426 listDisplayListMenu(win, data->menu_list_data,(ListCbFunc)mmi_audio_player_menu_list_listmnu_cb,0);
427
428 break;
429
430
431 default:
432 break;
433 }
434
435 }
436
437
438 /*******************************************************************************
439
440 $Function: mmi_audio_player_files_browse
441
442 $Description: This function is called when the user selects "Browse Player Files" option
443
444 $Returns: MFW_EVENT_CONSUMED
445
446 $Arguments:
447
448
449 *******************************************************************************/
450 GLOBAL int mmi_audio_player_files_browse( MfwMnu *m, MfwMnuItem *i )
451 {
452 T_MFW_HND win;
453 T_MFW_HND parent_win = mfw_parent(mfw_header());
454 int numberOfMelodies=0;
455
456 TRACE_FUNCTION ("mmi_audio_player_files_browse");
457 //initialize data in Player MFW
458 if(IsMfwInit==0)
459 {
460 mfw_audio_player_init();
461 IsMfwInit = 1;
462 }
463 numberOfMelodies = mfw_audio_player_return_file_number();
464 TRACE_EVENT_P1("numberOfMelodies is %d",numberOfMelodies);
465
466 if(numberOfMelodies <= 0)
467 {
468 mmi_audio_player_show_info(0, TxtPlayerFileNotLoaded, TxtNull, NULL);
469
470 }
471 else
472 {
473 win = mmi_audio_player_build_player_Menu(parent_win);
474
475 if (win NEQ NULL)
476 {
477 SEND_EVENT (win, E_INIT, 0, 0);
478 }
479
480 }
481 return MFW_EVENT_CONSUMED;
482 }
483
484
485 //Sep 29,2005 REF: SPR 34407 xdeepadh
486 /*******************************************************************************
487
488 $Function: mmi_audio_player_build_player_Menu
489
490 $Description: To hold list window
491
492 $Returns: Window handle
493
494 $Arguments:
495 *******************************************************************************/
496
497 static T_MFW_HND mmi_audio_player_build_player_Menu( MfwHnd parent_window)
498 {
499 T_player_menu * data = (T_player_menu *)mfwAlloc(sizeof (T_player_menu));
500 T_MFW_WIN * win;
501
502 TRACE_FUNCTION ("mmi_audio_player_build_player_Menu");
503
504 /*
505 * Create window handler
506 */
507
508 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)mmi_audio_player_files_win_cb);
509 if (data->win EQ NULL)
510 {
511 return NULL;
512 }
513
514 TRACE_EVENT("list holder window created: " );
515 /*
516 * connect the dialog data to the MFW-window
517 */
518
519 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_audio_player_files_exec_cb;
520 data->mmi_control.data = data;
521 win = ((T_MFW_HDR *)data->win)->data;
522 win->user = (void *)data;
523 data->parent = parent_window;
524 winShow(data->win);
525 /*
526 * return window handle
527 */
528
529 return data->win;
530 }
531
532 //Sep 27,2005 REF: SPR 34402 xdeepadh
533 /*******************************************************************************
534
535 $Function: mmi_audio_player_set_cur_selected_channels
536
537 $Description: The Menu for Player channels will be displayed,
538 by highlighting the selected menu item.
539
540 $Returns:None
541
542 $Arguments:None
543
544 *******************************************************************************/
545
546 void mmi_audio_player_set_cur_selected_channels(void)
547 {
548 UBYTE CurSel;
549 T_MFW_HND setting_win;
550 T_MFW_HND win = mfw_parent(mfw_header());
551
552 setting_win =(T_MFW_HND) bookMenuStart(win, (MfwMnuAttr*)PlayerChannelAttributes(), 0);
553
554 CurSel = FFS_flashData.player_channel_state;
555 SEND_EVENT(setting_win, DEFAULT_OPTION, NULL, &CurSel);
556 }
557
558
559 /*******************************************************************************
560
561 $Function: mmi_audio_player_set_channel_mono
562
563 $Description: set channels to mono
564
565 $Returns:
566
567 $Arguments:
568
569 *******************************************************************************/
570 GLOBAL int mmi_audio_player_set_channel_mono (MfwMnu* m, MfwMnuItem* i)
571 {
572
573 SHORT mfw_audio_player_retVal;
574
575 TRACE_FUNCTION ("mmi_audio_player_set_channel_mono()");
576
577 mfw_audio_player_retVal = mfw_audio_player_set_channel_mono();
578 if(mfw_audio_player_retVal != MFW_PLAYER_TEST_OK)
579 {
580 TRACE_FUNCTION ("mmi_audio_player_set_channel_mono(): Riviera Failed");
581 mmi_audio_player_show_info(0, TxtPlayerTest, TxtNull, NULL);
582 }
583 else
584 {
585 // Sep 27,2005 REF: SPR 34402 xdeepadh
586 // The channel state will be written into the flash.
587 FFS_flashData.player_channel_state = PLAYER_CHANNEL_MONO ;
588 flash_write();
589 mmi_audio_player_show_info(0, TxtPlayerMonoChannel, TxtNull, NULL);
590 }
591
592 return 1;
593 }
594
595 /*******************************************************************************
596
597 $Function: mmi_audio_player_set_channel_stereo
598
599 $Description: set channels to stereo
600
601 $Returns:
602
603 $Arguments:
604
605 *******************************************************************************/
606 GLOBAL int mmi_audio_player_set_channel_stereo (MfwMnu* m, MfwMnuItem* i)
607 {
608
609 SHORT mfw_audio_player_retVal;
610
611 TRACE_FUNCTION ("mmi_audio_player_set_channel_stereo()");
612 mfw_audio_player_retVal = mfw_audio_player_set_channel_stereo();
613 if(mfw_audio_player_retVal != MFW_PLAYER_TEST_OK)
614 {
615 TRACE_FUNCTION ("mmi_audio_player_set_channel_stereo(): Riviera Failed");
616 mmi_audio_player_show_info(0, TxtPlayerTest, TxtNull, NULL);
617 }
618 else
619 {
620 // Sep 27,2005 REF: SPR 34402 xdeepadh
621 // The channel state will be written into the flash.
622 FFS_flashData.player_channel_state = PLAYER_CHANNEL_STEREO;
623 flash_write();
624 mmi_audio_player_show_info(0, TxtPlayerStereoChannel, TxtNull, NULL);
625 }
626
627 return 1;
628 }
629
630
631 /*******************************************************************************
632
633 $Function: mmi_audio_player_show_info
634
635 $Description:
636
637 $Returns:
638
639 $Arguments:
640
641 *******************************************************************************/
642 static MfwHnd mmi_audio_player_show_info(T_MFW_HND parent, int str1, int str2, T_VOID_FUNC callback)
643 {
644 T_DISPLAY_DATA display_info;
645
646 TRACE_FUNCTION ("mmi_audio_player_show_info()");
647
648 /*
649 ** Create a timed dialog to display the Message "Failed"
650 */
651 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, str1, str2, COLOUR_STATUS);
652 dlg_initDisplayData_events( &display_info, callback, PLAYER_INFO_SCRN_TIMEOUT, KEY_LEFT | KEY_CLEAR | KEY_HUP);
653
654 return info_dialog(parent, &display_info);
655 }
656
657
658 //Jul 18, 2005 REF: SPR 31695 xdeepadh
659
660 /*******************************************************************************
661
662 $Function: mmi_audio_player_play_destroy
663
664 $Description: Destruction of an dialog
665
666 $Returns: void
667
668 $Arguments: win
669
670 *******************************************************************************/
671 void mmi_audio_player_play_destroy (T_MFW_HND own_window)
672 {
673 T_MFW_WIN * win = ((T_MFW_HDR *)own_window)->data;
674 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)win->user;
675
676 TRACE_FUNCTION ("mmi_audio_player_play_destroy()");
677
678 if (own_window == NULL)
679 {
680 TRACE_EVENT ("Error : Called with NULL Pointer");
681 return;
682 }
683
684 if (data)
685 {
686 /*
687 * Exit KEYBOARD Handle
688 */
689 kbd_delete (data->kbd);
690
691 /*
692 * Delete WIN Handler
693 */
694 win_delete (data->info_win);
695 /*
696 * Free Memory
697 */
698 FREE_MEMORY ((void *)data, sizeof (T_MMI_Player_Win_data));
699 }
700 }
701
702 //Jul 18, 2005 REF: SPR 31695 xdeepadh
703
704 /*******************************************************************************
705
706 $Function: mmi_audio_player_play_kbd_cb
707
708 $Description: Keyboard event handler
709
710 $Returns: status int
711
712 $Arguments: window handle event, keyboard control block
713
714 *******************************************************************************/
715
716 static int mmi_audio_player_play_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard)
717 {
718 T_MFW_HND win = mfw_parent (mfw_header());
719 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data;
720 T_MMI_Player_Win_data *data = (T_MMI_Player_Win_data *)win_data->user;
721
722 TRACE_FUNCTION("mmi_audio_player_play_kbd_cb");
723
724 switch (keyboard->code)
725 {
726
727 case KCD_LEFT:
728
729 if(IsPaused == FALSE)
730 {
731 mfw_audio_player_pause();
732 /*
733 * Clear Screen
734 */
735 dspl_ClearAll();
736 /*
737 * Print the information screen
738 */
739 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayerPause);
740 /*
741 * Print softkeys
742 */
743 displaySoftKeys(TxtPlayerResume, TxtStop);
744 IsPaused=TRUE;
745 }
746 else
747 {
748
749 /*
750 * Clear Screen
751 */
752 dspl_ClearAll();
753 mfw_audio_player_resume();
754 /*
755 * Print the information screen
756 */
757 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayerResume);
758
759 /*
760 * Print softkeys
761 */
762 displaySoftKeys(TxtPlayerPause, TxtStop);
763 IsPaused = FALSE;
764 }
765 break;
766 case KCD_HUP:
767 case KCD_RIGHT:
768 mfw_audio_player_stop();
769 //go back to the previous dialog
770 SEND_EVENT (win, PLAYER_DESTROY, 0, 0);
771 break;
772
773 default:
774 break;
775 }
776 return MFW_EVENT_CONSUMED;
777 }
778 //Nov 16,2005 REF: DR OMAPS00049192 x0039928
779 /*******************************************************************************
780
781 $Function: mmi_audio_player_start_cb
782
783 $Description: Mmi callback function for mp3 test application
784
785 $Returns: void
786
787 $Arguments: win, window handle
788
789 *******************************************************************************/
790 void mmi_audio_player_start_cb(T_MFW_HND win)
791 {
792 mmi_audio_player_play_destroy(win);
793 dspl_Enable(TRUE);
794 }
795
796 //Nov 16,2005 REF: DR OMAPS00049192 x0039928
797 /*******************************************************************************
798
799 $Function: mmi_audio_player_callback_init
800
801 $Description: Initializes the mmi return callback path.
802
803 $Returns: void
804
805 $Arguments: window handle, callback function
806
807 *******************************************************************************/
808 //Nov 16,2005 REF: DR OMAPS00049192 x0039928
809 static void mmi_audio_player_callback_init(T_MFW_HND win, void (*callback)(T_MFW_HND ))
810 {
811 mmi_audio_player_return_path.focus_win = win;
812 mmi_audio_player_return_path.callback = callback;
813 }
814
815 //Jul 18, 2005 REF: SPR 31695 xdeepadh
816 /*******************************************************************************
817
818 $Function: mmi_audio_player_play_exec_cb
819
820 $Description: Dialog function for Player test app dialog
821
822 $Returns: void
823
824 $Arguments: win, window handle event, value, parameter
825
826 *******************************************************************************/
827 void mmi_audio_player_play_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
828 {
829 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
830 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)win_data->user;
831 T_DISPLAY_DATA display_info;
832
833 TRACE_FUNCTION ("mmi_audio_player_play_exec_cb()");
834
835
836 switch (event)
837 {
838 case PLAYER_INIT:
839 TRACE_EVENT ("PLAYER_INIT()");
840 // Nov 16,2005 REF: DR OMAPS00049192 x0039928
841 // Initialize the callback function to the return path.
842 mmi_audio_player_callback_init(win, mmi_audio_player_start_cb);
843
844
845
846 // Initialize dialog
847 //Create keyboard handler
848 data->kbd = kbd_create (win, KEY_ALL, (T_MFW_CB)mmi_audio_player_play_kbd_cb);
849 if (value EQ PLAYER_PLAY)
850 {
851 TRACE_EVENT ("PLAYER_PLAY()");
852
853 mfw_audio_player_play();
854 win_show (win);
855 }
856 break;
857
858 case PLAYER_DESTROY:
859 mmi_audio_player_play_destroy(win);
860 break;
861 }
862 }
863
864 //Jul 18, 2005 REF: SPR 31695 xdeepadh
865
866 /*******************************************************************************
867
868 $Function: mmi_audio_player_play_win_cb
869
870 $Description: Callback function for information dialog
871
872 $Returns: void
873
874 $Arguments: window handle event, win
875 *******************************************************************************/
876 static int mmi_audio_player_play_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
877 {
878 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)win->user;
879
880 TRACE_FUNCTION ("mmi_audio_player_play_win_cb()");
881
882 if (data EQ NULL)
883 return NULL;
884
885 switch (event)
886 {
887 case E_WIN_VISIBLE:
888 if (win->flags & E_WIN_VISIBLE)
889 {
890 /*
891 * Clear Screen
892 */
893 dspl_ClearAll();
894 /*
895 * Print the information screen
896 */
897 ALIGNED_PROMPT(LEFT,Mmi_layout_line(1),0, TxtPlayerPlaying);
898 /*
899 * Print softkeys
900 */
901 displaySoftKeys(TxtPlayerPause,TxtStop );
902 }
903 break;
904
905 default:
906 return 0;
907 }
908 return 1;
909 }
910
911 //Jul 18, 2005 REF: SPR 31695 xdeepadh
912 /*******************************************************************************
913
914 $Function: mmi_audio_player_play_create
915
916 $Description: Creation of window
917
918 $Returns: Dialogue info win
919
920 $Arguments: parent win
921
922 *******************************************************************************/
923 static T_MFW_HND mmi_audio_player_play_create (T_MFW_HND parent_win)
924 {
925 T_MFW_WIN * win_data;
926 T_MMI_Player_Win_data * data = (T_MMI_Player_Win_data *)ALLOC_MEMORY (sizeof (T_MMI_Player_Win_data));
927
928 TRACE_FUNCTION ("mmi_audio_player_play_create()");
929
930 data->info_win = win_create (parent_win, 0, E_WIN_VISIBLE, (T_MFW_CB)mmi_audio_player_play_win_cb);
931
932 if (data->info_win EQ NULL)
933 return NULL;
934
935 /*
936 * Create window handler
937 */
938 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_audio_player_play_exec_cb;
939 data->mmi_control.data = data;
940 data->parent_win = parent_win;
941 win_data = ((T_MFW_HDR *)data->info_win)->data;
942 win_data->user = (void *)data;
943
944 /*
945 * return window handle
946 */
947 return data->info_win;
948 }
949
950 //Jul 18, 2005 REF: SPR 31695 xdeepadh
951 /*******************************************************************************
952
953 $Function: mmi_audio_player_play_start
954
955 $Description: create a new voicememo dialog
956
957 $Returns: Dialogue info win
958
959 $Arguments: parent win, display info
960
961 *******************************************************************************/
962 T_MFW_HND mmi_audio_player_play_start (T_MFW_HND parent_win, SHORT ID)
963 {
964 T_MFW_HND win;
965
966 win = mmi_audio_player_play_create (parent_win);
967
968
969 if (win NEQ NULL)
970 {
971 SEND_EVENT (win, PLAYER_INIT, ID, 0);
972 }
973 return win;
974 }
975
976
977 //Jul 18, 2005 REF: SPR 31695 xdeepadh
978
979 /*******************************************************************************
980
981 $Function: mmi_audio_player_play
982
983 $Description:
984
985 $Returns:
986
987 $Arguments:
988
989 *******************************************************************************/
990 GLOBAL int mmi_audio_player_play (MfwMnu* m, MfwMnuItem* i)
991 {
992 T_MFW_HND win = mfw_parent(mfw_header());
993 int max_file_number;
994
995 TRACE_FUNCTION ("mmi_audio_player_play()");
996
997 //If no file is selected inform the user
998 //retrieve from MFW number of files loaded
999 max_file_number = mfw_audio_player_return_file_number();
1000 //In case no files have been loaded return info message
1001 if(max_file_number == 0)
1002 {
1003 mmi_audio_player_show_info(0, TxtPlayerFileNotLoaded, TxtNull, NULL);
1004 }
1005 //If no file is selected inform the user
1006 else if(audio_player_currently_playing_idx < 0)
1007
1008 {
1009 mmi_audio_player_show_info(0, TxtPlayerSelectFile, TxtNull, NULL);
1010
1011 }
1012 else
1013 {
1014 //create a new Player playing screen
1015 mmi_audio_player_play_start (win, PLAYER_PLAY);
1016 }
1017
1018 return 1;
1019 }