FreeCalypso > hg > fc-magnetite
comparison src/ui3/mfw/mfw_mp3test.c @ 420:e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 Jan 2018 03:09:00 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
419:59143cd42ec7 | 420:e8ddbb0837ed |
---|---|
1 /* | |
2 +--------------------------------------------------------------------+ | |
3 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_mp3.c $| | |
4 | $Author:: NDH $Revision:: 1 $| | |
5 | CREATED: 21.05.04 $Modtime:: 21.05.04 14:58 $| | |
6 | STATE : code | | |
7 +--------------------------------------------------------------------+ | |
8 | |
9 MODULE : MFW_MP3 | |
10 | |
11 PURPOSE : This module contains Audio Interface functions. | |
12 | |
13 HISTORY : | |
14 | |
15 Nov 07, 2006 ER: OMAPS00102732 x0pleela | |
16 Description: FFS Support for Intel Sibley Flash - Intel 256+64 non-ADMUX (PF38F4050M0Y0C0Q) | |
17 Solution: Closing the opened directory if readdir is not successful and the new code | |
18 is under the compilation flag FF_MMI_RELIANCE_FFS | |
19 | |
20 Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
21 Description: midi and mp3 files is not being populated on accessing corresponding menu, but only during bootup | |
22 Solution: Populate files on accessing the "browse files" list | |
23 | |
24 Jun 06, 2006 REF: ERT OMAPS00070659 x0039928 | |
25 Bug:MP3 RWD and FWD function - MOT | |
26 Fix: Forward and Rewind functionalities are handled. | |
27 | |
28 | |
29 Jun 02,2006 REF: DR OMAPS00079746 x0039928 | |
30 Bug:MMI displays 'Playing' when trying to play a wrong file | |
31 Fix: MP3 playback error is handled. | |
32 | |
33 Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
34 Bug:MP3: The screen is not refreshed after the mp3 file completes playing | |
35 Fix: The AUDIO_OK event recieved after mp3 file play completes is now handled | |
36 in mfw_mp3_test_start_cb() | |
37 | |
38 Nov 14, 2005 REF: OMAPS00044445 xdeepadh | |
39 Description: Implementation of Test Menu for AAC | |
40 Solution: The existing MP3 test Application has been enhanced to support the AAC file testing. | |
41 The interfaces have been made generic to support both MP3 and AAC files. | |
42 | |
43 Nov 24,2005 REF: DR OMAPS00049192 x0039928 | |
44 Bug:MP3: The screen is not refreshed after the mp3 file completes playing | |
45 Soln: A variable mfw_mp3_playstate is added to maintain the mfw play state. | |
46 | |
47 Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
48 Bug:MP3: The screen is not refreshed after the mp3 file completes playing | |
49 Fix: The AUDIO_OK event recieved after mp3 file play completes is now handled | |
50 in mfw_mp3_test_start_cb() | |
51 | |
52 Aug 05, 2005 xdeepadh | |
53 Description: Configuring the audio path for midi | |
54 | |
55 | |
56 Jul 18, 2005 REF: SPR 31695 xdeepadh | |
57 Bug:Problems with MP3 test application | |
58 Fix:The window handling of MP3 Test Application has been done properly. | |
59 | |
60 Apr 06, 2005 REF: ENH 30011 xdeepadh | |
61 Description: Replacing the Test Application compilation flags with new flags. | |
62 Solution: Removed the Condition to call mp3 APIs, if L1_MP3 flag is enabled. | |
63 This file will be compiled only if L1_Mp3 flag is enabled. | |
64 */ | |
65 | |
66 | |
67 /* | |
68 ** Include Files | |
69 */ | |
70 | |
71 #define ENTITY_MFW | |
72 | |
73 /* includes */ | |
74 #include <string.h> | |
75 | |
76 #include "typedefs.h" | |
77 #include "rv_swe.h" | |
78 #include "l1sw.cfg" | |
79 | |
80 #include "rvm/rvm_gen.h" /* Generic RVM types and functions. */ | |
81 #include "rvf/rvf_pool_size.h" /* Stack & Memory Bank sizes definitions */ | |
82 #include "mfw_mfw.h" | |
83 #include "mfw_mp3test.h" | |
84 #include "mfw_sys.h" //Added for Trace functions. Jul 18, 2005 REF: SPR 31695 xdeepadh | |
85 #include "Audio/audio_api.h" | |
86 | |
87 #include "ffs/ffs_api.h" | |
88 | |
89 /*Local defines*/ | |
90 | |
91 //define maximum number of MP3 files being saved | |
92 #define PLAYER_MAX_FILES 5 | |
93 #define PLAYER_DIR "/mmi/mp3" | |
94 | |
95 /* | |
96 ** Local Variable Definitions | |
97 */ | |
98 | |
99 static T_RV_RETURN_PATH audio_player_return_path; | |
100 char* INPUT_FILES_STRING[PLAYER_MAX_FILES]; | |
101 int NUM_INPUT_FILES; | |
102 | |
103 T_AUDIO_MP3_PARAMETER mp3_parameter; | |
104 #ifdef FF_MMI_TEST_AAC | |
105 T_AUDIO_AAC_PARAMETER aac_parameter; | |
106 #endif | |
107 | |
108 #ifdef FF_MMI_AUDIO_PROFILE | |
109 //Flag to indicate whether audio media is being played. | |
110 extern UBYTE mfwAudPlay; | |
111 #endif | |
112 | |
113 //Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
114 MMI_RETURN_PATH mmi_audio_player_return_path; | |
115 | |
116 //Nov 24,2005 REF: DR OMAPS00049192 x0039928 | |
117 // Declare a variable to maintain the mp3 play state | |
118 int mfw_mp3_playstate = FALSE; | |
119 | |
120 char* inputFileName; // input file | |
121 char tempFilePath[AUDIO_MP3_PATH_NAME_MAX_SIZE]; | |
122 int audio_player_currently_playing_idx = -1; //index of file to play | |
123 UBYTE IsMP3On; //Variable to check the selected file | |
124 | |
125 /* | |
126 Function Prototypes | |
127 */ | |
128 static void mfw_audio_player_configure_callback_fn(void (*callback_fn)(void *)); | |
129 | |
130 | |
131 /* | |
132 ** Public function Definitions | |
133 */ | |
134 /******************************************************************************* | |
135 | |
136 $Function: mfw_audio_player_populate_files | |
137 | |
138 $Description:This function is called in order to retrieve file names from | |
139 Flash and save them in a table | |
140 | |
141 $Returns: Status | |
142 | |
143 $Arguments: filenames: table to save file names in | |
144 max_files_count:number of files in the list to be filled . | |
145 | |
146 *******************************************************************************/ | |
147 int mfw_audio_player_populate_files(char **file_names, int max_files_count) | |
148 { | |
149 /*a0393213 compiler warnings removal - variable fd removed*/ | |
150 char dir_name_p[] = PLAYER_DIR; | |
151 T_FFS_DIR dir = {0}; | |
152 char dest_name_p[100] = ""; | |
153 int i, files_count = 0; | |
154 char *fileExt; | |
155 TRACE_FUNCTION("mfw_audio_player_populate_files"); | |
156 if (ffs_opendir (dir_name_p, &dir) <= 0) | |
157 { | |
158 files_count = 0; | |
159 } | |
160 //Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
161 //Release previous allocared memory before allocating again | |
162 mfw_audio_player_unpopulate_files(); | |
163 | |
164 //read maximum of 5 file names | |
165 for (i = 0; ffs_readdir (&dir, dest_name_p, 100) > 0x0; i++) | |
166 { | |
167 (file_names[files_count]) = (char*)mfwAlloc(strlen(dest_name_p) + 1); | |
168 | |
169 if(file_names[files_count] != NULL) | |
170 { | |
171 // Jul 18, 2005 REF: SPR 31695 xdeepadh | |
172 //retrieve file extension | |
173 fileExt =(char*) mfw_audio_player_GetExtension(dest_name_p); | |
174 //Store only mp3 and aac file names in array | |
175 if ( strcmp(fileExt, "mp3")== 0 ) | |
176 { | |
177 strcpy (file_names[files_count], dest_name_p); | |
178 files_count++; | |
179 } | |
180 #ifdef FF_MMI_TEST_AAC | |
181 if ( strcmp(fileExt, "aac") == 0) | |
182 { | |
183 strcpy (file_names[files_count], dest_name_p); | |
184 files_count++; | |
185 } | |
186 #endif | |
187 if(files_count >= max_files_count) | |
188 break; | |
189 } | |
190 else | |
191 { | |
192 //files_count = 0; | |
193 } | |
194 | |
195 } | |
196 | |
197 //x0pleela 07 Nov, 2006 DVT: OMAPS00102732 | |
198 //Adding the MMI compilation flag FF_MMI_RELIANCE_FFS | |
199 //x0pleela 31 Oct, 2006 | |
200 //Closing the directory as per the new FFS logic | |
201 #ifdef FF_MMI_RELIANCE_FFS | |
202 ffs_closedir(dir); | |
203 #endif | |
204 return files_count; | |
205 } | |
206 //Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
207 /******************************************************************************* | |
208 | |
209 $Function: mfw_audio_player_unpopulate_files | |
210 | |
211 $Description:Free the allocated player array | |
212 | |
213 $Returns: Status | |
214 | |
215 $Arguments: None | |
216 | |
217 *******************************************************************************/ | |
218 void mfw_audio_player_unpopulate_files(void) | |
219 { | |
220 int i=0; | |
221 TRACE_FUNCTION("mfw_audio_player_unpopulate_files"); | |
222 //Release the memory allocated for the file list | |
223 for (i = 0; i<PLAYER_MAX_FILES; i++) | |
224 { | |
225 if(INPUT_FILES_STRING[i]) | |
226 mfwFree((U8 *)INPUT_FILES_STRING[i],(U16)strlen(INPUT_FILES_STRING[i]) + 1); | |
227 INPUT_FILES_STRING[i]=NULL; | |
228 } | |
229 } | |
230 | |
231 /******************************************************************************* | |
232 | |
233 $Function: mfw_audio_player_init | |
234 | |
235 $Description:Populate the Player array | |
236 | |
237 $Returns: Status | |
238 | |
239 $Arguments: None | |
240 | |
241 *******************************************************************************/ | |
242 void mfw_audio_player_init(void) | |
243 { | |
244 NUM_INPUT_FILES = mfw_audio_player_populate_files(INPUT_FILES_STRING, PLAYER_MAX_FILES); | |
245 mp3_parameter.mono_stereo = AUDIO_MP3_MONO; | |
246 #ifdef FF_MMI_TEST_AAC | |
247 aac_parameter.mono_stereo= AUDIO_AAC_MONO; | |
248 #endif | |
249 } | |
250 | |
251 /******************************************************************************* | |
252 | |
253 $Function: mfw_audio_player_set_channel_mono | |
254 | |
255 $Description:set channel to mono | |
256 | |
257 $Returns: Status | |
258 | |
259 $Arguments: None | |
260 | |
261 *******************************************************************************/ | |
262 SHORT mfw_audio_player_set_channel_mono(void) | |
263 { | |
264 TRACE_FUNCTION("mfw_audio_player_set_channel_mono"); | |
265 | |
266 switch(IsMP3On) | |
267 { | |
268 case MFW_PLAYER_MP3: | |
269 TRACE_EVENT("MP3"); | |
270 mp3_parameter.mono_stereo = AUDIO_MP3_MONO; | |
271 break; | |
272 | |
273 #ifdef FF_MMI_TEST_AAC | |
274 case MFW_PLAYER_AAC: | |
275 TRACE_EVENT("AAC"); | |
276 aac_parameter.mono_stereo= AUDIO_AAC_MONO; | |
277 break; | |
278 #endif | |
279 default: | |
280 break; | |
281 } | |
282 | |
283 return MFW_PLAYER_TEST_OK; | |
284 } | |
285 | |
286 | |
287 /******************************************************************************* | |
288 | |
289 $Function: mfw_audio_player_set_channel_stereo | |
290 | |
291 $Description:set channel to stereo | |
292 | |
293 $Returns: Status | |
294 | |
295 $Arguments: None | |
296 | |
297 *******************************************************************************/ | |
298 SHORT mfw_audio_player_set_channel_stereo(void) | |
299 { | |
300 TRACE_FUNCTION("mfw_audio_player_set_channel_stereo"); | |
301 | |
302 switch(IsMP3On) | |
303 { | |
304 case MFW_PLAYER_MP3: | |
305 TRACE_EVENT("MP3"); | |
306 mp3_parameter.mono_stereo = AUDIO_MP3_STEREO; | |
307 break; | |
308 | |
309 #ifdef FF_MMI_TEST_AAC | |
310 case MFW_PLAYER_AAC: | |
311 TRACE_EVENT("AAC"); | |
312 aac_parameter.mono_stereo= AUDIO_AAC_STEREO; | |
313 break; | |
314 #endif | |
315 default: | |
316 break; | |
317 } | |
318 | |
319 return MFW_PLAYER_TEST_OK; | |
320 } | |
321 | |
322 | |
323 | |
324 | |
325 /******************************************************************************* | |
326 | |
327 $Function: mfw_audio_player_mp3_start_cb | |
328 | |
329 $Description:callback function for starting mp3 file | |
330 | |
331 $Returns: None | |
332 | |
333 $Arguments: parameter: callback parameter | |
334 | |
335 *******************************************************************************/ | |
336 static void mfw_audio_player_mp3_start_cb (void *parameter) | |
337 { | |
338 //Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
339 T_AUDIO_MP3_STATUS *param = (T_AUDIO_MP3_STATUS *)parameter; | |
340 SHORT event = param->status; | |
341 UINT32 msg = param->os_hdr.msg_id; | |
342 | |
343 #ifdef FF_MMI_AUDIO_PROFILE | |
344 //configure the audio to voice path | |
345 mfwAudPlay = FALSE; | |
346 mfw_unset_stereo_path(mfw_get_current_audioDevice()); | |
347 #endif | |
348 | |
349 switch(event) | |
350 { | |
351 // MMI callback function is called to destroy the focus window when AUDIO_OK | |
352 // event is recieved for mp3 file play complete | |
353 case AUDIO_OK: | |
354 if((mfw_mp3_playstate == TRUE) && (msg == AUDIO_MP3_STATUS_MSG)) | |
355 (* mmi_audio_player_return_path.callback)(mmi_audio_player_return_path.focus_win, AUDIO_OK); | |
356 break; | |
357 // Jun 02,2006 REF: DR OMAPS00079746 x0039928 | |
358 // Fix: MP3 playback error is handled. | |
359 case AUDIO_ERROR: | |
360 if((mfw_mp3_playstate == TRUE) && (msg == AUDIO_MP3_STATUS_MSG)) | |
361 (* mmi_audio_player_return_path.callback)(mmi_audio_player_return_path.focus_win, AUDIO_ERROR); | |
362 break; | |
363 default: | |
364 break; | |
365 } | |
366 } | |
367 | |
368 | |
369 /******************************************************************************* | |
370 | |
371 $Function: mfw_audio_player_aac_start_cb | |
372 | |
373 $Description:callback function for starting aac file | |
374 | |
375 $Returns: None | |
376 | |
377 $Arguments: parameter: callback parameter | |
378 | |
379 *******************************************************************************/ | |
380 #ifdef FF_MMI_TEST_AAC | |
381 static void mfw_audio_player_aac_start_cb(void *parameter) | |
382 { | |
383 //Nov 16,2005 REF: DR OMAPS00049192 x0039928 | |
384 T_AUDIO_AAC_STATUS *param = (T_AUDIO_AAC_STATUS *)parameter; | |
385 SHORT event = param->status; | |
386 UINT32 msg = param->os_hdr.msg_id; | |
387 | |
388 #ifdef FF_MMI_AUDIO_PROFILE | |
389 //configure the audio to voice path | |
390 mfwAudPlay = FALSE; | |
391 mfw_unset_stereo_path(mfw_get_current_audioDevice()); | |
392 #endif | |
393 | |
394 switch(event) | |
395 { | |
396 // MMI callback function is called to destroy the focus window when AUDIO_OK | |
397 // event is recieved for mp3 file play complete | |
398 case AUDIO_OK: | |
399 if((mfw_mp3_playstate == TRUE) &&(msg == AUDIO_AAC_STATUS_MSG)) | |
400 (* mmi_audio_player_return_path.callback)(mmi_audio_player_return_path.focus_win, AUDIO_OK); | |
401 break; | |
402 // Jun 02,2006 REF: DR OMAPS00079746 x0039928 | |
403 // Fix: MP3 playback error is handled. | |
404 case AUDIO_ERROR: | |
405 if((mfw_mp3_playstate == TRUE) &&(msg == AUDIO_AAC_STATUS_MSG)) | |
406 (* mmi_audio_player_return_path.callback)(mmi_audio_player_return_path.focus_win, AUDIO_ERROR); | |
407 break; | |
408 default: | |
409 break; | |
410 } | |
411 } | |
412 #endif | |
413 | |
414 /******************************************************************************* | |
415 | |
416 $Function: mfw_audio_player_configure_callback_fn | |
417 | |
418 $Description:Configure the Riviera Return Path | |
419 | |
420 $Returns:None | |
421 | |
422 $Arguments: callback function | |
423 | |
424 *******************************************************************************/ | |
425 | |
426 static void mfw_audio_player_configure_callback_fn(void (*callback_fn)(void *)) | |
427 { | |
428 audio_player_return_path.addr_id = 0; | |
429 audio_player_return_path.callback_func = callback_fn; | |
430 | |
431 return; | |
432 } | |
433 | |
434 | |
435 | |
436 /******************************************************************************* | |
437 | |
438 $Function: mfw_audio_player_play | |
439 | |
440 $Description:play the file which was loaded | |
441 When no file was manually selected, play file located at first index by default | |
442 | |
443 $Returns:Status | |
444 | |
445 $Arguments: None | |
446 | |
447 *******************************************************************************/ | |
448 SHORT mfw_audio_player_play(void) | |
449 { | |
450 | |
451 SHORT mfw_audio_player_retVal; | |
452 TRACE_FUNCTION("mfw_audio_player_play"); | |
453 | |
454 //Aug 05, 2005 xdeepadh | |
455 #ifdef FF_MMI_AUDIO_PROFILE | |
456 //Configure the audio path to current Audio device. | |
457 mfw_set_stereo_path(mfw_get_current_audioDevice()); | |
458 mfwAudPlay = TRUE; //File is playing | |
459 #endif | |
460 //Nov 24,2005 REF: DR OMAPS00049192 x0039928 | |
461 // Set mp3 play state to True | |
462 mfw_mp3_playstate = TRUE; | |
463 | |
464 | |
465 //Based on the file selected, call the respective APIS to start playing | |
466 switch(IsMP3On) | |
467 { | |
468 case MFW_PLAYER_MP3 : | |
469 #ifdef FF_MMI_FILEMANAGER | |
470 sprintf(tempFilePath,"/FFS/%s/%s",PLAYER_DIR, inputFileName); | |
471 convert_u8_to_unicode(tempFilePath,mp3_parameter.mp3_name); | |
472 #else | |
473 sprintf(tempFilePath,"%s/%s",PLAYER_DIR, inputFileName); | |
474 strcpy(mp3_parameter.mp3_name, tempFilePath); | |
475 #endif | |
476 mfw_audio_player_configure_callback_fn(mfw_audio_player_mp3_start_cb); | |
477 | |
478 if (audio_mp3_start(&mp3_parameter, audio_player_return_path)) | |
479 { | |
480 mfw_audio_player_retVal = MFW_PLAYER_TEST_OK; | |
481 } | |
482 else | |
483 { | |
484 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
485 } | |
486 break; | |
487 | |
488 #ifdef FF_MMI_TEST_AAC | |
489 | |
490 case MFW_PLAYER_AAC: | |
491 #ifdef FF_MMI_FILEMANAGER | |
492 sprintf(tempFilePath,"/FFS/%s/%s",PLAYER_DIR, inputFileName); | |
493 convert_u8_to_unicode( tempFilePath,aac_parameter.aac_name); | |
494 #else | |
495 sprintf(tempFilePath,"%s/%s",PLAYER_DIR, inputFileName); | |
496 strcpy(aac_parameter.aac_name, tempFilePath); | |
497 #endif | |
498 mfw_audio_player_configure_callback_fn(mfw_audio_player_aac_start_cb); | |
499 | |
500 if (audio_aac_start(&aac_parameter, audio_player_return_path)) | |
501 { | |
502 mfw_audio_player_retVal = MFW_PLAYER_TEST_OK; | |
503 } | |
504 else | |
505 { | |
506 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
507 } | |
508 break; | |
509 #endif | |
510 default: | |
511 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
512 break; | |
513 } | |
514 return mfw_audio_player_retVal; | |
515 } | |
516 | |
517 | |
518 | |
519 /******************************************************************************* | |
520 | |
521 $Function: mfw_audio_player_stop | |
522 | |
523 $Description:stop the file which was played | |
524 | |
525 $Returns:Status | |
526 | |
527 $Arguments: None | |
528 | |
529 *******************************************************************************/ | |
530 SHORT mfw_audio_player_stop(void) | |
531 { | |
532 | |
533 SHORT mfw_audio_player_retVal; | |
534 UINT32 size_played; | |
535 // Aug 05, 2005 xdeepadh | |
536 #ifdef FF_MMI_AUDIO_PROFILE | |
537 //configure the audio to voice path | |
538 mfwAudPlay = FALSE; | |
539 mfw_unset_stereo_path(mfw_get_current_audioDevice()); | |
540 #endif | |
541 TRACE_FUNCTION("mfw_audio_player_stop"); | |
542 // Nov 24, 2005 REF : DR OMAPS00049192 x0039928 | |
543 // Set mp3 play state to false | |
544 mfw_mp3_playstate = FALSE; | |
545 | |
546 //Based on the file selected, call the respective APIS to stop playing | |
547 switch(IsMP3On) | |
548 { | |
549 case MFW_PLAYER_MP3 : | |
550 if (audio_mp3_stop(&size_played)) | |
551 { | |
552 mfw_audio_player_retVal = MFW_PLAYER_TEST_OK; | |
553 } | |
554 else | |
555 { | |
556 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
557 } | |
558 break; | |
559 | |
560 #ifdef FF_MMI_TEST_AAC | |
561 case MFW_PLAYER_AAC: | |
562 if(audio_aac_stop(&size_played)) | |
563 { | |
564 mfw_audio_player_retVal = MFW_PLAYER_TEST_OK; | |
565 } | |
566 else | |
567 { | |
568 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
569 } | |
570 break; | |
571 #endif | |
572 default: | |
573 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
574 break; | |
575 } | |
576 | |
577 return mfw_audio_player_retVal; | |
578 } | |
579 | |
580 #if (BOARD == 71) | |
581 /******************************************************************************* | |
582 | |
583 $Function: mfw_audio_player_forward | |
584 $Description: forward the file which is being played | |
585 $Returns:Status | |
586 | |
587 $Arguments: None | |
588 | |
589 *******************************************************************************/ | |
590 SHORT mfw_audio_player_forward(UINT32 time) | |
591 { | |
592 SHORT mfw_audio_player_retVal; | |
593 | |
594 if(audio_mp3_forward(time)) | |
595 mfw_audio_player_retVal = MFW_PLAYER_TEST_OK; | |
596 else | |
597 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
598 | |
599 return mfw_audio_player_retVal; | |
600 } | |
601 | |
602 /******************************************************************************* | |
603 | |
604 $Function: mfw_audio_player_rewind | |
605 $Description: rewind the file which is being played | |
606 $Returns:Status | |
607 | |
608 $Arguments: None | |
609 | |
610 *******************************************************************************/ | |
611 SHORT mfw_audio_player_rewind(UINT32 time) | |
612 { | |
613 SHORT mfw_audio_player_retVal; | |
614 | |
615 if(audio_mp3_rewind(time)) | |
616 mfw_audio_player_retVal = MFW_PLAYER_TEST_OK; | |
617 else | |
618 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
619 | |
620 return mfw_audio_player_retVal; | |
621 } | |
622 #endif | |
623 | |
624 /******************************************************************************* | |
625 | |
626 $Function: mfw_audio_player_pause | |
627 $Description:pause the file which was played | |
628 $Returns:Status | |
629 | |
630 $Arguments: None | |
631 | |
632 *******************************************************************************/ | |
633 SHORT mfw_audio_player_pause(void) | |
634 { | |
635 SHORT mfw_audio_player_retVal; | |
636 | |
637 TRACE_FUNCTION("mfw_audio_player_pause"); | |
638 //Based on the file selected, call the respective APIS to pause playing | |
639 switch(IsMP3On) | |
640 { | |
641 case MFW_PLAYER_MP3 : | |
642 if (audio_mp3_pause()) | |
643 { | |
644 mfw_audio_player_retVal = MFW_PLAYER_TEST_OK; | |
645 } | |
646 else | |
647 { | |
648 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
649 } | |
650 break; | |
651 | |
652 #ifdef FF_MMI_TEST_AAC | |
653 case MFW_PLAYER_AAC: | |
654 if (audio_aac_pause()) | |
655 { | |
656 mfw_audio_player_retVal = MFW_PLAYER_TEST_OK; | |
657 } | |
658 else | |
659 { | |
660 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
661 } | |
662 break; | |
663 #endif | |
664 default: | |
665 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
666 break; | |
667 } | |
668 return mfw_audio_player_retVal; | |
669 } | |
670 | |
671 | |
672 | |
673 /******************************************************************************* | |
674 | |
675 $Function: mfw_audio_player_resume | |
676 | |
677 $Description:resume the file which was played | |
678 $Returns:Status | |
679 | |
680 $Arguments: None | |
681 | |
682 *******************************************************************************/ | |
683 SHORT mfw_audio_player_resume(void) | |
684 { | |
685 SHORT mfw_audio_player_retVal; | |
686 | |
687 TRACE_FUNCTION("mfw_audio_player_resume"); | |
688 //Based on the file selected, call the respective APIS to resume playing | |
689 switch(IsMP3On) | |
690 { | |
691 case MFW_PLAYER_MP3 : | |
692 if (audio_mp3_resume()) | |
693 { | |
694 mfw_audio_player_retVal = MFW_PLAYER_TEST_OK; | |
695 } | |
696 else | |
697 { | |
698 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
699 } | |
700 break; | |
701 | |
702 #ifdef FF_MMI_TEST_AAC | |
703 case MFW_PLAYER_AAC: | |
704 if (audio_aac_resume()) | |
705 { | |
706 mfw_audio_player_retVal = MFW_PLAYER_TEST_OK; | |
707 } | |
708 else | |
709 { | |
710 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
711 } | |
712 break; | |
713 #endif | |
714 default: | |
715 mfw_audio_player_retVal = MFW_PLAYER_TEST_RIVIERA_FAILED; | |
716 break; | |
717 } | |
718 return mfw_audio_player_retVal; | |
719 } | |
720 | |
721 /******************************************************************************* | |
722 | |
723 $Function: mfw_audio_player_return_file_number | |
724 | |
725 $Description:resume the file which was played | |
726 $Returns:Status | |
727 | |
728 $Arguments: None | |
729 | |
730 *******************************************************************************/ | |
731 int mfw_audio_player_return_file_number(void) | |
732 { | |
733 return NUM_INPUT_FILES; | |
734 } | |
735 | |
736 /******************************************************************************* | |
737 | |
738 $Function: mfw_audio_player_return_file_name | |
739 | |
740 $Description: return file name given an input index | |
741 $Returns:file name of the selected index | |
742 | |
743 $Arguments: index | |
744 | |
745 *******************************************************************************/ | |
746 char* mfw_audio_player_return_file_name(int index) | |
747 { | |
748 return INPUT_FILES_STRING[index]; | |
749 } | |
750 | |
751 | |
752 /******************************************************************************* | |
753 | |
754 $Function: mfw_audio_player_save_selected_file_idx | |
755 | |
756 $Description:return file name given an input index | |
757 $Returns:status | |
758 | |
759 $Arguments: index | |
760 | |
761 *******************************************************************************/ | |
762 | |
763 SHORT mfw_audio_player_save_selected_file_idx(int index) | |
764 { | |
765 //default index is set to 0 and inputFileName to NULL at mp3 mfw initialisation | |
766 //save currently selected file to control block | |
767 audio_player_currently_playing_idx = index; | |
768 inputFileName = INPUT_FILES_STRING[index]; | |
769 return MFW_PLAYER_TEST_OK; | |
770 | |
771 } | |
772 // Jul 18, 2005 REF: SPR 31695 xdeepadh | |
773 | |
774 /******************************************************************************* | |
775 | |
776 $Function: mfw_audio_player_GetExtension | |
777 | |
778 $Description: public function to retrieve the extension of a file | |
779 | |
780 $Returns:Extention of the filename | |
781 | |
782 $Arguments: scr- Filename | |
783 | |
784 *******************************************************************************/ | |
785 char *mfw_audio_player_GetExtension(char *src) | |
786 { | |
787 U8 i; | |
788 TRACE_FUNCTION("mfw_audio_player_GetExtension"); | |
789 for(i = 0; i < strlen(src); i++){ | |
790 if(src[i] == '.'){ | |
791 return (src+i+1); | |
792 } | |
793 } | |
794 return (src+i); | |
795 } | |
796 | |
797 |