1 /******************************************************************************
2 *
3 * Copyright (C) 2018 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 /*!
21 ******************************************************************************
22 * \file ihevce_sys_api.c
23 *
24 * \brief
25 * This file contains wrapper utilities to use hevc encoder library
26 *
27 * \date
28 * 15/04/2014
29 *
30 * \author
31 * Ittiam
32 *
33 * List of Functions
34 *
35 *
36 ******************************************************************************
37 */
38
39 /*****************************************************************************/
40 /* File Includes */
41 /*****************************************************************************/
42 /* System include files */
43 #include <stdio.h>
44 #include <string.h>
45 #include <stdlib.h>
46 #include <assert.h>
47 #include <stdarg.h>
48 #include <math.h>
49
50 /* User include files */
51 #include "ihevc_typedefs.h"
52 #include "ihevc_macros.h"
53
54 #include "itt_video_api.h"
55 #include "ihevce_api.h"
56
57 /*****************************************************************************/
58 /* Function Definitions */
59 /*****************************************************************************/
60
61 /*!
62 ******************************************************************************
63 * \if Function name : ihevce_printf \endif
64 *
65 * \brief
66 * This function implements printf
67 *
68 *****************************************************************************
69 */
ihevce_printf(void * pv_handle,const char * format,...)70 WORD32 ihevce_printf(void *pv_handle, const char *format, ...)
71 {
72 UNUSED(pv_handle);
73 UNUSED(format);
74 return 0;
75 }
76
77 /*!
78 ******************************************************************************
79 * \if Function name : ihevce_fopen \endif
80 *
81 * \brief
82 * This function implements fopen
83 *
84 *****************************************************************************
85 */
ihevce_fopen(void * pv_handle,const char * filename,const char * mode)86 FILE *ihevce_fopen(void *pv_handle, const char *filename, const char *mode)
87 {
88 UNUSED(pv_handle);
89 UNUSED(filename);
90 UNUSED(mode);
91 return NULL;
92 }
93
94 /*!
95 ******************************************************************************
96 * \if Function name : ihevce_fclose \endif
97 *
98 * \brief
99 * This function implements fclose
100 *
101 *****************************************************************************
102 */
ihevce_fclose(void * pv_handle,FILE * file_ptr)103 int ihevce_fclose(void *pv_handle, FILE *file_ptr)
104 {
105 UNUSED(pv_handle);
106 UNUSED(file_ptr);
107 return -1;
108 }
109
110 /*!
111 ******************************************************************************
112 * \if Function name : ihevce_fflush \endif
113 *
114 * \brief
115 * This function implements fflush
116 *
117 *****************************************************************************
118 */
ihevce_fflush(void * pv_handle,FILE * file_ptr)119 int ihevce_fflush(void *pv_handle, FILE *file_ptr)
120 {
121 UNUSED(pv_handle);
122 UNUSED(file_ptr);
123 return -1;
124 }
125
126 /*!
127 ******************************************************************************
128 * \if Function name : ihevce_fseek \endif
129 *
130 * \brief
131 * This function implements fseek
132 *
133 *****************************************************************************
134 */
ihevce_fseek(void * pv_handle,FILE * file_ptr,long offset,int origin)135 int ihevce_fseek(void *pv_handle, FILE *file_ptr, long offset, int origin)
136 {
137 UNUSED(pv_handle);
138 UNUSED(file_ptr);
139 UNUSED(offset);
140 UNUSED(origin);
141 return -1;
142 }
143
144 /*!
145 ******************************************************************************
146 * \if Function name : ihevce_fscanf \endif
147 *
148 * \brief
149 * This function implements fscanf
150 *
151 *****************************************************************************
152 */
ihevce_fscanf(void * pv_handle,IHEVCE_DATA_TYPE e_data_type,FILE * file_ptr,const char * format,void * pv_dst)153 int ihevce_fscanf(
154 void *pv_handle, IHEVCE_DATA_TYPE e_data_type, FILE *file_ptr, const char *format, void *pv_dst)
155 {
156 UNUSED(pv_handle);
157 UNUSED(e_data_type);
158 UNUSED(file_ptr);
159 UNUSED(format);
160 UNUSED(pv_dst);
161 return 0;
162 }
163
164 /*!
165 ******************************************************************************
166 * \if Function name : ihevce_fgets \endif
167 *
168 * \brief
169 * This function implements fgets
170 *
171 *****************************************************************************
172 */
ihevce_fgets(void * pv_handle,char * pi1_str,int i4_size,FILE * pf_stream)173 char *ihevce_fgets(void *pv_handle, char *pi1_str, int i4_size, FILE *pf_stream)
174 {
175 UNUSED(pv_handle);
176 UNUSED(pi1_str);
177 UNUSED(i4_size);
178 UNUSED(pf_stream);
179 return NULL;
180 }
181
182 /*!
183 ******************************************************************************
184 * \if Function name : ihevce_fread \endif
185 *
186 * \brief
187 * This function implements fread
188 *
189 *****************************************************************************
190 */
191 size_t
ihevce_fread(void * pv_handle,void * pv_dst,size_t element_size,size_t count,FILE * file_ptr)192 ihevce_fread(void *pv_handle, void *pv_dst, size_t element_size, size_t count, FILE *file_ptr)
193 {
194 UNUSED(pv_handle);
195 UNUSED(pv_dst);
196 UNUSED(element_size);
197 UNUSED(count);
198 UNUSED(file_ptr);
199 return 0;
200 }
201
202 /*!
203 ******************************************************************************
204 * \if Function name : ihevce_sscanf \endif
205 *
206 * \brief
207 * This function implements sscanf
208 *
209 *****************************************************************************
210 */
ihevce_sscanf(void * pv_handle,const char * pv_src,const char * format,int * p_dst_int)211 int ihevce_sscanf(void *pv_handle, const char *pv_src, const char *format, int *p_dst_int)
212 {
213 UNUSED(pv_handle);
214 UNUSED(pv_src);
215 UNUSED(format);
216 UNUSED(p_dst_int);
217 return 0;
218 }
219
220 /*!
221 ******************************************************************************
222 * \if Function name : ihevce_fprintf \endif
223 *
224 * \brief
225 * This function implements fprintf
226 *
227 *****************************************************************************
228 */
ihevce_fprintf(void * pv_handle,FILE * file_ptr,const char * format,...)229 int ihevce_fprintf(void *pv_handle, FILE *file_ptr, const char *format, ...)
230 {
231 UNUSED(pv_handle);
232 UNUSED(file_ptr);
233 UNUSED(format);
234 return 0;
235 }
236
237 /*!
238 ******************************************************************************
239 * \if Function name : ihevce_fwrite \endif
240 *
241 * \brief
242 * This function implements fwrite
243 *
244 *****************************************************************************
245 */
ihevce_fwrite(void * pv_handle,const void * pv_src,size_t element_size,size_t count,FILE * file_ptr)246 size_t ihevce_fwrite(
247 void *pv_handle, const void *pv_src, size_t element_size, size_t count, FILE *file_ptr)
248 {
249 UNUSED(pv_handle);
250 UNUSED(pv_src);
251 UNUSED(element_size);
252 UNUSED(count);
253 UNUSED(file_ptr);
254 return 0;
255 }
256
257 /*!
258 ******************************************************************************
259 * \if Function name : ihevce_sprintf \endif
260 *
261 * \brief
262 * This function implements sprintf
263 *
264 *****************************************************************************
265 */
ihevce_sprintf(void * pv_handle,char * dst,const char * format,...)266 int ihevce_sprintf(void *pv_handle, char *dst, const char *format, ...)
267 {
268 UNUSED(pv_handle);
269 UNUSED(dst);
270 UNUSED(format);
271 return 0;
272 }
273
274 /*!
275 ******************************************************************************
276 * \if Function name : ihevce_init_sys_api \endif
277 *
278 * \brief
279 * This function initialises sysstem call apis
280 *
281 * \param[in]
282 * pv_main_ctxt : This is used only for storing.
283 * ps_sys_api : This is address to sys_api structure of static_cfg_prms
284 *
285 * \return
286 * None
287 *
288 * \author
289 * Ittiam
290 *
291 *****************************************************************************
292 */
ihevce_init_sys_api(void * pv_cb_handle,ihevce_sys_api_t * ps_sys_api)293 void ihevce_init_sys_api(void *pv_cb_handle, ihevce_sys_api_t *ps_sys_api)
294 {
295 ps_sys_api->pv_cb_handle = pv_cb_handle;
296
297 /* Console IO APIs */
298 ps_sys_api->ihevce_printf = ihevce_printf;
299
300 ps_sys_api->ihevce_sscanf = ihevce_sscanf;
301 ps_sys_api->ihevce_sprintf = ihevce_sprintf;
302
303 /* File IO APIs */
304 ps_sys_api->s_file_io_api.ihevce_fopen = ihevce_fopen;
305 ps_sys_api->s_file_io_api.ihevce_fclose = ihevce_fclose;
306 ps_sys_api->s_file_io_api.ihevce_fflush = ihevce_fflush;
307 ps_sys_api->s_file_io_api.ihevce_fseek = ihevce_fseek;
308
309 ps_sys_api->s_file_io_api.ihevce_fscanf = ihevce_fscanf;
310 ps_sys_api->s_file_io_api.ihevce_fread = ihevce_fread;
311
312 ps_sys_api->s_file_io_api.ihevce_fprintf = ihevce_fprintf;
313 ps_sys_api->s_file_io_api.ihevce_fwrite = ihevce_fwrite;
314 ps_sys_api->s_file_io_api.ihevce_fgets = ihevce_fgets;
315 }
316