OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / hardware / ti / omap3 / omx / audio / src / openmax_il / aac_dec / inc / OMX_AacDec_Utils.h
1
2 /*
3  * Copyright (C) Texas Instruments - http://www.ti.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 /* =============================================================================
22  *             Texas Instruments OMAP(TM) Platform Software
23  *  (c) Copyright Texas Instruments, Incorporated.  All Rights Reserved.
24  *
25  *  Use of this software is controlled by the terms and conditions found
26  *  in the license agreement under which this software has been supplied.
27  * ============================================================================ */
28 /**
29  * @file OMX_AacDec_Utils.h
30  *
31  * This is an header file for an audio AAC decoder that is fully
32  * compliant with the OMX Audio specification.
33  * This the file is used internally by the component
34  * in its code.
35  *
36  * @path  $(CSLPATH)\OMAPSW_MPU\linux\audio\src\openmax_il\aac_dec\inc\
37  *
38  * @rev 1.0
39  */
40 /* --------------------------------------------------------------------------- */
41 #ifndef OMX_AACDEC_UTILS__H
42 #define OMX_AACDEC_UTILS__H
43
44 #include <OMX_Component.h>
45 #include <OMX_TI_Common.h>
46 #include <OMX_TI_Debug.h>
47 #include "LCML_DspCodec.h"
48 #include <pthread.h>
49 #include <sched.h>
50
51 #ifdef RESOURCE_MANAGER_ENABLED
52 #include <ResourceManagerProxyAPI.h>
53 #endif
54
55 #ifdef UNDER_CE
56 #include <windows.h>
57 #include <oaf_osal.h>
58 #include <omx_core.h>
59 #include <stdlib.h>
60 #endif
61 #ifndef UNDER_CE
62 #define AUDIO_MANAGER
63 #else
64 #undef AUDIO_MANAGER
65 #endif
66
67 #ifdef __PERF_INSTRUMENTATION__
68 #include "perf.h"
69 #endif
70
71 #ifndef ANDROID
72     #define ANDROID
73 #endif
74
75 #ifdef ANDROID
76     /* Log for Android system*/
77     #undef LOG_TAG
78     #define LOG_TAG "OMX_AACDEC"
79
80     /* PV opencore capability custom parameter index */
81     #define PV_OMX_COMPONENT_CAPABILITY_TYPE_INDEX 0xFF7A347
82 #endif
83  
84 #define OBJECTTYPE_LC 2
85 #define OBJECTTYPE_LTP 4
86 #define OBJECTTYPE_HE 5
87 #define OBJECTTYPE_HE2 29
88
89 #define EXIT_COMPONENT_THRD  10
90
91
92 /* ======================================================================= */
93 /**
94  * @def    AAC_DEC__XXX_VER    Component version
95  */
96 /* ======================================================================= */
97 #define AACDEC_MAJOR_VER 1
98 #define AACDEC_MINOR_VER 1
99 /* ======================================================================= */
100 /**
101  * @def    NOT_USED_AACDEC    Defines a value for "don't care" parameters
102  */
103 /* ======================================================================= */
104 #define NOT_USED_AACDEC 0
105 /* ======================================================================= */
106 /**
107  * @def    NORMAL_BUFFER_AACDEC    Defines the flag value with all flags turned off
108  */
109 /* ======================================================================= */
110 #define NORMAL_BUFFER_AACDEC 0
111 /* ======================================================================= */
112 /**
113  * @def    OMX_AACDEC_DEFAULT_SEGMENT    Default segment ID for the LCML
114  */
115 /* ======================================================================= */
116 #define OMX_AACDEC_DEFAULT_SEGMENT (0)
117 /* ======================================================================= */
118 /**
119  * @def    OMX_AACDEC_SN_TIMEOUT    Timeout value for the socket node
120  */
121 /* ======================================================================= */
122 #define OMX_AACDEC_SN_TIMEOUT (-1)
123 /* ======================================================================= */
124 /**
125  * @def    OMX_AACDEC_SN_PRIORITY   Priority for the socket node
126  */
127 /* ======================================================================= */
128 #define OMX_AACDEC_SN_PRIORITY (10)
129 /* ======================================================================= */
130 /**
131  * @def    OMX_AACDEC_NUM_DLLS   number of DLL's
132  */
133 /* ======================================================================= */
134 #define OMX_AACDEC_NUM_DLLS (2)
135
136 #define AACDEC_BUFHEADER_VERSION 0x1
137 /* ======================================================================= */
138 /**
139  ** Default timeout used to come out of blocking calls*
140  *
141  */
142 /* ======================================================================= */
143 #define AACD_TIMEOUT (1000) /* millisecs */
144
145 /* ======================================================================= */
146 /**
147  * Wince #define
148  *
149  */
150 /* ======================================================================= */
151 #ifdef UNDER_CE
152 #define sleep Sleep
153 #endif
154 /* ======================================================================= */
155 /**
156  * @def    AACDEC_USN_DLL_NAME   USN DLL name
157  */
158 /* ======================================================================= */
159 #ifdef UNDER_CE
160 #define AACDEC_USN_DLL_NAME "\\windows\\usn.dll64P"
161 #else
162 #define AACDEC_USN_DLL_NAME "usn.dll64P"
163 #endif
164
165 /* ======================================================================= */
166 /**
167  * @def    AACDEC_DLL_NAME   AAC Dec Decoder socket node DLL name
168  */
169 /* ======================================================================= */
170 #ifdef UNDER_CE
171 #define AACDEC_DLL_NAME "\\windows\\mpeg4aacdec_sn.dll64P"
172 #else
173 #define AACDEC_DLL_NAME "mpeg4aacdec_sn.dll64P"
174 #endif
175
176 #define DONT_CARE 0
177
178 /* ======================================================================= */
179 /**
180  * @def    AACDEC_CPU_USAGE for Resource Mannager (MHZ)
181  */
182 /* ======================================================================= */
183 #define AACDEC_CPU_USAGE 50
184
185
186 /* ======================================================================= */
187 /**
188  * @def    AACDEC_SBR_CONTENT  flag detection
189  */
190 /* ======================================================================= */
191
192 #define AACDEC_SBR_CONTENT 0x601
193
194
195 /* ======================================================================= */
196 /**
197  * @def    AACDEC_PS_CONTENT flag  detection
198  */
199 /* ======================================================================= */
200
201 #define  AACDEC_PS_CONTENT 0x602
202
203
204 /* ======================================================================= */
205 /**
206  * @def    AACDEC_DEBUG   Debug print macro
207  */
208 /* ======================================================================= */
209
210 #undef AACDEC_DEBUG 
211 #define _ERROR_PROPAGATION__
212
213 #ifdef UNDER_CE
214
215 /* ======================================================================= */
216 /**
217  * @def    DEBUG   Memory print macro
218  */
219 /* ======================================================================= */
220 #if DEBUG
221 #define AACDEC_DPRINT printf
222 #define AACDEC_MEMPRINT printf
223 #define AACDEC_STATEPRINT printf
224 #define AACDEC_BUFPRINT printf
225 #define AACDEC_MEMPRINT printf
226 #define AACDEC_EPRINT printf
227 #else
228 #define AACDEC_DPRINT
229 #define AACDEC_MEMPRINT
230 #define AACDEC_STATEPRINT
231 #define AACDEC_BUFPRINT
232 #define AACDEC_MEMPRINT
233 #define AACDEC_EPRINT
234 #endif
235
236 #else /* for Linux */
237
238 #ifdef  AACDEC_DEBUG
239     #define AACDEC_DPRINT printf
240     #undef AACDEC_BUFPRINT printf
241     #undef AACDEC_MEMPRINT printf
242     #define AACDEC_STATEPRINT printf
243 #else
244     #define AACDEC_DPRINT(...)
245 #endif
246
247 #ifdef AACDEC_STATEDETAILS
248     #define AACDEC_STATEPRINT printf
249 #else
250     #define AACDEC_STATEPRINT(...)
251 #endif
252
253 #ifdef AACDEC_BUFDETAILS
254     #define AACDEC_BUFPRINT printf
255 #else
256     #define AACDEC_BUFPRINT(...)
257 #endif
258
259 #ifdef AACDEC_MEMDETAILS
260     #define AACDEC_MEMPRINT(...)  fprintf(stdout, "%s %d::  ",__FUNCTION__, __LINE__); \
261                                   fprintf(stdout, __VA_ARGS__); \
262                                   fprintf(stdout, "\n");
263 #else
264     #define AACDEC_MEMPRINT(...)
265 #endif
266
267 #define AACDEC_EPRINT LOGE
268
269 #endif
270
271
272 /* ======================================================================= */
273 /**
274  * @def    AACDEC_OMX_ERROR_EXIT   Exit print and return macro
275  */
276 /* ======================================================================= */
277 #define AACDEC_OMX_ERROR_EXIT(_e_, _c_, _s_)                            \
278     _e_ = _c_;                                                          \
279     OMXDBG_PRINT(stderr, ERROR, 4, 0, "\n**************** OMX ERROR ************************\n");  \
280     OMXDBG_PRINT(stderr, ERROR, 4, 0, "%d : Error Name: %s : Error Num = %x",__LINE__, _s_, _e_);  \
281     OMXDBG_PRINT(stderr, ERROR, 4, 0, "\n**************** OMX ERROR ************************\n");  \
282     goto EXIT;
283
284 /* ======================================================================= */
285 /**
286  * @def    AACDEC_OMX_CONF_CHECK_CMD   Command check Macro
287  */
288 /* ======================================================================= */
289 #define AACDEC_OMX_CONF_CHECK_CMD(_ptr1, _ptr2, _ptr3)  \
290     {                                                   \
291         if(!_ptr1 || !_ptr2 || !_ptr3){                 \
292             eError = OMX_ErrorBadParameter;             \
293             goto EXIT;                                  \
294         }                                               \
295     }
296
297 /* ======================================================================= */
298 /**
299  * @def    OMX_CONF_INIT_STRUCT   Macro to Initialise the structure variables
300  */
301 /* ======================================================================= */
302 #define OMX_CONF_INIT_STRUCT(_s_, _name_)       \
303     memset((_s_), 0x0, sizeof(_name_));         \
304     (_s_)->nSize = sizeof(_name_);              \
305     (_s_)->nVersion.s.nVersionMajor = 1;      \
306     (_s_)->nVersion.s.nVersionMinor = 1;      \
307     (_s_)->nVersion.s.nRevision = 0x0;          \
308     (_s_)->nVersion.s.nStep = 0x0
309
310 /* ======================================================================= */
311 /**
312  * @def    AACDEC_BUFDETAILS   Turns buffer messaging on and off
313  */
314 /* ======================================================================= */
315 #undef AACDEC_BUFDETAILS
316 /* ======================================================================= */
317 /**
318  * @def    AACDEC_STATEDETAILS   Turns state messaging on and off
319  */
320 /* ======================================================================= */
321 #undef AACDEC_STATEDETAILS
322 /* ======================================================================= */
323 /**
324  * @def    AACDEC_MEMDETAILS   Turns memory messaging on and off
325  */
326 /* ======================================================================= */
327 #undef AACDEC_MEMDETAILS
328
329 #define AACDEC_OUTPUT_PORT 1
330 #define AACDEC_INPUT_PORT 0
331 #define AACDEC_APP_ID  100
332 #define MAX_NUM_OF_BUFS_AACDEC 15
333 #define PARAMETRIC_STEREO_AACDEC 1
334 #define NON_PARAMETRIC_STEREO_AACDEC 0
335 /* ======================================================================= */
336 /**
337  * @def    NUM_OF_PORTS_AACDEC   Number of ports
338  */
339 /* ======================================================================= */
340 #define NUM_OF_PORTS_AACDEC 2
341 /* ======================================================================= */
342 /**
343  * @def    STREAM_COUNT_AACDEC   Number of streams
344  */
345 /* ======================================================================= */
346 #define STREAM_COUNT_AACDEC 2
347
348 /** Default timeout used to come out of blocking calls*/
349
350 /* ======================================================================= */
351 /**
352  * @def    AACD_NUM_INPUT_BUFFERS   Default number of input buffers
353  *
354  */
355 /* ======================================================================= */
356 #define AACD_NUM_INPUT_BUFFERS 4
357 /* ======================================================================= */
358 /**
359  * @def    AACD_NUM_OUTPUT_BUFFERS   Default number of output buffers
360  *
361  */
362 /* ======================================================================= */
363 #define AACD_NUM_OUTPUT_BUFFERS 4
364
365 /* ======================================================================= */
366 /**
367  * @def    AACD_INPUT_BUFFER_SIZE   Default input buffer size
368  *
369  */
370 /* ======================================================================= */
371 #define AACD_INPUT_BUFFER_SIZE 1536*4
372 /* ======================================================================= */
373 /**
374  * @def    AACD_OUTPUT_BUFFER_SIZE   Default output buffer size
375  *
376  */
377 /* ======================================================================= */
378 #define AACD_OUTPUT_BUFFER_SIZE 8192*2
379 /* ======================================================================= */
380 /**
381  * @def    AACD_SAMPLING_FREQUENCY   Sampling frequency
382  */
383 /* ======================================================================= */
384 #define AACD_SAMPLING_FREQUENCY 44100
385
386 /* ======================================================================= */
387 /**
388  * @def    AACDec macros for MONO,STEREO_INTERLEAVED,STEREO_NONINTERLEAVED
389  */
390 /* ======================================================================= */
391 /*#define AACD_STEREO_INTERLEAVED_STREAM     2
392   #define AACD_STEREO_NONINTERLEAVED_STREAM  3*/
393 /* ======================================================================= */
394 /**
395  * @def    AACDec macros for MONO,STEREO_INTERLEAVED,STEREO_NONINTERLEAVED
396  */
397 /* ======================================================================= */
398 /* Stream types supported*/
399 #define MONO_STREAM_AACDEC                   1
400 #define STEREO_INTERLEAVED_STREAM_AACDEC     2
401 #define STEREO_NONINTERLEAVED_STREAM_AACDEC  3
402
403 /* ======================================================================= */
404 /**
405  * pthread variable to indicate OMX returned all buffers to app 
406  */
407 /* ======================================================================= */
408 pthread_mutex_t bufferReturned_mutex; 
409 pthread_cond_t bufferReturned_condition;
410
411 /**
412  *
413  * AAC Decoder Profile:0 - MAIN, 1 - LC, 2 - SSR, 3 - LTP.
414  */
415 typedef enum {
416     EProfileMain,
417     EProfileLC,
418     EProfileSSR,
419     EProfileLTP
420 }AACProfile;
421 /* ======================================================================= */
422 /** COMP_PORT_TYPE_AACDEC  Port types
423  *
424  *  @param  INPUT_PORT_AACDEC                    Input port
425  *
426  *  @param  OUTPUT_PORT_AACDEC               Output port
427  */
428 /*  ==================================================================== */
429 /*This enum must not be changed. */
430 typedef enum COMP_PORT_TYPE_AACDEC {
431     INPUT_PORT_AACDEC = 0,
432     OUTPUT_PORT_AACDEC
433 }COMP_PORT_TYPE_AACDEC;
434 /* ======================================================================= */
435 /** OMX_INDEXAUDIOTYPE_AACDEC  Defines the custom configuration settings
436  *                              for the component
437  *
438  *  @param  OMX_IndexCustomMode16_24bit_AACDEC  Sets the 16/24 mode
439  *
440  *  @param  OMX_IndexCustomModeProfile_AACDEC  Sets the Profile mode
441  *
442  *  @param  OMX_IndexCustomModeSBR_AACDEC  Sets the SBR mode
443  *
444  *  @param  OMX_IndexCustomModeDasfConfig_AACDEC  Sets the DASF mode
445  *
446  *  @param  OMX_IndexCustomModeRAW_AACDEC  Sets the RAW mode
447  *
448  *  @param  OMX_IndexCustomModePS_AACDEC  Sets the ParametricStereo mode
449  *
450  */
451 /*  ==================================================================== */
452 typedef enum OMX_INDEXAUDIOTYPE_AACDEC {
453     OMX_IndexCustomAacDecHeaderInfoConfig = 0xFF000001,
454     OMX_IndexCustomAacDecStreamIDConfig,
455     OMX_IndexCustomAacDecDataPath,
456     OMX_IndexCustomDebug
457 }OMX_INDEXAUDIOTYPE_AACDEC;
458
459 /* ======================================================================= */
460 /** IAUDIO_PcmFormat: This value is used by DSP.
461  *
462  * @param IAUDIO_BLOCK: It is used in DASF mode.
463  *
464  * @param IAUDIO_INTERLEAVED: It specifies interleaved format of SN.
465  */
466 /* ==================================================================== */
467 typedef enum {
468     EAUDIO_BLOCK =0,
469     EAUDIO_INTERLEAVED
470 }TAUDIO_AacFormat;
471
472 /* ======================================================================= */
473 /** IAUDIO_PcmFormat: This value is used by DSP.
474  *
475  * @param IAUDIO_BLOCK: It is used in DASF mode.
476  *
477  * @param IAUDIO_INTERLEAVED: It specifies interleaved format of SN.
478  */
479 /* ==================================================================== */
480 typedef enum {
481     IAUDIO_BLOCK=0,
482     IAUDIO_INTERLEAVED
483 } IAUDIO_PcmFormat;
484 /* ======================================================================= */
485 /** MPEG4AACDEC_UALGParams
486  *
487  * @param lOutputFormat - To set interleaved/Block format:Refer to IAUDIO_AacFormat.
488  * @param DownSampleSbr -
489  */
490 /* ==================================================================== */
491 typedef struct {
492     OMX_U32    size;
493     long       lOutputFormat;
494     long       DownSampleSbr;
495     long       iEnablePS;
496     long       lSamplingRateIdx;
497     long       bRawFormat;
498     long       dualMonoMode;
499 } MPEG4AACDEC_UALGParams;
500
501 /* ======================================================================= */
502 /** IUALG_Cmd_AAC_DEC: This enum type describes the standard set of commands that
503  * will be passed to iualg control API at DSP. This enum is taken as it is from
504  * DSP side USN source code.
505  *
506  * @param IUALG_CMD_STOP: This command indicates that higher layer framework
507  * has received a stop command and no more process API will be called for the
508  * current data stream. The iualg layer is expected to ensure that all processed
509  * output as is put in the output IUALG_Buf buffers and the state of all buffers
510  * changed as to free or DISPATCH after this function call.
511  *
512  * @param IUALG_CMD_PAUSE: This command indicates that higher layer framework
513  * has received a PAUSE command on the current data stream. The iualg layer
514  * can change the state of some of its output IUALG_Bufs to DISPATCH to enable
515  * high level framework to use the processed data until the command was received.
516  *
517  * @param IUALG_CMD_GETSTATUS: This command indicates that some algo specific
518  * status needs to be returned to the framework. The pointer to the status
519  * structure will be in IALG_status * variable passed to the control API.
520  * The interpretation of the content of this pointer is left to IUALG layer.
521  *
522  * @param IUALG_CMD_SETSTATUS: This command indicates that some algo specific
523  * status needs to be set. The pointer to the status structure will be in
524  * IALG_status * variable passed to the control API. The interpretation of the
525  * content of this pointer is left to IUALG layer.
526  *
527  * @param IUALG_CMD_USERCMDSTART: The algorithm specific control commands can
528  * have the enum type set from this number.
529  */
530 /* ==================================================================== */
531
532 typedef enum {
533     IUALG_CMD_STOP          = 0,
534     IUALG_CMD_PAUSE         = 1,
535     IUALG_CMD_GETSTATUS     = 2,
536     IUALG_CMD_SETSTATUS     = 3,
537     IUALG_CMD_USERCMDSTART_AACDEC  = 100
538 }IUALG_Cmd_AAC_DEC;
539
540 #ifdef UNDER_CE
541 #ifndef _OMX_EVENT_
542 #define _OMX_EVENT_
543 typedef struct OMX_Event {
544     HANDLE event;
545 } OMX_Event;
546 #endif
547 int OMX_CreateEvent(OMX_Event *event);
548 int OMX_SignalEvent(OMX_Event *event);
549 int OMX_WaitForEvent(OMX_Event *event);
550 int OMX_DestroyEvent(OMX_Event *event);
551 #endif
552
553 /* ======================================================================= */
554 /** IUALG_PCMDCmd: This enum specifies the command to DSP.
555  *
556  * @param IULAG_CMD_SETSTREAMTYPE: Specifies the stream type to be sent to DSP.
557  */
558 /* ==================================================================== */
559 typedef enum {
560     IULAG_CMD_SETSTREAMTYPE = IUALG_CMD_USERCMDSTART_AACDEC
561 }IUALG_PCMDCmd;
562
563 /* ======================================================================= */
564 /** AACDEC_UAlgInBufParamStruct: This struct is passed with input buffers that
565  * are sent to DSP.
566  */
567 /* ==================================================================== */
568 typedef struct {
569     /* Set to 1 if buffer is last buffer */
570     unsigned short bLastBuffer;
571     unsigned short bConcealBuffer;
572 }AACDEC_UAlgInBufParamStruct;
573
574 /* ======================================================================= */
575 /** USN_AudioCodecParams: This contains the information which does to Codec
576  * on DSP
577  * are sent to DSP.
578  */
579 /* ==================================================================== */
580 typedef struct USN_AudioCodecParams{
581     /* Specifies the sample frequency */
582     unsigned long ulSamplingFreq;
583     /* Specifies the UUID */
584     unsigned long unUUID;
585     /* Specifies the audio format */
586     unsigned short unAudioFormat;
587 }USN_AudioCodecParams;
588
589 /* ======================================================================= */
590 /** AACDEC_UAlgOutBufParamStruct: This is passed with output buffer to DSP.
591  */
592 /* ==================================================================== */
593 typedef struct {
594     unsigned long ulFrameCount;
595     unsigned long isLastBuffer;
596 }AACDEC_UAlgOutBufParamStruct;
597
598 typedef struct AACDEC_UALGParams{
599     unsigned long    lOutputFormat;
600     unsigned long    lMonoToStereoCopy;
601 } AACDEC_UALGParams;
602
603 /* ======================================================================= */
604 /** AACD_LCML_BUFHEADERTYPE: This is LCML buffer header which is sent to LCML
605  * for both input and output buffers.
606  */
607 /* ==================================================================== */
608 typedef struct AACD_LCML_BUFHEADERTYPE {
609     /* Direction whether input or output buffer */
610     OMX_DIRTYPE eDir;
611     /* Pointer to OMX Buffer Header */
612     OMX_BUFFERHEADERTYPE *pBufHdr;
613     /* Other parameters, may be useful for enhancements */
614     void *pOtherParams[10];
615     /* Input Parameter Information structure */
616     AACDEC_UAlgInBufParamStruct *pIpParam;
617     /* Output Parameter Information structure */
618     AACDEC_UAlgOutBufParamStruct *pOpParam;
619 }AACD_LCML_BUFHEADERTYPE;
620
621 /* Component Port Context */
622 typedef struct AUDIODEC_PORT_TYPE {
623     /* Used in tunneling, this is handle of tunneled component */
624     OMX_HANDLETYPE hTunnelComponent;
625     /* Port which has to be tunneled */
626     OMX_U32 nTunnelPort;
627     /* Buffer Supplier Information */
628     OMX_BUFFERSUPPLIERTYPE eSupplierSetting;
629     /* Number of buffers */
630     OMX_U8 nBufferCnt;
631     /* Port format information */
632     OMX_AUDIO_PARAM_PORTFORMATTYPE* pPortFormat;
633 } AUDIODEC_PORT_TYPE;
634
635
636 /* ======================================================================= */
637 /** AAC_DEC_BUFFERLIST: This contains information about a buffer's owner whether
638  * it is application or component, number of buffers owned etc.
639  *
640  * @see OMX_BUFFERHEADERTYPE
641  */
642 /* ==================================================================== */
643 struct AAC_DEC_BUFFERLIST{
644     /* Array of pointer to OMX buffer headers */
645     OMX_BUFFERHEADERTYPE *pBufHdr[MAX_NUM_OF_BUFS_AACDEC];
646     /* Array that tells about owner of each buffer */
647     OMX_U32 bufferOwner[MAX_NUM_OF_BUFS_AACDEC];
648     /* Tracks pending buffers */
649     OMX_U32 bBufferPending[MAX_NUM_OF_BUFS_AACDEC];
650     /* Number of buffers  */
651     OMX_U32 numBuffers;
652 };
653
654 typedef struct AAC_DEC_BUFFERLIST AACDEC_BUFFERLIST;
655
656 typedef struct PV_OMXComponentCapabilityFlagsType
657 {
658         ////////////////// OMX COMPONENT CAPABILITY RELATED MEMBERS (for opencore compatability)
659         OMX_BOOL iIsOMXComponentMultiThreaded;
660         OMX_BOOL iOMXComponentSupportsExternalOutputBufferAlloc;
661         OMX_BOOL iOMXComponentSupportsExternalInputBufferAlloc;
662         OMX_BOOL iOMXComponentSupportsMovableInputBuffers;
663         OMX_BOOL iOMXComponentSupportsPartialFrames;
664         OMX_BOOL iOMXComponentNeedsNALStartCode;
665         OMX_BOOL iOMXComponentCanHandleIncompleteFrames;
666 } PV_OMXComponentCapabilityFlagsType;
667
668 /* ======================================================================= */
669 /** AACDEC_COMPONENT_PRIVATE: This is the major and main structure of the
670  * component which contains all type of information of buffers, ports etc
671  * contained in the component.
672  *
673  * @see OMX_BUFFERHEADERTYPE
674  * @see OMX_AUDIO_PARAM_PORTFORMATTYPE
675  * @see OMX_PARAM_PORTDEFINITIONTYPE
676  * @see AACD_LCML_BUFHEADERTYPE
677  * @see OMX_PORT_PARAM_TYPE
678  * @see OMX_PRIORITYMGMTTYPE
679  * @see AUDIODEC_PORT_TYPE
680  * @see AACDEC_BUFFERLIST
681  * @see LCML_STRMATTR
682  * @see
683  */
684 /* ==================================================================== */
685
686 typedef struct AACDEC_COMPONENT_PRIVATE
687 {
688
689     OMX_CALLBACKTYPE cbInfo;
690     /** Handle for use with async callbacks */
691     OMX_PORT_PARAM_TYPE* sPortParam;
692     /* Input port information */
693     OMX_AUDIO_PARAM_PORTFORMATTYPE sInPortFormat;
694     /* Output port information */
695     OMX_AUDIO_PARAM_PORTFORMATTYPE sOutPortFormat;
696     /* Buffer owner information */
697     OMX_U32 bIsBufferOwned[NUM_OF_PORTS_AACDEC];
698
699     /** This will contain info like how many buffers
700         are there for input/output ports, their size etc, but not
701         BUFFERHEADERTYPE POINTERS. */
702     OMX_PARAM_PORTDEFINITIONTYPE* pPortDef[NUM_OF_PORTS_AACDEC];
703     /* Contains information that come from application */
704     OMX_AUDIO_PARAM_AACPROFILETYPE* aacParams;
705
706     OMX_AUDIO_PARAM_PCMMODETYPE* pcmParams;
707
708     /** This is component handle */
709     OMX_COMPONENTTYPE* pHandle;
710
711     /** Current state of this component */
712     OMX_STATETYPE curState;
713
714     /** The component thread handle */
715     pthread_t ComponentThread;
716
717     /** The pipes for sending buffers to the thread */
718     int dataPipe[2];
719
720     /** The pipes for sending buffers to the thread */
721     int cmdPipe[2];
722
723     /** The pipes for sending command data to the thread */
724     int cmdDataPipe[2];
725
726     /** Set to indicate component is stopping */
727     OMX_U32 bIsEOFSent;
728
729     /** Count of number of buffers outstanding with bridge */
730     OMX_U32 lcml_nIpBuf;
731
732     /** Count of number of buffers outstanding with bridge */
733     OMX_U32 lcml_nOpBuf;
734
735     /** Counts of number of input buffers sent to LCML */
736     OMX_U32 lcml_nCntIp;
737     /** Counts of number of input buffers received from LCML */
738     OMX_U32 lcml_nCntIpRes;
739     /** Counts of number of output buffers sent to LCML */
740     OMX_U32 lcml_nCntOp;
741     /** Counts of number of output buffers received from LCML */
742     OMX_U32 lcml_nCntOpReceived;
743     /** Counts of number of buffers sent to App  */
744     OMX_U32 lcml_nCntApp;
745     /** Counts of number of buffers received from App  */
746     OMX_U32 app_nBuf;
747
748     OMX_U32 lcml_compID;
749     /** Counts of number of output buffers reclaimed from lcml  */
750     OMX_U32 num_Reclaimed_Op_Buff;
751     /** Counts of number of input buffers sent to lcml  */
752     OMX_U32 num_Sent_Ip_Buff;
753     /** Counts of number of output buffers sent to lcml  */
754     OMX_U32 num_Op_Issued;
755     /** Holds the value of dasf mode, 1: DASF mode or 0: File Mode  */
756     OMX_U32 dasfmode;
757
758     /** This is LCML handle  */
759     OMX_HANDLETYPE pLcmlHandle;
760
761     /** ID stream ID**/
762     OMX_U32 streamID;
763     /** Contains pointers to LCML Buffer Headers */
764     AACD_LCML_BUFHEADERTYPE *pLcmlBufHeader[2];
765
766 #ifdef __PERF_INSTRUMENTATION__
767     PERF_OBJHANDLE pPERF, pPERFcomp;
768     OMX_U32 nLcml_nCntIp;         
769     OMX_U32 nLcml_nCntOpReceived;
770 #endif
771
772     /** Tells whether buffers on ports have been allocated */
773     OMX_U32 bPortDefsAllocated;
774     /** Tells whether component thread has started */
775     OMX_U32 bCompThreadStarted;
776     /** Marks the buffer data  */
777     OMX_PTR pMarkData;
778     /** Marks the buffer */
779     OMX_MARKTYPE *pMarkBuf;
780     /** Marks the target component */
781     OMX_HANDLETYPE hMarkTargetComponent;
782     /** Flag to track when input buffer's filled length is 0 */
783     OMX_U32 bBypassDSP;
784     /** Input port enable flag */
785     OMX_U32 ipPortEnableFlag;
786     /** Input port disble flag */
787     OMX_U32 ipPortDisableFlag;
788     /** Pointer to port parameter structure */
789     OMX_PORT_PARAM_TYPE* pPortParamType;
790     /** Pointer to port priority management structure */
791     OMX_PRIORITYMGMTTYPE* pPriorityMgmt;
792
793 #ifdef RESOURCE_MANAGER_ENABLED
794     RMPROXY_CALLBACKTYPE rmproxyCallback;
795 #endif
796
797     OMX_BOOL bPreempted;
798
799         
800     /** Contains the port related info of both the ports */
801     AUDIODEC_PORT_TYPE *pCompPort[NUM_OF_PORTS_AACDEC];
802     /* Checks whether or not buffer were allocated by appliction */
803     OMX_U32 bufAlloced;
804     /** Flag to check about execution of component thread */
805     OMX_U16 bExitCompThrd;
806     /** Pointer to list of input buffers */
807     AACDEC_BUFFERLIST *pInputBufferList;
808     /** Pointer to list of output buffers */
809     AACDEC_BUFFERLIST *pOutputBufferList;
810     /** it is used for component's create phase arguments */
811     LCML_STRMATTR  *strmAttr;
812     /** Contains the version information */
813     OMX_U32 nVersion;
814
815     /** Number of input buffers at runtime */
816     OMX_U32 nRuntimeInputBuffers;
817
818     /** Number of output buffers at runtime */
819     OMX_U32 nRuntimeOutputBuffers;
820
821     /** Parameters being passed to the SN */
822     USN_AudioCodecParams *pParams;
823
824     /** Dynamic Parameters being passed to the SN */
825     MPEG4AACDEC_UALGParams * AACDEC_UALGParam;
826
827     OMX_U16 framemode;
828
829     OMX_STRING cComponentName;
830
831     OMX_VERSIONTYPE ComponentVersion;
832
833     OMX_U32 nOpBit;
834     OMX_U32 parameteric_stereo;
835     OMX_U32 dualMonoMode;
836     OMX_U32 SBR;
837     OMX_U32 RAW;
838     OMX_U32 nFillThisBufferCount;
839     OMX_U32 nFillBufferDoneCount;
840     OMX_U32 nEmptyThisBufferCount;
841     OMX_U32 nEmptyBufferDoneCount;
842     OMX_U32 bInitParamsInitialized;
843     AACDEC_BUFFERLIST *pInputBufferListQueue;
844     AACDEC_BUFFERLIST *pOutputBufferListQueue;
845     /** To store input buffers recieved while in paused state **/
846     OMX_BUFFERHEADERTYPE *pInputBufHdrPending[MAX_NUM_OF_BUFS_AACDEC];
847     OMX_U32 nNumInputBufPending;
848     
849     /** To store out buffers received while in puased state **/
850     OMX_BUFFERHEADERTYPE *pOutputBufHdrPending[MAX_NUM_OF_BUFS_AACDEC];
851     OMX_U32 nNumOutputBufPending;
852     
853     /** Flags to control port disable command **/
854     OMX_U32 bDisableCommandPending;
855     OMX_U32 bDisableCommandParam;
856     /** Flags to control port enable command **/
857     OMX_U32 bEnableCommandPending;
858     OMX_U32 bEnableCommandParam;
859
860     OMX_U32 nInvalidFrameCount;
861     OMX_U32 numPendingBuffers;
862     OMX_U32 bNoIdleOnStop;
863     OMX_U32 bDspStoppedWhileExecuting;
864     /* bIdleCommandPending;*/
865     OMX_S32 nOutStandingFillDones;
866     OMX_BOOL bIsInvalidState;
867     OMX_STRING* sDeviceString;
868 #ifndef UNDER_CE    
869     pthread_mutex_t AlloBuf_mutex;    
870     pthread_cond_t AlloBuf_threshold;
871     OMX_U8 AlloBuf_waitingsignal;
872     
873     pthread_mutex_t InLoaded_mutex;
874     pthread_cond_t InLoaded_threshold;
875     OMX_U8 InLoaded_readytoidle;
876     
877     pthread_mutex_t InIdle_mutex;
878     pthread_cond_t InIdle_threshold;
879     OMX_U8 InIdle_goingtoloaded;
880
881     pthread_mutex_t codecStop_mutex;    
882     pthread_cond_t codecStop_threshold;
883     OMX_U8 codecStop_waitingsignal;
884
885     pthread_mutex_t codecFlush_mutex;    
886     pthread_cond_t codecFlush_threshold;
887     OMX_U8 codecFlush_waitingsignal;
888
889     OMX_U32 nUnhandledFillThisBuffers;
890     OMX_U32 nHandledFillThisBuffers;
891     OMX_U32 nUnhandledEmptyThisBuffers;
892     OMX_U32 nHandledEmptyThisBuffers;
893     OMX_BOOL bFlushOutputPortCommandPending;
894     OMX_BOOL bFlushInputPortCommandPending;
895 #else
896     OMX_Event AlloBuf_event;
897     OMX_U8 AlloBuf_waitingsignal;
898     
899     OMX_Event InLoaded_event;
900     OMX_U8 InLoaded_readytoidle;
901     
902     OMX_Event InIdle_event;
903     OMX_U8 InIdle_goingtoloaded; 
904 #endif
905
906     OMX_BOOL bLoadedCommandPending;
907     OMX_PARAM_COMPONENTROLETYPE *componentRole;
908
909     OMX_U8 PendingInPausedBufs;
910     OMX_BUFFERHEADERTYPE *pInBufHdrPausedPending[MAX_NUM_OF_BUFS_AACDEC];
911     OMX_U8 PendingOutPausedBufs;
912     OMX_BUFFERHEADERTYPE *pOutBufHdrPausedPending[MAX_NUM_OF_BUFS_AACDEC];
913     
914     /** Keep buffer timestamps **/
915     OMX_S64 arrBufIndex[MAX_NUM_OF_BUFS_AACDEC];
916         /**Keep buffer tickcount*/
917         OMX_U32 arrBufIndexTick[MAX_NUM_OF_BUFS_AACDEC];
918         
919     /** Index to arrBufIndex[] and arrBufIndexTick[], used for input buffer timestamps */
920     OMX_U8 IpBufindex;
921     /** Index to arrBufIndex[] and arrBufIndexTick[], used for input buffer timestamps  */
922     OMX_U8 OpBufindex;
923
924     /** Flag to flush SN after EOS in order to process more buffers after EOS**/
925     OMX_U8 SendAfterEOS;
926
927     /** Flag to mark the first sent buffer**/
928     OMX_U8 first_buff;
929     /** First Time Stamp sent **/
930     OMX_TICKS first_TS;
931     /** Temporal time stamp **/
932     OMX_TICKS temp_TS;
933
934     PV_OMXComponentCapabilityFlagsType iPVCapabilityFlags;
935     OMX_BOOL bConfigData;
936     OMX_BOOL reconfigInputPort;
937     OMX_BOOL reconfigOutputPort;
938     OMX_U8 OutPendingPR;
939
940     struct OMX_TI_Debug dbg;
941
942     /** Indicate when first output buffer received from DSP **/
943     OMX_U32 first_output_buf_rcv;
944
945 } AACDEC_COMPONENT_PRIVATE;
946
947 /* ================================================================================= * */
948 /**
949  * OMX_ComponentInit() function is called by OMX Core to initialize the component
950  * with default values of the component. Before calling this function OMX_Init
951  * must have been called.
952  *
953  * @param *hComp This is component handle allocated by the OMX core.
954  *
955  * @pre          OMX_Init should be called by application.
956  *
957  * @post         Component has initialzed with default values.
958  *
959  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
960  *               OMX_ErrorInsufficientResources = Not enough memory
961  *
962  *  @see          AacDec_StartCompThread()
963  */
964 /* ================================================================================ * */
965 #ifndef UNDER_CE
966 OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp);
967 #else
968 /*  WinCE Implicit Export Syntax */
969 #define OMX_EXPORT __declspec(dllexport)
970 /* ===========================================================  */
971 /**
972  *  OMX_ComponentInit()  Initializes component
973  *
974  *
975  *  @param hComp            OMX Handle
976  *
977  *  @return OMX_ErrorNone = Successful
978  *          Other error code = fail
979  *
980  */
981 /*================================================================== */
982 OMX_EXPORT OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp);
983 #endif
984
985 /* ================================================================================= * */
986 /**
987  * AacDec_StartCompThread() starts the component thread. This is internal
988  * function of the component.
989  *
990  * @param pHandle This is component handle allocated by the OMX core.
991  *
992  * @pre          None
993  *
994  * @post         None
995  *
996  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
997  *               OMX_ErrorInsufficientResources = Not enough memory
998  *
999  *  @see         None
1000  */
1001 /* ================================================================================ * */
1002 OMX_ERRORTYPE AacDec_StartCompThread(OMX_HANDLETYPE pHandle);
1003 /* ================================================================================= * */
1004 /**
1005  * AACDEC_Fill_LCMLInitParams() fills the LCML initialization structure.
1006  *
1007  * @param pHandle This is component handle allocated by the OMX core.
1008  *
1009  * @param plcml_Init This structure is filled and sent to LCML.
1010  *
1011  * @pre          None
1012  *
1013  * @post         None
1014  *
1015  *  @return      OMX_ErrorNone = Successful Inirialization of the LCML struct.
1016  *               OMX_ErrorInsufficientResources = Not enough memory
1017  *
1018  *  @see         None
1019  */
1020 /* ================================================================================ * */
1021 OMX_ERRORTYPE AACDEC_Fill_LCMLInitParams(OMX_HANDLETYPE pHandle, LCML_DSP *plcml_Init, OMX_U16 arr[]);
1022 /* ================================================================================= * */
1023 /**
1024  * AACDEC_GetBufferDirection() function determines whether it is input buffer or
1025  * output buffer.
1026  *
1027  * @param *pBufHeader This is pointer to buffer header whose direction needs to
1028  *                    be determined.
1029  *
1030  * @param *eDir  This is output argument which stores the direction of buffer.
1031  *
1032  * @pre          None
1033  *
1034  * @post         None
1035  *
1036  *  @return      OMX_ErrorNone = Successful processing.
1037  *               OMX_ErrorBadParameter = In case of invalid buffer
1038  *
1039  *  @see         None
1040  */
1041 /* ================================================================================ * */
1042 OMX_ERRORTYPE AACDEC_GetBufferDirection(OMX_BUFFERHEADERTYPE *pBufHeader,
1043                                         OMX_DIRTYPE *eDir);
1044 /* ================================================================================= * */
1045 /**
1046  * AACDEC_LCML_Callback() function is callback which is called by LCML whenever
1047  * there is an even generated for the component.
1048  *
1049  * @param event  This is event that was generated.
1050  *
1051  * @param arg    This has other needed arguments supplied by LCML like handles
1052  *               etc.
1053  *
1054  * @pre          None
1055  *
1056  * @post         None
1057  *
1058  *  @return      OMX_ErrorNone = Successful processing.
1059  *               OMX_ErrorInsufficientResources = Not enough memory
1060  *
1061  *  @see         None
1062  */
1063 /* ================================================================================ * */
1064 OMX_ERRORTYPE AACDEC_LCML_Callback (TUsnCodecEvent event,void * args [10]);
1065 /* ================================================================================= * */
1066 /**
1067  * AACDEC_HandleCommand() function handles the command sent by the application.
1068  * All the state transitions, except from nothing to loaded state, of the
1069  * component are done by this function.
1070  *
1071  * @param pComponentPrivate  This is component's private date structure.
1072  *
1073  * @pre          None
1074  *
1075  * @post         None
1076  *
1077  *  @return      OMX_ErrorNone = Successful processing.
1078  *               OMX_ErrorInsufficientResources = Not enough memory
1079  *               OMX_ErrorHardware = Hardware error has occured lile LCML failed
1080  *               to do any said operartion.
1081  *
1082  *  @see         None
1083  */
1084 /* ================================================================================ * */
1085 OMX_U32 AACDEC_HandleCommand (AACDEC_COMPONENT_PRIVATE *pComponentPrivate);
1086 /* ================================================================================= * */
1087 /**
1088  * AACDEC_HandleDataBuf_FromApp() function handles the input and output buffers
1089  * that come from the application. It is not direct function wich gets called by
1090  * the application rather, it gets called eventually.
1091  *
1092  * @param *pBufHeader This is the buffer header that needs to be processed.
1093  *
1094  * @param *pComponentPrivate  This is component's private date structure.
1095  *
1096  * @pre          None
1097  *
1098  * @post         None
1099  *
1100  *  @return      OMX_ErrorNone = Successful processing.
1101  *               OMX_ErrorInsufficientResources = Not enough memory
1102  *               OMX_ErrorHardware = Hardware error has occured lile LCML failed
1103  *               to do any said operartion.
1104  *
1105  *  @see         None
1106  */
1107 /* ================================================================================ * */
1108 OMX_ERRORTYPE AACDEC_HandleDataBuf_FromApp(OMX_BUFFERHEADERTYPE *pBufHeader,
1109                                            AACDEC_COMPONENT_PRIVATE *pComponentPrivate);
1110 /* ================================================================================= * */
1111 /**
1112  * AACDEC_GetLCMLHandle() function gets the LCML handle and interacts with LCML
1113  * by using this LCML Handle.
1114  *
1115  * @param *pBufHeader This is the buffer header that needs to be processed.
1116  *
1117  * @param *pComponentPrivate  This is component's private date structure.
1118  *
1119  * @pre          None
1120  *
1121  * @post         None
1122  *
1123  *  @return      OMX_HANDLETYPE = Successful loading of LCML library.
1124  *               OMX_ErrorHardware = Hardware error has occured.
1125  *
1126  *  @see         None
1127  */
1128 /* ================================================================================ * */
1129 OMX_HANDLETYPE AACDEC_GetLCMLHandle(AACDEC_COMPONENT_PRIVATE* pComponentPrivate);
1130 /* ================================================================================= * */
1131 /**
1132  * AACDEC_GetCorresponding_LCMLHeader() function gets the corresponding LCML
1133  * header from the actual data buffer for required processing.
1134  *
1135  * @param *pBuffer This is the data buffer pointer.
1136  *
1137  * @param eDir   This is direction of buffer. Input/Output.
1138  *
1139  * @param *AACD_LCML_BUFHEADERTYPE  This is pointer to LCML Buffer Header.
1140  *
1141  * @pre          None
1142  *
1143  * @post         None
1144  *
1145  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
1146  *               OMX_ErrorHardware = Hardware error has occured.
1147  *
1148  *  @see         None
1149  */
1150 /* ================================================================================ * */
1151 OMX_ERRORTYPE AACDEC_GetCorresponding_LCMLHeader(AACDEC_COMPONENT_PRIVATE* pComponentPrivate,
1152                                                  OMX_U8 *pBuffer,
1153                                                  OMX_DIRTYPE eDir,
1154                                                  AACD_LCML_BUFHEADERTYPE **ppLcmlHdr);
1155 /* ================================================================================= * */
1156 /**
1157  * AACDEC_FreeCompResources() function frees the component resources.
1158  *
1159  * @param pComponent This is the component handle.
1160  *
1161  * @pre          None
1162  *
1163  * @post         None
1164  *
1165  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
1166  *               OMX_ErrorHardware = Hardware error has occured.
1167  *
1168  *  @see         None
1169  */
1170 /* ================================================================================ * */
1171 OMX_ERRORTYPE AACDEC_FreeCompResources(OMX_HANDLETYPE pComponent);
1172 /* ================================================================================= * */
1173 /**
1174  * AACDEC_CleanupInitParams() function frees only the initialization time
1175  * memories allocated. For example, it will not close pipes, it will not free the
1176  * memory allocated to the buffers etc. But it does free the memory of buffers
1177  * utilized by the LCML etc. It is basically subset of AACDEC_FreeCompResources()
1178  * function.
1179  *
1180  * @param pComponent This is the component handle.
1181  *
1182  * @pre          None
1183  *
1184  * @post         None
1185  *
1186  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
1187  *
1188  *  @see         None
1189  */
1190 /* ================================================================================ * */
1191 void AACDEC_CleanupInitParams(OMX_HANDLETYPE pComponent);
1192 /* ================================================================================= * */
1193 /**
1194  * AACDEC_CleanupInitParamsEx() function frees only the initialization time
1195  * memories allocated. For example, it will not close pipes, it will not free the
1196  * memory allocated to the buffers etc. But it does free the memory of buffers
1197  * utilized by the LCML etc. It is basically subset of AACDEC_FreeCompResources()
1198  * function. Called while port disable when port reconfiguration takes place.
1199  *
1200  * @param pComponent This is the component handle.
1201  *
1202  * @pre          None
1203  *
1204  * @post         None
1205  *
1206  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
1207  *
1208  *  @see         None
1209  */
1210 /* ================================================================================ * */
1211 void AACDEC_CleanupInitParamsEx(OMX_HANDLETYPE pComponent,OMX_U32 indexport);
1212 /* ===========================================================  */
1213 /**
1214  *  AACDEC_SetPending()  Called when the component queues a buffer
1215  * to the LCML
1216  *
1217  *  @param pComponentPrivate        Component private data
1218  *
1219  *  @param pBufHdr                Buffer header
1220  *
1221  *  @param eDir                    Direction of the buffer
1222  *
1223  *  @return None
1224  */
1225 /*================================================================== */
1226 void AACDEC_SetPending(AACDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber);
1227 /* ===========================================================  */
1228 /**
1229  *  AACDEC_ClearPending()  Called when a buffer is returned
1230  * from the LCML
1231  *
1232  *  @param pComponentPrivate        Component private data
1233  *
1234  *  @param pBufHdr                Buffer header
1235  *
1236  *  @param eDir                    Direction of the buffer
1237  *
1238  *  @return None
1239  */
1240 /*================================================================== */
1241 void AACDEC_ClearPending(AACDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber) ;
1242 /* ===========================================================  */
1243 /**
1244  *  AACDEC_IsPending()
1245  *
1246  *
1247  *  @param pComponentPrivate        Component private data
1248  *
1249  *  @return OMX_ErrorNone = Successful
1250  *          Other error code = fail
1251  */
1252 /*================================================================== */
1253 OMX_U32 AACDEC_IsPending(AACDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir);
1254 /* ===========================================================  */
1255 /**
1256  *  AACDECFill_LCMLInitParamsEx()  Fills the parameters needed
1257  * to initialize the LCML without recreating the socket node
1258  *
1259  *  @param pComponent            OMX Handle
1260  *
1261  *  @return None
1262  */
1263
1264 /*================================================================== */
1265 OMX_ERRORTYPE AACDECFill_LCMLInitParamsEx(OMX_HANDLETYPE pComponent,OMX_U32 indexport);
1266 /* ===========================================================  */
1267 /**
1268  *  AACDEC_IsValid()
1269  *
1270  *
1271  *  @param pComponentPrivate        Component private data
1272  *
1273  *  @return OMX_ErrorNone = Successful
1274  *          Other error code = fail
1275  */
1276 /*================================================================== */
1277 OMX_U32 AACDEC_IsValid(AACDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U8 *pBuffer, OMX_DIRTYPE eDir) ;
1278
1279 #ifdef RESOURCE_MANAGER_ENABLED
1280 void AACDEC_ResourceManagerCallback(RMPROXY_COMMANDDATATYPE cbData);
1281 #endif
1282 /*=======================================================================*/
1283 /*! @fn AACDec_GetSampleRateIndexL
1284
1285  * @brief Gets the sample rate index
1286
1287  * @param  aRate : Actual Sampling Freq
1288
1289  * @Return  Index
1290
1291  */
1292 /*=======================================================================*/
1293 int AACDec_GetSampleRateIndexL( const int aRate);
1294 int AACDec_GetSampleRatebyIndex( const int index);
1295 void* AACDEC_ComponentThread (void* pThreadData);
1296
1297 OMX_U32 AACDEC_ParseHeader(OMX_BUFFERHEADERTYPE* pBufHeader,
1298                            AACDEC_COMPONENT_PRIVATE *pComponentPrivate);
1299
1300 /*  =========================================================================*/
1301 /*  func    GetBits                                                          */
1302 /*                                                                           */
1303 /*  desc    Gets aBits number of bits from position aPosition of one buffer  */
1304 /*            and returns the value in a TUint value.                        */
1305 /*  =========================================================================*/
1306 OMX_U32 AACDEC_GetBits(OMX_U32* nPosition, OMX_U8 nBits, OMX_U8* pBuffer, OMX_BOOL bIcreasePosition);
1307
1308 /*  =========================================================================*/
1309 /*  func    AACDEC_HandleUSNError
1310  *
1311  *  desc    Handles error messages returned by the dsp
1312  *
1313  * @Return n/a
1314  *
1315  *  =========================================================================*/
1316 void AACDEC_HandleUSNError (AACDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 arg);
1317
1318 /*=======================================================================*/
1319 /*! @fn SignalIfAllBuffersAreReturned 
1320  * @brief Sends pthread signal to indicate OMX has returned all buffers to app 
1321  * @param  none 
1322  * @Return void 
1323  */
1324 /*=======================================================================*/
1325 void SignalIfAllBuffersAreReturned(AACDEC_COMPONENT_PRIVATE *pComponentPrivate);
1326
1327 #endif