1/*
2 * Copyright (C) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef NATIVE_AVCODEC_VIDEOENCODER_H
17#define NATIVE_AVCODEC_VIDEOENCODER_H
18
19#include <stdint.h>
20#include <stdio.h>
21#include "native_avcodec_base.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/**
28 * @brief When OH_AVCodec needs new input parameter during the running process, the function pointer will be called and
29 * carry an available OH_AVFormat to fill in the new input parameter. This parameter takes effect immediately with the
30 * frame.
31 *
32 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
33 * @param codec OH_AVCodec instance
34 * @param index The index corresponding to the new OH_AVFormat instance
35 * @param parameter Parameter containing the new OH_AVFormat instance
36 * @param userData specified data
37 * @since 12
38 */
39typedef void (*OH_VideoEncoder_OnNeedInputParameter)(OH_AVCodec *codec, uint32_t index, OH_AVFormat *parameter,
40                                                     void *userData);
41
42/**
43 * @brief Creates a video encoder instance from the mime type, which is recommended in most cases.
44 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
45 * @param mime mime type description string, refer to {@link AVCODEC_MIME_TYPE}
46 * @return Returns a Pointer to an OH_AVCodec instance.
47 * Return nullptr if memory ran out or the mime type is not supported.
48 * @since 9
49 * @version 1.0
50 */
51OH_AVCodec *OH_VideoEncoder_CreateByMime(const char *mime);
52
53/**
54 * @brief Create a video encoder instance through the video encoder name. The premise of using this interface is to
55 * know the exact name of the encoder.
56 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
57 * @param name Video encoder name
58 * @return Returns a Pointer to an OH_AVCodec instance.
59 * Return nullptr if memory ran out or the encoder name is not supported.
60 * @since 9
61 * @version 1.0
62 */
63OH_AVCodec *OH_VideoEncoder_CreateByName(const char *name);
64
65/**
66 * @brief Clear the internal resources of the encoder and destroy the encoder instance
67 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
68 * @param codec Pointer to an OH_AVCodec instance
69 * @return Returns AV_ERR_OK if the execution is successful,
70 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
71 * {@link AV_ERR_NO_MEMORY}, inner resource has already released.
72 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
73 * {@link AV_ERR_UNKNOWN}, unknown error.
74 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
75 * @since 9
76 * @version 1.0
77 */
78OH_AVErrCode OH_VideoEncoder_Destroy(OH_AVCodec *codec);
79
80/**
81 * @brief Set the asynchronous callback function so that your application can respond to the events generated by the
82 * video encoder. This interface must be called before Prepare is called.
83 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
84 * @param codec Pointer to an OH_AVCodec instance
85 * @param callback A collection of all callback functions, see {@link OH_AVCodecAsyncCallback}
86 * @param userData User specific data
87 * @return Returns AV_ERR_OK if the execution is successful,
88 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
89 * {@link AV_ERR_NO_MEMORY}, inner resource has already released.
90 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
91 * {@link AV_ERR_UNKNOWN}, unknown error.
92 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
93 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
94 * @deprecated since 11
95 * @useinstead OH_VideoEncoder_RegisterCallback
96 * @since 9
97 * @version 1.0
98 */
99OH_AVErrCode OH_VideoEncoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallback callback, void *userData);
100
101/**
102 * @brief Set the asynchronous callback function so that your application can respond to the events generated by the
103 * video encoder. This interface must be called before Prepare is called.
104 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
105 * @param codec Pointer to an OH_AVCodec instance
106 * @param callback A collection of all callback functions, see {@link OH_AVCodecCallback}
107 * @param userData User specific data
108 * @return Returns AV_ERR_OK if the execution is successful,
109 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
110 * {@link AV_ERR_NO_MEMORY}, inner resource has already released.
111 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
112 * {@link AV_ERR_UNKNOWN}, unknown error.
113 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
114 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
115 * @since 11
116 */
117OH_AVErrCode OH_VideoEncoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData);
118
119/**
120 * @brief Set the asynchronous callback function so that your application can respond to the events generated by the
121 * video encoder. This interface is optional only for input surface. If this interface is used, it must be invoked
122 * before {@link OH_VideoEncoder_Configure}.
123 *
124 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
125 * @param codec Pointer to an OH_AVCodec instance
126 * @param onInputParameter A callback functions, see {@link OH_VideoEncoder_OnNeedInputParameter}
127 * @param userData User specific data
128 * @return Returns AV_ERR_OK if the execution is successful,
129 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
130 * {@link AV_ERR_NO_MEMORY}, inner resource has already released.
131 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
132 * {@link AV_ERR_UNKNOWN}, unknown error.
133 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
134 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
135 * @since 12
136 */
137OH_AVErrCode OH_VideoEncoder_RegisterParameterCallback(OH_AVCodec *codec,
138                                                       OH_VideoEncoder_OnNeedInputParameter onInputParameter,
139                                                       void *userData);
140
141/**
142 * @brief To configure the video encoder, typically, you need to configure the description information of the
143 * encoded video track. This interface must be called before Prepare is called.
144 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
145 * @param codec Pointer to an OH_AVCodec instance
146 * @param format A pointer to an OH_AVFormat that gives the description of the video track to be encoded
147 * @return Returns AV_ERR_OK if the execution is successful,
148 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
149 * {@link AV_ERR_NO_MEMORY}, instance has already released.
150 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid. Invalid param in format.
151 * {@link AV_ERR_UNKNOWN}, unknown error.
152 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
153 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
154 * @since 9
155 * @version 1.0
156 */
157OH_AVErrCode OH_VideoEncoder_Configure(OH_AVCodec *codec, OH_AVFormat *format);
158
159/**
160 * @brief To prepare the internal resources of the encoder, the Configure interface must be called before
161 * calling this interface.
162 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
163 * @param codec Pointer to an OH_AVCodec instance
164 * @return Returns AV_ERR_OK if the execution is successful,
165 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
166 * {@link AV_ERR_NO_MEMORY}, instance has already released.
167 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
168 * {@link AV_ERR_UNKNOWN}, unknown error.
169 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
170 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
171 * @since 9
172 * @version 1.0
173 */
174OH_AVErrCode OH_VideoEncoder_Prepare(OH_AVCodec *codec);
175
176/**
177 * @brief Start the encoder, this interface must be called after the Prepare is successful. After being
178 * successfully started, the encoder will start reporting NeedInputData events.
179 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
180 * @param codec Pointer to an OH_AVCodec instance
181 * @return Returns AV_ERR_OK if the execution is successful,
182 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
183 * {@link AV_ERR_NO_MEMORY}, instance has already released.
184 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
185 * {@link AV_ERR_UNKNOWN}, unknown error.
186 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
187 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
188 * @since 9
189 * @version 1.0
190 */
191OH_AVErrCode OH_VideoEncoder_Start(OH_AVCodec *codec);
192
193/**
194 * @brief Stop the encoder. After stopping, you can re-enter the Started state through Start.
195 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
196 * @param codec Pointer to an OH_AVCodec instance
197 * @return Returns AV_ERR_OK if the execution is successful,
198 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
199 * {@link AV_ERR_NO_MEMORY}, instance has already released.
200 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
201 * {@link AV_ERR_UNKNOWN}, unknown error.
202 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
203 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
204 * @since 9
205 * @version 1.0
206 */
207OH_AVErrCode OH_VideoEncoder_Stop(OH_AVCodec *codec);
208
209/**
210 * @brief Clear the input and output data buffered in the encoder. After this interface is called, all the Buffer
211 * indexes previously reported through the asynchronous callback will be invalidated, make sure not to access the
212 * Buffers corresponding to these indexes.
213 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
214 * @param codec Pointer to an OH_AVCodec instance
215 * @return Returns AV_ERR_OK if the execution is successful,
216 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
217 * {@link AV_ERR_NO_MEMORY}, instance has already released.
218 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
219 * {@link AV_ERR_UNKNOWN}, unknown error.
220 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
221 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
222 * @since 9
223 * @version 1.0
224 */
225OH_AVErrCode OH_VideoEncoder_Flush(OH_AVCodec *codec);
226
227/**
228 * @brief Reset the encoder. To continue coding, you need to call the Configure interface again to
229 * configure the encoder instance.
230 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
231 * @param codec Pointer to an OH_AVCodec instance
232 * @return Returns AV_ERR_OK if the execution is successful,
233 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
234 * {@link AV_ERR_NO_MEMORY}, instance has already released.
235 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
236 * {@link AV_ERR_UNKNOWN}, unknown error.
237 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
238 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
239 * @since 9
240 * @version 1.0
241 */
242OH_AVErrCode OH_VideoEncoder_Reset(OH_AVCodec *codec);
243
244/**
245 * @brief Get the description information of the output data of the encoder, refer to {@link OH_AVFormat} for details.
246 * It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs to
247 * be manually released by the caller.
248 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
249 * @param codec Pointer to an OH_AVCodec instance
250 * @return Returns a pointer to an OH_AVFormat instance.
251 * Return nullptr if the codec is nullptr or invaild.
252 * @since 9
253 * @version 1.0
254 */
255OH_AVFormat *OH_VideoEncoder_GetOutputDescription(OH_AVCodec *codec);
256
257/**
258 * @brief Set dynamic parameters to the encoder. Note: This interface can only be called after the encoder is started.
259 * At the same time, incorrect parameter settings may cause the encoding to fail.
260 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
261 * @param codec Pointer to an OH_AVCodec instance
262 * @param format OH_AVFormat handle pointer
263 * @return Returns AV_ERR_OK if the execution is successful,
264 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
265 * {@link AV_ERR_NO_MEMORY}, instance has already released.
266 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid. Invalid param in format.
267 * {@link AV_ERR_UNKNOWN}, unknown error.
268 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
269 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
270 * @since 9
271 * @version 1.0
272 */
273OH_AVErrCode OH_VideoEncoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format);
274
275/**
276 * @brief Get the input Surface from the video encoder, this interface must be called before Prepare is called.
277 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
278 * @param codec Pointer to an OH_AVCodec instance
279 * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow}, the application is responsible for
280 * managing the life cycle of the window, call OH_NativeWindow_DestroyNativeWindow() when done.
281 * @return Returns AV_ERR_OK if the execution is successful,
282 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
283 * {@link AV_ERR_NO_MEMORY}, inner resource has already released.
284 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
285 * {@link AV_ERR_UNKNOWN}, unknown error.
286 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
287 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
288 * @since 9
289 * @version 1.0
290 */
291OH_AVErrCode OH_VideoEncoder_GetSurface(OH_AVCodec *codec, OHNativeWindow **window);
292
293/**
294 * @brief Return the processed output Buffer to the encoder.
295 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
296 * @param codec Pointer to an OH_AVCodec instance
297 * @param index The index value corresponding to the output Buffer
298 * @return Returns AV_ERR_OK if the execution is successful,
299 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
300 * {@link AV_ERR_NO_MEMORY}, instance has already released.
301 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
302 * Buffer index should be given by {@link OH_AVCodecOnNewOutputData}.
303 * {@link AV_ERR_UNKNOWN}, unknown error.
304 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
305 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
306 * @deprecated since 11
307 * @useinstead OH_VideoEncoder_FreeOutputBuffer
308 * @since 9
309 * @version 1.0
310 */
311OH_AVErrCode OH_VideoEncoder_FreeOutputData(OH_AVCodec *codec, uint32_t index);
312
313/**
314 * @brief Notifies the video encoder that the input stream has ended. It is recommended to use this interface to notify
315 * the encoder of the end of the stream in surface mode
316 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
317 * @param codec Pointer to an OH_AVCodec instance
318 * @return Returns AV_ERR_OK if the execution is successful,
319 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
320 * {@link AV_ERR_NO_MEMORY}, instance has already released.
321 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
322 * {@link AV_ERR_UNKNOWN}, unknown error.
323 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
324 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
325 * @since 9
326 * @version 1.0
327 */
328OH_AVErrCode OH_VideoEncoder_NotifyEndOfStream(OH_AVCodec *codec);
329
330/**
331 * @brief Submit the input buffer filled with data to the video encoder.
332 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
333 * @param codec Pointer to an OH_AVCodec instance
334 * @param index Enter the index value corresponding to the Buffer
335 * @param attr Information describing the data contained in the Buffer
336 * @return Returns AV_ERR_OK if the execution is successful,
337 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
338 * {@link AV_ERR_NO_MEMORY}, instance has already released.
339 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
340 * Buffer index should be given by {@link OH_AVCodecOnNeedInputData}.
341 * {@link AV_ERR_UNKNOWN}, unknown error.
342 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
343 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
344 * @deprecated since 11
345 * @useinstead OH_VideoEncoder_PushInputBuffer
346 * @since 10
347 */
348OH_AVErrCode OH_VideoEncoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH_AVCodecBufferAttr attr);
349
350/**
351 * @brief Submit the input buffer filled with data to the video encoder.
352 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
353 * @param codec Pointer to an OH_AVCodec instance
354 * @param index Enter the index value corresponding to the Buffer
355 * @return Returns AV_ERR_OK if the execution is successful,
356 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
357 * {@link AV_ERR_NO_MEMORY}, instance has already released.
358 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
359 * Buffer index should be given by {@link OH_AVCodecOnNeedInputBuffer}.
360 * {@link AV_ERR_UNKNOWN}, unknown error.
361 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
362 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
363
364 * @since 11
365 */
366OH_AVErrCode OH_VideoEncoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index);
367
368/**
369 * @brief Submit the input parameter filled with data to the video encoder.
370 *
371 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
372 * @param codec Pointer to an OH_AVCodec instance
373 * @param index Enter the index value corresponding to the input parameter
374 * @return Returns AV_ERR_OK if the execution is successful,
375 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
376 * {@link AV_ERR_NO_MEMORY}, instance has already released.
377 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
378 * Index should be given by {@link OH_VideoEncoder_OnNeedInputParameter}.
379 * {@link AV_ERR_UNKNOWN}, unknown error.
380 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
381 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
382 * @since 12
383 */
384OH_AVErrCode OH_VideoEncoder_PushInputParameter(OH_AVCodec *codec, uint32_t index);
385
386/**
387 * @brief Return the processed output Buffer to the encoder.
388 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
389 * @param codec Pointer to an OH_AVCodec instance
390 * @param index The index value corresponding to the output Buffer
391 * @return Returns AV_ERR_OK if the execution is successful,
392 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
393 * {@link AV_ERR_NO_MEMORY}, instance has already released.
394 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
395 * Buffer index should be given by {@link OH_AVCodecOnNewOutputBuffer}.
396 * {@link AV_ERR_UNKNOWN}, unknown error.
397 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
398 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
399 * @since 11
400 */
401OH_AVErrCode OH_VideoEncoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index);
402
403/**
404 * @brief Get the input data description of the encoder after call {@OH_VideoEncoder_Configure},
405 * refer to {@link OH_AVFormat} for details. It should be noted that the life cycle of the OH_AVFormat
406 * instance pointed to by the return value needs to be manually released by the caller.
407 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
408 * @param codec Pointer to an OH_AVCodec instance
409 * @return Returns a pointer to an OH_AVFormat instance.
410 * Return nullptr if the encoder is nullptr or invaild.
411 * @since 10
412 */
413OH_AVFormat *OH_VideoEncoder_GetInputDescription(OH_AVCodec *codec);
414
415/**
416 * @brief Check whether the current codec instance is valid. It can be used fault recovery or app
417 * switchback from the background
418 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
419 * @param codec Pointer to an OH_AVCodec instance
420 * @param isValid Output Parameter. A pointer to a boolean instance, it is true if the codec instance is valid,
421 * false if the codec instance is invalid
422 * @return Returns AV_ERR_OK if the execution is successful,
423 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
424 * {@link AV_ERR_NO_MEMORY}, instance has already released.
425 * {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
426 * {@link AV_ERR_UNKNOWN}, unknown error.
427 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
428 * @since 10
429 */
430OH_AVErrCode OH_VideoEncoder_IsValid(OH_AVCodec *codec, bool *isValid);
431
432/**
433 * @brief The bitrate mode of video encoder.
434 * @syscap SystemCapability.Multimedia.Media.VideoEncoder
435 * @since 9
436 * @version 1.0
437 */
438typedef enum OH_VideoEncodeBitrateMode {
439    /* constant bit rate mode. */
440    CBR = 0,
441    /* variable bit rate mode. */
442    VBR = 1,
443    /* constant quality mode. */
444    CQ = 2,
445} OH_VideoEncodeBitrateMode;
446
447#ifdef __cplusplus
448}
449#endif
450
451#endif // NATIVE_AVCODEC_VIDEOENCODER_H