3 * Copyright (C) Texas Instruments - http://www.ti.com/
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.
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.
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
21 /* =============================================================================
22 * Texas Instruments OMAP(TM) Platform Software
23 * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved.
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 * ============================================================================ */
29 * @file OMX_G722Decoder.h
31 * This is an header file for an audio G722 decoder that is fully
32 * compliant with the OMX Audio specification.
33 * This the file is used internally by the component
36 * @path $(CSLPATH)\OMAPSW_MPU\linux\audio\src\openmax_il\g722_dec\inc\
40 /* --------------------------------------------------------------------------- */
41 #ifndef OMX_G722DEC_UTILS__H
42 #define OMX_G722DEC_UTILS__H
44 #include <OMX_Component.h>
46 #include "LCML_DspCodec.h"
57 /*#define G722DEC_DEBUG **/ /* See all debug statement of the component */
58 /*#define G722DEC_MEMDETAILS */ /* See memory details of the component */
59 /*#define G722DEC_BUFDETAILS */ /* See buffers details of the component */
60 /*#define G722DEC_STATEDETAILS */ /* See all state transitions of the component */
62 #define MAX_NUM_OF_BUFS 10 /* Max number of buffers used */
63 #define G722D_NUM_INPUT_BUFFERS 1 /* Default number of input buffers */
64 #define G722D_NUM_OUTPUT_BUFFERS 1 /* Default number of output buffers */
65 #define G722D_INPUT_BUFFER_SIZE 4096 /* Default size of input buffer */
66 #define G722D_OUTPUT_BUFFER_SIZE 320 /* Default size of output buffer */
68 #define NUM_OF_PORTS 2 /* Number of ports of component */
69 #define INVALID_SAMPLING_FREQ 51
71 #define EXIT_COMPONENT_THRD 10
74 #define G722DEC_MAJOR_VER 0xF1 /* Majer version of the component */
75 #define G722DEC_MINOR_VER 0xF2 /* Minor version of the component */
76 #define G722DEC_BUFHEADER_VERSION 0x0 /* Version of the buffer header struct */
77 #define NOT_USED 10 /* To specify that a particulat field is not used */
78 #define NORMAL_BUFFER 0 /* Marks a buffer as normal buffer i.e. not last buffer */
79 #define OMX_G722DEC_DEFAULT_SEGMENT (0) /* Default segment ID */
80 #define OMX_G722DEC_SN_TIMEOUT (-1) /* timeout, wait until ack is received */
81 #define OMX_G722DEC_SN_PRIORITY (10) /* Priority used by DSP */
82 #define G722DEC_CPU 50 /* TBD, 50MHz for the moment */
85 #define USN_DLL_NAME "\\windows\\usn.dll64P" /* Path of USN DLL */
86 #define G722DEC_DLL_NAME "\\windows\\g722dec_sn.dll64P" /* Path of G722 SN DLL */
88 #define USN_DLL_NAME "usn.dll64P" /* Path of USN DLL */
89 #define G722DEC_DLL_NAME "g722dec_sn.dll64P" /* Path of G722 SN DLL */
92 #define DONT_CARE 0 /* Value unused or ignored */
94 /** Default timeout used to come out of blocking calls*/
95 #define G722D_TIMEOUT (1000) /* millisecs */
100 #define G722DEC_DPRINT printf
101 #define G722DEC_EPRINT printf
102 #define G722DEC_MEMPRINT printf
103 #define G722DEC_STATEPRINT printf
104 #define G722DEC_BUFPRINT printf
106 #define G722DEC_DPRINT
107 #define G722DEC_EPRINT
108 #define G722DEC_MEMPRINT
109 #define G722DEC_STATEPRINT
110 #define G722DEC_BUFPRINT
113 #else /* for Linux */
117 #define G722DEC_DPRINT(...) fprintf(stdout, "%s %d:: ",__FUNCTION__, __LINE__); \
118 fprintf(stdout, __VA_ARGS__); \
119 fprintf(stdout, "\n");
121 #define G722DEC_BUFPRINT printf
122 #define G722DEC_MEMPRINT printf
123 #define G722DEC_STATEPRINT printf
126 #define G722DEC_DPRINT(...)
128 #ifdef G722DEC_STATEDETAILS
129 #define G722DEC_STATEPRINT printf
131 #define G722DEC_STATEPRINT(...)
134 #ifdef G722DEC_BUFDETAILS
135 #define G722DEC_BUFPRINT printf
137 #define G722DEC_BUFPRINT(...)
140 #ifdef G722DEC_MEMDETAILS
141 #define G722DEC_MEMPRINT(...) fprintf(stdout, "%s %d:: ",__FUNCTION__, __LINE__); \
142 fprintf(stdout, __VA_ARGS__); \
143 fprintf(stdout, "\n");
145 #define G722DEC_MEMPRINT(...)
150 #endif /*for UNDER_CE*/
152 #define G722D_OMX_MALLOC(_pStruct_, _sName_) \
153 _pStruct_ = (_sName_*)malloc(sizeof(_sName_)); \
154 if(_pStruct_ == NULL){ \
155 printf("***********************************\n"); \
156 printf("%d :: Malloc Failed\n",__LINE__); \
157 printf("***********************************\n"); \
158 eError = OMX_ErrorInsufficientResources; \
161 memset(_pStruct_,0,sizeof(_sName_)); \
162 G722DEC_MEMPRINT("%d :: Malloced = %p\n",__LINE__,_pStruct_);
166 #define G722D_OMX_MALLOC_SIZE(_ptr_, _size_,_name_) \
167 _ptr_ = (_name_ *)malloc(_size_); \
169 printf("***********************************\n"); \
170 printf("%d :: Malloc Failed\n",__LINE__); \
171 printf("***********************************\n"); \
172 eError = OMX_ErrorInsufficientResources; \
175 memset(_ptr_,0,_size_); \
176 G722DEC_MEMPRINT("%d :: Malloced = %p\n",__LINE__,_ptr_);
178 #define G722D_OMX_ERROR_EXIT(_e_, _c_, _s_) \
180 printf("\n**************** OMX ERROR ************************\n"); \
181 printf("%d : Error Name: %s : Error Num = %x",__LINE__, _s_, _e_); \
182 printf("\n**************** OMX ERROR ************************\n"); \
186 #define G722D_OMX_CONF_CHECK_CMD(_ptr1, _ptr2, _ptr3) \
188 if(!_ptr1 || !_ptr2 || !_ptr3){ \
189 eError = OMX_ErrorBadParameter; \
194 #define G722D_OMX_FREE(ptr) \
196 G722DEC_MEMPRINT("%d :: Freeing Address = %p\n",__LINE__,ptr); \
201 #define OMX_CONF_INIT_STRUCT(_s_, _name_) \
202 memset((_s_), 0x0, sizeof(_name_)); \
203 (_s_)->nSize = sizeof(_name_); \
204 (_s_)->nVersion.s.nVersionMajor = 0x1; \
205 (_s_)->nVersion.s.nVersionMinor = 0x0; \
206 (_s_)->nVersion.s.nRevision = 0x0; \
207 (_s_)->nVersion.s.nStep = 0x0
210 /* ======================================================================= */
211 /** OMX_G722DEC_INDEXAUDIOTYPE Defines the custom configuration settings
214 * @param OMX_IndexCustomG722DecModeDasfConfig Sets the DASF mode
217 /* ==================================================================== */
218 typedef enum OMX_G722DEC_INDEXAUDIOTYPE {
219 /*OMX_IndexCustomG722DecModeDasfConfig = OMX_IndexIndexVendorStartUnused + 1,*/
220 OMX_IndexCustomG722DecModeDasfConfig = 0xFF000001,
221 OMX_IndexCustomG722DecHeaderInfoConfig,
222 OMX_IndexCustomG722DecStreamIDConfig,
223 OMX_IndexCustomG722DecDataPath
224 }OMX_G722DEC_INDEXAUDIOTYPE;
227 /* ============================================================================== * */
228 /** G722D_COMP_PORT_TYPE describes the input and output port of indices of the
231 * @param G722D_INPUT_PORT Input port index
233 * @param G722D_OUTPUT_PORT Output port index
235 /* ============================================================================ * */
236 typedef enum G722D_COMP_PORT_TYPE {
237 G722D_INPUT_PORT = 0,
239 }G722D_COMP_PORT_TYPE;
242 /* ======================================================================= */
243 /** G722DEC_ParamStruct: This struct is passed with input buffers that
246 /* ==================================================================== */
248 /* Set to 1 if buffer is last buffer */
249 unsigned long usLastFrame;
250 unsigned long usFrameLost;
251 }G722DEC_ParamStruct;
253 /* ======================================================================= */
254 /** G722DEC_UAlgInBufParamStruct: This struct is passed with input buffers that
257 /* ==================================================================== */
259 /* Set to 1 if buffer is last buffer */
260 unsigned long bLastBuffer;
261 }G722DEC_UAlgInBufParamStruct;
264 /* ======================================================================= */
265 /** G722D_USN_AudioCodecParams: This contains the information which does to Codec
269 /* ==================================================================== */
270 typedef struct USN_AudioCodecParams{
271 /* Specifies the sample frequency */
272 unsigned long ulSamplingFreq;
273 /* Specifies the UUID */
274 unsigned long unUUID;
275 /* Specifies the audio format */
276 unsigned short unAudioFormat;
277 }G722D_USN_AudioCodecParams;
279 /* ======================================================================= */
280 /** G722DEC_UAlgOutBufParamStruct: This is passed with output buffer to DSP.
282 /* ==================================================================== */
284 /* Number of frames in a buffer */
285 unsigned long ulFrameCount;
286 }G722DEC_UAlgOutBufParamStruct;
288 /* ======================================================================= */
289 /** G722D_LCML_BUFHEADERTYPE: This is LCML buffer header which is sent to LCML
290 * for both input and output buffers.
292 /* ==================================================================== */
293 typedef struct G722D_LCML_BUFHEADERTYPE {
294 /* Direction whether input or output buffer */
296 /* Pointer to OMX Buffer Header */
297 OMX_BUFFERHEADERTYPE *pBufHdr;
298 /* Other parameters, may be useful for enhancements */
299 void *pOtherParams[10];
300 /* Input Parameter Information structure */
301 /*G722DEC_UAlgInBufParamStruct *pIpParam;*/
302 G722DEC_ParamStruct *pIpParam;
303 /* Output Parameter Information structure */
304 G722DEC_UAlgOutBufParamStruct *pOpParam;
306 OMX_BUFFERHEADERTYPE* buffer;
307 }G722D_LCML_BUFHEADERTYPE;
309 /* ======================================================================= */
310 /** G722D_AUDIODEC_PORT_TYPE: This contains component port information.
312 * @see OMX_AUDIO_PARAM_PORTFORMATTYPE
314 /* ==================================================================== */
315 typedef struct AUDIODEC_PORT_TYPE {
316 /* Used in tunneling, this is handle of tunneled component */
317 OMX_HANDLETYPE hTunnelComponent;
318 /* Port which has to be tunneled */
320 /* Buffer Supplier Information */
321 OMX_BUFFERSUPPLIERTYPE eSupplierSetting;
322 /* Number of buffers */
324 /* Port format information */
325 OMX_AUDIO_PARAM_PORTFORMATTYPE* pPortFormat;
326 } G722D_AUDIODEC_PORT_TYPE;
329 /* ======================================================================= */
330 /** _G722D_BUFFERLIST: This contains information about a buffer's owner whether
331 * it is application or component, number of buffers owned etc.
333 * @see OMX_BUFFERHEADERTYPE
335 /* ==================================================================== */
336 struct _G722D_BUFFERLIST{
337 /* Array of pointer to OMX buffer headers */
338 OMX_BUFFERHEADERTYPE *pBufHdr[MAX_NUM_OF_BUFS];
339 /* Array that tells about owner of each buffer */
340 OMX_U32 bufferOwner[MAX_NUM_OF_BUFS];
341 OMX_U32 bBufferPending[MAX_NUM_OF_BUFS];
342 /* Number of buffers */
346 typedef struct _G722D_BUFFERLIST G722D_BUFFERLIST;
351 typedef struct OMX_Event {
355 int OMX_CreateEvent(OMX_Event *event);
356 int OMX_SignalEvent(OMX_Event *event);
357 int OMX_WaitForEvent(OMX_Event *event);
358 int OMX_DestroyEvent(OMX_Event *event);
361 /* ======================================================================= */
362 /** G722DEC_COMPONENT_PRIVATE: This is the major and main structure of the
363 * component which contains all type of information of buffers, ports etc
364 * contained in the component.
366 * @see OMX_BUFFERHEADERTYPE
367 * @see OMX_AUDIO_PARAM_PORTFORMATTYPE
368 * @see OMX_PARAM_PORTDEFINITIONTYPE
369 * @see G722D_LCML_BUFHEADERTYPE
370 * @see OMX_PORT_PARAM_TYPE
371 * @see OMX_PRIORITYMGMTTYPE
372 * @see G722D_AUDIODEC_PORT_TYPE
373 * @see G722D_BUFFERLIST
374 * @see G722D_AUDIODEC_PORT_TYPE
378 /* ==================================================================== */
379 typedef struct G722DEC_COMPONENT_PRIVATE
381 /** Handle for use with async callbacks */
382 OMX_CALLBACKTYPE cbInfo;
383 /* Component port information */
384 OMX_PORT_PARAM_TYPE *sPortParam;
385 /* Input port information */
386 OMX_AUDIO_PARAM_PORTFORMATTYPE sInPortFormat;
387 /* Output port information */
388 OMX_AUDIO_PARAM_PORTFORMATTYPE sOutPortFormat;
389 /* Buffer owner information */
390 OMX_U32 bIsBufferOwned[NUM_OF_PORTS];
392 /** Number of input buffers at runtime */
393 OMX_U32 nRuntimeInputBuffers;
395 /** Number of output buffers at runtime */
396 OMX_U32 nRuntimeOutputBuffers;
398 /* Audio codec parameters structure */
399 G722D_USN_AudioCodecParams *pParams;
401 /** This will contain info like how many buffers
402 are there for input/output ports, their size etc, but not
403 BUFFERHEADERTYPE POINTERS. */
404 OMX_PARAM_PORTDEFINITIONTYPE* pPortDef[NUM_OF_PORTS];
405 /* Contains information that come from application */
406 OMX_AUDIO_PARAM_PCMMODETYPE* G722Params[NUM_OF_PORTS];
407 /** This is component handle */
408 OMX_COMPONENTTYPE* pHandle;
409 /** Current state of this component */
410 OMX_STATETYPE curState;
411 /** The component thread handle */
412 pthread_t ComponentThread;
413 /** The pipes for sending buffers to the thread */
415 /** The pipes for sending buffers to the thread */
418 /** The pipes for sending command data to the thread */
421 /* int portcmdPipe[2]; */
423 /** The pipes for sending buffers to the thread */
426 /** Set to indicate component is stopping */
429 /** Count of number of buffers outstanding with bridge */
432 /** Count of number of buffers outstanding with bridge */
435 /** Counts of number of input buffers sent to LCML */
437 /** Counts of number of input buffers received from LCML */
438 OMX_U32 lcml_nCntIpRes;
439 /** Counts of number of output buffers sent to LCML */
441 /** Counts of number of output buffers received from LCML */
442 OMX_U32 lcml_nCntOpReceived;
443 /** Counts of number of buffers sent to App */
444 OMX_U32 lcml_nCntApp;
445 /** Counts of number of buffers received from App */
448 /** Counts of number of output buffers reclaimed from lcml */
449 OMX_U32 num_Reclaimed_Op_Buff;
450 /** Counts of number of input buffers sent to lcml */
451 OMX_U32 num_Sent_Ip_Buff;
452 /** Counts of number of output buffers sent to lcml */
453 OMX_U32 num_Op_Issued;
454 /** Holds the value of dasf mode, 1: DASF mode or 0: File Mode */
457 OMX_STRING* sDeviceString;
459 /** This is LCML handle */
460 OMX_HANDLETYPE pLcmlHandle;
462 /** Contains pointers to LCML Buffer Headers */
463 G722D_LCML_BUFHEADERTYPE *pLcmlBufHeader[2];
464 OMX_U32 bBufferIsAllocated;
466 /** Tells whether buffers on ports have been allocated */
467 OMX_U32 bPortDefsAllocated;
468 /** Tells whether component thread has started */
469 OMX_U32 bCompThreadStarted;
470 /** Marks the buffer data */
472 /** Marks the buffer */
473 OMX_MARKTYPE *pMarkBuf;
474 /** Marks the target component */
475 OMX_HANDLETYPE hMarkTargetComponent;
476 /** Flag to track when input buffer's filled length is 0 */
478 /** Input port enable flag */
479 int ipPortEnableFlag;
480 /** Input port disble flag */
481 int ipPortDisableFlag;
482 /** Pointer to port parameter structure */
483 OMX_PORT_PARAM_TYPE* pPortParamType;
484 /** Pointer to port priority management structure */
485 OMX_PRIORITYMGMTTYPE* pPriorityMgmt;
486 /** Contains the port related info of both the ports */
487 G722D_AUDIODEC_PORT_TYPE *pCompPort[NUM_OF_PORTS];
488 /* Checks whether or not buffer were allocated by appliction */
490 /** Flag to check about execution of component thread */
491 OMX_U16 bExitCompThrd;
492 /** Pointer to list of input buffers */
493 G722D_BUFFERLIST *pInputBufferList;
494 /** Pointer to list of output buffers */
495 G722D_BUFFERLIST *pOutputBufferList;
496 /** it is used for component's create phase arguments */
497 LCML_STRMATTR *strmAttr;
498 /** Contains the version information */
501 /** ACDN mode flag */
504 /** Audio Stream ID */
508 int bLcmlHandleOpened;
509 OMX_U32 nFillThisBufferCount;
510 /** Counts number of FillBufferDone calls*/
511 OMX_U32 nFillBufferDoneCount;
512 /** Counts number of EmptyThisBuffer calls*/
513 OMX_U32 nEmptyThisBufferCount;
514 /** Counts number of EmptyBufferDone calls*/
515 OMX_U32 nEmptyBufferDoneCount;
516 /** Checks if component Init Params have been initialized */
517 OMX_U32 bInitParamsInitialized;
518 G722D_BUFFERLIST *pInputBufferListQueue;
519 G722D_BUFFERLIST *pOutputBufferListQueue;
520 OMX_BUFFERHEADERTYPE *pInputBufHdrPending[MAX_NUM_OF_BUFS];
521 OMX_U32 nNumInputBufPending;
522 OMX_BUFFERHEADERTYPE *pOutputBufHdrPending[MAX_NUM_OF_BUFS];
523 OMX_U32 nNumOutputBufPending;
524 OMX_BUFFERHEADERTYPE *pOutBufHdrWhilePaused[MAX_NUM_OF_BUFS];
525 OMX_U32 nPendingOutPausedBufs;
527 OMX_U32 bDisableCommandPending;
528 OMX_U32 bDisableCommandParam;
529 OMX_U32 nInvalidFrameCount;
530 OMX_U32 numPendingBuffers;
531 OMX_U32 bNoIdleOnStop;
532 OMX_U32 bDspStoppedWhileExecuting;
533 OMX_U32 bIdleCommandPending;
534 OMX_U32 nOutStandingFillDones;
537 pthread_mutex_t AlloBuf_mutex;
538 pthread_cond_t AlloBuf_threshold;
539 OMX_U8 AlloBuf_waitingsignal;
541 pthread_mutex_t InLoaded_mutex;
542 pthread_cond_t InLoaded_threshold;
543 OMX_U8 InLoaded_readytoidle;
545 pthread_mutex_t InIdle_mutex;
546 pthread_cond_t InIdle_threshold;
547 OMX_U8 InIdle_goingtoloaded;
549 OMX_Event AlloBuf_event;
550 OMX_U8 AlloBuf_waitingsignal;
552 OMX_Event InLoaded_event;
553 OMX_U8 InLoaded_readytoidle;
555 OMX_Event InIdle_event;
556 OMX_U8 InIdle_goingtoloaded;
559 OMX_BOOL bLoadedCommandPending;
560 OMX_PARAM_COMPONENTROLETYPE *componentRole;
561 OMX_VERSIONTYPE ComponentVersion;
562 OMX_STRING cComponentName;
564 /** Keep buffer timestamps **/
565 OMX_S64 arrTimestamp[MAX_NUM_OF_BUFS];
566 /** Keep buffer nTickCounts **/
567 OMX_S64 arrTickCount[MAX_NUM_OF_BUFS];
568 /** Index to arrTimestamp[], used for input buffer timestamps */
570 /** Index to arrTimestamp[], used for output buffer timestamps */
572 } G722DEC_COMPONENT_PRIVATE;
576 /* ================================================================================= * */
578 * OMX_ComponentInit() function is called by OMX Core to initialize the component
579 * with default values of the component. Before calling this function OMX_Init
580 * must have been called.
582 * @param *hComp This is component handle allocated by the OMX core.
584 * @pre OMX_Init should be called by application.
586 * @post Component has initialzed with default values.
588 * @return OMX_ErrorNone = Successful Inirialization of the component\n
589 * OMX_ErrorInsufficientResources = Not enough memory
591 * @see G722Dec_StartCompThread()
593 /* ================================================================================ * */
595 OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp);
597 /* WinCE Implicit Export Syntax */
598 #define OMX_EXPORT __declspec(dllexport)
599 OMX_EXPORT OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp);
602 /* ================================================================================= * */
604 * G722Dec_StartCompThread() starts the component thread. This is internal
605 * function of the component.
607 * @param pHandle This is component handle allocated by the OMX core.
613 * @return OMX_ErrorNone = Successful Inirialization of the component\n
614 * OMX_ErrorInsufficientResources = Not enough memory
618 /* ================================================================================ * */
619 OMX_ERRORTYPE G722Dec_StartCompThread(OMX_HANDLETYPE pHandle);
621 /* ================================================================================= * */
623 * G722DEC_Fill_LCMLInitParams() fills the LCML initialization structure.
625 * @param pHandle This is component handle allocated by the OMX core.
627 * @param plcml_Init This structure is filled and sent to LCML.
633 * @return OMX_ErrorNone = Successful Inirialization of the LCML struct.
634 * OMX_ErrorInsufficientResources = Not enough memory
638 /* ================================================================================ * */
639 OMX_ERRORTYPE G722DEC_Fill_LCMLInitParams(OMX_HANDLETYPE pHandle,
640 LCML_DSP *plcml_Init, OMX_U16 arr[]);
642 /* ================================================================================= * */
644 * G722DEC_GetBufferDirection() function determines whether it is input buffer or
647 * @param *pBufHeader This is pointer to buffer header whose direction needs to
650 * @param *eDir This is output argument which stores the direction of buffer.
656 * @return OMX_ErrorNone = Successful processing.
657 * OMX_ErrorBadParameter = In case of invalid buffer
661 /* ================================================================================ * */
662 OMX_ERRORTYPE G722DEC_GetBufferDirection(OMX_BUFFERHEADERTYPE *pBufHeader,
665 /* ================================================================================= * */
667 * G722DEC_LCML_Callback() function is callback which is called by LCML whenever
668 * there is an even generated for the component.
670 * @param event This is event that was generated.
672 * @param arg This has other needed arguments supplied by LCML like handles
679 * @return OMX_ErrorNone = Successful processing.
680 * OMX_ErrorInsufficientResources = Not enough memory
684 /* ================================================================================ * */
685 OMX_ERRORTYPE G722DEC_LCML_Callback (TUsnCodecEvent event,void * args [10]);
687 /* ================================================================================= * */
689 * G722DEC_HandleCommand() function handles the command sent by the application.
690 * All the state transitions, except from nothing to loaded state, of the
691 * component are done by this function.
693 * @param pComponentPrivate This is component's private date structure.
699 * @return OMX_ErrorNone = Successful processing.
700 * OMX_ErrorInsufficientResources = Not enough memory
701 * OMX_ErrorHardware = Hardware error has occured lile LCML failed
702 * to do any said operartion.
706 /* ================================================================================ * */
707 OMX_U32 G722DEC_HandleCommand (G722DEC_COMPONENT_PRIVATE *pComponentPrivate);
709 /* ================================================================================= * */
711 * G722DEC_HandleDataBuf_FromApp() function handles the input and output buffers
712 * that come from the application. It is not direct function wich gets called by
713 * the application rather, it gets called eventually.
715 * @param *pBufHeader This is the buffer header that needs to be processed.
717 * @param *pComponentPrivate This is component's private date structure.
723 * @return OMX_ErrorNone = Successful processing.
724 * OMX_ErrorInsufficientResources = Not enough memory
725 * OMX_ErrorHardware = Hardware error has occured lile LCML failed
726 * to do any said operartion.
730 /* ================================================================================ * */
731 OMX_ERRORTYPE G722DEC_HandleDataBuf_FromApp(OMX_BUFFERHEADERTYPE *pBufHeader,
732 G722DEC_COMPONENT_PRIVATE *pComponentPrivate);
734 /* ================================================================================= * */
736 * G722DEC_GetLCMLHandle() function gets the LCML handle and interacts with LCML
737 * by using this LCML Handle.
739 * @param *pBufHeader This is the buffer header that needs to be processed.
741 * @param *pComponentPrivate This is component's private date structure.
747 * @return OMX_HANDLETYPE = Successful loading of LCML library.
748 * OMX_ErrorHardware = Hardware error has occured.
752 /* ================================================================================ * */
753 OMX_HANDLETYPE G722DEC_GetLCMLHandle(G722DEC_COMPONENT_PRIVATE *pComponentPrivate);
755 /* ================================================================================= * */
757 * G722DEC_GetCorresponding_LCMLHeader() function gets the corresponding LCML
758 * header from the actual data buffer for required processing.
760 * @param *pBuffer This is the data buffer pointer.
762 * @param eDir This is direction of buffer. Input/Output.
764 * @param *G722D_LCML_BUFHEADERTYPE This is pointer to LCML Buffer Header.
770 * @return OMX_ErrorNone = Successful Inirialization of the component\n
771 * OMX_ErrorHardware = Hardware error has occured.
775 /* ================================================================================ * */
776 OMX_ERRORTYPE G722DEC_GetCorresponding_LCMLHeader(G722DEC_COMPONENT_PRIVATE *pComponentPrivate,
779 G722D_LCML_BUFHEADERTYPE **ppLcmlHdr);
781 /* ================================================================================= * */
783 * G722DEC_FreeCompResources() function frees the component resources.
785 * @param pComponent This is the component handle.
791 * @return OMX_ErrorNone = Successful Inirialization of the component\n
792 * OMX_ErrorHardware = Hardware error has occured.
796 /* ================================================================================ * */
797 OMX_ERRORTYPE G722DEC_FreeCompResources(OMX_HANDLETYPE pComponent);
799 /* ================================================================================= * */
801 * G722DEC_CleanupInitParams() function frees only the initialization time
802 * memories allocated. For example, it will not close pipes, it will not free the
803 * memory allocated to the buffers etc. But it does free the memory of buffers
804 * utilized by the LCML etc. It is basically subset of G722DEC_FreeResources()
807 * @param pComponent This is the component handle.
813 * @return OMX_ErrorNone = Successful Inirialization of the component\n
817 /* ================================================================================ * */
818 void G722DEC_CleanupInitParams(OMX_HANDLETYPE pComponent);
820 /* ================================================================================= * */
822 * G722DEC_ComponentThread() This is component thread of the component which keeps
823 * running or lsitening from the application unless component is deinitialized
824 * from by the application i.e. component is transitioned from Idle to Loaded
827 * @param pHandle This is component handle allocated by the OMX core.
833 * @return OMX_ErrorNone = Successful Inirialization of the component\n
834 * OMX_ErrorInsufficientResources = Not enough memory
838 /* ================================================================================ * */
839 void* G722DEC_ComponentThread (void* pThreadData);
841 OMX_ERRORTYPE G722DECFill_LCMLInitParamsEx (OMX_HANDLETYPE pComponent);
842 void G722DEC_SetPending (G722DEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber);
843 void G722DEC_ClearPending (G722DEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber) ;
844 OMX_U32 G722DEC_IsPending (G722DEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir);
845 OMX_U32 G722DEC_IsValid (G722DEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U8 *pBuffer, OMX_DIRTYPE eDir) ;
846 void printEmmEvent (TUsnCodecEvent);
847 void* G722DEC_ComponentThread (void* pThreadData);
849 #ifndef OMX_G722_COMPONENTTHREAD__H
850 #define OMX_G722_COMPONENTTHREAD__H
852 #define EXIT_COMPONENT_THRD 10