• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /**
17  * @addtogroup CodecBase
18  * @{
19  *
20  * @brief The CodecBase module provides variables, properties, and functions
21  * for audio and video muxer, demuxer, and basic encoding and decoding functions.
22  *
23  * @syscap SystemCapability.Multimedia.Media.CodecBase
24  * @since 9
25  */
26 
27 /**
28  * @file native_avcodec_base.h
29  *
30  * @brief Declare the Native API used for audio and video muxer,
31  * demuxer and basic encoding and decoding functions.
32  *
33  * @kit AVCodecKit
34  * @library libnative_media_codecbase.so
35  * @syscap SystemCapability.Multimedia.Media.CodecBase
36  * @since 9
37  */
38 
39 #ifndef NATIVE_AVCODEC_BASE_H
40 #define NATIVE_AVCODEC_BASE_H
41 
42 #include <stdint.h>
43 #include <stdio.h>
44 #include "native_avbuffer.h"
45 #include "native_avmemory.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 typedef struct NativeWindow OHNativeWindow;
52 typedef struct OH_AVCodec OH_AVCodec;
53 
54 /**
55  * @brief When an error occurs in the running of the OH_AVCodec instance, the function pointer will be called
56  * to report specific error information.
57  * @syscap SystemCapability.Multimedia.Media.CodecBase
58  * @param codec OH_AVCodec instance
59  * @param errorCode specific error code
60  * @param userData The data that the user rely on to execute the callback.
61  * @since 9
62  * @version 1.0
63  */
64 typedef void (*OH_AVCodecOnError)(OH_AVCodec *codec, int32_t errorCode, void *userData);
65 
66 /**
67  * @brief When the resolution of the decoding input stream or the resolution of the encoding output stream changes,
68  * the function pointer will be called to report the new stream description information.
69  * It should be noted that the life cycle of the OH_AVFormat pointer is only valid when the function pointer is called,
70  * and it is forbidden to continue to access after the call ends.
71  * @syscap SystemCapability.Multimedia.Media.CodecBase
72  * @param codec OH_AVCodec instance
73  * @param format New output stream description information
74  * @param userData The data that the user rely on to execute the callback.
75  * @since 9
76  * @version 1.0
77  */
78 typedef void (*OH_AVCodecOnStreamChanged)(OH_AVCodec *codec, OH_AVFormat *format, void *userData);
79 
80 /**
81  * @brief When OH_AVCodec needs new input data during the running process,
82  * the function pointer will be called and carry an available buffer to fill in the new input data.
83  * @syscap SystemCapability.Multimedia.Media.CodecBase
84  * @param codec OH_AVCodec instance
85  * @param index The index corresponding to the newly available input buffer.
86  * @param data New available input buffer.
87  * @param userData The data that the user rely on to execute the callback.
88  * @deprecated since 11
89  * @useinstead OH_AVCodecOnNeedInputBuffer
90  * @since 9
91  * @version 1.0
92  */
93 typedef void (*OH_AVCodecOnNeedInputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData);
94 
95 /**
96  * @brief When new output data is generated during the operation of OH_AVCodec, the function pointer will be
97  * called and carry a buffer containing the new output data. It should be noted that the life cycle of the
98  * OH_AVCodecBufferAttr pointer is only valid when the function pointer is called, which prohibits continued
99  * access after the call ends.
100  * @syscap SystemCapability.Multimedia.Media.CodecBase
101  * @param codec OH_AVCodec instance
102  * @param index The index corresponding to the new output buffer.
103  * @param data Buffer containing the new output data
104  * @param attr The description of the new output buffer, please refer to {@link OH_AVCodecBufferAttr}
105  * @param userData The data that the user rely on to execute the callback.
106  * @deprecated since 11
107  * @useinstead OH_AVCodecOnNewOutputBuffer
108  * @since 9
109  * @version 1.0
110  */
111 typedef void (*OH_AVCodecOnNewOutputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data,
112                                           OH_AVCodecBufferAttr *attr, void *userData);
113 
114 /**
115  * @brief When OH_AVCodec needs new input data during the running process,
116  * the function pointer will be called and carry an available buffer to fill in the new input data.
117  * @syscap SystemCapability.Multimedia.Media.CodecBase
118  * @param codec OH_AVCodec instance
119  * @param index The index corresponding to the newly available input buffer.
120  * @param buffer New available input buffer.
121  * @param userData The data that the user rely on to execute the callback.
122  * @since 11
123  */
124 typedef void (*OH_AVCodecOnNeedInputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData);
125 
126 /**
127  * @brief When new output data is generated during the operation of OH_AVCodec, the function pointer will be
128  * called and carry a buffer containing the new output data.
129  * @syscap SystemCapability.Multimedia.Media.CodecBase
130  * @param codec OH_AVCodec instance
131  * @param index The index corresponding to the new output buffer.
132  * @param buffer Buffer containing the new output buffer.
133  * @param userData The data that the user rely on to execute the callback.
134  * @since 11
135  */
136 typedef void (*OH_AVCodecOnNewOutputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData);
137 
138 /**
139  * @brief A collection of all asynchronous callback function pointers in OH_AVCodec. Register an instance of this
140  * structure to the OH_AVCodec instance, and process the information reported through the callback to ensure the
141  * normal operation of OH_AVCodec.
142  * @syscap SystemCapability.Multimedia.Media.CodecBase
143  * @param onError Monitor OH_AVCodec operation errors, refer to {@link OH_AVCodecOnError}
144  * @param onStreamChanged Monitor codec stream information, refer to {@link OH_AVCodecOnStreamChanged}
145  * @param onNeedInputData Monitoring codec requires input data, refer to {@link OH_AVCodecOnNeedInputData}
146  * @param onNeedOutputData Monitor codec to generate output data, refer to {@link OH_AVCodecOnNewOutputData}
147  * @deprecated since 11
148  * @useinstead OH_AVCodecCallback
149  * @since 9
150  * @version 1.0
151  */
152 typedef struct OH_AVCodecAsyncCallback {
153     OH_AVCodecOnError onError;
154     OH_AVCodecOnStreamChanged onStreamChanged;
155     OH_AVCodecOnNeedInputData onNeedInputData;
156     OH_AVCodecOnNewOutputData onNeedOutputData;
157 } OH_AVCodecAsyncCallback;
158 
159 /**
160  * @brief A collection of all asynchronous callback function pointers in OH_AVCodec. Register an instance of this
161  * structure to the OH_AVCodec instance, and process the information reported through the callback to ensure the
162  * normal operation of OH_AVCodec.
163  * @syscap SystemCapability.Multimedia.Media.CodecBase
164  * @param onError Monitor OH_AVCodec operation errors, refer to {@link OH_AVCodecOnError}
165  * @param onStreamChanged Monitor codec stream information, refer to {@link OH_AVCodecOnStreamChanged}
166  * @param onNeedInputBuffer Monitoring codec requires input buffer, refer to {@link OH_AVCodecOnNeedInputBuffer}
167  * @param onNewOutputBuffer Monitor codec to generate output buffer, refer to {@link OH_AVCodecOnNewOutputBuffer}
168  * @since 11
169  */
170 typedef struct OH_AVCodecCallback {
171     OH_AVCodecOnError onError;
172     OH_AVCodecOnStreamChanged onStreamChanged;
173     OH_AVCodecOnNeedInputBuffer onNeedInputBuffer;
174     OH_AVCodecOnNewOutputBuffer onNewOutputBuffer;
175 } OH_AVCodecCallback;
176 
177 /**
178  * @brief The function pointer will be called to get sequence media data.
179  * @syscap SystemCapability.Multimedia.Media.CodecBase
180  * @param data OH_AVBuffer buffer to fill.
181  * @param length Expected to read size.
182  * @param pos Current read offset.
183  * @return Actual size of data read to the buffer.
184  * @since 12
185  */
186 typedef int32_t (*OH_AVDataSourceReadAt)(OH_AVBuffer *data, int32_t length, int64_t pos);
187 
188 /**
189  * @brief User customized data source.
190  * @syscap SystemCapability.Multimedia.Media.CodecBase
191  * @since 12
192  */
193 typedef struct OH_AVDataSource {
194     /**
195      * @brief Total size of the data source.
196      * @syscap SystemCapability.Multimedia.Media.CodecBase
197      * @since 12
198      */
199     int64_t size;
200     /**
201      * @brief Callback interface for reading data from datasource.
202      * @syscap SystemCapability.Multimedia.Media.CodecBase
203      * @since 12
204      */
205     OH_AVDataSourceReadAt readAt;
206 } OH_AVDataSource;
207 
208 /**
209  * @brief The function pointer will be called to get sequence media data.
210  * @syscap SystemCapability.Multimedia.Media.CodecBase
211  * @param data OH_AVBuffer buffer to fill.
212  * @param length Expected to read size.
213  * @param pos Current read offset.
214  * @param userData User-defined data.
215  * @return Actual size of data read to the buffer.
216  * @since 20
217  */
218 typedef int32_t (*OH_AVDataSourceReadAtExt)(OH_AVBuffer *data, int32_t length, int64_t pos, void* userData);
219 
220 /**
221  * @brief User customized data source.
222  * @syscap SystemCapability.Multimedia.Media.CodecBase
223  * @since 20
224  */
225 typedef struct OH_AVDataSourceExt {
226     /**
227      * @brief Total size of the data source.
228      * @syscap SystemCapability.Multimedia.Media.CodecBase
229      * @since 20
230      */
231     int64_t size;
232     /**
233      * @brief Callback interface for reading data from datasource.
234      * @syscap SystemCapability.Multimedia.Media.CodecBase
235      * @since 20
236      */
237     OH_AVDataSourceReadAtExt readAt;
238 } OH_AVDataSourceExt;
239 
240 /**
241  * @brief Enumerates the MIME types of video mpeg2 codec.
242  *
243  * @syscap SystemCapability.Multimedia.Media.CodecBase
244  * @since 17
245  */
246 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG2;
247 
248 /**
249  * @brief Enumerates the mime types of video avc codec.
250  * @syscap SystemCapability.Multimedia.Media.CodecBase
251  * @since 9
252  * @version 1.0
253  */
254 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_AVC;
255 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AAC;
256 
257 /**
258  * @brief Enumerates the MIME types of audio and video codecs
259  * @syscap SystemCapability.Multimedia.Media.CodecBase
260  * @since 10
261  */
262 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_FLAC;
263 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_VORBIS;
264 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_MPEG;
265 
266 /**
267  * @brief Enumerates the mime types of video hevc codec.
268  * @syscap SystemCapability.Multimedia.Media.CodecBase
269  * @since 10
270  * @version 1.0
271  */
272 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_HEVC;
273 
274 /**
275  * @brief Enumerates the types of audio and video muxer
276  * @syscap SystemCapability.Multimedia.Media.CodecBase
277  * @deprecated since 11
278  * @since 10
279  */
280 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4;
281 
282 /**
283  * @brief brief Enumerates the Mime type of video mpeg4 part2 codec.
284  *
285  * @syscap SystemCapability.Multimedia.Media.CodecBase
286  * @since 17
287  */
288 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2;
289 /**
290  * @brief Enumerates the MIME types of video codecs
291  * @syscap SystemCapability.Multimedia.Media.CodecBase
292  * @since 17
293  */
294 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_H263;
295 
296 /**
297  * @brief Enumerates the types of audio and video muxer
298  * @syscap SystemCapability.Multimedia.Media.CodecBase
299  * @since 10
300  */
301 extern const char *OH_AVCODEC_MIMETYPE_IMAGE_JPG;
302 extern const char *OH_AVCODEC_MIMETYPE_IMAGE_PNG;
303 extern const char *OH_AVCODEC_MIMETYPE_IMAGE_BMP;
304 
305 /**
306  * @brief Enumerates the MIME types of audio codecs
307  * @syscap SystemCapability.Multimedia.Media.CodecBase
308  * @since 11
309  */
310 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_VIVID;
311 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_NB;
312 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_WB;
313 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_OPUS;
314 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_G711MU;
315 
316 /**
317  * @brief Enumerates the MIME type of audio low bitrate voice codec.
318  *
319  * @syscap SystemCapability.Multimedia.Media.CodecBase
320  * @since 12
321  */
322 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_LBVC;
323 
324 /**
325  * @brief Enumerates the MIME type of audio ape codec.
326  *
327  * @syscap SystemCapability.Multimedia.Media.CodecBase
328  * @since 12
329  */
330 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_APE;
331 
332 /**
333  * @brief Enumerates the MIME type of versatile video coding.
334  *
335  * @syscap SystemCapability.Multimedia.Media.CodecBase
336  * @since 12
337  */
338 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_VVC;
339 
340 /**
341  * @brief Enumerates the MIME type of subtitle srt.
342  *
343  * @syscap SystemCapability.Multimedia.Media.CodecBase
344  * @since 12
345  */
346 extern const char *OH_AVCODEC_MIMETYPE_SUBTITLE_SRT;
347 
348 /**
349  * @brief Enumerates the mime type of subtitle webvtt.
350  *
351  * @syscap SystemCapability.Multimedia.Media.CodecBase
352  * @since 12
353  */
354 extern const char *OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT;
355 
356 /**
357  * @brief Enumerates the MIME type of audio raw stream.
358  *
359  * @syscap SystemCapability.Multimedia.Media.CodecBase
360  * @since 18
361  */
362 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_RAW;
363 
364 /**
365  * @brief Enumerates the mime types of audio G711 A-law codec.
366  *
367  * @syscap SystemCapability.Multimedia.Media.CodecBase
368  * @since 20
369  */
370 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_G711A;
371 
372 /**
373  * @brief Key for timeStamp in surfacebuffer, value type is int64_t.
374  * @syscap SystemCapability.Multimedia.Media.CodecBase
375  * @since 9
376  * @version 1.0
377  * @deprecated since 14
378  */
379 extern const char *OH_ED_KEY_TIME_STAMP;
380 
381 /* Key for endOfStream in surfacebuffer, value type is int32_t.
382  * @deprecated since 14
383  */
384 extern const char *OH_ED_KEY_EOS;
385 
386 /**
387  * @brief Provides the uniform key for storing the media description.
388  * @syscap SystemCapability.Multimedia.Media.CodecBase
389  * @since 9
390  * @version 1.0
391  */
392 /* Key for track media type, value type is int32_t, see @OH_MediaType. */
393 extern const char *OH_MD_KEY_TRACK_TYPE;
394 /* Key for codec mime type, value type is string. */
395 extern const char *OH_MD_KEY_CODEC_MIME;
396 /* Key for media file duration in microseconds, value type is int64_t. */
397 extern const char *OH_MD_KEY_DURATION;
398 /* Key for bitrate, value type is int64_t. */
399 extern const char *OH_MD_KEY_BITRATE;
400 /**
401  * @brief Key for maximum bitrate, value type is int64_t.
402  *
403  * @syscap SystemCapability.Multimedia.Media.CodecBase
404  * @since 20
405 */
406 extern const char *OH_MD_KEY_MAX_BITRATE;
407 /* Key for setting the max decode input size, value type is int32_t. */
408 extern const char *OH_MD_KEY_MAX_INPUT_SIZE;
409 /* Key for video width, value type is int32_t */
410 extern const char *OH_MD_KEY_WIDTH;
411 /* Key for video height, value type is int32_t */
412 extern const char *OH_MD_KEY_HEIGHT;
413 /* Key for video pixel format, value type is int32_t, see @OH_AVPixelFormat */
414 extern const char *OH_MD_KEY_PIXEL_FORMAT;
415 /* key for audio raw format, value type is int32_t , see @OH_BitsPerSample */
416 extern const char *OH_MD_KEY_AUDIO_SAMPLE_FORMAT;
417 /* Key for video frame rate, value type is double. The value must be greater than 0. */
418 extern const char *OH_MD_KEY_FRAME_RATE;
419 /* Video encode bitrate mode, the value type is int32_t, see @OH_VideoEncodeBitrateMode */
420 extern const char *OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE;
421 /* Encode profile, the value type is int32_t. see @OH_AVCProfile, OH_HEVCProfile, OH_AACProfile. */
422 extern const char *OH_MD_KEY_PROFILE;
423 /* Key for audio channel count, value type is int32_t */
424 extern const char *OH_MD_KEY_AUD_CHANNEL_COUNT;
425 /* Key for audio sample rate, value type is int32_t */
426 extern const char *OH_MD_KEY_AUD_SAMPLE_RATE;
427 /**
428  * @brief Key for the interval of key frame, value type is int32_t, the unit is milliseconds.
429  * This key is optional and only used for video encoding. A negative value means no key frames
430  * are requested after the first frame. A zero value means a stream containing all key frames is requested.
431  *
432  * @syscap SystemCapability.Multimedia.Media.CodecBase
433  * @since 9
434  */
435 extern const char *OH_MD_KEY_I_FRAME_INTERVAL;
436 /* Key of the surface rotation angle, value type is int32_t: should be {0, 90, 180, 270}, default is 0.
437  * This key is only used in video decoding Surface mode.
438  */
439 extern const char *OH_MD_KEY_ROTATION;
440 
441 /**
442  * @brief Provides the uniform key for storing the media description.
443  * @syscap SystemCapability.Multimedia.Media.CodecBase
444  * @since 10
445  */
446 /* Key for video YUV value range flag, value type is int32_t, 1 for full range, 0 for limited range. */
447 extern const char *OH_MD_KEY_RANGE_FLAG;
448 /* Key for video color primaries, value type is int32_t, see @OH_ColorPrimary. */
449 extern const char *OH_MD_KEY_COLOR_PRIMARIES;
450 /* Key for video transfer characteristics, value type is int32_t, see @OH_TransferCharacteristic.
451  */
452 extern const char *OH_MD_KEY_TRANSFER_CHARACTERISTICS;
453 /* Key for video matrix coefficients, value type is int32_t, see @OH_MatrixCoefficient.
454  */
455 extern const char *OH_MD_KEY_MATRIX_COEFFICIENTS;
456 /* Key for the request an I-Frame immediately, value type is int32_t.
457  * It is used when OH_VideoEncoder_SetParameter is called or takes effect immediately with the frame. */
458 extern const char *OH_MD_KEY_REQUEST_I_FRAME;
459 /* Key for the desired encoding quality, value type is int32_t, the range of encoding scene values in H264 and H265
460  * can be obtained based on the capability query interface @OH_AVCapability_GetEncoderQualityRange, this key is only
461  * supported for encoders that are configured in constant quality mode */
462 extern const char *OH_MD_KEY_QUALITY;
463 /**
464  * @brief Key for the desired encoding quality, value type is int32_t, this key is only
465  * supported for encoders that are configured in Stable Quality RateControl, the higher
466  * values generally result in more efficient(smaller-sized) encoding.
467  *
468  * @syscap SystemCapability.Multimedia.Media.CodecBase
469  * @since 20
470 */
471 extern const char *OH_MD_KEY_SQR_FACTOR;
472 /* Key of the codec specific data, value type is a uint8_t pointer.
473  * In video, SPS/PPS is transferred. In audio, extraData is transferred. */
474 extern const char *OH_MD_KEY_CODEC_CONFIG;
475 /* Key for media file title, value type is string. */
476 extern const char *OH_MD_KEY_TITLE;
477 /* Key for Media file artist, value type is string. */
478 extern const char *OH_MD_KEY_ARTIST;
479 /* key for the media files of the album, value type is string. */
480 extern const char *OH_MD_KEY_ALBUM;
481 /* Key for album artist, value type is string. */
482 extern const char *OH_MD_KEY_ALBUM_ARTIST;
483 /* source format Key for date, value type is string */
484 extern const char *OH_MD_KEY_DATE;
485 /* Key for media file comment, value type is string. */
486 extern const char *OH_MD_KEY_COMMENT;
487 /* Key for media file genre, value type is string. */
488 extern const char *OH_MD_KEY_GENRE;
489 /* Key for media file copyright, value type is string. */
490 extern const char *OH_MD_KEY_COPYRIGHT;
491 /* Key for media file language, value type is string. */
492 extern const char *OH_MD_KEY_LANGUAGE;
493 /* Key for media file description, value type is string. */
494 extern const char *OH_MD_KEY_DESCRIPTION;
495 /* Key for media file lyrics, value type is string. */
496 extern const char *OH_MD_KEY_LYRICS;
497 /* Key for media file track count, value type is int32_t. */
498 extern const char *OH_MD_KEY_TRACK_COUNT;
499 /* Key for the desired encoding channel layout, value type is int64_t, this key is only supported for encoders. */
500 extern const char *OH_MD_KEY_CHANNEL_LAYOUT;
501 /* Key for bits per coded sample, value type is int32_t, supported for flac encoder, see @OH_BitsPerSample */
502 extern const char *OH_MD_KEY_BITS_PER_CODED_SAMPLE;
503 /* Key for the aac format, value type is int32_t, supported for aac decoder.
504  * The aac format is divided into ADTS format and LATM format.
505  * Where 0 represents LATM format and 1 represents ADTS format. */
506 extern const char *OH_MD_KEY_AAC_IS_ADTS;
507 /* Key for aac sbr mode, value type is int32_t, supported for aac encoder. */
508 extern const char *OH_MD_KEY_SBR;
509 /* Key for flac compliance level, value type is int32_t, only used in audio encoding. */
510 extern const char *OH_MD_KEY_COMPLIANCE_LEVEL;
511 /* Key for vorbis identification header, value type is a uint8_t pointer, supported only for vorbis decoder */
512 extern const char *OH_MD_KEY_IDENTIFICATION_HEADER;
513 /* Key for vorbis setup header, value type is a uint8_t pointer, supported only for vorbis decoder */
514 extern const char *OH_MD_KEY_SETUP_HEADER;
515 /**
516  * @brief Key for video scale type, value type is int32_t, see @OH_ScalingMode.
517  * It is recommended to directly call the @OH_NativeWindow_NativeWindowSetScalingModeV2 interface for setting.
518  * This key is optional and only used for video decoding in Surface mode.
519  * @syscap SystemCapability.Multimedia.Media.CodecBase
520  * @since 10
521  * @deprecated 14
522  * @useinstead OH_NativeWindow_NativeWindowSetScalingModeV2
523  */
524 extern const char *OH_MD_KEY_SCALING_MODE;
525 /* Key for max input buffer count, value type is int32_t. */
526 extern const char *OH_MD_MAX_INPUT_BUFFER_COUNT;
527 /* Key for max output buffer count, value type is int32_t. */
528 extern const char *OH_MD_MAX_OUTPUT_BUFFER_COUNT;
529 
530 /**
531  * @brief Provides the uniform key for storing the media description.
532  * @syscap SystemCapability.Multimedia.Media.CodecBase
533  * @since 11
534  */
535 /* Key for audio codec compression level, value type is int32_t */
536 extern const char *OH_MD_KEY_AUDIO_COMPRESSION_LEVEL;
537 /* key for whether the video track in the media file is HDR Vivid, value type is int32_t.
538  * Demuxer and muxer are supported. */
539 extern const char *OH_MD_KEY_VIDEO_IS_HDR_VIVID;
540 /* Key for number of audio objects, value type is int32_t, only used in Audio Vivid decoding. */
541 extern const char *OH_MD_KEY_AUDIO_OBJECT_NUMBER;
542 /* Key for meta data of Audio Vivid, value type is a uint8_t pointer, only used in Audio Vivid decoding. */
543 extern const char *OH_MD_KEY_AUDIO_VIVID_METADATA;
544 
545 /**
546  * @brief Key for querying the maximum long-term reference count of video encoder, value type is int32_t.
547  * You should query the count through interface {@link OH_AVCapability_GetFeatureProperties}
548  * with enum {@link VIDEO_ENCODER_LONG_TERM_REFERENCE}.
549  *
550  * @syscap SystemCapability.Multimedia.Media.CodecBase
551  * @since 12
552  */
553 extern const char *OH_FEATURE_PROPERTY_KEY_VIDEO_ENCODER_MAX_LTR_FRAME_COUNT;
554 /**
555  * @brief Key for enable the temporal scalability mode, value type is int32_t (0 or 1): 1 is enabled, 0 otherwise.
556  * The default value is 0. To query supported, you should use the interface {@link OH_AVCapability_IsFeatureSupported}
557  * with enum {@link VIDEO_ENCODER_TEMPORAL_SCALABILITY}. This is an optional key that applies only to video encoding.
558  * It is used in Configure state.
559  *
560  * @syscap SystemCapability.Multimedia.Media.CodecBase
561  * @since 12
562  */
563 extern const char *OH_MD_KEY_VIDEO_ENCODER_ENABLE_TEMPORAL_SCALABILITY;
564 /**
565  * @brief Key for describing the interval size at the base layer in temporal group of picture,
566  * value type is int32_t. It takes effect only when temporal level scale is enable.
567  * This is an optional key that applies only to video encoding. It is used in Configure state.
568  *
569  * @syscap SystemCapability.Multimedia.Media.CodecBase
570  * @since 12
571  */
572 extern const char *OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_SIZE;
573 /**
574  * @brief Key for describing the reference mode in temporal group of picture, value type is int32_t, see enum
575  * {@link OH_TemporalGopReferenceMode}. It takes effect only when temporal level sacle is enabled.
576  * This is an optional key that applies only to video encodeing. It is used in Configure state.
577  *
578  * @syscap SystemCapability.Multimedia.Media.CodecBase
579  * @since 12
580  */
581 extern const char *OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_REFERENCE_MODE;
582 /**
583  * @brief Key for describing the count of used long-term reference frames, value type is int32_t, must be within the
584  * supported range. To get supported range, you should query wthether the capability is supported through the interface
585  * {@link OH_AVCapability_GetFeatureProperties} with enum {@link VIDEO_ENCODER_LONG_TERM_REFERENCE}, otherwise, not set
586  * the key. This is an optional key that applies only to video encodeing. It is used in Configure state.
587  *
588  * @syscap SystemCapability.Multimedia.Media.CodecBase
589  * @since 12
590  */
591 extern const char *OH_MD_KEY_VIDEO_ENCODER_LTR_FRAME_COUNT;
592 /**
593  * @brief Key for describing mark this frame as a long term reference frame, value type is int32_t (0 or 1): 1 is mark,
594  * 0 otherwise. It takes effect only when the number of used long term reference frames is configured. This is an
595  * optional key that applies only to video encoding input loop. It takes effect immediately.
596  *
597  * @syscap SystemCapability.Multimedia.Media.CodecBase
598  * @since 12
599  */
600 extern const char *OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_MARK_LTR;
601 /**
602  * @brief Key for describing the long term reference frame poc referenced by this frame, value type is int32_t. This is
603  * an optional key that applies only to video encodeing input loop. It takes effect immediately.
604  *
605  * @syscap SystemCapability.Multimedia.Media.CodecBase
606  * @since 12
607  */
608 extern const char *OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_USE_LTR;
609 /**
610  * @brief Key for whether the frame corresponding to output buffer in OH_AVBuffer is a long-term reference frame,
611  * value type is int32_t (0 or 1): 1 is LTR,0 otherwise. This is an optional key that applies only
612  * to video encodeing output loop. It indicates the attribute of the frame.
613  *
614  * @syscap SystemCapability.Multimedia.Media.CodecBase
615  * @since 12
616  */
617 extern const char *OH_MD_KEY_VIDEO_PER_FRAME_IS_LTR;
618 /**
619  * @brief Key for describing the frame poc, value type is int32_t. This is an optional key that applies only to video
620  * encodeing output loop. It indicates the attribute of the frame.
621  *
622  * @syscap SystemCapability.Multimedia.Media.CodecBase
623  * @since 12
624  */
625 extern const char *OH_MD_KEY_VIDEO_PER_FRAME_POC;
626 /**
627  * @brief Key for describing the top-coordinate (y) of the crop rectangle, value type is int32_t. This is the top-most
628  * row included in the crop frame, where row indices start at 0. This key is only used for video decoding.
629  *
630  * @syscap SystemCapability.Multimedia.Media.CodecBase
631  * @since 12
632  */
633 extern const char *OH_MD_KEY_VIDEO_CROP_TOP;
634 /**
635  * @brief Key for describing the bottom-coordinate (y) of the crop rectangle, value type is int32_t. This is the
636  * bottom-most row included in the crop frame, where row indices start at 0. This key is only used for video decoding.
637  *
638  * @syscap SystemCapability.Multimedia.Media.CodecBase
639  * @since 12
640  */
641 extern const char *OH_MD_KEY_VIDEO_CROP_BOTTOM;
642 /**
643  * @brief Key for describing the left-coordinate (x) of the crop rectangle, value type is int32_t.
644  * This is the left-most column included in the crop frame, where column indices start at 0.
645  * This key is only used for video decoding.
646  *
647  * @syscap SystemCapability.Multimedia.Media.CodecBase
648  * @since 12
649  */
650 extern const char *OH_MD_KEY_VIDEO_CROP_LEFT;
651 /**
652  * @brief Key for describing the right-coordinate (x) of the crop rectangle, value type is int32_t. This is the
653  * right-most column included in the crop frame, where column indices start at 0.
654  * This key is only used for video decoding.
655  *
656  * @syscap SystemCapability.Multimedia.Media.CodecBase
657  * @since 12
658  */
659 extern const char *OH_MD_KEY_VIDEO_CROP_RIGHT;
660 /**
661  * @brief Key for describing the stride of the video buffer layout, value type is int32_t. Stride (or row increment) is
662  * the difference between the index of a pixel and that of the pixel directly underneath. For YUV 420 formats, the
663  * stride corresponds to the Y plane; the stride of the U and V planes can be calculated based on the color format,
664  * though it is generally undefined and depends on the device and release.
665  *
666  * @syscap SystemCapability.Multimedia.Media.CodecBase
667  * @since 12
668  */
669 extern const char *OH_MD_KEY_VIDEO_STRIDE;
670 /**
671  * @brief Key for describing the plane height of a multi-planar (YUV) video buffer layout, value type is int32_t.
672  * Slice height (or plane height/vertical stride) is the number of rows that must be skipped to get from
673  * the top of the Y plane to the top of the U plane in the buffer. In essence the offset of the U plane
674  * is sliceHeight * stride. The height of the U/V planes can be calculated based on the color format,
675  * though it is generally undefined and depends on the device and release.
676  *
677  * @syscap SystemCapability.Multimedia.Media.CodecBase
678  * @since 12
679  */
680 extern const char *OH_MD_KEY_VIDEO_SLICE_HEIGHT;
681 /**
682  * @brief Key for describing the valid picture width of the video, value type is int32_t.
683  * Get the value from an OH_AVFormat instance, which obtained by calling {@link OH_VideoDecoder_GetOutputDescription}
684  * or {@link OH_AVCodecOnStreamChanged}.
685  *
686  * @syscap SystemCapability.Multimedia.Media.CodecBase
687  * @since 12
688  */
689 extern const char *OH_MD_KEY_VIDEO_PIC_WIDTH;
690 /**
691  * @brief Key for describing the valid picture height of the video, value type is int32_t.
692  * Get the value from an OH_AVFormat instance, which obtained by calling {@link OH_VideoDecoder_GetOutputDescription}
693  * or {@link OH_AVCodecOnStreamChanged}.
694  *
695  * @syscap SystemCapability.Multimedia.Media.CodecBase
696  * @since 12
697  */
698 extern const char *OH_MD_KEY_VIDEO_PIC_HEIGHT;
699 /**
700  * @brief Key to enable the low latency mode, value type is int32_t (0 or 1):1 is enabled, 0 otherwise.
701  * If enabled, the video decoder doesn't hold input and output data more than required by
702  * the codec standards. This is an optional key that applies only to video decoder.
703  * It is used in Configure state.
704  *
705  * @syscap SystemCapability.Multimedia.Media.CodecBase
706  * @since 12
707  */
708 extern const char *OH_MD_KEY_VIDEO_ENABLE_LOW_LATENCY;
709 /**
710  * @brief Key for describing the maximum quantization parameter allowed for video encoder, value type is int32_t.
711  * It is used in configure/setparameter or takes effect immediately with the frame.
712  *
713  * @syscap SystemCapability.Multimedia.Media.CodecBase
714  * @since 12
715  */
716 extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_MAX;
717 /**
718  * @brief Key for describing the minimum quantization parameter allowed for video encoder, value type is int32_t.
719  * It is used in configure/setparameter or takes effect immediately with the frame.
720  *
721  * @syscap SystemCapability.Multimedia.Media.CodecBase
722  * @since 12
723  */
724 extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_MIN;
725 /**
726  * @brief Key for describing the video frame averge quantization parameter, value type is int32_t.
727  * Indicate the average qp value of the current frame encoding block, which is output with OH_AVBuffer.
728  *
729  * @syscap SystemCapability.Multimedia.Media.CodecBase
730  * @since 12
731  */
732 extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_AVERAGE;
733 /**
734  * @brief Key for describing video frame mean squared error, value type is double.
735  * Indicate the MSE statistics of the current frame encoding block, which is output with OH_AVBuffer.
736  *
737  * @syscap SystemCapability.Multimedia.Media.CodecBase
738  * @since 12
739  */
740 extern const char *OH_MD_KEY_VIDEO_ENCODER_MSE;
741 /**
742  * @brief Key for decoding timestamp corresponding to the sample of audio, video, or subtitles carried in OH_AVBuffer,
743  * in microseconds, value type is int64_t.
744  *
745  * @syscap SystemCapability.Multimedia.Media.CodecBase
746  * @since 12
747  */
748 extern const char *OH_MD_KEY_DECODING_TIMESTAMP;
749 /**
750  * @brief Key for duration corresponding to the sample of audio, video, or subtitles carried in OH_AVBuffer,
751  * in microseconds, value type is int64_t.
752  *
753  * @syscap SystemCapability.Multimedia.Media.CodecBase
754  * @since 12
755  */
756 extern const char *OH_MD_KEY_BUFFER_DURATION;
757 /**
758  * @brief Key for sample aspect ratio, value type is double.
759  *
760  * @syscap SystemCapability.Multimedia.Media.CodecBase
761  * @since 12
762  */
763 extern const char *OH_MD_KEY_VIDEO_SAR;
764 /**
765  * @brief Key for start time of the first frame in the media file in microseconds, value type is int64_t.
766  *
767  * @syscap SystemCapability.Multimedia.Media.CodecBase
768  * @since 12
769  */
770 extern const char *OH_MD_KEY_START_TIME;
771 /**
772  * @brief Key for start time of track in microseconds, value type is int64_t.
773  *
774  * @syscap SystemCapability.Multimedia.Media.CodecBase
775  * @since 12
776  */
777 extern const char *OH_MD_KEY_TRACK_START_TIME;
778 /**
779  * @brief Key for setting the output color space of video decoder. The value type is int32_t.
780  * The supported value is {@link OH_COLORSPACE_BT709_LIMIT}, see {@link OH_NativeBuffer_ColorSpace}. It is used in
781  * {@link OH_VideoDecoder_Configure}. If the color space conversion capability is supported and this key is configured,
782  * the video decoder will automatically transcode an HDR Vivid video to an SDR video with color space BT709.
783  * If color space conversion capability is not supported, {@link OH_VideoDecoder_Configure} returns
784  * {@link AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION}.
785  * If the input video is not an HDR vivid video, an error {@link AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION} will
786  * be reported by callback function {@link OH_AVCodecOnError}.
787  *
788  * @syscap SystemCapability.Multimedia.Media.CodecBase
789  * @since 12
790  */
791 extern const char *OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACE;
792 /**
793  * @brief Key for describing if enable VRR or not, value type is int32_t (0 or 1): 1 is enabled, 0 otherwise.
794  * This is an optional key that applies only to video decoder. It is used in configure.
795  *
796  * @syscap SystemCapability.Multimedia.Media.CodecBase
797  * @since 14
798  */
799 extern const char *OH_MD_KEY_VIDEO_DECODER_OUTPUT_ENABLE_VRR;
800 /**
801  * @brief Key applies only when configuring a video encoder in surface mode, value type is int32_t.
802  * If no new frame became available since the last frame submitted to the encoder,
803  * it will sumbit the previous frame repeatly in milliseconds. It is used in configure.
804  *
805  * @syscap SystemCapability.Multimedia.Media.CodecBase
806  * @since 18
807  */
808 extern const char *OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER;
809 /**
810  * @brief Key for describing the maximum count that the frame previously submitted to the encoder will be
811  * repeated, in case no new frame has been available since, value type is int32_t. This key takes effect only when
812  * {@link VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER} is vaild. It is used in configure.
813  *
814  * @syscap SystemCapability.Multimedia.Media.CodecBase
815  * @since 18
816  */
817 extern const char *OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNT;
818 /**
819  * @brief Key for creation timestamp of a media file, value type is string.
820  *
821  * @syscap SystemCapability.Multimedia.Media.CodecBase
822  * @since 14
823  */
824 extern const char *OH_MD_KEY_CREATION_TIME;
825 /**
826  * @brief Key to set the region of interest(ROI) as QpOffset-Rects, value type is string in the format
827  * "Top1,Left1-Bottom1,Right1=Offset1;Top2,Left2-Bottom2,Right2=Offset2;". Each "Top,Left-Bottom,Right=Offset"
828  * represents the coordinate information and quantization parameter of one ROI. Each "=Offset" in the string
829  * can be omitted, like "Top1,Left1-Bottom1,Right1;Top2,Left2-Bottom2,Right2=Offset2;", the encoder
830  * will use the default quantization parameter to perform the ROI encoding on the first ROI and
831  * use Offset2 on the second ROI.
832  *
833  * This is an optional key that applies only to video encoder.
834  * It is used in running process and is set with each frame.
835  * In surface mode, it is used in {@link OH_VideoEncoder_OnNeedInputParameter}.
836  * In buffer mode, it is configured via {@link OH_AVBuffer_SetParameter}.
837  * @syscap SystemCapability.Multimedia.Media.CodecBase
838  * @since 20
839  */
840 extern const char *OH_MD_KEY_VIDEO_ENCODER_ROI_PARAMS;
841 /**
842  * @brief Key for the decision of setting moov in front or not, value type is int32_t.
843  *
844  * @syscap SystemCapability.Multimedia.Media.CodecBase
845  * @since 20
846  */
847 extern const char *OH_MD_KEY_ENABLE_MOOV_FRONT;
848 
849 /**
850  * @brief Key to enable B-frame encoding, value type is int32_t (0 or 1): 1 is enabled, 0 otherwise.
851  *
852  * This is an optional key that applies only to video encoder, default is 0.\n
853  * If enabled, the video encoder will use B-frame, the decode order will be different from the display order.\n
854  * For unsupported platforms, Configuring this key will have no effect.\n
855  * Platform capability can be checked via {@link OH_AVCapability_IsFeatureSupported} with
856  * {@link OH_AVCapabilityFeature::VIDEO_ENCODER_B_FRAME}.\n
857  * It's only used in configuration phase.\n
858  *
859  * @syscap SystemCapability.Multimedia.Media.CodecBase
860  * @since 20
861 */
862 extern const char *OH_MD_KEY_VIDEO_ENCODER_ENABLE_B_FRAME;
863 
864 /**
865  * @brief Key for describing the maximum B-frame count of video encoder, value type is int32_t.
866  *
867  * Note: This key is only for querying the capability of the codec currently.
868  * Usage specifications:
869  * 1. Check feature support via {@link OH_AVCapability_IsFeatureSupported} with
870  * {@link OH_AVCapabilityFeature::VIDEO_ENCODER_B_FRAME}.\n
871  * 2. Obtain OH_AVFormat handle via {@link OH_AVCapability_GetFeatureProperties} with
872  * {@link OH_AVCapabilityFeature::VIDEO_ENCODER_B_FRAME}.\n
873  * 3. Get maximum B-frame count via {@link OH_AVFormat_GetIntValue} with this key.\n
874  *
875  * @syscap SystemCapability.Multimedia.Media.CodecBase
876  * @since 20
877 */
878 extern const char *OH_MD_KEY_VIDEO_ENCODER_MAX_B_FRAMES;
879 /**
880  * @brief Key to enable Bitrate Control Based on Presentation Time Stamp(PTS),
881  * value type is int32_t (0 or 1):1 is enabled, 0 otherwise.
882  *
883  * This is an optional key that applies only to video encoder, default is 0.
884  * If enabled, the PTS information must be carried in each video frame and sent to the encoder.
885  * It is used in configure.
886  *
887  * @syscap SystemCapability.Multimedia.Media.CodecBase
888  * @since 20
889 */
890 extern const char *OH_MD_KEY_VIDEO_ENCODER_ENABLE_PTS_BASED_RATECONTROL;
891 
892 /**
893  * @brief Key for describing the reference relationship between tracks, value type is int32_t*.
894  *
895  * @syscap SystemCapability.Multimedia.Media.CodecBase
896  * @since 20
897 */
898 extern const char *OH_MD_KEY_REFERENCE_TRACK_IDS;
899 /**
900  * @brief Key for describing the track reference type, value type is string.
901  *
902  * @syscap SystemCapability.Multimedia.Media.CodecBase
903  * @since 20
904 */
905 extern const char *OH_MD_KEY_TRACK_REFERENCE_TYPE;
906 /**
907  * @brief Key for describing the track description, value type is string.
908  *
909  * @syscap SystemCapability.Multimedia.Media.CodecBase
910  * @since 20
911 */
912 extern const char *OH_MD_KEY_TRACK_DESCRIPTION;
913 
914 /**
915  * @brief Key to enable synchronous mode, value type is (0 or 1): 1 is enabled, 0 otherwise.
916  *
917  * This is an optional key, default is 0.\n
918  * When enabled:
919  *       - Callbacks should NOT be set for codecs
920  *       - Buffer query APIs must be used instead
921  *       - Only used in configuration phase
922  *
923  * @syscap SystemCapability.Multimedia.Media.CodecBase
924  * @since 20
925  */
926 extern const char *OH_MD_KEY_ENABLE_SYNC_MODE;
927 
928 /**
929  * @brief Key for specifying whether to output a blank frame during video decoder shutdown,
930  * value type is int32_t (0 or 1): 1 is enabled, 0 otherwise.
931  *
932  * This is an optional key, only used when configuring a video decoder in surface mode.\n
933  * By default, this feature is disabled (0).\n
934  * When enabled, the video decoder will output a blank frame (typically black)
935  * when stop or release to ensure a smooth transition to no-signal state on display devices.\n
936  * This prevents display retention or flickering caused by abrupt termination.\n
937  *
938  * @since 20
939  */
940 extern const char *OH_MD_KEY_VIDEO_DECODER_BLANK_FRAME_ON_SHUTDOWN;
941 
942 /**
943  * @brief Media type.
944  * @syscap SystemCapability.Multimedia.Media.CodecBase
945  * @since 9
946  * @version 1.0
947  */
948 typedef enum OH_MediaType {
949     /* track is audio. */
950     MEDIA_TYPE_AUD = 0,
951     /* track is video. */
952     MEDIA_TYPE_VID = 1,
953     /** track is subtitle.
954      * @since 12
955      */
956     MEDIA_TYPE_SUBTITLE = 2,
957     /** track is timed meta.
958      * @since 20
959      */
960     MEDIA_TYPE_TIMED_METADATA = 5,
961     /** track is auxiliary.
962      * @since 20
963      */
964     MEDIA_TYPE_AUXILIARY = 6,
965 } OH_MediaType;
966 
967 /**
968  * @brief AAC Profile
969  * @syscap SystemCapability.Multimedia.Media.CodecBase
970  * @since 9
971  * @version 1.0
972  */
973 typedef enum OH_AACProfile {
974     /** AAC encoding level is Low Complexity levele. */
975     AAC_PROFILE_LC = 0,
976     /** AAC encoding level is High Efficiency levele.
977      * @since 14
978      */
979     AAC_PROFILE_HE = 3,
980     /** AAC encoding level is High Efficiency v2 levele.
981      * @since 14
982      */
983     AAC_PROFILE_HE_V2 = 4,
984 } OH_AACProfile;
985 
986 /**
987  * @brief AVC Profile
988  * @syscap SystemCapability.Multimedia.Media.CodecBase
989  * @since 9
990  * @version 1.0
991  */
992 typedef enum OH_AVCProfile {
993     AVC_PROFILE_BASELINE = 0,
994     AVC_PROFILE_HIGH = 4,
995     AVC_PROFILE_MAIN = 8,
996 } OH_AVCProfile;
997 
998 /**
999  * @brief MPEG2 Profile
1000  *
1001  * @syscap SystemCapability.Multimedia.Media.CodecBase
1002  * @since 17
1003  */
1004 typedef enum OH_MPEG2Profile {
1005     /** Simple profile */
1006     MPEG2_PROFILE_SIMPLE  = 0,
1007     /** Main profile */
1008     MPEG2_PROFILE_MAIN    = 1,
1009     /** SNR scalable profile */
1010     MPEG2_PROFILE_SNR     = 2,
1011     /** Spatially scalable profile */
1012     MPEG2_PROFILE_SPATIAL = 3,
1013     /** High profile */
1014     MPEG2_PROFILE_HIGH    = 4,
1015     /** 4:2:2 profile */
1016     MPEG2_PROFILE_422     = 5,
1017 } OH_MPEG2Profile;
1018 
1019 /**
1020  * @brief MPEG4 Profile
1021  *
1022  * @syscap SystemCapability.Multimedia.Media.CodecBase
1023  * @since 17
1024  */
1025 typedef enum OH_MPEG4Profile {
1026     /** Simple profile */
1027     MPEG4_PROFILE_SIMPLE             = 0,
1028     /** Simple scalable profile */
1029     MPEG4_PROFILE_SIMPLE_SCALABLE    = 1,
1030     /** Core profile */
1031     MPEG4_PROFILE_CORE               = 2,
1032     /** Main profile */
1033     MPEG4_PROFILE_MAIN               = 3,
1034     /** N-Bit profile */
1035     MPEG4_PROFILE_NBIT               = 4,
1036     /** Hybrid profile */
1037     MPEG4_PROFILE_HYBRID             = 5,
1038     /** Basic animated texture profile */
1039     MPEG4_PROFILE_BASIC_ANIMATED_TEXTURE = 6,
1040     /** Scalable texture profile */
1041     MPEG4_PROFILE_SCALABLE_TEXTURE   = 7,
1042     /** Simple FA profile */
1043     MPEG4_PROFILE_SIMPLE_FA          = 8,
1044     /** Advanced real time simple profile */
1045     MPEG4_PROFILE_ADVANCED_REAL_TIME_SIMPLE  = 9,
1046     /** Core scalable profile */
1047     MPEG4_PROFILE_CORE_SCALABLE      = 10,
1048     /** Advanced coding efficiency profile */
1049     MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 11,
1050     /** Advanced core profile */
1051     MPEG4_PROFILE_ADVANCED_CORE      = 12,
1052     /** Advanced scalable texture profile */
1053     MPEG4_PROFILE_ADVANCED_SCALABLE_TEXTURE  = 13,
1054     /** Advanced simple profile */
1055     MPEG4_PROFILE_ADVANCED_SIMPLE    = 17,
1056 } OH_MPEG4Profile;
1057 
1058 /**
1059  * @brief H263 Profile
1060  *
1061  * @syscap SystemCapability.Multimedia.Media.CodecBase
1062  * @since 17
1063  */
1064 typedef enum OH_H263Profile {
1065     /** Baseline profile */
1066     H263_PROFILE_BASELINE = 0,
1067     /** Version 1 backward compatibility profile */
1068     H263_PROFILE_VERSION_1_BACKWARD_COMPATIBILITY = 2,
1069 } OH_H263Profile;
1070 
1071 /**
1072  * @brief HEVC Profile
1073  * @syscap SystemCapability.Multimedia.Media.CodecBase
1074  * @since 10
1075  */
1076 typedef enum OH_HEVCProfile {
1077     /** HEVC encoding level is the main level. */
1078     HEVC_PROFILE_MAIN = 0,
1079     /** HEVC encoding level is 10 bit main level. */
1080     HEVC_PROFILE_MAIN_10 = 1,
1081     /** HEVC encoding level is the main level for still images. */
1082     HEVC_PROFILE_MAIN_STILL = 2,
1083     /** HEVC encoding level is HDR10 main level.
1084      * @deprecated since 14
1085     */
1086     HEVC_PROFILE_MAIN_10_HDR10 = 3,
1087     /** HEVC encoding level is HDR10+ main level.
1088      * @deprecated since 14
1089     */
1090     HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4,
1091 } OH_HEVCProfile;
1092 
1093 /**
1094  * @brief VVC Profile: A specified subset of the syntax of VVC.
1095  * @syscap SystemCapability.Multimedia.Media.CodecBase
1096  * @since 15
1097  */
1098 typedef enum OH_VVCProfile {
1099     /** Main 10 profile */
1100     VVC_PROFILE_MAIN_10 = 1,
1101     /** Main 12 profile */
1102     VVC_PROFILE_MAIN_12 = 2,
1103     /** Main 12 Intra profile */
1104     VVC_PROFILE_MAIN_12_INTRA = 10,
1105     /** Multilayer Main 10 profile */
1106     VVC_PROFILE_MULTI_MAIN_10 = 17,
1107     /** Main 10 4:4:4 profile */
1108     VVC_PROFILE_MAIN_10_444 = 33,
1109     /** Main 12 4:4:4 profile */
1110     VVC_PROFILE_MAIN_12_444 = 34,
1111     /** Main 16 4:4:4 profile */
1112     VVC_PROFILE_MAIN_16_444 = 36,
1113     /** Main 12 4:4:4 Intra profile */
1114     VVC_PROFILE_MAIN_12_444_INTRA = 42,
1115     /** Main 16 4:4:4 Intra profile */
1116     VVC_PROFILE_MAIN_16_444_INTRA = 44,
1117     /** Multilayer Main 10 4:4:4 profile */
1118     VVC_PROFILE_MULTI_MAIN_10_444 = 49,
1119     /** Main 10 Still Picture profile */
1120     VVC_PROFILE_MAIN_10_STILL = 65,
1121     /** Main 12 Still Picture profile */
1122     VVC_PROFILE_MAIN_12_STILL = 66,
1123     /** Main 10 4:4:4 Still Picture profile */
1124     VVC_PROFILE_MAIN_10_444_STILL = 97,
1125     /** Main 12 4:4:4 Still Picture profile */
1126     VVC_PROFILE_MAIN_12_444_STILL = 98,
1127     /** Main 16 4:4:4 Still Picture profile */
1128     VVC_PROFILE_MAIN_16_444_STILL = 100,
1129 } OH_VVCProfile;
1130 
1131 /**
1132  * @brief Enumerates the muxer output file format.
1133  * @syscap SystemCapability.Multimedia.Media.CodecBase
1134  * @since 10
1135  */
1136 typedef enum OH_AVOutputFormat {
1137     /** Default output file format, default to MP4 format. */
1138     AV_OUTPUT_FORMAT_DEFAULT = 0,
1139     /** The muxer output MP4 file format. */
1140     AV_OUTPUT_FORMAT_MPEG_4 = 2,
1141     /** The muxer output M4A file format.*/
1142     AV_OUTPUT_FORMAT_M4A = 6,
1143     /**
1144      * The muxer output amr file format.
1145      * @since 12
1146      */
1147     AV_OUTPUT_FORMAT_AMR = 8,
1148     /**
1149      * The muxer output mp3 file format.
1150      * @since 12
1151      */
1152     AV_OUTPUT_FORMAT_MP3 = 9,
1153     /**
1154      * The muxer output wav file format.
1155      * @since 12
1156      */
1157     AV_OUTPUT_FORMAT_WAV = 10,
1158     /**
1159      * The muxer output aac file format.
1160      * @since 18
1161      */
1162     AV_OUTPUT_FORMAT_AAC = 11,
1163     /**
1164      * The muxer output flac file format.
1165      * @since 20
1166      */
1167     AV_OUTPUT_FORMAT_FLAC = 12,
1168 } OH_AVOutputFormat;
1169 
1170 /**
1171  * @brief Seek Mode.
1172  * @syscap SystemCapability.Multimedia.Media.CodecBase
1173  * @since 10
1174  */
1175 typedef enum OH_AVSeekMode {
1176     /* Seek to sync sample after the time. If there is no I-frame after the time point, the mode may fail to seek. */
1177     SEEK_MODE_NEXT_SYNC = 0,
1178     /* Seek to sync sample before the time. */
1179     SEEK_MODE_PREVIOUS_SYNC,
1180     /* Seek to sync sample closest to time. */
1181     SEEK_MODE_CLOSEST_SYNC,
1182 } OH_AVSeekMode;
1183 
1184 /**
1185  * @brief Scaling Mode, only used in Surface mode.
1186  * @syscap SystemCapability.Multimedia.Media.CodecBase
1187  * @since 10
1188  * @deprecated since 14
1189  * @useinstead OHScalingModeV2
1190  */
1191 typedef enum OH_ScalingMode {
1192     /* Adaptively adjust the image size based on the window size.
1193      * @deprecated since 14
1194      * @useinstead OH_SCALING_MODE_SCALE_TO_WINDOW_V2
1195     */
1196     SCALING_MODE_SCALE_TO_WINDOW = 1,
1197     /* Crop the image size based on the window size.
1198      * @deprecated since 14
1199      * @useinstead OH_SCALING_MODE_SCALE_CROP_V2
1200      */
1201     SCALING_MODE_SCALE_CROP = 2,
1202 } OH_ScalingMode;
1203 
1204 /**
1205  * @brief enum Audio Bits Per Coded Sample.
1206  * @syscap SystemCapability.Multimedia.Media.CodecBase
1207  * @since 10
1208  */
1209 typedef enum OH_BitsPerSample {
1210     /* 8-bit unsigned integer sampling. */
1211     SAMPLE_U8 = 0,
1212     /* 16-bit signed integer sampling. */
1213     SAMPLE_S16LE = 1,
1214     /* 24-bit signed integer sampling. */
1215     SAMPLE_S24LE = 2,
1216     /* 32-bit signed integer sampling. */
1217     SAMPLE_S32LE = 3,
1218     /* 32-bit float sampling. */
1219     SAMPLE_F32LE = 4,
1220     /* 8-bit unsigned integer plane sampling. */
1221     SAMPLE_U8P = 5,
1222     /* 16-bit unsigned integer plane sampling. */
1223     SAMPLE_S16P = 6,
1224     /* 24-bit unsigned integer plane sampling. */
1225     SAMPLE_S24P = 7,
1226     /* 32-bit unsigned integer plane sampling. */
1227     SAMPLE_S32P = 8,
1228     /* 32-bit float plane sampling. */
1229     SAMPLE_F32P = 9,
1230     /* Invalid sampling format. */
1231     INVALID_WIDTH = -1
1232 } OH_BitsPerSample;
1233 
1234 /**
1235  * @brief Color Primary.
1236  * @syscap SystemCapability.Multimedia.Media.CodecBase
1237  * @since 10
1238  */
1239 typedef enum OH_ColorPrimary {
1240     COLOR_PRIMARY_BT709 = 1,
1241     COLOR_PRIMARY_UNSPECIFIED = 2,
1242     COLOR_PRIMARY_BT470_M = 4,
1243     COLOR_PRIMARY_BT601_625 = 5,
1244     COLOR_PRIMARY_BT601_525 = 6,
1245     COLOR_PRIMARY_SMPTE_ST240 = 7,
1246     COLOR_PRIMARY_GENERIC_FILM = 8,
1247     COLOR_PRIMARY_BT2020 = 9,
1248     COLOR_PRIMARY_SMPTE_ST428 = 10,
1249     COLOR_PRIMARY_P3DCI = 11,
1250     COLOR_PRIMARY_P3D65 = 12,
1251 } OH_ColorPrimary;
1252 
1253 /**
1254  * @brief Transfer Characteristic, both encoding and decoding are supported.
1255  * @syscap SystemCapability.Multimedia.Media.CodecBase
1256  * @since 10
1257  */
1258 typedef enum OH_TransferCharacteristic {
1259     /* BT709 transfer function. */
1260     TRANSFER_CHARACTERISTIC_BT709 = 1,
1261     /* transfer function not specified. */
1262     TRANSFER_CHARACTERISTIC_UNSPECIFIED = 2,
1263     /* GAMMA_2_2 transfer function. */
1264     TRANSFER_CHARACTERISTIC_GAMMA_2_2 = 4,
1265     /* GAMMA_2_8 transfer function. */
1266     TRANSFER_CHARACTERISTIC_GAMMA_2_8 = 5,
1267     /* BT601 transfer function. */
1268     TRANSFER_CHARACTERISTIC_BT601 = 6,
1269     /* SMPTE_ST240 transfer function. */
1270     TRANSFER_CHARACTERISTIC_SMPTE_ST240 = 7,
1271     /* LINEAR transfer function. */
1272     TRANSFER_CHARACTERISTIC_LINEAR = 8,
1273     /* LOG transfer function. */
1274     TRANSFER_CHARACTERISTIC_LOG = 9,
1275     /* LOG_SQRT transfer function. */
1276     TRANSFER_CHARACTERISTIC_LOG_SQRT = 10,
1277     /* IEC_61966_2_4 transfer function. */
1278     TRANSFER_CHARACTERISTIC_IEC_61966_2_4 = 11,
1279     /* BT1361 transfer function. */
1280     TRANSFER_CHARACTERISTIC_BT1361 = 12,
1281     /* IEC_61966_2_1 transfer function. */
1282     TRANSFER_CHARACTERISTIC_IEC_61966_2_1 = 13,
1283     /* BT2020_10BIT transfer function. */
1284     TRANSFER_CHARACTERISTIC_BT2020_10BIT = 14,
1285     /* BT2020_12BIT transfer function. */
1286     TRANSFER_CHARACTERISTIC_BT2020_12BIT = 15,
1287     /* PQ transfer function. */
1288     TRANSFER_CHARACTERISTIC_PQ = 16,
1289     /* SMPTE_ST428 transfer function. */
1290     TRANSFER_CHARACTERISTIC_SMPTE_ST428 = 17,
1291     /* HLG transfer function. */
1292     TRANSFER_CHARACTERISTIC_HLG = 18,
1293 } OH_TransferCharacteristic;
1294 
1295 /**
1296  * @brief Matrix Coefficient, both encoding and decoding are supported.
1297  * @syscap SystemCapability.Multimedia.Media.CodecBase
1298  * @since 10
1299  */
1300 typedef enum OH_MatrixCoefficient {
1301     /* Unit matrix. */
1302     MATRIX_COEFFICIENT_IDENTITY = 0,
1303     /* BT709 conversion matrix. */
1304     MATRIX_COEFFICIENT_BT709 = 1,
1305     /* Conversion matrix not specified. */
1306     MATRIX_COEFFICIENT_UNSPECIFIED = 2,
1307     /* FCC conversion matrix. */
1308     MATRIX_COEFFICIENT_FCC = 4,
1309     /* BT601_625 conversion matrix. */
1310     MATRIX_COEFFICIENT_BT601_625 = 5,
1311     /* BT601_525 conversion matrix. */
1312     MATRIX_COEFFICIENT_BT601_525 = 6,
1313     /* SMPTE_ST240  conversion matrix. */
1314     MATRIX_COEFFICIENT_SMPTE_ST240 = 7,
1315     /* YCGCO conversion matrix. */
1316     MATRIX_COEFFICIENT_YCGCO = 8,
1317     /* BT2020_NCL conversion matrix. */
1318     MATRIX_COEFFICIENT_BT2020_NCL = 9,
1319     /* BT2020_CL conversion matrix. */
1320     MATRIX_COEFFICIENT_BT2020_CL = 10,
1321     /* SMPTE_ST2085 conversion matrix. */
1322     MATRIX_COEFFICIENT_SMPTE_ST2085 = 11,
1323     /* CHROMATICITY_NCL conversion matrix. */
1324     MATRIX_COEFFICIENT_CHROMATICITY_NCL = 12,
1325     /* CHROMATICITY_CL conversion matrix. */
1326     MATRIX_COEFFICIENT_CHROMATICITY_CL = 13,
1327     /* ICTCP conversion matrix. */
1328     MATRIX_COEFFICIENT_ICTCP = 14,
1329 } OH_MatrixCoefficient;
1330 
1331 /**
1332  * @brief MPEG2 Level.
1333  *
1334  * @syscap SystemCapability.Multimedia.Media.CodecBase
1335  * @since 17
1336  */
1337 typedef enum OH_MPEG2Level {
1338     /** Low level */
1339     MPEG2_LEVEL_LL  = 0,
1340     /** Main level */
1341     MPEG2_LEVEL_ML  = 1,
1342     /** High 1440 level */
1343     MPEG2_LEVEL_H14 = 2,
1344     /** High level */
1345     MPEG2_LEVEL_HL  = 3,
1346 }OH_MPEG2Level;
1347 
1348 /**
1349  * @brief MPEG4 Level.
1350  *
1351  * @syscap SystemCapability.Multimedia.Media.CodecBase
1352  * @since 17
1353  */
1354 typedef enum OH_MPEG4Level {
1355     /** 0 level */
1356     MPEG4_LEVEL_0  = 0,
1357     /** 0B level */
1358     MPEG4_LEVEL_0B = 1,
1359     /** 1 level */
1360     MPEG4_LEVEL_1  = 2,
1361     /** 2 level */
1362     MPEG4_LEVEL_2  = 3,
1363     /** 3 level */
1364     MPEG4_LEVEL_3  = 4,
1365      /** 3B level */
1366     MPEG4_LEVEL_3B = 5,
1367     /** 4 level */
1368     MPEG4_LEVEL_4  = 6,
1369     /** 4A level */
1370     MPEG4_LEVEL_4A = 7,
1371     /** 5 level */
1372     MPEG4_LEVEL_5  = 8,
1373     /** 6 level */
1374     MPEG4_LEVEL_6  = 9,
1375 }OH_MPEG4Level;
1376 
1377 /**
1378  * @brief H263 Level.
1379  *
1380  * @syscap SystemCapability.Multimedia.Media.CodecBase
1381  * @since 17
1382  */
1383 typedef enum OH_H263Level {
1384     /** 10 level */
1385     H263_LEVEL_10 = 0,
1386     /** 20 level */
1387     H263_LEVEL_20 = 1,
1388     /** 30 level */
1389     H263_LEVEL_30 = 2,
1390     /** 40 level */
1391     H263_LEVEL_40 = 3,
1392     /** 45 level */
1393     H263_LEVEL_45 = 4,
1394     /** 50 level */
1395     H263_LEVEL_50 = 5,
1396     /** 60 level */
1397     H263_LEVEL_60 = 6,
1398     /** 70 level */
1399     H263_LEVEL_70 = 7
1400 } OH_H263Level;
1401 
1402 /**
1403  * @brief AVC Level.
1404  *
1405  * @syscap SystemCapability.Multimedia.Media.CodecBase
1406  * @since 12
1407  */
1408 typedef enum OH_AVCLevel {
1409     AVC_LEVEL_1 = 0,
1410     AVC_LEVEL_1b = 1,
1411     AVC_LEVEL_11 = 2,
1412     AVC_LEVEL_12 = 3,
1413     AVC_LEVEL_13 = 4,
1414     AVC_LEVEL_2 = 5,
1415     AVC_LEVEL_21 = 6,
1416     AVC_LEVEL_22 = 7,
1417     AVC_LEVEL_3 = 8,
1418     AVC_LEVEL_31 = 9,
1419     AVC_LEVEL_32 = 10,
1420     AVC_LEVEL_4 = 11,
1421     AVC_LEVEL_41 = 12,
1422     AVC_LEVEL_42 = 13,
1423     AVC_LEVEL_5 = 14,
1424     AVC_LEVEL_51 = 15,
1425     AVC_LEVEL_52 = 16,
1426     AVC_LEVEL_6 = 17,
1427     AVC_LEVEL_61 = 18,
1428     AVC_LEVEL_62 = 19,
1429 } OH_AVCLevel;
1430 
1431 /**
1432  * @brief HEVC Level.
1433  *
1434  * @syscap SystemCapability.Multimedia.Media.CodecBase
1435  * @since 12
1436  */
1437 typedef enum OH_HEVCLevel {
1438     HEVC_LEVEL_1 = 0,
1439     HEVC_LEVEL_2 = 1,
1440     HEVC_LEVEL_21 = 2,
1441     HEVC_LEVEL_3 = 3,
1442     HEVC_LEVEL_31 = 4,
1443     HEVC_LEVEL_4 = 5,
1444     HEVC_LEVEL_41 = 6,
1445     HEVC_LEVEL_5 = 7,
1446     HEVC_LEVEL_51 = 8,
1447     HEVC_LEVEL_52 = 9,
1448     HEVC_LEVEL_6 = 10,
1449     HEVC_LEVEL_61 = 11,
1450     HEVC_LEVEL_62 = 12,
1451 } OH_HEVCLevel;
1452 
1453 /**
1454  * @brief VVC Level: A defined set of constraints on the values that may be taken by the syntax elements and variables
1455  * of VVC, or the value of a transform coefficient prior to scaling.
1456  *
1457  * @syscap SystemCapability.Multimedia.Media.CodecBase
1458  * @since 15
1459  */
1460 typedef enum OH_VVCLevel {
1461     /** VVC level 1.0 */
1462     VVC_LEVEL_1 = 16,
1463     /** VVC level 2.0 */
1464     VVC_LEVEL_2 = 32,
1465     /** VVC level 2.1 */
1466     VVC_LEVEL_21 = 35,
1467     /** VVC level 3.0 */
1468     VVC_LEVEL_3 = 48,
1469     /** VVC level 3.1 */
1470     VVC_LEVEL_31 = 51,
1471     /** VVC level 4.0 */
1472     VVC_LEVEL_4 = 64,
1473     /** VVC level 4.1 */
1474     VVC_LEVEL_41 = 67,
1475     /** VVC level 5.0 */
1476     VVC_LEVEL_5 = 80,
1477     /** VVC level 5.1 */
1478     VVC_LEVEL_51 = 83,
1479     /** VVC level 5.2 */
1480     VVC_LEVEL_52 = 86,
1481     /** VVC level 6.0 */
1482     VVC_LEVEL_6 = 96,
1483     /** VVC level 6.1 */
1484     VVC_LEVEL_61 = 99,
1485     /** VVC level 6.2 */
1486     VVC_LEVEL_62 = 102,
1487     /** VVC level 6.3 */
1488     VVC_LEVEL_63 = 105,
1489     /** VVC level 15.5 */
1490     VVC_LEVEL_155 = 255,
1491 } OH_VVCLevel;
1492 
1493 /**
1494  * @brief The bitrate mode of encoder.
1495  * @syscap SystemCapability.Multimedia.Media.CodecBase
1496  * @since 10
1497  */
1498 typedef enum OH_BitrateMode {
1499     /* Constant Bit rate mode. */
1500     BITRATE_MODE_CBR = 0,
1501     /* Variable Bit rate mode. */
1502     BITRATE_MODE_VBR = 1,
1503     /* Constant Quality mode. */
1504     BITRATE_MODE_CQ = 2,
1505     /** Stable Quality Rate Control mode.
1506      * @since 20
1507      */
1508     BITRATE_MODE_SQR = 3
1509 } OH_BitrateMode;
1510 
1511 /**
1512  * @brief The reference mode in temporal group of picture.
1513  *
1514  * @syscap SystemCapability.Multimedia.Media.CodecBase
1515  * @since 12
1516  */
1517 typedef enum OH_TemporalGopReferenceMode {
1518     /** Refer to latest short-term reference frame. */
1519     ADJACENT_REFERENCE = 0,
1520     /** Refer to latest long-term reference frame. */
1521     JUMP_REFERENCE = 1,
1522     /** Uniformly scaled reference structure, which has even distribution of video frames after drop the highest
1523      *  enhance layer. The temporal group of pictures must be power of 2. */
1524     UNIFORMLY_SCALED_REFERENCE = 2,
1525 } OH_TemporalGopReferenceMode;
1526 
1527 #ifdef __cplusplus
1528 }
1529 #endif
1530 
1531 #endif // NATIVE_AVCODEC_BASE_H
1532 /** @} */