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_AmrDec_Utils.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 header file with the utils necesary to for the NBAMR_DEC component.
34 * in its code.
35 *
36 * @path $(CSLPATH)\
37 *
38 * @rev 0.1
39 */
40 /* --------------------------------------------------------------------------- */
41 
42 #ifndef OMX_AMRDEC_UTILS__H
43 #define OMX_AMRDEC_UTILS__H
44 
45 #include <OMX_Component.h>
46 #include "OMX_TI_Common.h"
47 #include "OMX_AmrDecoder.h"
48 
49 /* ======================================================================= */
50 /**
51  * @def    AMRDEC_MAJOR_VER              Define value for "major" version
52  */
53 /* ======================================================================= */
54 #define  AMRDEC_MAJOR_VER 0xF1
55 
56 /* ======================================================================= */
57 /**
58  * @def    AMRDEC_MINOR_VER              Define value for "minor" version
59  */
60 /* ======================================================================= */
61 #define  AMRDEC_MINOR_VER 0xF2
62 
63 /* ======================================================================= */
64 /**
65  * @def    NOT_USED                            Define a not used value
66  */
67 /* ======================================================================= */
68 #define NOT_USED 10
69 
70 /* ======================================================================= */
71 /**
72  * @def    NORMAL_BUFFER                       Define a normal buffer value
73  */
74 /* ======================================================================= */
75 #define NORMAL_BUFFER 0
76 
77 /* ======================================================================= */
78 /**
79  * @def    OMX_AMRDEC_DEFAULT_SEGMENT        Define the default segment
80  */
81 /* ======================================================================= */
82 #define OMX_AMRDEC_DEFAULT_SEGMENT (0)
83 
84 /* ======================================================================= */
85 /**
86  * @def    OMX_AMRDEC_SN_TIMEOUT            Define a value for SN Timeout
87  */
88 /* ======================================================================= */
89 #define OMX_AMRDEC_SN_TIMEOUT (-1)
90 
91 /* ======================================================================= */
92 /**
93  * @def    OMX_AMRDEC_SN_PRIORITY           Define a value for SN Priority
94  */
95 /* ======================================================================= */
96 #define OMX_AMRDEC_SN_PRIORITY (10)
97 
98 /* ======================================================================= */
99 /**
100  * @def    OMX_AMRDEC_NUM_DLLS              Define a num of DLLS to be used
101  */
102 /* ======================================================================= */
103 #define OMX_AMRDEC_NUM_DLLS (2)
104 
105 /* ======================================================================= */
106 /**
107  * @def    NBAMRDEC_USN_DLL_NAME             Path & Name of USN DLL to be used
108  *                                           at initialization
109  */
110 /* ======================================================================= */
111 #ifdef UNDER_CE
112 	#define NBAMRDEC_USN_DLL_NAME "\\windows\\usn.dll64P"
113 #else
114 	#define NBAMRDEC_USN_DLL_NAME "usn.dll64P"
115 #endif
116 
117 /* ======================================================================= */
118 /**
119  * @def    NBAMRDEC_USN_DLL_NAME             Path & Name of DLL to be useda
120  *                                           at initialization
121  */
122 /* ======================================================================= */
123 #ifdef UNDER_CE
124 	#define NBAMRDEC_DLL_NAME "\\windows\\nbamrdec_sn.dll64P"
125 #else
126 	#define NBAMRDEC_DLL_NAME "nbamrdec_sn.dll64P"
127 #endif
128 
129 OMX_ERRORTYPE NBAMRDECGetCorresponding_LCMLHeader(AMRDEC_COMPONENT_PRIVATE *pComponentPrivate,
130                                           OMX_U8 *pBuffer,
131                                           OMX_DIRTYPE eDir,
132                                           LCML_NBAMRDEC_BUFHEADERTYPE **ppLcmlHdr);
133 
134 OMX_ERRORTYPE NBAMRDECLCML_Callback (TUsnCodecEvent event,void * args [10]);
135 
136 OMX_ERRORTYPE NBAMRDECFill_LCMLInitParams(OMX_HANDLETYPE pHandle,
137                   LCML_DSP *plcml_Init,OMX_U16 arr[]);
138 
139 OMX_ERRORTYPE NBAMRDECGetBufferDirection(OMX_BUFFERHEADERTYPE *pBufHeader, OMX_DIRTYPE *eDir);
140 OMX_U32 NBAMRDECHandleCommand (AMRDEC_COMPONENT_PRIVATE *pComponentPrivate);
141 
142 OMX_ERRORTYPE NBAMRDECHandleDataBuf_FromApp(OMX_BUFFERHEADERTYPE *pBufHeader,
143         AMRDEC_COMPONENT_PRIVATE *pComponentPrivate);
144 
145 void  AddHeader(BYTE **pFileBuf);
146 void  ResetPtr(BYTE **pFileBuf);
147 OMX_HANDLETYPE NBAMRDECGetLCMLHandle(AMRDEC_COMPONENT_PRIVATE *pComponentPrivate);
148 OMX_ERRORTYPE NBAMRDECFreeLCMLHandle(AMRDEC_COMPONENT_PRIVATE *pComponentPrivate);
149 OMX_ERRORTYPE NBAMRDEC_CleanupInitParams(OMX_HANDLETYPE pComponent);
150 void NBAMRDEC_SetPending(AMRDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir);
151 void NBAMRDEC_ClearPending(AMRDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir) ;
152 OMX_U32 NBAMRDEC_IsPending(AMRDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir);
153 OMX_ERRORTYPE NBAMRDECFill_LCMLInitParamsEx(OMX_HANDLETYPE pComponent);
154 OMX_U32 NBAMRDEC_IsValid(AMRDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U8 *pBuffer, OMX_DIRTYPE eDir) ;
155 OMX_ERRORTYPE OMX_DmmMap(DSP_HPROCESSOR ProcHandle, int size, void* pArmPtr, DMM_BUFFER_OBJ* pDmmBuf, struct OMX_TI_Debug dbg);
156 OMX_ERRORTYPE OMX_DmmUnMap(DSP_HPROCESSOR ProcHandle, void* pMapPtr, void* pResPtr, struct OMX_TI_Debug dbg);
157 
158 #ifdef RESOURCE_MANAGER_ENABLED
159 void NBAMR_ResourceManagerCallback(RMPROXY_COMMANDDATATYPE cbData);
160 #endif
161 
162 void NBAMRDEC_HandleUSNError (AMRDEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 arg);
163 #ifdef UNDER_CE
164 	#ifndef _OMX_EVENT_
165 		#define _OMX_EVENT_
166 		typedef struct OMX_Event {
167 			HANDLE event;
168 		} OMX_Event;
169 	#endif
170 	int OMX_CreateEvent(OMX_Event *event);
171 	int OMX_SignalEvent(OMX_Event *event);
172 	int OMX_WaitForEvent(OMX_Event *event);
173 	int OMX_DestroyEvent(OMX_Event *event);
174 #endif
175 
176 #endif
177