daf_comp_drv.c
18.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*******************************************************************************
*
* Filename:
* ---------
* daf_comp_drv.c
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* DAF playback driver
*
* Author:
* -------
* -------
*
*==============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/
#ifdef DAF_DECODE
#include "kal_public_api.h"
#include "kal_general_types.h"
#include "kal_trace.h"
#include "string.h"
#include "fs_errcode.h"
#include "fsal.h"
#include "l1audio.h"
#include "audio_enum.h"
#include "am.h"
#include "ast.h"
#include "media.h"
#include "afe.h"
#include "l1sp_trc.h"
#include "daf_drv.h"
#include "MedAdapt.h"
#include "DAF_codec.h"
#include "AudCom.h"
#include "AudComUtil.h"
#include "OMX_Index.h"
#include "postprocess.h"
#include "audio_def.h"
#include "dpmgr.h"
// If there are consecutive frame error, driver stops the playback
// The suggest value is 25.
// 0: means that we don't enable the check
#define ERROR_FRAME_THRESHOLD 0
#ifdef MUSICAM_DECODE
const uint16 DAF_BIT_RATE_TABLE_L2_V1[15]={1, 32, 48, 56, 64, 80, 96, 112,
128, 160, 192, 224, 256, 320, 384};
#endif // #ifdef MUSICAM_DECODE
const uint16 DAF_BIT_RATE_TABLE_V1[15]={1, 32, 40, 48, 56, 64, 80, 96, 112,
128, 160, 192, 224, 256, 320};
const uint16 DAF_BIT_RATE_TABLE_V2[15]={1, 8, 16, 24, 32, 40, 48, 56, 64, 80,
96, 112, 128, 144, 160};
kal_bool dafGetBitRateIdx(uint16 wFHdrW1, uint16 wFHdrW2, int16* wBitRateIdx)
{
kal_uint16 MPEGver;
kal_int32 bit_rate_idx;
#ifdef MUSICAM_DECODE
kal_uint16 layer;
layer = (wFHdrW1>>9) & 3;
#endif // #ifdef MUSICAM_DECODE
MPEGver = (wFHdrW1>>11) & 3; /* check MPEG audio version ID */
#ifdef MUSICAM_DECODE
if(layer == 1){ // Layer III
#endif // #ifdef MUSICAM_DECODE
/* check bit rate */
if( MPEGver == 3 ){ /* MPEG1 */
bit_rate_idx = (wFHdrW2 >> 4) & 0x0F;
}else{ /* MPEG2, MPEG2.5 */
bit_rate_idx = (wFHdrW2 >> 4) & 0x0F;
}
#ifdef MUSICAM_DECODE
}else if(layer == 2){ // Layer II
if( MPEGver == 3 ) /* MPEG1 */
bit_rate_idx = (wFHdrW2 >> 4) & 0x0F;
else
bit_rate_idx = (wFHdrW2 >> 4) & 0x0F;
}else{
return false;
}
#endif // #ifdef MUSICAM_DECODE
*wBitRateIdx = bit_rate_idx;
return true;
}
void dafUpdateInfo(dafMediaHdl *ihdl, uint16 wFHdrW1, uint16 wFHdrW2)
{
kal_uint16 MPEGver;
kal_int32 sample_rate_idx;
#ifdef MUSICAM_DECODE
kal_uint16 layer;
layer = (wFHdrW1>>9) & 3;
#endif // #ifdef MUSICAM_DECODE
MPEGver = (wFHdrW1>>11) & 3; /* check MPEG audio version ID */
sample_rate_idx = (wFHdrW2 >> 2) & 3; /* sampling rate frequency index */
/* check sampling rate */
ihdl->uSampleRate = dafGetSamplingRate(MPEGver, sample_rate_idx);
#ifdef MUSICAM_DECODE
if(layer == 1){ // Layer III
#endif // #ifdef MUSICAM_DECODE
/* check bit rate */
if( MPEGver == 3 ){ /* MPEG1 */
ihdl->uSamplesPerFrame = 1152;
}else{ /* MPEG2, MPEG2.5 */
ihdl->uSamplesPerFrame = 576;
}
ihdl->uMLayer = 3;
#ifdef MUSICAM_DECODE
}else if(layer == 2){ // Layer II
ihdl->uSamplesPerFrame = 1152;
ihdl->uMLayer = 2;
}
#endif // #ifdef MUSICAM_DECODE
ihdl->frameDur = ihdl->uSamplesPerFrame * 1000000000 / (kal_uint64) ihdl->uSampleRate;
}
static void dafGetInfo(kal_uint16 wFHdrW1, kal_uint16 wFHdrW2, audInfoStruct *contentInfo)
{
kal_uint16 MPEGver;
kal_int32 srIdx;
#ifdef MUSICAM_DECODE
kal_uint16 layer;
layer = (wFHdrW1>>9) & 3;
#endif // #ifdef MUSICAM_DECODE
MPEGver = (wFHdrW1>>11) & 3; /* check MPEG audio version ID */
srIdx = (wFHdrW2 >> 2) & 3; /* sampling rate frequency index */
/* sampling rate */
contentInfo->sampleRate = dafGetSamplingRate( MPEGver, srIdx);
/* bit rate */
if( MPEGver == 3 ){ /* MPEG1 */
contentInfo->bitRate = DAF_BIT_RATE_TABLE_V1[(wFHdrW2 >> 4) & 0x0F] * 1000;
#ifdef MUSICAM_DECODE
}else{ /* MPEG2, MPEG2.5 */
contentInfo->bitRate = DAF_BIT_RATE_TABLE_V2[(wFHdrW2 >> 4) & 0x0F] * 1000;
}
/* bit rate */
if( MPEGver == 3 ){ /* MPEG1 */
if(layer == 1) // Layer III
contentInfo->bitRate = DAF_BIT_RATE_TABLE_V1[(wFHdrW2 >> 4) & 0x0F] * 1000;
else
contentInfo->bitRate = DAF_BIT_RATE_TABLE_L2_V1[(wFHdrW2 >> 4) & 0x0F] * 1000;
#endif // #ifdef MUSICAM_DECODE
}else{ /* MPEG2, MPEG2.5 */
contentInfo->bitRate = DAF_BIT_RATE_TABLE_V2[(wFHdrW2 >> 4) & 0x0F] * 1000;
}
contentInfo->details.DAF.bit_rate_index = (kal_uint8)((wFHdrW2 >> 4) & 0x0F);
contentInfo->details.DAF.CRC = (kal_uint8)((wFHdrW1>>8) & 1);
contentInfo->details.DAF.channel_mode = (kal_uint8)((wFHdrW2 >> 14) & 0x3);
if(((wFHdrW2 >> 14) & 0x3) == 0x03) // stereo indicator
contentInfo->stereo = false;
else
contentInfo->stereo = true;
}
static kal_uint32 dafGetDur( dafMediaHdl* ihdl, uint32 bitRate )
{
kal_uint32 file_size, time;
FSAL_GetFileSize(ihdl->pstFSAL, &file_size);
if (file_size >= ihdl->uID3V2Size)
file_size -= ihdl->uID3V2Size;
else
file_size = 0;
if(bitRate)
time = (kal_uint64)file_size * 8000 / (kal_uint64)bitRate;
else
time = 0;
return time;
}
#if defined XING_SUPPORT
static int ExtractI4(unsigned char *buf)
{
int x;
// big endian extract
x = buf[0];
x <<= 8;
x |= buf[1];
x <<= 8;
x |= buf[2];
x <<= 8;
x |= buf[3];
return x;
}
static int GetXingHeader(XHEADDATA *Xing, kal_uint8 *data_buf)
{
int i, head_f;
int id, mode, sr_idx;
static const int samplerate_table[4] = { 44100, 48000, 32000, 99999 };
Xing->flags = 0;
id = (data_buf[1] >> 3) & 1;
sr_idx = (data_buf[2] >> 2) & 3;
mode = (data_buf[3] >> 6) & 3;
if( id ) {
if( mode != 3 ) data_buf+= 36;
else data_buf+= 21;
}
else {
if( mode != 3 ) data_buf+= 21;
else data_buf+= 13;
}
if( data_buf[0] != 'X' ) return 0;
if( data_buf[1] != 'i' ) return 0;
if( data_buf[2] != 'n' ) return 0;
if( data_buf[3] != 'g' ) return 0;
data_buf+=4;
Xing->h_id = id;
Xing->samprate = samplerate_table[sr_idx];
if( id == 0 )
Xing->samprate >>= 1;
head_f = Xing->flags = ExtractI4(data_buf);
data_buf+=4;
if( head_f & FRAMES_FLAG ) {
Xing->frames= ExtractI4(data_buf);
data_buf+=4;
}
if( head_f & BYTES_FLAG ) {
Xing->bytes = ExtractI4(data_buf);
data_buf+=4;
}
if( head_f & TOC_FLAG ) {
if( Xing->toc != NULL ) {
for(i=0;i<100;i++) {
Xing->toc[i] = data_buf[i];
}
}
data_buf+=100;
}
Xing->vbr_scale = -1;
if( head_f & VBR_SCALE_FLAG ) {
Xing->vbr_scale = ExtractI4(data_buf);
data_buf+=4;
}
return 1; // success
}
#endif // #if defined XING_SUPPORT
Media_Status DAF_GetContentDescInfo( STFSAL *pstFSAL, audInfoStruct *contentInfo, void *param )
{
dafMediaHdl *ihdl;
kal_uint16 headerFstWd, headerSndWd;
ihdl = (dafMediaHdl *)audio_alloc_mem( sizeof(dafMediaHdl) );
if(ihdl==NULL)
{
return MEDIA_FAIL;
}
mhdlInitEx( ( MHdl *)ihdl, 0xFFFF , NULL );
ihdl->pstFSAL = pstFSAL;
memset(contentInfo, 0, sizeof(audInfoStruct));
autSkipID3Tag((MHdl *) ihdl, ihdl->pstFSAL, &ihdl->fileOffset, &ihdl->buf[0] );
ihdl->uID3V2Size = ihdl->fileOffset;
if ( dafReachNextFrame(ihdl, &headerFstWd, &headerSndWd, 0) == KAL_FALSE ){
audio_free_mem( (void **) &ihdl );
return MEDIA_BAD_FORMAT;
}
dafUpdateInfo(ihdl, headerFstWd, headerSndWd);
#if defined XING_SUPPORT
if(autGetBytesFromFileNoEnd((MHdl*)ihdl, ihdl->pstFSAL, ihdl->fileOffset, 512, &ihdl->buf[0]) == 512){
ihdl->fXing = (kal_bool) GetXingHeader(&ihdl->stXing, &ihdl->buf[0]);
}
#endif // #if defined XING_SUPPORT
dafGetInfo(headerFstWd, headerSndWd, contentInfo);
#if defined XING_SUPPORT
if(ihdl->fXing && ihdl->stXing.frames){
if((contentInfo->sampleRate == 44100) || (contentInfo->sampleRate == 48000) || (contentInfo->sampleRate == 32000))
contentInfo->time = (kal_int64)ihdl->stXing.frames * 1152000 / contentInfo->sampleRate;
else
contentInfo->time = (kal_int64)ihdl->stXing.frames * 576000 / contentInfo->sampleRate;
}else
#endif // #if defined XING_SUPPORT
contentInfo->time = dafGetDur(ihdl, contentInfo->bitRate);
audio_free_mem( (void **) &ihdl );
kal_trace( TRACE_FUNC, L1AUDIO_CONTENT, MEDIA_FORMAT_DAF );
return MEDIA_SUCCESS;
}
// For component
static Media_Status DafMedReachValidRegion( MHdl *hdl )
{
kal_uint32 uFirstFrameOffset, uFrameDur;
if(AST_SUCCESS != DafParseHeader(hdl, &uFirstFrameOffset, &uFrameDur))
{
return MEDIA_FILE_INCOMPLETE;
}
return MEDIA_SUCCESS;
}
static Media_Event dafMedProcess( MHdl *hdl, Media_Event event )
{
MHPB_Internal *ihdl = (MHPB_Internal *)hdl;
AudComHdl *pParHdl = ihdl->NodeArray[0].curHdl;
kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_PROCESS, hdl->mediaType, hdl, event, hdl->state, hdl->eof,0,0,0);
switch(event) {
case MEDIA_READY_TO_PLAY:
return event;
case MEDIA_END:
case MEDIA_STOP_TIME_UP:
Media_A2V_NOTIFY_MEDIA_END(GenCompStop, hdl);
break;
case MEDIA_ERROR:
GenCompStop(hdl);
break;
case MEDIA_DATA_REQUEST:
case MEDIA_BUFFER_UNDERFLOW:
{
kal_uint32 I;
OMX_ERRORTYPE result;
if (ihdl->pstFSAL)
{
OMX_BUFFERHEADERTYPE *pBufHdr;
AudComHdlInt *iParHdl = (AudComHdlInt *)pParHdl;
do
{
result = DafPar_Process_Internal(pParHdl);
if (result != OMX_ErrorNone)
{
return MEDIA_READ_ERROR;
}
pBufHdr = ACU_GetBufferHeader(pParHdl, 1);
} while ((pBufHdr != NULL) && !(iParHdl->isEOF));
}
else
{
ACU_SendProcessCommandl((AudComHdlInt *)pParHdl);
}
if(!(hdl->pStrmStruct== NULL && ihdl->pstFSAL==NULL))
{
hdl->FinishWriteData(hdl);
}
if (ihdl->pstFSAL)
{
return MEDIA_NONE;
}
break;
}
default:
// should never reach here
ASSERT(0);
}
return event;
}
static Media_Status DafMedPlay( MHdl *hdl )
{
MHPB_Internal *ihdl = (MHPB_Internal *)hdl;
SinkParam Sink_param;
kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_PLAY, hdl->mediaType, hdl->state, hdl->GetDataCount(hdl),0,0,0,0);
#if defined(__AUDIO_NOT_SUPPORTED__)
return MEDIA_FAIL;
#endif
PcmSink_TerminateSound();
// Change status
hdl->eof = KAL_FALSE;
hdl->waiting = KAL_FALSE;
ihdl->endflag = KAL_FALSE;
KT_StopAndWait();
TONE_StopAndWait();
mhdlRefillAndUpdateVideoBuffer(hdl); //call this function, if video eof, hdl->eof will be set.
hdl->state = COMPONENT_STATE_PLAY;
// Load code
ihdl->region = DPMGR_MP3;
DPMGR_Load(DPMGR_MP3);
if (OMX_ErrorNone != ihdl->ParNode.curHdl->Start(ihdl->ParNode.curHdl)) {
// Unload code
DPMGR_Unload(DPMGR_MP3);
ihdl->region = DPMGR_NOT_MATCH;
if(ihdl->mh.eof || ihdl->mh.start_time)
{
kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_PLAY_ERROR, hdl->mediaType, 0,MEDIA_SEEK_EOF,0,0,0,0);
return MEDIA_SEEK_EOF;
}
else
{
kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_PLAY_ERROR, hdl->mediaType, 1,MEDIA_FAIL,0,0,0,0);
return MEDIA_FAIL;
}
}
Media_SetAudioFormat(MEDIA_FORMAT_DAF);
ihdl->DecNode.curHdl->Start(ihdl->DecNode.curHdl);
ihdl->DecNode.curHdl->SetParameter(ihdl->DecNode.curHdl, OMX_IndexParamMediaTekPcmSink, &Sink_param);
if ( OMX_ErrorNone != AudioDrain_Start(ihdl, Sink_param.uSamplingFreq, Sink_param.uChannelNum)) {
if (ihdl->mh.eof) {
kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_PLAY_ERROR, hdl->mediaType, 6,MEDIA_SEEK_EOF,0,0,0,0);
return MEDIA_SEEK_EOF;
} else {
kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_PLAY_ERROR, hdl->mediaType, 7,MEDIA_FAIL,0,0,0,0);
return MEDIA_FAIL;
}
}
kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_PLAY_SUCCESS, hdl->mediaType, hdl->state, hdl->GetDataCount(hdl),0,0,0,0);
return MEDIA_SUCCESS;
}
static const MHPB_CompList DafDecFuncArray[2] = {
{DafPar_GetMemSize, DafPar_Init, MP3DEC_PARSER_BUFSIZE, MP3DEC_PARSER_BUFNUM},
{DafDec_GetMemSize, DafDec_Init, MP3DEC_DECODER_BUFSIZE, MP3DEC_DECODER_BUFNUM}
};
static const MHPB_CompList DafParOnlyFunc = {
DafPar_GetMemSize, DafPar_Init, MP3DEC_PARSER_BUFSIZE, 0
};
MHdl *DAF_Open(void(*handler)( MHdl *handle, Media_Event event ), STFSAL *pstFSAL, void *param)
{
MHdl *hdl;
if (handler == NULL) {
MHPB_CompList const *pArray[2] = {&DafParOnlyFunc, NULL};
hdl = MH_Component_List_Open(handler, pstFSAL, pArray);
} else {
// Load code
DPMGR_Load(DPMGR_MP3);
hdl = MH_Component_Open(handler, pstFSAL, &DafDecFuncArray[0], &DafDecFuncArray[1]);
// Unload code
DPMGR_Unload(DPMGR_MP3);
}
hdl->mediaType = MEDIA_FORMAT_DAF;
kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_OPEN, hdl->mediaType, hdl, handler,0,0,0,0);
hdl->Process = dafMedProcess;
hdl->BuildCache = AudAstBuildCache;
hdl->GetCacheDuration = AudAstGetCacheDur;
hdl->SetCacheTbl = DafAstSetCacheTbl;
hdl->GetTotalDuration = AudAstGetTotalDuration;
hdl->ReachValidRegion = DafMedReachValidRegion;
hdl->Play = DafMedPlay;
// Set Parameter to component
{
MHPB_Internal *ihdl;
AcuFileParam parseInfo;
ihdl = (MHPB_Internal *)hdl;
// For streaming parser
if (pstFSAL == NULL) {
ihdl->NodeArray[0].curHdl->SetParameter(ihdl->NodeArray[0].curHdl, OMX_IndexParamMediaTekSetDafStrmInfo, (OMX_PTR)param);
}
ihdl->ParseFrame = DafParseFrame;
ihdl->ParseHeader = DafParseHeader;
}
return hdl;
}
#endif // DAF_DECODE