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_G711Decoder.h
     30  *
     31  * This is an header file for an audio PCM decoder that is fully
     32  * compliant with the OMX Audio specification.
     33  * This the file that the application that uses OMX would include
     34  * in its code.
     35  *
     36  * @path $(CSLPATH)\
     37  *
     38  * @rev 0.1
     39  */
     40 /* --------------------------------------------------------------------------- */
     41 
     42 #ifndef OMX_G711DECODER_H
     43 #define OMX_G711DECODER_H
     44 
     45 #include "LCML_DspCodec.h"
     46 #include <OMX_Component.h>
     47 #include <pthread.h>
     48 
     49 #ifndef UNDER_CE
     50 
     51 #ifdef DSP_RENDERING_ON
     52 #include <AudioManagerAPI.h>
     53 #endif
     54 
     55 #ifdef RESOURCE_MANAGER_ENABLED
     56 #include <ResourceManagerProxyAPI.h>
     57 #endif
     58 
     59 #endif
     60 
     61 
     62 /* ======================================================================= */
     63 /**
     64  * @def    EXTRA_BUFFBYTES                Num of Extra Bytes to be allocated
     65  */
     66 /* ======================================================================= */
     67 #define EXTRA_BUFFBYTES (256)
     68 
     69 /* ======================================================================= */
     70 /**
     71  * @def    G711D_TIMEOUT   Default timeout used to come out of blocking calls
     72  */
     73 /* ======================================================================= */
     74 #define G711D_TIMEOUT (1000) /* millisecs */
     75 
     76 /* ======================================================================= */
     77 /**
     78  * @def    NUM_G711DEC_INPUT_BUFFERS              Number of Input Buffers
     79  */
     80 /* ======================================================================= */
     81 #define NUM_G711DEC_INPUT_BUFFERS 1
     82 
     83 /* ======================================================================= */
     84 /**
     85  * @def    NUM_G711DEC_OUTPUT_BUFFERS              Number of Output Buffers
     86  */
     87 /* ======================================================================= */
     88 #define NUM_G711DEC_OUTPUT_BUFFERS 1
     89 
     90 /* ======================================================================= */
     91 /**
     92  * @def    NUM_G711DEC_OUTPUT_BUFFERS_DASF         Number of Output Buffers
     93  *                                                  on DASF mode
     94  */
     95 /* ======================================================================= */
     96 #define NUM_G711DEC_OUTPUT_BUFFERS_DASF 2
     97 
     98 /* ======================================================================= */
     99 /**
    100  * @def    OUTPUT_G711DEC_BUFFER_SIZE           Standart Output Buffer Size
    101  */
    102 /* ======================================================================= */
    103 #define OUTPUT_G711DEC_BUFFER_SIZE 160
    104 
    105 /* ======================================================================= */
    106 /**
    107  * @def    INPUT_G711DEC_BUFFER_SIZE             Standart Input Buffer Size
    108  *
    109  */
    110 /* ======================================================================= */
    111 #define INPUT_G711DEC_BUFFER_SIZE 80
    112 /* ========================================================================== */
    113 /**
    114  * @def    RTP_Framesize                          Size in Bytes of determined
    115  *                                               frame. Not change it
    116  */
    117 /* ========================================================================== */
    118 #define RTP_Framesize 80
    119 /* ========================================================================== */
    120 /**
    121  * @def    STD_GSMFRDEC_BUF_SIZE                  Standart Input Buffer Size
    122  */
    123 /* ========================================================================== */
    124 #define STD_G711DEC_BUF_SIZE 80
    125 
    126 /* ======================================================================= */
    127 /**
    128  * @def    STREAM_COUNT                         Stream Count value for
    129  *                                              LCML init.
    130  */
    131 /* ======================================================================= */
    132 #define STREAM_COUNT 2
    133 
    134 /* ======================================================================= */
    135 /**
    136  * @def    INPUT_STREAM_ID                      Input Stream ID
    137  */
    138 /* ======================================================================= */
    139 #define INPUT_STREAM_ID 0
    140 
    141 /* ======================================================================= */
    142 /**
    143  * @def    MAX_NUM_OF_BUFS                      Max Num of Bufs Allowed
    144  */
    145 /* ======================================================================= */
    146 #define MAX_NUM_OF_BUFS 10
    147 
    148 /*#define G711DEC_DEBUG
    149   #define G711DEC_MEMCHECK*/
    150 #undef G711DEC_DEBUG
    151 #undef G711DEC_MEMCHECK
    152 
    153 #if 0
    154 #define FillBufferDone(handle, appPrivate, buffer) FillBufferDone(handle, appPrivate, buffer); \
    155     printf("FillBufferDone :: line %d, buffer %p\n", __LINE__, buffer)
    156 #endif
    157 #if 0
    158 #define EmptyBufferDone(handle, appPrivate, buffer) EmptyBufferDone(handle, appPrivate, buffer); \
    159     printf("EmptyBufferDone :: line %d, buffer %p\n", __LINE__, buffer)
    160 #endif
    161 #ifndef UNDER_CE
    162 #ifdef  G711DEC_DEBUG
    163 #define G711DEC_DPRINT(...)    fprintf(stderr,__VA_ARGS__)
    164 #else
    165 #define G711DEC_DPRINT(...)
    166 #endif
    167 
    168 #ifdef  G711DEC_MEMCHECK
    169 #define G711DEC_MEMPRINT(...)    fprintf(stderr,__VA_ARGS__)
    170 #else
    171 #define G711DEC_MEMPRINT(...)
    172 #endif
    173 
    174 
    175 #ifdef  G711DEC_DEBUG_MCP
    176 #define G711DEC_MCP_DPRINT(...)    fprintf(stderr,__VA_ARGS__)
    177 #else
    178 #define G711DEC_MCP_DPRINT(...)
    179 #endif
    180 #else /*UNDER_CE*/
    181 #ifdef  G711DEC_DEBUG
    182 #define G711DEC_DPRINT(STR, ARG...) printf()
    183 #else
    184 #endif
    185 
    186 #ifdef G711DEC_MEMCHECK
    187 #define G711DEC_MEMPRINT(STR, ARG...) printf()
    188 #else
    189 #endif
    190 #ifdef UNDER_CE
    191 
    192 #ifdef DEBUG
    193 #define G711DEC_DPRINT   printf
    194 #define G711DEC_MEMPRINT   printf
    195 
    196 #else
    197 #define G711DEC_DPRINT
    198 #define G711DEC_MEMPRINT
    199 #endif
    200 
    201 #endif  //UNDER_CE
    202 
    203 #endif
    204 
    205 /* ======================================================================= */
    206 /**
    207  * @def    WMADEC_MEMDEBUG   Enable memory leaks debuf info
    208  */
    209 /* ======================================================================= */
    210 #undef G711DEC_MEMDEBUG
    211 
    212 /* ======================================================================= */
    213 /**
    214  * @def  CACHE_ALIGNMENT                           Buffer Cache Alignment
    215  */
    216 /* ======================================================================= */
    217 #define CACHE_ALIGNMENT 128
    218 
    219 /* ======================================================================= */
    220 /**
    221  * @def    NUM_OF_PORTS                       Number of Comunication Port
    222  */
    223 /* ======================================================================= */
    224 #define NUM_OF_PORTS 2
    225 
    226 
    227 /* ======================================================================= */
    228 /**
    229  *  M A C R O S FOR MALLOC and MEMORY FREE and CLOSING PIPES
    230  */
    231 /* ======================================================================= */
    232 
    233 #define OMX_NBCONF_INIT_STRUCT(_s_, _name_)     \
    234     memset((_s_), 0x0, sizeof(_name_));         \
    235     (_s_)->nSize = sizeof(_name_);              \
    236     (_s_)->nVersion.s.nVersionMajor = 0x1;      \
    237     (_s_)->nVersion.s.nVersionMinor = 0x0;      \
    238     (_s_)->nVersion.s.nRevision = 0x0;          \
    239     (_s_)->nVersion.s.nStep = 0x0
    240 
    241 #define G711D_OMX_MALLOC(_pStruct_, _sName_)                        \
    242     _pStruct_ = (_sName_*)newmalloc(sizeof(_sName_));               \
    243     if(_pStruct_ == NULL){                                          \
    244         printf("***********************************\n");            \
    245         printf("%d :: Malloc Failed\n",__LINE__);                   \
    246         printf("***********************************\n");            \
    247         eError = OMX_ErrorInsufficientResources;                    \
    248         goto EXIT;                                                  \
    249     }                                                               \
    250     memset(_pStruct_,0,sizeof(_sName_));                            \
    251     G711DEC_MEMPRINT("%d :: Malloced = %p\n",__LINE__,_pStruct_);
    252 
    253 #define G711D_OMX_MALLOC_SIZE(_ptr_, _size_,_name_)             \
    254     _ptr_ = (_name_ *)newmalloc(_size_);                        \
    255     if(_ptr_ == NULL){                                          \
    256         printf("***********************************\n");        \
    257         printf("%d :: Malloc Failed\n",__LINE__);               \
    258         printf("***********************************\n");        \
    259         eError = OMX_ErrorInsufficientResources;                \
    260         goto EXIT;                                              \
    261     }                                                           \
    262     memset(_ptr_,0,_size_);                                     \
    263     G711DEC_MEMPRINT("%d :: Malloced = %p\n",__LINE__,_ptr_);
    264 
    265 #define OMX_G711DECMEMFREE_STRUCT(_pStruct_)                    \
    266     if(_pStruct_ != NULL){                                      \
    267     G711DEC_MEMPRINT("%d :: [FREE] %p\n",__LINE__,_pStruct_);   \
    268         newfree(_pStruct_);                                     \
    269         _pStruct_ = NULL;                                       \
    270     }
    271 
    272 
    273 
    274 
    275 #define OMX_NBCLOSE_PIPE(_pStruct_,err)                         \
    276     G711DEC_DPRINT("%d :: CLOSING PIPE \n",__LINE__);           \
    277     err = close (_pStruct_);                                    \
    278     if(0 != err && OMX_ErrorNone == eError){                    \
    279         eError = OMX_ErrorHardware;                             \
    280         printf("%d :: Error while closing pipe\n",__LINE__);    \
    281         goto EXIT;                                              \
    282     }
    283 
    284 /* ======================================================================= */
    285 /** G711DEC_COMP_PORT_TYPE  Port Type
    286  *
    287  *  @param  G711DEC_INPUT_PORT                   Port Type Input
    288  *
    289  *  @param  G711DEC_OUTPUT_PORT                  Port Type Output
    290  *
    291  */
    292 /*  ==================================================================== */
    293 typedef enum G711DEC_COMP_PORT_TYPE {
    294     G711DEC_INPUT_PORT = 0,
    295     G711DEC_OUTPUT_PORT
    296 }G711DEC_COMP_PORT_TYPE;
    297 
    298 /* ======================================================================= */
    299 /** G711DEC_StreamType  StreamType
    300  *
    301  *  @param  G711DEC_DMM                  Stream Type DMM
    302  *
    303  *  @param  G711DEC_INSTRM               Stream Type Input
    304  *
    305  *  @param  G711DEC_OUTSTRM             Stream Type Output
    306  */
    307 /*  ==================================================================== */
    308 enum G711DEC_StreamType
    309     {
    310         G711DEC_DMM,
    311         G711DEC_INSTRM,
    312         G711DEC_OUTSTRM
    313     };
    314 
    315 /* ======================================================================= */
    316 /** G711DEC_BUFFER_Dir  Direction of the Buffer
    317  *
    318  *  @param  G711DEC_DIRECTION_INPUT              Direction Input
    319  *
    320  *  @param  G711DEC_DIRECTION_INPUT              Direction Output
    321  */
    322 /*  ==================================================================== */
    323 typedef enum {
    324     G711DEC_DIRECTION_INPUT,
    325     G711DEC_DIRECTION_OUTPUT
    326 }G711DEC_BUFFER_Dir;
    327 
    328 
    329 /* =================================================================================== */
    330 /**
    331  *
    332  */
    333 /* ================================================================================== */
    334 typedef struct G711DEC_FTYPES{
    335     OMX_S16     FrameSizeType;
    336     OMX_S16     NmuNLvl;
    337     OMX_S16     NoiseLp;
    338     OMX_S16     dBmNoise;
    339     OMX_S16     plc;
    340 }G711DEC_FTYPES;
    341 /* =================================================================================== */
    342 /**
    343  * Socket node input parameters.
    344  */
    345 /* ================================================================================== */
    346 typedef struct G711DEC_AudioCodecParams
    347 {
    348     unsigned long iSamplingRate;
    349     unsigned long iStrmId;
    350     unsigned short iAudioFormat;
    351     // unsigned short iFrameFormat;
    352 }G711DEC_AudioCodecParams;
    353 
    354 /* =================================================================================== */
    355 /**
    356  * Socket node alg parameters..
    357  */
    358 /* ================================================================================== */
    359 typedef struct {
    360     unsigned long usEndOfFile;
    361     unsigned long usFrameLost;
    362 }G711DEC_UAlgInBufParamStruct;
    363 
    364 /* ========================================================================== */
    365 /**
    366  * Socket node alg parameters..
    367  */
    368 /* ========================================================================== */
    369 typedef struct G711DEC_FrameStruct{
    370     unsigned long   usLastFrame;
    371     unsigned long   usFrameLost;
    372     unsigned long   frameType; /* 0: voice frame (80 bytes), 1: SID frame (22 bytes), 2: No Data (0 bytes), 3: Frame lost */
    373 } G711DEC_FrameStruct;
    374 
    375 typedef struct G711DEC_ParamStruct{
    376     unsigned long int usNbFrames;
    377     G711DEC_FrameStruct *pParamElem;
    378 } G711DEC_ParamStruct;
    379 
    380 /* =================================================================================== */
    381 /**
    382  * LCML_G711DEC_BUFHEADERTYPE
    383  */
    384 /* ================================================================================== */
    385 typedef struct LCML_G711DEC_BUFHEADERTYPE {
    386     G711DEC_BUFFER_Dir eDir;
    387     OMX_BUFFERHEADERTYPE* buffer;
    388     G711DEC_UAlgInBufParamStruct *pIpParam;
    389     G711DEC_FrameStruct *pFrameParam;
    390     G711DEC_ParamStruct *pBufferParam;
    391     DMM_BUFFER_OBJ* pDmmBuf;
    392 }LCML_G711DEC_BUFHEADERTYPE;
    393 
    394 #ifndef UNDER_CE
    395 
    396 OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp);
    397 
    398 #else
    399 /* =================================================================================== */
    400 /**
    401  *   OMX_EXPORT                                           WinCE Implicit Export Syntax
    402  */
    403 /* ================================================================================== */
    404 #define OMX_EXPORT __declspec(dllexport)
    405 
    406 OMX_EXPORT OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp);
    407 
    408 #endif
    409 
    410 OMX_ERRORTYPE G711DEC_StartComponentThread(OMX_HANDLETYPE pHandle);
    411 OMX_ERRORTYPE G711DEC_StopComponentThread(OMX_HANDLETYPE pHandle);
    412 OMX_ERRORTYPE G711DEC_FreeCompResources(OMX_HANDLETYPE pComponent);
    413 
    414 typedef struct _G711DEC_BUFFERLIST G711DEC_BUFFERLIST;
    415 
    416 /* =================================================================================== */
    417 /**
    418  * Structure for buffer list
    419  */
    420 /* ================================================================================== */
    421 struct _G711DEC_BUFFERLIST{
    422     OMX_BUFFERHEADERTYPE *pBufHdr[MAX_NUM_OF_BUFS]; /* records buffer header send by client */
    423     OMX_U32 bufferOwner[MAX_NUM_OF_BUFS];
    424     OMX_U32 bBufferPending[MAX_NUM_OF_BUFS];
    425     OMX_U32 numBuffers;
    426 };
    427 
    428 /* =================================================================================== */
    429 /**
    430  * G711ENC_PORT_TYPE Structure for PortFormat details
    431  */
    432 /* =================================================================================== */
    433 typedef struct G711DEC_PORT_TYPE {
    434     OMX_HANDLETYPE hTunnelComponent;
    435     OMX_U32 nTunnelPort;
    436     OMX_BUFFERSUPPLIERTYPE eSupplierSetting;
    437     OMX_U8 nBufferCnt;
    438     OMX_AUDIO_PARAM_PORTFORMATTYPE* pPortFormat;
    439 } G711DEC_PORT_TYPE;
    440 
    441 OMX_ERRORTYPE OMX_DmmMap(DSP_HPROCESSOR ProcHandle, int size,
    442                          void* pArmPtr, DMM_BUFFER_OBJ* pDmmBuf);
    443 OMX_ERRORTYPE OMX_DmmUnMap(DSP_HPROCESSOR ProcHandle, void* pMapPtr,
    444                            void* pResPtr);
    445 /* =================================================================================== */
    446 /**
    447  * Component private data
    448  */
    449 /* ================================================================================== */
    450 typedef struct G711DEC_COMPONENT_PRIVATE
    451 {
    452 #ifdef UNDER_CE
    453     OMX_BUFFERHEADERTYPE* pBufHeader[NUM_OF_PORTS];
    454 #endif
    455 
    456     /** Structure of callback pointers */
    457     OMX_CALLBACKTYPE cbInfo;
    458 
    459     G711DEC_PORT_TYPE *pCompPort[NUM_OF_PORTS];
    460 
    461     /** Handle for use with async callbacks */
    462     OMX_PORT_PARAM_TYPE sPortParam;
    463 
    464     /** Input port parameters */
    465     OMX_AUDIO_PARAM_PORTFORMATTYPE sInPortFormat;
    466 
    467     /** Output port parameters */
    468     OMX_AUDIO_PARAM_PORTFORMATTYPE sOutPortFormat;
    469 
    470     /** This will contain info like how many buffers
    471         are there for input/output ports, their size etc, but not
    472         BUFFERHEADERTYPE POINTERS. */
    473     OMX_PARAM_PORTDEFINITIONTYPE* pPortDef[NUM_OF_PORTS];
    474 
    475     /** G711 Component Parameters */
    476     OMX_AUDIO_PARAM_PCMMODETYPE* g711Params[NUM_OF_PORTS];
    477 
    478     /** This is component handle */
    479     OMX_COMPONENTTYPE* pHandle;
    480 
    481     /** Current state of this component */
    482     OMX_STATETYPE curState;
    483 
    484     /** The component thread handle */
    485     pthread_t ComponentThread;
    486 
    487     /** The pipes for sending buffers to the thread */
    488     int dataPipe[2];
    489 
    490     /** The pipes for sending buffers to the thread */
    491     int cmdPipe[2];
    492 
    493     /** The pipes for sending buffers to the thread */
    494     int cmdDataPipe[2];
    495 
    496     /** Set to indicate component is stopping */
    497     OMX_U32 bIsStopping;
    498 
    499     /** Flag set when the EOS marker is sent */
    500     OMX_U32 bIsEOFSent;
    501 
    502     /** Count of number of buffers outstanding with bridge */
    503     OMX_U32 lcml_nIpBuf;
    504 
    505     /** Count of number of buffers outstanding with bridge */
    506     OMX_U32 lcml_nOpBuf;
    507 
    508     /** Number of Buffers In the Application*/
    509     OMX_U32 app_nBuf;
    510 
    511     /** LCML Number Input Buffer Received*/
    512     OMX_U32 lcml_nCntIp;
    513 
    514     /** LCML Number Output Buffer Received*/
    515     OMX_U32 lcml_nCntOpReceived;
    516 
    517     /** Num Reclaimed OutPut Buff    */
    518     OMX_U32 num_Reclaimed_Op_Buff;
    519 
    520     /** Num Sent Input Buff   */
    521     OMX_U32 num_Sent_Ip_Buff;
    522 
    523     /** Num Sent Output Buff Issued   */
    524     OMX_U32 num_Op_Issued;
    525 
    526     /** LCML Handle */
    527     OMX_HANDLETYPE pLcmlHandle;
    528 
    529     /** LCML Buffer Header */
    530     LCML_G711DEC_BUFHEADERTYPE *pLcmlBufHeader[2];
    531 
    532     /** Flag for G711 mode */
    533     OMX_S16 iG711Mode;
    534 
    535     /** Flag for DASF mode */
    536     OMX_S16 dasfmode;
    537 
    538     /** Flag for ACDN mode */
    539     OMX_S16 acdnmode;
    540 
    541     /** Flag for frame size type mode */
    542     OMX_S16 fsizemode;
    543     /** Flag for fram type mode */
    544     OMX_S16 ftype;
    545     /** Flag for Noise Level NMU */
    546     OMX_S16 nmulevel;
    547     /** Flag for Noise LP  */
    548     OMX_S16 noiselp;
    549     /** Flag for Noise level in dBm */
    550     OMX_S16 dbmnoise;
    551     /** Flag for Noise level in dBm */
    552     OMX_S16 packetlostc;
    553 
    554     /** Writing pipe Used for DSP_RENDERING_ON */
    555     int fdwrite;
    556 
    557     /** Reading pipe Used for DSP_RENDERING_ON */
    558     int fdread;
    559 
    560     /* ID stream ID*/
    561     OMX_U32 streamID;
    562 
    563     /* Flag for Port Defs Allocated*/
    564     OMX_U32 bPortDefsAllocated;
    565 
    566     /* Flag for Component Thread Started*/
    567     OMX_U32 bCompThreadStarted;
    568 
    569     /** Mark data */
    570     OMX_PTR pMarkData;
    571 
    572     /** Mark buffer */
    573     OMX_MARKTYPE *pMarkBuf;
    574 
    575     /** Mark target component */
    576     OMX_HANDLETYPE hMarkTargetComponent;
    577 
    578     /** Flag set when buffer should not be queued to the DSP */
    579     OMX_U32 bBypassDSP;
    580 
    581     /** Input buffer list */
    582     G711DEC_BUFFERLIST *pInputBufferList;
    583 
    584     /** Output buffer list */
    585     G711DEC_BUFFERLIST *pOutputBufferList;
    586 
    587     /** LCML stream attributes */
    588     LCML_STRMATTR *strmAttr;
    589 
    590     /** Component version */
    591     OMX_U32 nVersion;
    592 
    593     /** Play Complete Flag */
    594     OMX_U32 bPlayCompleteFlag;
    595 
    596     /** Number of Bytes holding to be sent*/
    597     OMX_U32 nHoldLength;
    598 
    599     /** Pointer to the data holding to be sent*/
    600     OMX_U8* pHoldBuffer;
    601 
    602     /** Flag set when LCML handle is opened */
    603     OMX_S16 bLcmlHandleOpened;
    604 
    605     /** Keeps track of the number of nFillThisBufferCount() calls */
    606     OMX_U32 nFillThisBufferCount;
    607 
    608     /** Keeps track of the number of nFillBufferDoneCount() calls */
    609     OMX_U32 nFillBufferDoneCount;
    610 
    611     /** Keeps track of the number of nEmptyThisBufferCount() calls */
    612     OMX_U32 nEmptyThisBufferCount;
    613 
    614     /** Keeps track of the number of nEmptyBufferDoneCount() calls */
    615     OMX_U32 nEmptyBufferDoneCount;
    616 
    617     /** Parameters for the Audio Codec */
    618     G711DEC_AudioCodecParams *pParams;
    619 
    620     /** Flag for Init Params Initialized */
    621     OMX_U32 bInitParamsInitialized;
    622 
    623     /** Flag for bIdleCommandPending */
    624     OMX_U32 bIdleCommandPending;
    625 
    626     /** Array of Input Buffers that are pending to sent due State = Idle */
    627     OMX_BUFFERHEADERTYPE *pInputBufHdrPending[MAX_NUM_OF_BUFS];
    628 
    629     /** Number of Input Buffers that are pending to sent due State = Idle */
    630     OMX_U32 nNumInputBufPending;
    631 
    632     /** Array of Output Buffers that are pending to sent due State = Idle */
    633     OMX_BUFFERHEADERTYPE *pOutputBufHdrPending[MAX_NUM_OF_BUFS];
    634 
    635     /** Number of Output Buffers that are pending to sent due State = Idle */
    636     OMX_U32 nNumOutputBufPending;
    637 
    638     /** Flag for Reenabling Ports*/
    639     OMX_U32 bJustReenabled;
    640 
    641     /** Flag for Invalid Frame Count*/
    642     OMX_U32 nInvalidFrameCount;
    643 
    644     /** Flag for Writes While Paused   */
    645     OMX_U32 nDataWritesWhilePaused;
    646 
    647     /** Flag for bDisableCommandPending*/
    648     OMX_U32 bDisableCommandPending;
    649 
    650     /** Flag for bDisableCommandParam*/
    651     OMX_U32 bDisableCommandParam;
    652 
    653     /** Flag for Enabling the port*/
    654     OMX_U32 bEnableCommandPending;
    655 
    656     /** Flag for Enabling the port*/
    657     OMX_U32 bEnableCommandParam;
    658 
    659     /** Flag to set when socket node stop callback should not transition
    660         component to OMX_StateIdle */
    661     OMX_U32 bNoIdleOnStop;
    662 
    663     /** Flag set when socket node is stopped */
    664     OMX_U32 bDspStoppedWhileExecuting;
    665 
    666     /** Number of outstanding FillBufferDone() calls */
    667     OMX_S32 nOutStandingFillDones;
    668 
    669     /** Stop Codec Command Sent Flag*/
    670     OMX_U8 bStopSent;
    671 
    672     OMX_BOOL bLoadedCommandPending;
    673 
    674     OMX_PARAM_COMPONENTROLETYPE componentRole;
    675 
    676     /* Device string */
    677     OMX_STRING* sDeviceString;
    678     /* Removing sleep() calls. Definition. */
    679 #ifndef UNDER_CE
    680     pthread_mutex_t AlloBuf_mutex;
    681     pthread_cond_t AlloBuf_threshold;
    682     OMX_U8 AlloBuf_waitingsignal;
    683 
    684     pthread_mutex_t InLoaded_mutex;
    685     pthread_cond_t InLoaded_threshold;
    686     OMX_U8 InLoaded_readytoidle;
    687 
    688     pthread_mutex_t InIdle_mutex;
    689     pthread_cond_t InIdle_threshold;
    690     OMX_U8 InIdle_goingtoloaded;
    691 #else
    692     OMX_Event AlloBuf_event;
    693     OMX_U8 AlloBuf_waitingsignal;
    694 
    695     OMX_Event InLoaded_event;
    696     OMX_U8 InLoaded_readytoidle;
    697 
    698     OMX_Event InIdle_event;
    699     OMX_U8 InIdle_goingtoloaded;
    700 #endif
    701     // /**************************/
    702     OMX_U8 nUnhandledFillThisBuffers;
    703 
    704     /**Keep buffer tickcount*/
    705     OMX_U32 arrBufIndexTick[MAX_NUM_OF_BUFS];
    706 
    707     /** Keep buffer timestamps **/
    708     OMX_U32 arrBufIndex[MAX_NUM_OF_BUFS];
    709 
    710     /** Index to arrBufIndex[], used for input buffer timestamps */
    711     OMX_U8 IpBufindex;
    712 
    713     /** Index to arrBufIndex[], used for output buffer timestamps */
    714     OMX_U8 OpBufindex;
    715 
    716     /** Pointer to RM callback **/
    717 #ifdef RESOURCE_MANAGER_ENABLED
    718     RMPROXY_CALLBACKTYPE rmproxyCallback;
    719 #endif
    720 
    721     OMX_BOOL bPreempted;
    722 
    723 
    724 } G711DEC_COMPONENT_PRIVATE;
    725 
    726 typedef enum OMX_G711DEC_INDEXAUDIOTYPE {
    727     OMX_IndexCustomG711DecModeAcdnConfig = 0xFF000001,
    728     OMX_IndexCustomG711DecModeDasfConfig,
    729     OMX_IndexCustomG711DecHeaderInfoConfig,
    730     OMX_IndexCustomG711DecFrameParams,
    731     OMX_IndexCustomG711DecDataPath
    732 }OMX_G711DEC_INDEXAUDIOTYPE;
    733 
    734 #ifdef RESOURCE_MANAGER_ENABLED
    735 void G711DEC_ResourceManagerCallback(RMPROXY_COMMANDDATATYPE cbData);
    736 #endif
    737 
    738 #endif /* OMX_G711DECODER_H */
    739