xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/apiVOIPMFE.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2009-2010 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // ("MStar Confidential Information") by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////
94 
95 ///////////////////////////////////////////////////////////////////////////////////////////////////
96 ///
97 /// @file   apiVOIPMFE.h
98 /// @brief  MStar Multi Format Video Encoder driver
99 /// @author MStar Semiconductor Inc.
100 /// @version 1.0
101 ///////////////////////////////////////////////////////////////////////////////////////////////////
102 
103 /*! \defgroup VDEC VDEC modules
104 
105     *! \defgroup VENC VENC(video encoder) interface.
106      *  \ingroup VDEC
107     This is the MStar Multi Format Video Encoder driver
108 
109     <b>Calling sequences</b>
110 
111    -# MApi_MFE_Initialize
112    -# MApi_MFE_Encode
113    -# MApi_MFE_CompressOnePicture     //loop
114    -# (optional) MApi_MFE_GetVOL
115    -# (optional) MApi_MFE_SetConfig
116    -# (optional) MApi_MFE_GetConfig
117    -# MApi_MFE_DeInitialize
118 
119  *! \defgroup MFE Multi Format Video Encoder driver
120  *  \ingroup VENC
121 
122  * *! \defgroup MFE_BASIC MFE driver basic.
123  *  \ingroup MFE
124 
125  *! \defgroup MFE_CONFIG MFE driver set/get configure.
126  *  \ingroup MFE
127 
128  *! \defgroup MFE_OPERATION MFE driver operation.
129  *  \ingroup MFE
130 
131  *! \defgroup MFE_toBeRemove MFE driver API to be removed.
132  *  \ingroup MFE
133  */
134 
135 #ifndef _API_VOIP_MFE_H_
136 #define _API_VOIP_MFE_H_
137 
138 #ifdef __cplusplus
139 extern "C"
140 {
141 #endif
142 
143 // below function is used for T8/T12/Janus2 VOIP project
144 
145 /* vop coding modes */
146 // type: I_VOP, P_VOP, or B_VOP
147 #define I_VOP        0UL
148 #define P_VOP        1UL
149 #define B_VOP        2UL
150 
151 
152  typedef enum {
153     PQ_LOW,
154     PQ_NORMAL,
155     PQ_HIGH
156  } PQ_LEVEL;
157 
158  typedef enum {
159     VOIP_MPEG4,
160     VOIP_H263,
161     VOIP_H264,
162     VOIP_JPEG
163  } VOIP_CODEC_TYPE;
164 
165 typedef enum {
166     MPEG4_ENC = 0,
167     H263_ENC = 1,
168     H264_ENC = 2,
169     JPEG_ENC = 3,
170     UNKNOWN_TYPE = 0xFF
171 } MFE_CODEC_TYPE;
172 
173 
174 /*
175 typedef enum {
176     MFE_RET_OK                      = 1,
177     MFE_RET_FAIL                    = -1000,
178     MFE_RET_CLOSE_FAIL              = -1002,
179 
180     MFE_RET_DEC_INIT_FAIL           = -2000,
181 
182     MFE_RET_INVALID_PARAM           = -4000
183 } MFE_ERROR_CODE;
184 */
185 
186 typedef enum {
187     MFE_ENC_SETCONF_FRAME_TYPE = 100,
188     MFE_ENC_SETCONF_CHANGE_FRAME_RATE,
189     MFE_ENC_SETCONF_CHANGE_BIT_RATE,
190     MFE_ENC_SETCONF_OUT_BSP_BUFFER,
191     MFE_ENC_SETCONF_FRAME_TAG,
192     MFE_ENC_SETCONF_JPE_QUALITY,
193     MFE_ENC_SETCONF_CHANGE_BIT_RATE_AND_FRAME_RATE,
194     MFE_ENC_SETCONF_RESET_SPSPPS,
195     MFE_ENC_SETCONF_SET_COLORFORMAT,
196 
197     MFE_ENC_GETCONF_FRAME_TAG = 300,
198     MFE_ENC_GETCONF_OUT_BSP_BUFFER,
199     MFE_ENC_GETCONF_JPE_QUALITY,
200     MFE_ENC_GETCONF_DROP,
201 } MFE_ENC_CONF;
202 
203 // <<< Calling sequences >>>
204 //
205 //      MApi_MFE_Initialize
206 //      MApi_MFE_Encode
207 //      MApi_MFE_CompressOnePicture     //loop
208 //      (optional) MApi_MFE_GetVOL
209 //      (optional) MApi_MFE_SetConfig
210 //      (optional) MApi_MFE_GetConfig
211 //      MApi_MFE_DeInitialize
212 
213 
214 //-------------------------------------------------------------------------------------------------
215 /// Notify driver to start encoder.
216 /// @ingroup MFE_toBeRemove
217 /// @return TRUE : succeed
218 /// @return FALSE : fail
219 //-------------------------------------------------------------------------------------------------
220 MS_BOOL MApi_MFE_Encode(void);
221 
222 //-------------------------------------------------------------------------------------------------
223 /// Encode one frame.
224 /// @ingroup MFE_BASIC
225 /// @param  YUVPlane               \b IN: YUVPlane The image physical address. it must be 256 alignment.
226 /// @param  bForceIframe           \b IN: bForceIframe force this frame tobe I.
227 /// @return TRUE : succeed
228 /// @return FALSE : fail
229 //-------------------------------------------------------------------------------------------------
230 MS_BOOL MApi_MFE_CompressOnePicture_ex(MEMMAP_CUR_t YUVPlane, MS_BOOL bForceIframe);
231 
232 //-------------------------------------------------------------------------------------------------
233 /// Get bitstream header.
234 /// @ingroup MFE_BASIC
235 /// @param  header_info              \b OUT: return header size and length.
236 /// @return TRUE : succeed
237 /// @return FALSE : fail
238 //-------------------------------------------------------------------------------------------------
239 MS_BOOL MApi_MFE_GetVOL_ex(void *header_info);
240 
241 //-------------------------------------------------------------------------------------------------
242 /// De-initialize MFE driver
243 /// @ingroup MFE_BASIC
244 /// @return TRUE : succeed
245 /// @return FALSE : fail
246 //-------------------------------------------------------------------------------------------------
247 MS_BOOL MApi_MFE_DeInitialize(void);
248 
249 //-------------------------------------------------------------------------------------------------
250 /// Get MFE driver state.
251 /// @ingroup MFE_operation
252 /// @return MFE driver state
253 //-------------------------------------------------------------------------------------------------
254 // MFE_STATE MApi_MFE_GetState(void);
255 
256 //MS_BOOL MApi_MFE_GenSPSPPS(MS_U32 pHeaderSPS,MS_U32 SPSLen,MS_U32 pHeaderPPS,MS_U32 PPSLen);
257 
258 
259 MS_BOOL MApi_MFE_Initialize_ex(PVR_Info* in_Info,
260 StreamCallback out_cb,CleanCallback mfe_CleanBufStatus, void *ctx);
261 //-------------------------------------------------------------------------------------------------
262 /// Set config to MFE driver.
263 /// @ingroup MFE_CONFIG
264 /// @param  conf_type              \b IN: set config type.
265 /// @param  value                  \b IN: set config value.
266 /// @return TRUE : succeed
267 /// @return FALSE : fail
268 //-------------------------------------------------------------------------------------------------
269 MS_BOOL MApi_MFE_SetConfig(MFE_ENC_CONF conf_type, void *value);
270 
271 //-------------------------------------------------------------------------------------------------
272 /// Get config from MFE driver.
273 /// @ingroup MFE_CONFIG
274 /// @param  conf_type              \b IN: get config type.
275 /// @param  value                  \b OUT: return config value.
276 /// @return TRUE : succeed
277 /// @return FALSE : fail
278 //-------------------------------------------------------------------------------------------------
279 MS_BOOL MApi_MFE_GetConfig(MFE_ENC_CONF conf_type, void *value);
280 
281 //-------------------------------------------------------------------------------------------------
282 /// Get MFE HW capability.
283 /// @ingroup MFE_CONFIG
284 /// @param  pDrv                 \b OUT: Get HW capability.
285 /// @param  len                  \b OUT: Get HW capability length of struct.
286 /// @return TRUE : succeed
287 /// @return FALSE : fail
288 //-------------------------------------------------------------------------------------------------
289 MS_BOOL MApi_MFE_GetHWCap(MFE_HwCapV0 *pDrv, MS_U32 *len);
290 #ifdef __cplusplus
291 }
292 #endif
293 
294 #endif
295 
296