OMX_AacEnc_Utils.h revision 00f4c8bed7990ebaff8e20bd13b5dbdacbe22c29
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#ifndef OMX_AACENC_UTILS__H
22#define OMX_AACENC_UTILS__H
23
24#include <OMX_Component.h>
25#include <OMX_TI_Common.h>
26#include <OMX_TI_Debug.h>
27#include "LCML_DspCodec.h"
28#include "OMX_AacEncoder.h"
29/* #include <ResourceManagerProxyAPI.h> */
30
31#define AACENC_MAJOR_VER 0x0001
32#define AACENC_MINOR_VER 0x0001
33#define NOT_USED 10
34#define NORMAL_BUFFER 0
35#define OMX_AACENC_DEFAULT_SEGMENT (0)
36#define OMX_AACENC_SN_TIMEOUT (1000)
37#define OMX_AACENC_SN_PRIORITY (10)
38#define OMX_AACENC_NUM_DLLS (2)
39#define AACENC_CPU_USAGE 45
40#define _ERROR_PROPAGATION__
41#define MPEG4AACENC_MAX_OUTPUT_FRAMES 24
42
43#ifndef ANDROID
44    #define ANDROID
45#endif
46
47#ifdef ANDROID
48    #undef LOG_TAG
49    #define LOG_TAG "OMX_AACENC"
50
51/* PV opencore capability custom parameter index */
52    #define PV_OMX_COMPONENT_CAPABILITY_TYPE_INDEX 0xFF7A347
53#endif
54
55#define EXTRA_BYTES 128
56#define DSP_CACHE_ALIGNMENT 256
57
58#ifdef __PERF_INSTRUMENTATION__
59    #include "perf.h"
60#endif
61#include <OMX_Component.h>
62
63#define OMX_CONF_INIT_STRUCT(_s_, _name_)   \
64    memset((_s_), 0x0, sizeof(_name_)); \
65    (_s_)->nSize = sizeof(_name_);      \
66    (_s_)->nVersion.s.nVersionMajor = AACENC_MAJOR_VER;  \
67    (_s_)->nVersion.s.nVersionMinor = AACENC_MINOR_VER;  \
68    (_s_)->nVersion.s.nRevision = 0x0001;      \
69    (_s_)->nVersion.s.nStep = 0x0
70
71#define OMX_CONF_CHECK_CMD(_ptr1, _ptr2, _ptr3) \
72{                       \
73    if(!_ptr1 || !_ptr2 || !_ptr3){     \
74        OMXDBG_PRINT(stderr, ERROR, 4, 0, "%d :: Error bad parameter \n",__LINE__);\
75        eError = OMX_ErrorBadParameter;     \
76    goto EXIT;          \
77    }                       \
78}
79
80#define OMX_CONF_SET_ERROR_BAIL(_eError, _eCode)\
81{                       \
82    _eError = _eCode;               \
83    goto OMX_CONF_CMD_BAIL;         \
84}
85
86#define OMX_MALLOC_STRUCT(_pStruct_, _sName_)   \
87    _pStruct_ = (_sName_*)newmalloc(sizeof(_sName_));   \
88    if(_pStruct_ == NULL){  \
89        eError = OMX_ErrorInsufficientResources;    \
90        goto EXIT;  \
91    } \
92    memset(_pStruct_,0,sizeof(_sName_));
93
94#define OMX_MALLOC_STRUCT_SIZE(_ptr_, _size_,_name_)    \
95    _ptr_ = (_name_ *)newmalloc(_size_);    \
96    if(_ptr_ == NULL){  \
97        eError = OMX_ErrorInsufficientResources;    \
98        goto EXIT;  \
99    } \
100    memset(_ptr_,0,_size_);
101
102
103#define OMX_MEMFREE_STRUCT(_pStruct_)\
104    OMXDBG_PRINT(stderr, PRINT, 2, OMX_DBG_BASEMASK, "%d :: FREEING MEMORY = %p\n",__LINE__,_pStruct_);\
105    if(_pStruct_ != NULL){\
106        newfree(_pStruct_);\
107        _pStruct_ = NULL;\
108    }
109
110#define OMX_CLOSE_PIPE(_pStruct_,err)\
111    OMXDBG_PRINT(stderr, PRINT, 2, OMX_DBG_BASEMASK, "%d :: CLOSING PIPE \n",__LINE__);\
112    err = close (_pStruct_);\
113    if(0 != err && OMX_ErrorNone == eError){\
114        eError = OMX_ErrorHardware;\
115        OMXDBG_PRINT(stderr, ERROR, 4, 0, "%d :: Error while closing pipe\n",__LINE__);\
116        goto EXIT;\
117    }
118
119#define OMX_DPRINT_ADDRESS(_s_, _ptr_)  \
120    OMXDBG_PRINT(stderr, PRINT, 2, 0, "%s = %p\n", _s_, _ptr_);
121
122
123#undef SWAT_ANALYSIS
124
125/* debug message */
126#undef AACENC_DEBUG
127#define AACENC_ERROR
128
129
130#ifndef UNDER_CE
131#ifdef  AACENC_ERROR
132     #define AACENC_EPRINT(...) fprintf(stderr,__VA_ARGS__)
133#else
134     #define AACENC_EPRINT(...)
135#endif /* AAC_ERROR*/
136
137
138#ifdef  AACENC_DEBUG
139     #define AACENC_DPRINT(...) fprintf(stderr,__VA_ARGS__)
140#else
141     #define AACENC_DPRINT(...)
142#endif
143
144#else /*UNDER_CE*/
145
146#ifdef  AACENC_DEBUG
147 #define AACENC_DPRINT(STR, ARG...) printf()
148#else
149#endif
150
151#endif /*UNDER_CE*/
152
153/* ======================================================================= */
154/**
155 * @def    AACENC_USN_DLL_NAME   USN DLL name
156 */
157/* ======================================================================= */
158#ifdef UNDER_CE
159#define AACENC_USN_DLL_NAME "\\windows\\usn.dll64P"
160#else
161#define AACENC_USN_DLL_NAME "usn.dll64P"
162#endif
163
164/* ======================================================================= */
165/**
166 * @def    AACENC_DLL_NAME   AAC Enc Encoder socket node DLL name
167 */
168/* ======================================================================= */
169#ifdef UNDER_CE
170#define AACENC_DLL_NAME "\\windows\\mpeg4aacenc_sn.dll64P"
171#else
172#define AACENC_DLL_NAME "mpeg4aacenc_sn.dll64P"
173#endif
174
175typedef struct
176{
177    OMX_BOOL bLastBuffer;
178}AACENC_UAlgInBufParamStruct;
179
180typedef struct
181{
182    unsigned long unNumFramesEncoded;
183    unsigned long unFrameSizes[MPEG4AACENC_MAX_OUTPUT_FRAMES];
184}AACENC_UAlgOutBufParamStruct;
185
186
187typedef struct PV_OMXComponentCapabilityFlagsType
188{
189        ////////////////// OMX COMPONENT CAPABILITY RELATED MEMBERS (for opencore compatability)
190        OMX_BOOL iIsOMXComponentMultiThreaded;
191        OMX_BOOL iOMXComponentSupportsExternalOutputBufferAlloc;
192        OMX_BOOL iOMXComponentSupportsExternalInputBufferAlloc;
193        OMX_BOOL iOMXComponentSupportsMovableInputBuffers;
194        OMX_BOOL iOMXComponentSupportsPartialFrames;
195        OMX_BOOL iOMXComponentNeedsNALStartCode;
196        OMX_BOOL iOMXComponentCanHandleIncompleteFrames;
197} PV_OMXComponentCapabilityFlagsType;
198
199/*This enum must not be changed.*/
200typedef enum COMP_PORT_TYPE
201{
202    INPUT_PORT = 0,
203    OUTPUT_PORT
204}COMP_PORT_TYPE;
205
206typedef enum
207{
208    DIRECTION_INPUT,
209    DIRECTION_OUTPUT
210}BUFFER_Dir;
211
212typedef struct BUFFS
213{
214    char BufHeader;
215    char Buffer;
216}BUFFS;
217
218typedef struct BUFFERHEADERTYPE_INFO
219{
220    OMX_BUFFERHEADERTYPE* pBufHeader[MAX_NUM_OF_BUFS];
221    BUFFS bBufOwner[MAX_NUM_OF_BUFS];
222}BUFFERHEADERTYPE_INFO;
223
224typedef OMX_ERRORTYPE (*fpo)(OMX_HANDLETYPE);
225
226typedef struct AACENC_AudioCodecParams
227{
228    unsigned long  iSamplingRate;
229    unsigned long  iStrmId;
230    unsigned short iAudioFormat;
231}AACENC_AudioCodecParams;
232
233/* enum AACENC_BOOL_TYPE                        */
234/* brief Enumerated type for Boolean decision   */
235
236typedef enum
237{
238    AACENC_FALSE = 0,     /*!< To indicate False  */
239    AACENC_TRUE  = 1      /*!< To indicate True   */
240} AACENC_BOOL_TYPE;
241
242/*! \enum AACENC_OBJ_TYP  */
243/*! \brief enumerated type for output format */
244typedef enum
245{
246  AACENC_OBJ_TYP_LC           = 2,   /*!< AAC Low Complexity  */
247  AACENC_OBJ_TYP_HEAAC        = 5,   /*!< HE AAC              */
248  AACENC_OBJ_TYP_PS           = 29   /*!< AAC LC + SBR + PS   */
249} AACENC_OBJ_TYP;
250
251/*! \enum  AACENC_TRANSPORT_TYPE */
252/*! \brief Enumerated type for output file format */
253typedef enum
254{
255  AACENC_TT_RAW    = 0,              /*!< Raw Output Format   */
256  AACENC_TT_ADIF   = 1,              /*!< ADIF File Format    */
257  AACENC_TT_ADTS   = 2               /*!< ADTS File Format    */
258} AACENC_TRANSPORT_TYPE;
259
260/* ======================================================================= */
261/** MPEG4AACENC_UALGParams
262 *
263 * @param lOutputFormat - To set interleaved/Block format:Refer to IAUDIO_PcmFormat.
264 * @param DownSampleSbr -
265 */
266/* ==================================================================== */
267typedef struct
268{
269    long size;           /* size of this structure */
270    long bitRate;        /* Average bit rate in bits per second */
271    long sampleRate;     /* Samplling frequency in Hz */
272    long numChannels;    /* Number of Channels: IAUDIO_ChannelId */
273
274}MPEG4AUDENC_UALGdynamicparams;
275
276
277typedef struct MPEG4AACENC_UALGParams
278{
279    int size;
280    MPEG4AUDENC_UALGdynamicparams audenc_dynamicparams;
281                                            /*!< generic encoder dynamic parameters  */
282
283    /* For RESET Command */
284    AACENC_BOOL_TYPE        useTns;         /*!< Flag for activating TNS feature     */
285    AACENC_BOOL_TYPE        usePns;         /*!< Flag for activating PNS feature     */
286
287    AACENC_OBJ_TYP          outObjectType;  /*!< Output Object Type LC/HE/HEv2     */
288    AACENC_TRANSPORT_TYPE   outFileFormat;  /*!< Output File Format            */
289
290} MPEG4AACENC_UALGParams;
291
292typedef enum {
293    IUALG_CMD_STOP          = 0,
294    IUALG_CMD_PAUSE         = 1,
295    IUALG_CMD_GETSTATUS     = 2,
296    IUALG_CMD_SETSTATUS     = 3,
297    IUALG_CMD_USERCMDSTART  = 100
298}IUALG_Cmd;
299
300typedef enum {
301    IAUDIO_BLOCK=0,
302    IAUDIO_INTERLEAVED
303} IAUDIO_AacFormat;
304
305typedef struct LCML_AACENC_BUFHEADERTYPE
306{
307      BUFFER_Dir eDir;
308      OMX_BUFFERHEADERTYPE* buffer;
309      AACENC_UAlgInBufParamStruct *pIpParam;
310      AACENC_UAlgOutBufParamStruct *pOpParam;
311}LCML_AACENC_BUFHEADERTYPE;
312
313
314
315typedef struct _BUFFERLIST BUFFERLIST;
316
317struct _BUFFERLIST
318{
319    OMX_BUFFERHEADERTYPE sBufHdr;                   /* actual buffer header */
320    OMX_BUFFERHEADERTYPE *pBufHdr[MAX_NUM_OF_BUFS]; /* records buffer header send by client */
321    OMX_U32 bufferOwner[MAX_NUM_OF_BUFS];
322    OMX_U16 numBuffers;
323    OMX_U32 bBufferPending[MAX_NUM_OF_BUFS];
324    BUFFERLIST *pNextBuf;
325    BUFFERLIST *pPrevBuf;
326};
327
328#ifdef UNDER_CE
329    #ifndef _OMX_EVENT_
330        #define _OMX_EVENT_
331        typedef struct OMX_Event {
332            HANDLE event;
333        } OMX_Event;
334    #endif
335    int OMX_CreateEvent(OMX_Event *event);
336    int OMX_SignalEvent(OMX_Event *event);
337    int OMX_WaitForEvent(OMX_Event *event);
338    int OMX_DestroyEvent(OMX_Event *event);
339#endif
340
341
342
343typedef struct AACENC_COMPONENT_PRIVATE
344{
345    /** Array of pointers to BUFFERHEADERTYPE structues
346       This pBufHeader[INPUT_PORT] will point to all the
347       BUFFERHEADERTYPE structures related to input port,
348       not just one structure. Same is for output port
349       also. */
350    OMX_BUFFERHEADERTYPE* pBufHeader[NUM_OF_PORTS];
351
352    BUFFERHEADERTYPE_INFO BufInfo[NUM_OF_PORTS];
353
354    OMX_CALLBACKTYPE cbInfo;
355    /** Handle for use with async callbacks */
356    OMX_PORT_PARAM_TYPE sPortParam;
357
358    OMX_PRIORITYMGMTTYPE* sPriorityMgmt;
359
360/*  RMPROXY_CALLBACKTYPE rmproxyCallback; */
361    OMX_BOOL bPreempted;
362
363    OMX_AUDIO_PARAM_PORTFORMATTYPE sInPortFormat;
364
365    OMX_AUDIO_PARAM_PORTFORMATTYPE sOutPortFormat;
366
367    OMX_U32 bIsBufferOwned[NUM_OF_PORTS];
368    /** This will contain info like how many buffers
369        are there for input/output ports, their size etc, but not
370        BUFFERHEADERTYPE POINTERS. */
371    OMX_U32 abc;
372
373    OMX_U32 def;
374
375    OMX_PARAM_PORTDEFINITIONTYPE* pPortDef[NUM_OF_PORTS];
376
377    OMX_AUDIO_PARAM_AACPROFILETYPE* aacParams[NUM_OF_PORTS];
378
379    OMX_AUDIO_PARAM_PCMMODETYPE* pcmParam[NUM_OF_PORTS];
380
381    /** This is component handle */
382    OMX_COMPONENTTYPE* pHandle;
383
384    /** Current state of this component */
385    OMX_STATETYPE curState;
386
387    /** The component thread handle */
388    pthread_t ComponentThread;
389
390    /** The pipes for sending buffers to the thread */
391    int dataPipe[2];
392
393    /** The pipes for sending buffers to the thread */
394    int cmdPipe[2];
395    /** The pipes for sending buffers to the thread */
396    int cmdDataPipe[2];
397
398    /** The pipes for sending buffers to the thread */
399  /*  int lcml_Pipe[2];  */
400
401    /** Set to indicate component is stopping */
402    OMX_U32 bIsStopping;
403
404    /** Number of input buffers at runtime */
405    OMX_U32 nRuntimeInputBuffers;
406
407    /** Number of output buffers at runtime */
408    OMX_U32 nRuntimeOutputBuffers;
409
410    OMX_U32 bIsThreadstop;
411
412    OMX_U32 bIsEOFSent;
413
414    /** Count of number of buffers outstanding with bridge */
415    OMX_U32 lcml_nIpBuf;
416
417    OMX_BOOL CustomConfiguration;
418
419#ifdef __PERF_INSTRUMENTATION__
420        PERF_OBJHANDLE pPERF, pPERFcomp;
421        OMX_U32 nLcml_nCntIp;
422        OMX_U32 nLcml_nCntOpReceived;
423#endif
424
425    /** Count of number of buffers outstanding with bridge */
426    OMX_U32 lcml_nOpBuf;
427
428    OMX_U32 app_nBuf;
429
430    OMX_U32 lcml_nCntIp;
431
432    OMX_U32 lcml_nCntOpReceived;
433
434    OMX_U32 lcml_nCntApp;
435
436    OMX_U32 lcml_compID;
437
438    OMX_U32 num_Reclaimed_Op_Buff;
439
440    OMX_U32 num_Sent_Ip_Buff;
441
442    OMX_U32 num_Op_Issued;
443
444    OMX_HANDLETYPE pLcmlHandle;
445
446    LCML_AACENC_BUFHEADERTYPE *pLcmlBufHeader[2];
447
448    MPEG4AACENC_UALGParams* ptAlgDynParams;
449
450    AACENC_AudioCodecParams* pParams;
451
452    OMX_U16 ulSamplingRate;
453
454    OMX_U16 unNumChannels;
455
456    OMX_U32 unBitrate;
457
458    OMX_U16 nObjectType;
459
460    OMX_U32 bitRateMode;
461
462    OMX_U16 File_Format;
463
464    OMX_U32 dasfmode;
465
466    OMX_U32 EmptybufferdoneCount;
467
468    OMX_U32 EmptythisbufferCount;
469
470    OMX_U32 FillbufferdoneCount;
471
472    OMX_U32 FillthisbufferCount;
473
474    OMX_U32 bPortDefsAllocated;
475
476    OMX_U32 bCompThreadStarted;
477
478    OMX_PTR pMarkData;
479
480    OMX_MARKTYPE *pMarkBuf;
481
482    OMX_HANDLETYPE hMarkTargetComponent;
483
484    OMX_U32 bBypassDSP;
485
486    BUFFERLIST *pInputBufferList;
487
488    BUFFERLIST *pOutputBufferList;
489
490    LCML_STRMATTR *strmAttr;
491
492    OMX_U32 nVersion;
493
494    OMX_STRING cComponentName;
495
496    OMX_VERSIONTYPE ComponentVersion;
497
498    OMX_U32 streamID;
499
500    OMX_U32 bInputBufferHeaderAllocated;
501    /** Stores input buffers while paused */
502    OMX_BUFFERHEADERTYPE *pInputBufHdrPending[MAX_NUM_OF_BUFS];
503
504    /** Number of input buffers received while paused */
505    OMX_U32 nNumInputBufPending;
506
507    /** Stores output buffers while paused */
508    OMX_BUFFERHEADERTYPE *pOutputBufHdrPending[MAX_NUM_OF_BUFS];
509
510    /** Number of output buffers received while paused */
511    OMX_U32 nNumOutputBufPending;
512
513
514    OMX_U8 PendingInPausedBufs;
515    OMX_BUFFERHEADERTYPE *pInBufHdrPausedPending[MAX_NUM_OF_BUFS];
516    OMX_U8 PendingOutPausedBufs;
517    OMX_BUFFERHEADERTYPE *pOutBufHdrPausedPending[MAX_NUM_OF_BUFS];
518
519
520
521    OMX_U32 bPlayCompleteFlag;
522
523    /** Flag set when a disable command is pending */
524    OMX_U32 bDisableCommandPending;
525
526    /** Parameter for pending disable command */
527    OMX_U32 bDisableCommandParam;
528
529    /** Flag set when a disable command is pending */
530    OMX_U32 bEnableCommandPending;
531
532    /** Parameter for pending disable command */
533    OMX_U32 nEnableCommandParam;
534
535    /** Flag to set when socket node stop callback should not transition
536        component to OMX_StateIdle */
537    OMX_U32 bNoIdleOnStop;
538
539    /** Flag set when idle command is pending */
540    /* OMX_U32 bIdleCommandPending; */
541
542    /** Flag set when pause command is pending */
543    OMX_U32 bPauseCommandPending;
544
545    /** Flag set when socket node is stopped */
546    OMX_U32 bDspStoppedWhileExecuting;
547
548    /** Number of outstanding FillBufferDone() calls */
549    OMX_S32 nOutStandingFillDones;
550
551    /** Number of outstanding EmptyBufferDone() calls */
552    OMX_S32 nOutStandingEmptyDones;
553
554    OMX_BUFFERHEADERTYPE *LastOutputBufferHdrQueued;
555
556#ifndef UNDER_CE
557    pthread_mutex_t AlloBuf_mutex;
558    pthread_cond_t AlloBuf_threshold;
559    OMX_U8 AlloBuf_waitingsignal;
560
561    pthread_mutex_t codecStop_mutex;
562    pthread_cond_t codecStop_threshold;
563    OMX_U8 codecStop_waitingsignal;
564
565    pthread_mutex_t codecFlush_mutex;
566    pthread_cond_t codecFlush_threshold;
567    OMX_U8 codecFlush_waitingsignal;
568
569pthread_mutex_t InLoaded_mutex;
570    pthread_cond_t InLoaded_threshold;
571    OMX_U8 InLoaded_readytoidle;
572
573    pthread_mutex_t InIdle_mutex;
574    pthread_cond_t InIdle_threshold;
575    OMX_U8 InIdle_goingtoloaded;
576
577    OMX_U8 nUnhandledFillThisBuffers;
578    OMX_U8 nUnhandledEmptyThisBuffers;
579    OMX_BOOL bFlushOutputPortCommandPending;
580    OMX_BOOL bFlushInputPortCommandPending;
581
582#else
583    OMX_Event AlloBuf_event;
584    OMX_U8 AlloBuf_waitingsignal;
585
586    OMX_Event InLoaded_event;
587    OMX_U8 InLoaded_readytoidle;
588
589    OMX_Event InIdle_event;
590    OMX_U8 InIdle_goingtoloaded;
591
592
593#endif
594    OMX_BOOL bLoadedCommandPending;
595    OMX_BOOL bIsInvalidState;
596    void* PtrCollector[6];
597
598    OMX_BUFFERHEADERTYPE *LastOutbuf;
599    OMX_PARAM_COMPONENTROLETYPE componentRole;
600    OMX_U16 FramesPer_OutputBuffer;
601
602    /* backup pointer for LCML */
603    void* ptrLibLCML;
604
605    OMX_BOOL bCodecDestroyed;
606    OMX_BOOL bGotLCML;
607
608    OMX_STRING* sDeviceString;
609    OMX_BOOL bFirstOutputBuffer;
610
611    /** Keep buffer timestamps **/
612    OMX_S64 timestampBufIndex[MAX_NUM_OF_BUFS];
613    /** Index to arrBufIndex[], used for input buffer timestamps */
614    OMX_U8 IpBufindex;
615    /** Index to arrBufIndex[], used for output buffer timestamps */
616    OMX_U8 OpBufindex;
617
618    /** Keep buffer tickcount **/
619    OMX_U32 tickcountBufIndex[MAX_NUM_OF_BUFS];
620
621    PV_OMXComponentCapabilityFlagsType iPVCapabilityFlags;
622
623    struct OMX_TI_Debug dbg;
624
625} AACENC_COMPONENT_PRIVATE;
626
627OMX_ERRORTYPE AACENCGetCorresponding_LCMLHeader(AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U8 *pBuffer,
628                                                  OMX_DIRTYPE eDir,
629                                                  LCML_AACENC_BUFHEADERTYPE **ppLcmlHdr);
630
631OMX_ERRORTYPE AACENCLCML_Callback(TUsnCodecEvent event,void * args [10]);
632
633OMX_ERRORTYPE AACENCFill_LCMLInitParams(OMX_HANDLETYPE pHandle,
634                                          LCML_DSP *plcml_Init,OMX_U16 arr[]);
635
636OMX_ERRORTYPE AACENCGetBufferDirection(OMX_BUFFERHEADERTYPE *pBufHeader, OMX_DIRTYPE *eDir);
637
638OMX_U32 AACENCHandleCommand(AACENC_COMPONENT_PRIVATE *pComponentPrivate);
639
640OMX_ERRORTYPE AACENCHandleDataBuf_FromApp(OMX_BUFFERHEADERTYPE *pBufHeader,
641                                            AACENC_COMPONENT_PRIVATE *pComponentPrivate);
642
643int AACEnc_GetSampleRateIndexL( const int aRate);
644
645OMX_HANDLETYPE AACENCGetLCMLHandle(AACENC_COMPONENT_PRIVATE *pComponentPrivate);
646
647OMX_ERRORTYPE AACENC_CleanupInitParams(OMX_HANDLETYPE pHandle);
648
649void AACENC_SetPending(AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber);
650
651void AACENC_ClearPending(AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber) ;
652
653OMX_U32 AACENC_IsPending(AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir);
654
655/* ===========================================================  */
656/**
657*  AACENC_TransitionToIdle() Transitions component to idle
658*
659*
660*  @param pComponentPrivate     Component private data
661*
662*  @return OMX_ErrorNone = No error
663*          OMX Error code = Error
664*/
665/*================================================================== */
666/*OMX_ERRORTYPE AACENC_TransitionToIdle(AACENC_COMPONENT_PRIVATE *pComponentPrivate); */
667
668OMX_ERRORTYPE AACENC_TransitionToPause(AACENC_COMPONENT_PRIVATE *pComponentPrivate);
669
670OMX_ERRORTYPE AACENCFill_LCMLInitParamsEx(OMX_HANDLETYPE pComponent);
671
672OMX_ERRORTYPE AACENCWriteConfigHeader(AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr);
673
674/* void AACENC_ResourceManagerCallback(RMPROXY_COMMANDDATATYPE cbData); */
675
676#ifndef UNDER_CE
677OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp);
678#else
679/*  WinCE Implicit Export Syntax */
680#define OMX_EXPORT __declspec(dllexport)
681OMX_EXPORT OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp);
682#endif
683
684
685OMX_ERRORTYPE AACENC_StartComponentThread(OMX_HANDLETYPE pHandle);
686
687OMX_ERRORTYPE AACENC_StopComponentThread(OMX_HANDLETYPE pHandle);
688
689OMX_ERRORTYPE AACENC_FreeCompResources(OMX_HANDLETYPE pComponent);
690
691#endif
692
693
694
695