Home | History | Annotate | Download | only in inc
      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 ALOGE
    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 typedef enum{
    541   IAAC_WARN_DATA_CORRUPT = 0x0804
    542 }IAAC_WARN_MSG;
    543 
    544 #ifdef UNDER_CE
    545 #ifndef _OMX_EVENT_
    546 #define _OMX_EVENT_
    547 typedef struct OMX_Event {
    548     HANDLE event;
    549 } OMX_Event;
    550 #endif
    551 int OMX_CreateEvent(OMX_Event *event);
    552 int OMX_SignalEvent(OMX_Event *event);
    553 int OMX_WaitForEvent(OMX_Event *event);
    554 int OMX_DestroyEvent(OMX_Event *event);
    555 #endif
    556 
    557 /* ======================================================================= */
    558 /** IUALG_PCMDCmd: This enum specifies the command to DSP.
    559  *
    560  * @param IULAG_CMD_SETSTREAMTYPE: Specifies the stream type to be sent to DSP.
    561  */
    562 /* ==================================================================== */
    563 typedef enum {
    564     IULAG_CMD_SETSTREAMTYPE = IUALG_CMD_USERCMDSTART_AACDEC
    565 }IUALG_PCMDCmd;
    566 
    567 /* ======================================================================= */
    568 /** AACDEC_UAlgInBufParamStruct: This struct is passed with input buffers that
    569  * are sent to DSP.
    570  */
    571 /* ==================================================================== */
    572 typedef struct {
    573     /* Set to 1 if buffer is last buffer */
    574     unsigned short bLastBuffer;
    575     unsigned short bConcealBuffer;
    576 }AACDEC_UAlgInBufParamStruct;
    577 
    578 /* ======================================================================= */
    579 /** USN_AudioCodecParams: This contains the information which does to Codec
    580  * on DSP
    581  * are sent to DSP.
    582  */
    583 /* ==================================================================== */
    584 typedef struct USN_AudioCodecParams{
    585     /* Specifies the sample frequency */
    586     unsigned long ulSamplingFreq;
    587     /* Specifies the UUID */
    588     unsigned long unUUID;
    589     /* Specifies the audio format */
    590     unsigned short unAudioFormat;
    591 }USN_AudioCodecParams;
    592 
    593 /* ======================================================================= */
    594 /** AACDEC_UAlgOutBufParamStruct: This is passed with output buffer to DSP.
    595  */
    596 /* ==================================================================== */
    597 typedef struct {
    598     unsigned long ulFrameCount;
    599     unsigned long isLastBuffer;
    600 }AACDEC_UAlgOutBufParamStruct;
    601 
    602 typedef struct AACDEC_UALGParams{
    603     unsigned long    lOutputFormat;
    604     unsigned long    lMonoToStereoCopy;
    605 } AACDEC_UALGParams;
    606 
    607 /* ======================================================================= */
    608 /** AACD_LCML_BUFHEADERTYPE: This is LCML buffer header which is sent to LCML
    609  * for both input and output buffers.
    610  */
    611 /* ==================================================================== */
    612 typedef struct AACD_LCML_BUFHEADERTYPE {
    613     /* Direction whether input or output buffer */
    614     OMX_DIRTYPE eDir;
    615     /* Pointer to OMX Buffer Header */
    616     OMX_BUFFERHEADERTYPE *pBufHdr;
    617     /* Other parameters, may be useful for enhancements */
    618     void *pOtherParams[10];
    619     /* Input Parameter Information structure */
    620     AACDEC_UAlgInBufParamStruct *pIpParam;
    621     /* Output Parameter Information structure */
    622     AACDEC_UAlgOutBufParamStruct *pOpParam;
    623 }AACD_LCML_BUFHEADERTYPE;
    624 
    625 /* Component Port Context */
    626 typedef struct AUDIODEC_PORT_TYPE {
    627     /* Used in tunneling, this is handle of tunneled component */
    628     OMX_HANDLETYPE hTunnelComponent;
    629     /* Port which has to be tunneled */
    630     OMX_U32 nTunnelPort;
    631     /* Buffer Supplier Information */
    632     OMX_BUFFERSUPPLIERTYPE eSupplierSetting;
    633     /* Number of buffers */
    634     OMX_U8 nBufferCnt;
    635     /* Port format information */
    636     OMX_AUDIO_PARAM_PORTFORMATTYPE* pPortFormat;
    637 } AUDIODEC_PORT_TYPE;
    638 
    639 
    640 /* ======================================================================= */
    641 /** AAC_DEC_BUFFERLIST: This contains information about a buffer's owner whether
    642  * it is application or component, number of buffers owned etc.
    643  *
    644  * @see OMX_BUFFERHEADERTYPE
    645  */
    646 /* ==================================================================== */
    647 struct AAC_DEC_BUFFERLIST{
    648     /* Array of pointer to OMX buffer headers */
    649     OMX_BUFFERHEADERTYPE *pBufHdr[MAX_NUM_OF_BUFS_AACDEC];
    650     /* Array that tells about owner of each buffer */
    651     OMX_U32 bufferOwner[MAX_NUM_OF_BUFS_AACDEC];
    652     /* Tracks pending buffers */
    653     OMX_U32 bBufferPending[MAX_NUM_OF_BUFS_AACDEC];
    654     /* Number of buffers  */
    655     OMX_U32 numBuffers;
    656 };
    657 
    658 typedef struct AAC_DEC_BUFFERLIST AACDEC_BUFFERLIST;
    659 
    660 typedef struct PV_OMXComponentCapabilityFlagsType
    661 {
    662         ////////////////// OMX COMPONENT CAPABILITY RELATED MEMBERS (for opencore compatability)
    663         OMX_BOOL iIsOMXComponentMultiThreaded;
    664         OMX_BOOL iOMXComponentSupportsExternalOutputBufferAlloc;
    665         OMX_BOOL iOMXComponentSupportsExternalInputBufferAlloc;
    666         OMX_BOOL iOMXComponentSupportsMovableInputBuffers;
    667         OMX_BOOL iOMXComponentSupportsPartialFrames;
    668         OMX_BOOL iOMXComponentNeedsNALStartCode;
    669         OMX_BOOL iOMXComponentCanHandleIncompleteFrames;
    670 } PV_OMXComponentCapabilityFlagsType;
    671 
    672 /* ======================================================================= */
    673 /** AACDEC_COMPONENT_PRIVATE: This is the major and main structure of the
    674  * component which contains all type of information of buffers, ports etc
    675  * contained in the component.
    676  *
    677  * @see OMX_BUFFERHEADERTYPE
    678  * @see OMX_AUDIO_PARAM_PORTFORMATTYPE
    679  * @see OMX_PARAM_PORTDEFINITIONTYPE
    680  * @see AACD_LCML_BUFHEADERTYPE
    681  * @see OMX_PORT_PARAM_TYPE
    682  * @see OMX_PRIORITYMGMTTYPE
    683  * @see AUDIODEC_PORT_TYPE
    684  * @see AACDEC_BUFFERLIST
    685  * @see LCML_STRMATTR
    686  * @see
    687  */
    688 /* ==================================================================== */
    689 
    690 typedef struct AACDEC_COMPONENT_PRIVATE
    691 {
    692 
    693     OMX_CALLBACKTYPE cbInfo;
    694     /** Handle for use with async callbacks */
    695     OMX_PORT_PARAM_TYPE* sPortParam;
    696     /* Input port information */
    697     OMX_AUDIO_PARAM_PORTFORMATTYPE sInPortFormat;
    698     /* Output port information */
    699     OMX_AUDIO_PARAM_PORTFORMATTYPE sOutPortFormat;
    700     /* Buffer owner information */
    701     OMX_U32 bIsBufferOwned[NUM_OF_PORTS_AACDEC];
    702 
    703     /** This will contain info like how many buffers
    704         are there for input/output ports, their size etc, but not
    705         BUFFERHEADERTYPE POINTERS. */
    706     OMX_PARAM_PORTDEFINITIONTYPE* pPortDef[NUM_OF_PORTS_AACDEC];
    707     /* Contains information that come from application */
    708     OMX_AUDIO_PARAM_AACPROFILETYPE* aacParams;
    709 
    710     OMX_AUDIO_PARAM_PCMMODETYPE* pcmParams;
    711 
    712     /** This is component handle */
    713     OMX_COMPONENTTYPE* pHandle;
    714 
    715     /** Current state of this component */
    716     OMX_STATETYPE curState;
    717 
    718     /** The component thread handle */
    719     pthread_t ComponentThread;
    720 
    721     /** The pipes for sending buffers to the thread */
    722     int dataPipe[2];
    723 
    724     /** The pipes for sending buffers to the thread */
    725     int cmdPipe[2];
    726 
    727     /** The pipes for sending command data to the thread */
    728     int cmdDataPipe[2];
    729 
    730     /** Set to indicate component is stopping */
    731     OMX_U32 bIsEOFSent;
    732 
    733     /** Count of number of buffers outstanding with bridge */
    734     OMX_U32 lcml_nIpBuf;
    735 
    736     /** Count of number of buffers outstanding with bridge */
    737     OMX_U32 lcml_nOpBuf;
    738 
    739     /** Counts of number of input buffers sent to LCML */
    740     OMX_U32 lcml_nCntIp;
    741     /** Counts of number of input buffers received from LCML */
    742     OMX_U32 lcml_nCntIpRes;
    743     /** Counts of number of output buffers sent to LCML */
    744     OMX_U32 lcml_nCntOp;
    745     /** Counts of number of output buffers received from LCML */
    746     OMX_U32 lcml_nCntOpReceived;
    747     /** Counts of number of buffers sent to App  */
    748     OMX_U32 lcml_nCntApp;
    749     /** Counts of number of buffers received from App  */
    750     OMX_U32 app_nBuf;
    751 
    752     OMX_U32 lcml_compID;
    753     /** Counts of number of output buffers reclaimed from lcml  */
    754     OMX_U32 num_Reclaimed_Op_Buff;
    755     /** Counts of number of input buffers sent to lcml  */
    756     OMX_U32 num_Sent_Ip_Buff;
    757     /** Counts of number of output buffers sent to lcml  */
    758     OMX_U32 num_Op_Issued;
    759     /** Holds the value of dasf mode, 1: DASF mode or 0: File Mode  */
    760     OMX_U32 dasfmode;
    761 
    762     /** This is LCML handle  */
    763     OMX_HANDLETYPE pLcmlHandle;
    764 
    765     /** ID stream ID**/
    766     OMX_U32 streamID;
    767     /** Contains pointers to LCML Buffer Headers */
    768     AACD_LCML_BUFHEADERTYPE *pLcmlBufHeader[2];
    769 
    770 #ifdef __PERF_INSTRUMENTATION__
    771     PERF_OBJHANDLE pPERF, pPERFcomp;
    772     OMX_U32 nLcml_nCntIp;
    773     OMX_U32 nLcml_nCntOpReceived;
    774 #endif
    775 
    776     /** Tells whether buffers on ports have been allocated */
    777     OMX_U32 bPortDefsAllocated;
    778     /** Tells whether component thread has started */
    779     OMX_U32 bCompThreadStarted;
    780     /** Marks the buffer data  */
    781     OMX_PTR pMarkData;
    782     /** Marks the buffer */
    783     OMX_MARKTYPE *pMarkBuf;
    784     /** Marks the target component */
    785     OMX_HANDLETYPE hMarkTargetComponent;
    786     /** Flag to track when input buffer's filled length is 0 */
    787     OMX_U32 bBypassDSP;
    788     /** Input port enable flag */
    789     OMX_U32 ipPortEnableFlag;
    790     /** Input port disble flag */
    791     OMX_U32 ipPortDisableFlag;
    792     /** Pointer to port parameter structure */
    793     OMX_PORT_PARAM_TYPE* pPortParamType;
    794     /** Pointer to port priority management structure */
    795     OMX_PRIORITYMGMTTYPE* pPriorityMgmt;
    796 
    797 #ifdef RESOURCE_MANAGER_ENABLED
    798     RMPROXY_CALLBACKTYPE rmproxyCallback;
    799 #endif
    800 
    801     OMX_BOOL bPreempted;
    802 
    803 
    804     /** Contains the port related info of both the ports */
    805     AUDIODEC_PORT_TYPE *pCompPort[NUM_OF_PORTS_AACDEC];
    806     /* Checks whether or not buffer were allocated by appliction */
    807     OMX_U32 bufAlloced;
    808     /** Flag to check about execution of component thread */
    809     OMX_U16 bExitCompThrd;
    810     /** Pointer to list of input buffers */
    811     AACDEC_BUFFERLIST *pInputBufferList;
    812     /** Pointer to list of output buffers */
    813     AACDEC_BUFFERLIST *pOutputBufferList;
    814     /** it is used for component's create phase arguments */
    815     LCML_STRMATTR  *strmAttr;
    816     /** Contains the version information */
    817     OMX_U32 nVersion;
    818 
    819     /** Number of input buffers at runtime */
    820     OMX_U32 nRuntimeInputBuffers;
    821 
    822     /** Number of output buffers at runtime */
    823     OMX_U32 nRuntimeOutputBuffers;
    824 
    825     /** Parameters being passed to the SN */
    826     USN_AudioCodecParams *pParams;
    827 
    828     /** Dynamic Parameters being passed to the SN */
    829     MPEG4AACDEC_UALGParams * AACDEC_UALGParam;
    830 
    831     OMX_U16 framemode;
    832 
    833     OMX_STRING cComponentName;
    834 
    835     OMX_VERSIONTYPE ComponentVersion;
    836 
    837     OMX_U32 nOpBit;
    838     OMX_U32 parameteric_stereo;
    839     OMX_U32 dualMonoMode;
    840     OMX_U32 SBR;
    841     OMX_U32 RAW;
    842     OMX_U32 nFillThisBufferCount;
    843     OMX_U32 nFillBufferDoneCount;
    844     OMX_U32 nEmptyThisBufferCount;
    845     OMX_U32 nEmptyBufferDoneCount;
    846     OMX_U32 bInitParamsInitialized;
    847     AACDEC_BUFFERLIST *pInputBufferListQueue;
    848     AACDEC_BUFFERLIST *pOutputBufferListQueue;
    849     /** To store input buffers recieved while in paused state **/
    850     OMX_BUFFERHEADERTYPE *pInputBufHdrPending[MAX_NUM_OF_BUFS_AACDEC];
    851     OMX_U32 nNumInputBufPending;
    852 
    853     /** To store out buffers received while in puased state **/
    854     OMX_BUFFERHEADERTYPE *pOutputBufHdrPending[MAX_NUM_OF_BUFS_AACDEC];
    855     OMX_U32 nNumOutputBufPending;
    856 
    857     /** Flags to control port disable command **/
    858     OMX_U32 bDisableCommandPending;
    859     OMX_U32 bDisableCommandParam;
    860     /** Flags to control port enable command **/
    861     OMX_U32 bEnableCommandPending;
    862     OMX_U32 bEnableCommandParam;
    863 
    864     OMX_U32 nInvalidFrameCount;
    865     OMX_U32 numPendingBuffers;
    866     OMX_U32 bNoIdleOnStop;
    867     OMX_U32 bDspStoppedWhileExecuting;
    868     /* bIdleCommandPending;*/
    869     OMX_S32 nOutStandingFillDones;
    870     OMX_BOOL bIsInvalidState;
    871     OMX_STRING* sDeviceString;
    872 #ifndef UNDER_CE
    873     pthread_mutex_t AlloBuf_mutex;
    874     pthread_cond_t AlloBuf_threshold;
    875     OMX_U8 AlloBuf_waitingsignal;
    876 
    877     pthread_mutex_t InLoaded_mutex;
    878     pthread_cond_t InLoaded_threshold;
    879     OMX_U8 InLoaded_readytoidle;
    880 
    881     pthread_mutex_t InIdle_mutex;
    882     pthread_cond_t InIdle_threshold;
    883     OMX_U8 InIdle_goingtoloaded;
    884 
    885     pthread_mutex_t codecStop_mutex;
    886     pthread_cond_t codecStop_threshold;
    887     OMX_U8 codecStop_waitingsignal;
    888 
    889     pthread_mutex_t codecFlush_mutex;
    890     pthread_cond_t codecFlush_threshold;
    891     OMX_U8 codecFlush_waitingsignal;
    892 
    893     OMX_U32 nUnhandledFillThisBuffers;
    894     OMX_U32 nHandledFillThisBuffers;
    895     OMX_U32 nUnhandledEmptyThisBuffers;
    896     OMX_U32 nHandledEmptyThisBuffers;
    897     OMX_BOOL bFlushOutputPortCommandPending;
    898     OMX_BOOL bFlushInputPortCommandPending;
    899 #else
    900     OMX_Event AlloBuf_event;
    901     OMX_U8 AlloBuf_waitingsignal;
    902 
    903     OMX_Event InLoaded_event;
    904     OMX_U8 InLoaded_readytoidle;
    905 
    906     OMX_Event InIdle_event;
    907     OMX_U8 InIdle_goingtoloaded;
    908 #endif
    909 
    910     OMX_BOOL bLoadedCommandPending;
    911     OMX_PARAM_COMPONENTROLETYPE *componentRole;
    912 
    913     OMX_U8 PendingInPausedBufs;
    914     OMX_BUFFERHEADERTYPE *pInBufHdrPausedPending[MAX_NUM_OF_BUFS_AACDEC];
    915     OMX_U8 PendingOutPausedBufs;
    916     OMX_BUFFERHEADERTYPE *pOutBufHdrPausedPending[MAX_NUM_OF_BUFS_AACDEC];
    917 
    918     /** Keep buffer timestamps **/
    919     OMX_S64 arrBufIndex[MAX_NUM_OF_BUFS_AACDEC];
    920 	/**Keep buffer tickcount*/
    921 	OMX_U32 arrBufIndexTick[MAX_NUM_OF_BUFS_AACDEC];
    922 
    923     /** Index to arrBufIndex[] and arrBufIndexTick[], used for input buffer timestamps */
    924     OMX_U8 IpBufindex;
    925     /** Index to arrBufIndex[] and arrBufIndexTick[], used for input buffer timestamps  */
    926     OMX_U8 OpBufindex;
    927 
    928     /** Flag to flush SN after EOS in order to process more buffers after EOS**/
    929     OMX_U8 SendAfterEOS;
    930 
    931     /** Flag to mark the first sent buffer**/
    932     OMX_U8 first_buff;
    933     /** First Time Stamp sent **/
    934     OMX_TICKS first_TS;
    935     /** Temporal time stamp **/
    936     OMX_TICKS temp_TS;
    937 
    938     PV_OMXComponentCapabilityFlagsType iPVCapabilityFlags;
    939     OMX_BOOL bConfigData;
    940     OMX_BOOL reconfigInputPort;
    941     OMX_BOOL reconfigOutputPort;
    942     OMX_U8 OutPendingPR;
    943 
    944     struct OMX_TI_Debug dbg;
    945 
    946     /** Indicate when first output buffer received from DSP **/
    947     OMX_U32 first_output_buf_rcv;
    948 
    949 } AACDEC_COMPONENT_PRIVATE;
    950 
    951 /* ================================================================================= * */
    952 /**
    953  * OMX_ComponentInit() function is called by OMX Core to initialize the component
    954  * with default values of the component. Before calling this function OMX_Init
    955  * must have been called.
    956  *
    957  * @param *hComp This is component handle allocated by the OMX core.
    958  *
    959  * @pre          OMX_Init should be called by application.
    960  *
    961  * @post         Component has initialzed with default values.
    962  *
    963  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
    964  *               OMX_ErrorInsufficientResources = Not enough memory
    965  *
    966  *  @see          AacDec_StartCompThread()
    967  */
    968 /* ================================================================================ * */
    969 #ifndef UNDER_CE
    970 OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp);
    971 #else
    972 /*  WinCE Implicit Export Syntax */
    973 #define OMX_EXPORT __declspec(dllexport)
    974 /* ===========================================================  */
    975 /**
    976  *  OMX_ComponentInit()  Initializes component
    977  *
    978  *
    979  *  @param hComp            OMX Handle
    980  *
    981  *  @return OMX_ErrorNone = Successful
    982  *          Other error code = fail
    983  *
    984  */
    985 /*================================================================== */
    986 OMX_EXPORT OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp);
    987 #endif
    988 
    989 /* ================================================================================= * */
    990 /**
    991  * AacDec_StartCompThread() starts the component thread. This is internal
    992  * function of the component.
    993  *
    994  * @param pHandle This is component handle allocated by the OMX core.
    995  *
    996  * @pre          None
    997  *
    998  * @post         None
    999  *
   1000  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
   1001  *               OMX_ErrorInsufficientResources = Not enough memory
   1002  *
   1003  *  @see         None
   1004  */
   1005 /* ================================================================================ * */
   1006 OMX_ERRORTYPE AacDec_StartCompThread(OMX_HANDLETYPE pHandle);
   1007 /* ================================================================================= * */
   1008 /**
   1009  * AACDEC_Fill_LCMLInitParams() fills the LCML initialization structure.
   1010  *
   1011  * @param pHandle This is component handle allocated by the OMX core.
   1012  *
   1013  * @param plcml_Init This structure is filled and sent to LCML.
   1014  *
   1015  * @pre          None
   1016  *
   1017  * @post         None
   1018  *
   1019  *  @return      OMX_ErrorNone = Successful Inirialization of the LCML struct.
   1020  *               OMX_ErrorInsufficientResources = Not enough memory
   1021  *
   1022  *  @see         None
   1023  */
   1024 /* ================================================================================ * */
   1025 OMX_ERRORTYPE AACDEC_Fill_LCMLInitParams(OMX_HANDLETYPE pHandle, LCML_DSP *plcml_Init, OMX_U16 arr[]);
   1026 /* ================================================================================= * */
   1027 /**
   1028  * AACDEC_GetBufferDirection() function determines whether it is input buffer or
   1029  * output buffer.
   1030  *
   1031  * @param *pBufHeader This is pointer to buffer header whose direction needs to
   1032  *                    be determined.
   1033  *
   1034  * @param *eDir  This is output argument which stores the direction of buffer.
   1035  *
   1036  * @pre          None
   1037  *
   1038  * @post         None
   1039  *
   1040  *  @return      OMX_ErrorNone = Successful processing.
   1041  *               OMX_ErrorBadParameter = In case of invalid buffer
   1042  *
   1043  *  @see         None
   1044  */
   1045 /* ================================================================================ * */
   1046 OMX_ERRORTYPE AACDEC_GetBufferDirection(OMX_BUFFERHEADERTYPE *pBufHeader,
   1047                                         OMX_DIRTYPE *eDir);
   1048 /* ================================================================================= * */
   1049 /**
   1050  * AACDEC_LCML_Callback() function is callback which is called by LCML whenever
   1051  * there is an even generated for the component.
   1052  *
   1053  * @param event  This is event that was generated.
   1054  *
   1055  * @param arg    This has other needed arguments supplied by LCML like handles
   1056  *               etc.
   1057  *
   1058  * @pre          None
   1059  *
   1060  * @post         None
   1061  *
   1062  *  @return      OMX_ErrorNone = Successful processing.
   1063  *               OMX_ErrorInsufficientResources = Not enough memory
   1064  *
   1065  *  @see         None
   1066  */
   1067 /* ================================================================================ * */
   1068 OMX_ERRORTYPE AACDEC_LCML_Callback (TUsnCodecEvent event,void * args [10]);
   1069 /* ================================================================================= * */
   1070 /**
   1071  * AACDEC_HandleCommand() function handles the command sent by the application.
   1072  * All the state transitions, except from nothing to loaded state, of the
   1073  * component are done by this function.
   1074  *
   1075  * @param pComponentPrivate  This is component's private date structure.
   1076  *
   1077  * @pre          None
   1078  *
   1079  * @post         None
   1080  *
   1081  *  @return      OMX_ErrorNone = Successful processing.
   1082  *               OMX_ErrorInsufficientResources = Not enough memory
   1083  *               OMX_ErrorHardware = Hardware error has occured lile LCML failed
   1084  *               to do any said operartion.
   1085  *
   1086  *  @see         None
   1087  */
   1088 /* ================================================================================ * */
   1089 OMX_U32 AACDEC_HandleCommand (AACDEC_COMPONENT_PRIVATE *pComponentPrivate);
   1090 /* ================================================================================= * */
   1091 /**
   1092  * AACDEC_HandleDataBuf_FromApp() function handles the input and output buffers
   1093  * that come from the application. It is not direct function wich gets called by
   1094  * the application rather, it gets called eventually.
   1095  *
   1096  * @param *pBufHeader This is the buffer header that needs to be processed.
   1097  *
   1098  * @param *pComponentPrivate  This is component's private date structure.
   1099  *
   1100  * @pre          None
   1101  *
   1102  * @post         None
   1103  *
   1104  *  @return      OMX_ErrorNone = Successful processing.
   1105  *               OMX_ErrorInsufficientResources = Not enough memory
   1106  *               OMX_ErrorHardware = Hardware error has occured lile LCML failed
   1107  *               to do any said operartion.
   1108  *
   1109  *  @see         None
   1110  */
   1111 /* ================================================================================ * */
   1112 OMX_ERRORTYPE AACDEC_HandleDataBuf_FromApp(OMX_BUFFERHEADERTYPE *pBufHeader,
   1113                                            AACDEC_COMPONENT_PRIVATE *pComponentPrivate);
   1114 /* ================================================================================= * */
   1115 /**
   1116  * AACDEC_GetLCMLHandle() function gets the LCML handle and interacts with LCML
   1117  * by using this LCML Handle.
   1118  *
   1119  * @param *pBufHeader This is the buffer header that needs to be processed.
   1120  *
   1121  * @param *pComponentPrivate  This is component's private date structure.
   1122  *
   1123  * @pre          None
   1124  *
   1125  * @post         None
   1126  *
   1127  *  @return      OMX_HANDLETYPE = Successful loading of LCML library.
   1128  *               OMX_ErrorHardware = Hardware error has occured.
   1129  *
   1130  *  @see         None
   1131  */
   1132 /* ================================================================================ * */
   1133 OMX_HANDLETYPE AACDEC_GetLCMLHandle(AACDEC_COMPONENT_PRIVATE* pComponentPrivate);
   1134 /* ================================================================================= * */
   1135 /**
   1136  * AACDEC_GetCorresponding_LCMLHeader() function gets the corresponding LCML
   1137  * header from the actual data buffer for required processing.
   1138  *
   1139  * @param *pBuffer This is the data buffer pointer.
   1140  *
   1141  * @param eDir   This is direction of buffer. Input/Output.
   1142  *
   1143  * @param *AACD_LCML_BUFHEADERTYPE  This is pointer to LCML Buffer Header.
   1144  *
   1145  * @pre          None
   1146  *
   1147  * @post         None
   1148  *
   1149  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
   1150  *               OMX_ErrorHardware = Hardware error has occured.
   1151  *
   1152  *  @see         None
   1153  */
   1154 /* ================================================================================ * */
   1155 OMX_ERRORTYPE AACDEC_GetCorresponding_LCMLHeader(AACDEC_COMPONENT_PRIVATE* pComponentPrivate,
   1156                                                  OMX_U8 *pBuffer,
   1157                                                  OMX_DIRTYPE eDir,
   1158                                                  AACD_LCML_BUFHEADERTYPE **ppLcmlHdr);
   1159 /* ================================================================================= * */
   1160 /**
   1161  * AACDEC_FreeCompResources() function frees the component resources.
   1162  *
   1163  * @param pComponent This is the component handle.
   1164  *
   1165  * @pre          None
   1166  *
   1167  * @post         None
   1168  *
   1169  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
   1170  *               OMX_ErrorHardware = Hardware error has occured.
   1171  *
   1172  *  @see         None
   1173  */
   1174 /* ================================================================================ * */
   1175 OMX_ERRORTYPE AACDEC_FreeCompResources(OMX_HANDLETYPE pComponent);
   1176 /* ================================================================================= * */
   1177 /**
   1178  * AACDEC_CleanupInitParams() function frees only the initialization time
   1179  * memories allocated. For example, it will not close pipes, it will not free the
   1180  * memory allocated to the buffers etc. But it does free the memory of buffers
   1181  * utilized by the LCML etc. It is basically subset of AACDEC_FreeCompResources()
   1182  * function.
   1183  *
   1184  * @param pComponent This is the component handle.
   1185  *
   1186  * @pre          None
   1187  *
   1188  * @post         None
   1189  *
   1190  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
   1191  *
   1192  *  @see         None
   1193  */
   1194 /* ================================================================================ * */
   1195 void AACDEC_CleanupInitParams(OMX_HANDLETYPE pComponent);
   1196 /* ================================================================================= * */
   1197 /**
   1198  * AACDEC_CleanupInitParamsEx() function frees only the initialization time
   1199  * memories allocated. For example, it will not close pipes, it will not free the
   1200  * memory allocated to the buffers etc. But it does free the memory of buffers
   1201  * utilized by the LCML etc. It is basically subset of AACDEC_FreeCompResources()
   1202  * function. Called while port disable when port reconfiguration takes place.
   1203  *
   1204  * @param pComponent This is the component handle.
   1205  *
   1206  * @pre          None
   1207  *
   1208  * @post         None
   1209  *
   1210  *  @return      OMX_ErrorNone = Successful Inirialization of the component\n
   1211  *
   1212  *  @see         None
   1213  */
   1214 /* ================================================================================ * */
   1215 void AACDEC_CleanupInitParamsEx(OMX_HANDLETYPE pComponent,OMX_U32 indexport);
   1216 /* ===========================================================  */
   1217 /**
   1218  *  AACDEC_SetPending()  Called when the component queues a buffer
   1219  * to the LCML
   1220  *
   1221  *  @param pComponentPrivate        Component private data
   1222  *
   1223  *  @param pBufHdr                Buffer header
   1224  *
   1225  *  @param eDir                    Direction of the buffer
   1226  *
   1227  *  @return None
   1228  */
   1229 /*================================================================== */
   1230 void AACDEC_SetPending(AACDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber);
   1231 /* ===========================================================  */
   1232 /**
   1233  *  AACDEC_ClearPending()  Called when a buffer is returned
   1234  * from the LCML
   1235  *
   1236  *  @param pComponentPrivate        Component private data
   1237  *
   1238  *  @param pBufHdr                Buffer header
   1239  *
   1240  *  @param eDir                    Direction of the buffer
   1241  *
   1242  *  @return None
   1243  */
   1244 /*================================================================== */
   1245 void AACDEC_ClearPending(AACDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber) ;
   1246 /* ===========================================================  */
   1247 /**
   1248  *  AACDEC_IsPending()
   1249  *
   1250  *
   1251  *  @param pComponentPrivate        Component private data
   1252  *
   1253  *  @return OMX_ErrorNone = Successful
   1254  *          Other error code = fail
   1255  */
   1256 /*================================================================== */
   1257 OMX_U32 AACDEC_IsPending(AACDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir);
   1258 /* ===========================================================  */
   1259 /**
   1260  *  AACDECFill_LCMLInitParamsEx()  Fills the parameters needed
   1261  * to initialize the LCML without recreating the socket node
   1262  *
   1263  *  @param pComponent            OMX Handle
   1264  *
   1265  *  @return None
   1266  */
   1267 
   1268 /*================================================================== */
   1269 OMX_ERRORTYPE AACDECFill_LCMLInitParamsEx(OMX_HANDLETYPE pComponent,OMX_U32 indexport);
   1270 /* ===========================================================  */
   1271 /**
   1272  *  AACDEC_IsValid()
   1273  *
   1274  *
   1275  *  @param pComponentPrivate        Component private data
   1276  *
   1277  *  @return OMX_ErrorNone = Successful
   1278  *          Other error code = fail
   1279  */
   1280 /*================================================================== */
   1281 OMX_U32 AACDEC_IsValid(AACDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U8 *pBuffer, OMX_DIRTYPE eDir) ;
   1282 
   1283 #ifdef RESOURCE_MANAGER_ENABLED
   1284 void AACDEC_ResourceManagerCallback(RMPROXY_COMMANDDATATYPE cbData);
   1285 #endif
   1286 /*=======================================================================*/
   1287 /*! @fn AACDec_GetSampleRateIndexL
   1288 
   1289  * @brief Gets the sample rate index
   1290 
   1291  * @param  aRate : Actual Sampling Freq
   1292 
   1293  * @Return  Index
   1294 
   1295  */
   1296 /*=======================================================================*/
   1297 int AACDec_GetSampleRateIndexL( const int aRate);
   1298 int AACDec_GetSampleRatebyIndex( const int index);
   1299 void* AACDEC_ComponentThread (void* pThreadData);
   1300 
   1301 OMX_U32 AACDEC_ParseHeader(OMX_BUFFERHEADERTYPE* pBufHeader,
   1302                            AACDEC_COMPONENT_PRIVATE *pComponentPrivate);
   1303 
   1304 /*  =========================================================================*/
   1305 /*  func    GetBits                                                          */
   1306 /*                                                                           */
   1307 /*  desc    Gets aBits number of bits from position aPosition of one buffer  */
   1308 /*            and returns the value in a TUint value.                        */
   1309 /*  =========================================================================*/
   1310 OMX_U32 AACDEC_GetBits(OMX_U32* nPosition, OMX_U8 nBits, OMX_U8* pBuffer, OMX_BOOL bIcreasePosition);
   1311 
   1312 /*  =========================================================================*/
   1313 /*  func    AACDEC_HandleUSNError
   1314  *
   1315  *  desc    Handles error messages returned by the dsp
   1316  *
   1317  * @Return n/a
   1318  *
   1319  *  =========================================================================*/
   1320 void AACDEC_HandleUSNError (AACDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 arg);
   1321 
   1322 /*=======================================================================*/
   1323 /*! @fn SignalIfAllBuffersAreReturned
   1324  * @brief Sends pthread signal to indicate OMX has returned all buffers to app
   1325  * @param  none
   1326  * @Return void
   1327  */
   1328 /*=======================================================================*/
   1329 void SignalIfAllBuffersAreReturned(AACDEC_COMPONENT_PRIVATE *pComponentPrivate);
   1330 
   1331 #endif
   1332