• 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 Enumerates the MIME types of video mpeg2 codec.
210  *
211  * @syscap SystemCapability.Multimedia.Media.CodecBase
212  * @since 17
213  */
214 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG2;
215 
216 /**
217  * @brief Enumerates the mime types of video avc codec.
218  * @syscap SystemCapability.Multimedia.Media.CodecBase
219  * @since 9
220  * @version 1.0
221  */
222 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_AVC;
223 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AAC;
224 
225 /**
226  * @brief Enumerates the MIME types of audio and video codecs
227  * @syscap SystemCapability.Multimedia.Media.CodecBase
228  * @since 10
229  */
230 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_FLAC;
231 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_VORBIS;
232 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_MPEG;
233 
234 /**
235  * @brief Enumerates the mime types of video hevc codec.
236  * @syscap SystemCapability.Multimedia.Media.CodecBase
237  * @since 10
238  * @version 1.0
239  */
240 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_HEVC;
241 
242 /**
243  * @brief Enumerates the types of audio and video muxer
244  * @syscap SystemCapability.Multimedia.Media.CodecBase
245  * @deprecated since 11
246  * @since 10
247  */
248 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4;
249 
250 /**
251  * @brief brief Enumerates the Mime type of video mpeg4 part2 codec.
252  *
253  * @syscap SystemCapability.Multimedia.Media.CodecBase
254  * @since 17
255  */
256 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2;
257 /**
258  * @brief Enumerates the MIME types of video codecs
259  * @syscap SystemCapability.Multimedia.Media.CodecBase
260  * @since 17
261  */
262 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_H263;
263 
264 /**
265  * @brief Enumerates the types of audio and video muxer
266  * @syscap SystemCapability.Multimedia.Media.CodecBase
267  * @since 10
268  */
269 extern const char *OH_AVCODEC_MIMETYPE_IMAGE_JPG;
270 extern const char *OH_AVCODEC_MIMETYPE_IMAGE_PNG;
271 extern const char *OH_AVCODEC_MIMETYPE_IMAGE_BMP;
272 
273 /**
274  * @brief Enumerates the MIME types of audio codecs
275  * @syscap SystemCapability.Multimedia.Media.CodecBase
276  * @since 11
277  */
278 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_VIVID;
279 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_NB;
280 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_WB;
281 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_OPUS;
282 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_G711MU;
283 
284 /**
285  * @brief Enumerates the MIME type of audio low bitrate voice codec.
286  *
287  * @syscap SystemCapability.Multimedia.Media.CodecBase
288  * @since 12
289  */
290 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_LBVC;
291 
292 /**
293  * @brief Enumerates the MIME type of audio ape codec.
294  *
295  * @syscap SystemCapability.Multimedia.Media.CodecBase
296  * @since 12
297  */
298 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_APE;
299 
300 /**
301  * @brief Enumerates the MIME type of versatile video coding.
302  *
303  * @syscap SystemCapability.Multimedia.Media.CodecBase
304  * @since 12
305  */
306 extern const char *OH_AVCODEC_MIMETYPE_VIDEO_VVC;
307 
308 /**
309  * @brief Enumerates the MIME type of subtitle srt.
310  *
311  * @syscap SystemCapability.Multimedia.Media.CodecBase
312  * @since 12
313  */
314 extern const char *OH_AVCODEC_MIMETYPE_SUBTITLE_SRT;
315 
316 /**
317  * @brief Enumerates the mime type of subtitle webvtt.
318  *
319  * @syscap SystemCapability.Multimedia.Media.CodecBase
320  * @since 12
321  */
322 extern const char *OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT;
323 
324 /**
325  * @brief Enumerates the MIME type of audio raw stream.
326  *
327  * @syscap SystemCapability.Multimedia.Media.CodecBase
328  * @since 18
329  */
330 extern const char *OH_AVCODEC_MIMETYPE_AUDIO_RAW;
331 
332 /**
333  * @brief Key for timeStamp in surfacebuffer, value type is int64_t.
334  * @syscap SystemCapability.Multimedia.Media.CodecBase
335  * @since 9
336  * @version 1.0
337  * @deprecated since 14
338  */
339 extern const char *OH_ED_KEY_TIME_STAMP;
340 
341 /* Key for endOfStream in surfacebuffer, value type is int32_t.
342  * @deprecated since 14
343  */
344 extern const char *OH_ED_KEY_EOS;
345 
346 /**
347  * @brief Provides the uniform key for storing the media description.
348  * @syscap SystemCapability.Multimedia.Media.CodecBase
349  * @since 9
350  * @version 1.0
351  */
352 /* Key for track media type, value type is int32_t, see @OH_MediaType. */
353 extern const char *OH_MD_KEY_TRACK_TYPE;
354 /* Key for codec mime type, value type is string. */
355 extern const char *OH_MD_KEY_CODEC_MIME;
356 /* Key for media file duration in microseconds, value type is int64_t. */
357 extern const char *OH_MD_KEY_DURATION;
358 /* Key for bitrate, value type is int64_t. */
359 extern const char *OH_MD_KEY_BITRATE;
360 /* Key for setting the max decode input size, value type is int32_t. */
361 extern const char *OH_MD_KEY_MAX_INPUT_SIZE;
362 /* Key for video width, value type is int32_t */
363 extern const char *OH_MD_KEY_WIDTH;
364 /* Key for video height, value type is int32_t */
365 extern const char *OH_MD_KEY_HEIGHT;
366 /* Key for video pixel format, value type is int32_t, see @OH_AVPixelFormat */
367 extern const char *OH_MD_KEY_PIXEL_FORMAT;
368 /* key for audio raw format, value type is int32_t , see @OH_BitsPerSample */
369 extern const char *OH_MD_KEY_AUDIO_SAMPLE_FORMAT;
370 /* Key for video frame rate, value type is double. The value must be greater than 0. */
371 extern const char *OH_MD_KEY_FRAME_RATE;
372 /* Video encode bitrate mode, the value type is int32_t, see @OH_VideoEncodeBitrateMode */
373 extern const char *OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE;
374 /* Encode profile, the value type is int32_t. see @OH_AVCProfile, OH_HEVCProfile, OH_AACProfile. */
375 extern const char *OH_MD_KEY_PROFILE;
376 /* Key for audio channel count, value type is int32_t */
377 extern const char *OH_MD_KEY_AUD_CHANNEL_COUNT;
378 /* Key for audio sample rate, value type is int32_t */
379 extern const char *OH_MD_KEY_AUD_SAMPLE_RATE;
380 /**
381  * @brief Key for the interval of key frame, value type is int32_t, the unit is milliseconds.
382  * This key is optional and only used for video encoding. A negative value means no key frames
383  * are requested after the first frame. A zero value means a stream containing all key frames is requested.
384  *
385  * @syscap SystemCapability.Multimedia.Media.CodecBase
386  * @since 9
387  */
388 extern const char *OH_MD_KEY_I_FRAME_INTERVAL;
389 /* Key of the surface rotation angle, value type is int32_t: should be {0, 90, 180, 270}, default is 0.
390  * This key is only used in video decoding Surface mode.
391  */
392 extern const char *OH_MD_KEY_ROTATION;
393 
394 /**
395  * @brief Provides the uniform key for storing the media description.
396  * @syscap SystemCapability.Multimedia.Media.CodecBase
397  * @since 10
398  */
399 /* Key for video YUV value range flag, value type is int32_t, 1 for full range, 0 for limited range. */
400 extern const char *OH_MD_KEY_RANGE_FLAG;
401 /* Key for video color primaries, value type is int32_t, see @OH_ColorPrimary. */
402 extern const char *OH_MD_KEY_COLOR_PRIMARIES;
403 /* Key for video transfer characteristics, value type is int32_t, see @OH_TransferCharacteristic.
404  */
405 extern const char *OH_MD_KEY_TRANSFER_CHARACTERISTICS;
406 /* Key for video matrix coefficients, value type is int32_t, see @OH_MatrixCoefficient.
407  */
408 extern const char *OH_MD_KEY_MATRIX_COEFFICIENTS;
409 /* Key for the request an I-Frame immediately, value type is int32_t.
410  * It is used when OH_VideoEncoder_SetParameter is called or takes effect immediately with the frame. */
411 extern const char *OH_MD_KEY_REQUEST_I_FRAME;
412 /* Key for the desired encoding quality, value type is int32_t, the range of encoding scene values in H264 and H265
413  * can be obtained based on the capability query interface @OH_AVCapability_GetEncoderQualityRange, this key is only
414  * supported for encoders that are configured in constant quality mode */
415 extern const char *OH_MD_KEY_QUALITY;
416 /* Key of the codec specific data, value type is a uint8_t pointer.
417  * In video, SPS/PPS is transferred. In audio, extraData is transferred. */
418 extern const char *OH_MD_KEY_CODEC_CONFIG;
419 /* Key for media file title, value type is string. */
420 extern const char *OH_MD_KEY_TITLE;
421 /* Key for Media file artist, value type is string. */
422 extern const char *OH_MD_KEY_ARTIST;
423 /* key for the media files of the album, value type is string. */
424 extern const char *OH_MD_KEY_ALBUM;
425 /* Key for album artist, value type is string. */
426 extern const char *OH_MD_KEY_ALBUM_ARTIST;
427 /* source format Key for date, value type is string */
428 extern const char *OH_MD_KEY_DATE;
429 /* Key for media file comment, value type is string. */
430 extern const char *OH_MD_KEY_COMMENT;
431 /* Key for media file genre, value type is string. */
432 extern const char *OH_MD_KEY_GENRE;
433 /* Key for media file copyright, value type is string. */
434 extern const char *OH_MD_KEY_COPYRIGHT;
435 /* Key for media file language, value type is string. */
436 extern const char *OH_MD_KEY_LANGUAGE;
437 /* Key for media file description, value type is string. */
438 extern const char *OH_MD_KEY_DESCRIPTION;
439 /* Key for media file lyrics, value type is string. */
440 extern const char *OH_MD_KEY_LYRICS;
441 /* Key for media file track count, value type is int32_t. */
442 extern const char *OH_MD_KEY_TRACK_COUNT;
443 /* Key for the desired encoding channel layout, value type is int64_t, this key is only supported for encoders. */
444 extern const char *OH_MD_KEY_CHANNEL_LAYOUT;
445 /* Key for bits per coded sample, value type is int32_t, supported for flac encoder, see @OH_BitsPerSample */
446 extern const char *OH_MD_KEY_BITS_PER_CODED_SAMPLE;
447 /* Key for the aac format, value type is int32_t, supported for aac decoder.
448  * The aac format is divided into ADTS format and LATM format.
449  * Where 0 represents LATM format and 1 represents ADTS format. */
450 extern const char *OH_MD_KEY_AAC_IS_ADTS;
451 /* Key for aac sbr mode, value type is int32_t, supported for aac encoder. */
452 extern const char *OH_MD_KEY_SBR;
453 /* Key for flac compliance level, value type is int32_t, only used in audio encoding. */
454 extern const char *OH_MD_KEY_COMPLIANCE_LEVEL;
455 /* Key for vorbis identification header, value type is a uint8_t pointer, supported only for vorbis decoder */
456 extern const char *OH_MD_KEY_IDENTIFICATION_HEADER;
457 /* Key for vorbis setup header, value type is a uint8_t pointer, supported only for vorbis decoder */
458 extern const char *OH_MD_KEY_SETUP_HEADER;
459 /**
460  * @brief Key for video scale type, value type is int32_t, see @OH_ScalingMode.
461  * It is recommended to directly call the @OH_NativeIndow_NativeIndowSettcalingModeV2 interface for setting.
462  * This key is optional and only used for video decoding in Surface mode.
463  * @syscap SystemCapability.Multimedia.Media.CodecBase
464  * @since 10
465  * @deprecated 14
466  * @useinstead OH_NativeIndow_NativeIndowSettcalingModeV2
467  */
468 extern const char *OH_MD_KEY_SCALING_MODE;
469 /* Key for max input buffer count, value type is int32_t. */
470 extern const char *OH_MD_MAX_INPUT_BUFFER_COUNT;
471 /* Key for max output buffer count, value type is int32_t. */
472 extern const char *OH_MD_MAX_OUTPUT_BUFFER_COUNT;
473 
474 /**
475  * @brief Provides the uniform key for storing the media description.
476  * @syscap SystemCapability.Multimedia.Media.CodecBase
477  * @since 11
478  */
479 /* Key for audio codec compression level, value type is int32_t */
480 extern const char *OH_MD_KEY_AUDIO_COMPRESSION_LEVEL;
481 /* key for whether the video track in the media file is HDR Vivid, value type is int32_t.
482  * Demuxer and muxer are supported. */
483 extern const char *OH_MD_KEY_VIDEO_IS_HDR_VIVID;
484 /* Key for number of audio objects, value type is int32_t, only used in Audio Vivid decoding. */
485 extern const char *OH_MD_KEY_AUDIO_OBJECT_NUMBER;
486 /* Key for meta data of Audio Vivid, value type is a uint8_t pointer, only used in Audio Vivid decoding. */
487 extern const char *OH_MD_KEY_AUDIO_VIVID_METADATA;
488 
489 /**
490  * @brief Key for querying the maximum long-term reference count of video encoder, value type is int32_t.
491  * You should query the count through interface {@link OH_AVCapability_GetFeatureProperties}
492  * with enum {@link VIDEO_ENCODER_LONG_TERM_REFERENCE}.
493  *
494  * @syscap SystemCapability.Multimedia.Media.CodecBase
495  * @since 12
496  */
497 extern const char *OH_FEATURE_PROPERTY_KEY_VIDEO_ENCODER_MAX_LTR_FRAME_COUNT;
498 /**
499  * @brief Key for enable the temporal scalability mode, value type is int32_t (0 or 1): 1 is enabled, 0 otherwise.
500  * The default value is 0. To query supported, you should use the interface {@link OH_AVCapability_IsFeatureSupported}
501  * with enum {@link VIDEO_ENCODER_TEMPORAL_SCALABILITY}. This is an optional key that applies only to video encoding.
502  * It is used in Configure state.
503  *
504  * @syscap SystemCapability.Multimedia.Media.CodecBase
505  * @since 12
506  */
507 extern const char *OH_MD_KEY_VIDEO_ENCODER_ENABLE_TEMPORAL_SCALABILITY;
508 /**
509  * @brief Key for describing the interval size at the base layer in temporal group of picture,
510  * value type is int32_t. It takes effect only when temporal level scale is enable.
511  * This is an optional key that applies only to video encoding. It is used in Configure state.
512  *
513  * @syscap SystemCapability.Multimedia.Media.CodecBase
514  * @since 12
515  */
516 extern const char *OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_SIZE;
517 /**
518  * @brief Key for describing the reference mode in temporal group of picture, value type is int32_t, see enum
519  * {@link OH_TemporalGopReferenceMode}. It takes effect only when temporal level sacle is enabled.
520  * This is an optional key that applies only to video encodeing. It is used in Configure state.
521  *
522  * @syscap SystemCapability.Multimedia.Media.CodecBase
523  * @since 12
524  */
525 extern const char *OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_REFERENCE_MODE;
526 /**
527  * @brief Key for describing the count of used long-term reference frames, value type is int32_t, must be within the
528  * supported range. To get supported range, you should query wthether the capability is supported through the interface
529  * {@link OH_AVCapability_GetFeatureProperties} with enum {@link VIDEO_ENCODER_LONG_TERM_REFERENCE}, otherwise, not set
530  * the key. This is an optional key that applies only to video encodeing. It is used in Configure state.
531  *
532  * @syscap SystemCapability.Multimedia.Media.CodecBase
533  * @since 12
534  */
535 extern const char *OH_MD_KEY_VIDEO_ENCODER_LTR_FRAME_COUNT;
536 /**
537  * @brief Key for describing mark this frame as a long term reference frame, value type is int32_t (0 or 1): 1 is mark,
538  * 0 otherwise. It takes effect only when the number of used long term reference frames is configured. This is an
539  * optional key that applies only to video encoding input loop. It takes effect immediately.
540  *
541  * @syscap SystemCapability.Multimedia.Media.CodecBase
542  * @since 12
543  */
544 extern const char *OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_MARK_LTR;
545 /**
546  * @brief Key for describing the long term reference frame poc referenced by this frame, value type is int32_t. This is
547  * an optional key that applies only to video encodeing input loop. It takes effect immediately.
548  *
549  * @syscap SystemCapability.Multimedia.Media.CodecBase
550  * @since 12
551  */
552 extern const char *OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_USE_LTR;
553 /**
554  * @brief Key for whether the frame corresponding to output buffer in OH_AVBuffer is a long-term reference frame,
555  * value type is int32_t (0 or 1): 1 is LTR,0 otherwise. This is an optional key that applies only
556  * to video encodeing output loop. It indicates the attribute of the frame.
557  *
558  * @syscap SystemCapability.Multimedia.Media.CodecBase
559  * @since 12
560  */
561 extern const char *OH_MD_KEY_VIDEO_PER_FRAME_IS_LTR;
562 /**
563  * @brief Key for describing the frame poc, value type is int32_t. This is an optional key that applies only to video
564  * encodeing output loop. It indicates the attribute of the frame.
565  *
566  * @syscap SystemCapability.Multimedia.Media.CodecBase
567  * @since 12
568  */
569 extern const char *OH_MD_KEY_VIDEO_PER_FRAME_POC;
570 /**
571  * @brief Key for describing the top-coordinate (y) of the crop rectangle, value type is int32_t. This is the top-most
572  * row included in the crop frame, where row indices start at 0. This key is only used for video decoding.
573  *
574  * @syscap SystemCapability.Multimedia.Media.CodecBase
575  * @since 12
576  */
577 extern const char *OH_MD_KEY_VIDEO_CROP_TOP;
578 /**
579  * @brief Key for describing the bottom-coordinate (y) of the crop rectangle, value type is int32_t. This is the
580  * bottom-most row included in the crop frame, where row indices start at 0. This key is only used for video decoding.
581  *
582  * @syscap SystemCapability.Multimedia.Media.CodecBase
583  * @since 12
584  */
585 extern const char *OH_MD_KEY_VIDEO_CROP_BOTTOM;
586 /**
587  * @brief Key for describing the left-coordinate (x) of the crop rectangle, value type is int32_t.
588  * This is the left-most column included in the crop frame, where column indices start at 0.
589  * This key is only used for video decoding.
590  *
591  * @syscap SystemCapability.Multimedia.Media.CodecBase
592  * @since 12
593  */
594 extern const char *OH_MD_KEY_VIDEO_CROP_LEFT;
595 /**
596  * @brief Key for describing the right-coordinate (x) of the crop rectangle, value type is int32_t. This is the
597  * right-most column included in the crop frame, where column indices start at 0.
598  * This key is only used for video decoding.
599  *
600  * @syscap SystemCapability.Multimedia.Media.CodecBase
601  * @since 12
602  */
603 extern const char *OH_MD_KEY_VIDEO_CROP_RIGHT;
604 /**
605  * @brief Key for describing the stride of the video buffer layout, value type is int32_t. Stride (or row increment) is
606  * the difference between the index of a pixel and that of the pixel directly underneath. For YUV 420 formats, the
607  * stride corresponds to the Y plane; the stride of the U and V planes can be calculated based on the color format,
608  * though it is generally undefined and depends on the device and release.
609  *
610  * @syscap SystemCapability.Multimedia.Media.CodecBase
611  * @since 12
612  */
613 extern const char *OH_MD_KEY_VIDEO_STRIDE;
614 /**
615  * @brief Key for describing the plane height of a multi-planar (YUV) video buffer layout, value type is int32_t.
616  * Slice height (or plane height/vertical stride) is the number of rows that must be skipped to get from
617  * the top of the Y plane to the top of the U plane in the buffer. In essence the offset of the U plane
618  * is sliceHeight * stride. The height of the U/V planes can be calculated based on the color format,
619  * though it is generally undefined and depends on the device and release.
620  *
621  * @syscap SystemCapability.Multimedia.Media.CodecBase
622  * @since 12
623  */
624 extern const char *OH_MD_KEY_VIDEO_SLICE_HEIGHT;
625 /**
626  * @brief Key for describing the valid picture width of the video, value type is int32_t.
627  * Get the value from an OH_AVFormat instance, which obtained by calling {@link OH_VideoDecoder_GetOutputDescription}
628  * or {@link OH_AVCodecOnStreamChanged}.
629  *
630  * @syscap SystemCapability.Multimedia.Media.CodecBase
631  * @since 12
632  */
633 extern const char *OH_MD_KEY_VIDEO_PIC_WIDTH;
634 /**
635  * @brief Key for describing the valid picture height of the video, value type is int32_t.
636  * Get the value from an OH_AVFormat instance, which obtained by calling {@link OH_VideoDecoder_GetOutputDescription}
637  * or {@link OH_AVCodecOnStreamChanged}.
638  *
639  * @syscap SystemCapability.Multimedia.Media.CodecBase
640  * @since 12
641  */
642 extern const char *OH_MD_KEY_VIDEO_PIC_HEIGHT;
643 /**
644  * @brief Key to enable the low latency mode, value type is int32_t (0 or 1):1 is enabled, 0 otherwise.
645  * If enabled, the video encoder or video decoder doesn't hold input and output data more than required by
646  * the codec standards. This is an optional key that applies only to video encodeing or video decoding.
647  * It is used in Configure state.
648  *
649  * @syscap SystemCapability.Multimedia.Media.CodecBase
650  * @since 12
651  */
652 extern const char *OH_MD_KEY_VIDEO_ENABLE_LOW_LATENCY;
653 /**
654  * @brief Key for describing the maximum quantization parameter allowed for video encoder, value type is int32_t.
655  * It is used in configure/setparameter or takes effect immediately with the frame.
656  *
657  * @syscap SystemCapability.Multimedia.Media.CodecBase
658  * @since 12
659  */
660 extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_MAX;
661 /**
662  * @brief Key for describing the minimum quantization parameter allowed for video encoder, value type is int32_t.
663  * It is used in configure/setparameter or takes effect immediately with the frame.
664  *
665  * @syscap SystemCapability.Multimedia.Media.CodecBase
666  * @since 12
667  */
668 extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_MIN;
669 /**
670  * @brief Key for describing the video frame averge quantization parameter, value type is int32_t.
671  * Indicate the average qp value of the current frame encoding block, which is output with OH_AVBuffer.
672  *
673  * @syscap SystemCapability.Multimedia.Media.CodecBase
674  * @since 12
675  */
676 extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_AVERAGE;
677 /**
678  * @brief Key for describing video frame mean squared error, value type is double.
679  * Indicate the MSE statistics of the current frame encoding block, which is output with OH_AVBuffer.
680  *
681  * @syscap SystemCapability.Multimedia.Media.CodecBase
682  * @since 12
683  */
684 extern const char *OH_MD_KEY_VIDEO_ENCODER_MSE;
685 /**
686  * @brief Key for decoding timestamp corresponding to the sample of audio, video, or subtitles carried in OH_AVBuffer,
687  * in microseconds, value type is int64_t.
688  *
689  * @syscap SystemCapability.Multimedia.Media.CodecBase
690  * @since 12
691  */
692 extern const char *OH_MD_KEY_DECODING_TIMESTAMP;
693 /**
694  * @brief Key for duration corresponding to the sample of audio, video, or subtitles carried in OH_AVBuffer,
695  * in microseconds, value type is int64_t.
696  *
697  * @syscap SystemCapability.Multimedia.Media.CodecBase
698  * @since 12
699  */
700 extern const char *OH_MD_KEY_BUFFER_DURATION;
701 /**
702  * @brief Key for sample aspect ratio, value type is double.
703  *
704  * @syscap SystemCapability.Multimedia.Media.CodecBase
705  * @since 12
706  */
707 extern const char *OH_MD_KEY_VIDEO_SAR;
708 /**
709  * @brief Key for start time of the first frame in the media file in microseconds, value type is int64_t.
710  *
711  * @syscap SystemCapability.Multimedia.Media.CodecBase
712  * @since 12
713  */
714 extern const char *OH_MD_KEY_START_TIME;
715 /**
716  * @brief Key for start time of track in microseconds, value type is int64_t.
717  *
718  * @syscap SystemCapability.Multimedia.Media.CodecBase
719  * @since 12
720  */
721 extern const char *OH_MD_KEY_TRACK_START_TIME;
722 /**
723  * @brief Key for setting the output color space of video decoder. The value type is int32_t.
724  * The supported value is {@link OH_COLORSPACE_BT709_LIMIT}, see {@link OH_NativeBuffer_ColorSpace}. It is used in
725  * {@link OH_VideoDecoder_Configure}. If the color space conversion capability is supported and this key is configured,
726  * the video decoder will automatically transcode an HDR Vivid video to an SDR video with color space BT709.
727  * If color space conversion capability is not supported, {@link OH_VideoDecoder_Configure} returns
728  * {@link AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION}.
729  * If the input video is not an HDR vivid video, an error {@link AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION} will
730  * be reported by callback function {@link OH_AVCodecOnError}.
731  *
732  * @syscap SystemCapability.Multimedia.Media.CodecBase
733  * @since 12
734  */
735 extern const char *OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACE;
736 /**
737  * @brief Key for describing if enable VRR or not, value type is int32_t (0 or 1): 1 is enabled, 0 otherwise.
738  * This is an optional key that applies only to video decoder. It is used in configure.
739  *
740  * @syscap SystemCapability.Multimedia.Media.CodecBase
741  * @since 14
742  */
743 extern const char *OH_MD_KEY_VIDEO_DECODER_OUTPUT_ENABLE_VRR;
744 /**
745  * @brief Key applies only when configuring a video encoder in surface mode, value type is int32_t.
746  * If no new frame became available since the last frame submitted to the encoder,
747  * it will sumbit the previous frame repeatly in milliseconds. It is used in configure.
748  *
749  * @syscap SystemCapability.Multimedia.Media.CodecBase
750  * @since 18
751  */
752 extern const char *OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER;
753 /**
754  * @brief Key for describing the maximum count that the frame previously submitted to the encoder will be
755  * repeated, in case no new frame has been available since, value type is int32_t. This key takes effect only when
756  * {@link VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER} is vaild. It is used in configure.
757  *
758  * @syscap SystemCapability.Multimedia.Media.CodecBase
759  * @since 18
760  */
761 extern const char *OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNT;
762 /**
763  * @brief Key for creation timestamp of a media file, value type is string.
764  *
765  * @syscap SystemCapability.Multimedia.Media.CodecBase
766  * @since 14
767  */
768 extern const char *OH_MD_KEY_CREATION_TIME;
769 
770 /**
771  * @brief Media type.
772  * @syscap SystemCapability.Multimedia.Media.CodecBase
773  * @since 9
774  * @version 1.0
775  */
776 typedef enum OH_MediaType {
777     /* track is audio. */
778     MEDIA_TYPE_AUD = 0,
779     /* track is video. */
780     MEDIA_TYPE_VID = 1,
781     /** track is subtitle.
782      * @since 12
783      */
784     MEDIA_TYPE_SUBTITLE = 2,
785 } OH_MediaType;
786 
787 /**
788  * @brief AAC Profile
789  * @syscap SystemCapability.Multimedia.Media.CodecBase
790  * @since 9
791  * @version 1.0
792  */
793 typedef enum OH_AACProfile {
794     /** AAC encoding level is Low Complexity levele. */
795     AAC_PROFILE_LC = 0,
796     /** AAC encoding level is High Efficiency levele.
797      * @since 14
798      */
799     AAC_PROFILE_HE = 3,
800     /** AAC encoding level is High Efficiency v2 levele.
801      * @since 14
802      */
803     AAC_PROFILE_HE_V2 = 4,
804 } OH_AACProfile;
805 
806 /**
807  * @brief AVC Profile
808  * @syscap SystemCapability.Multimedia.Media.CodecBase
809  * @since 9
810  * @version 1.0
811  */
812 typedef enum OH_AVCProfile {
813     AVC_PROFILE_BASELINE = 0,
814     AVC_PROFILE_HIGH = 4,
815     AVC_PROFILE_MAIN = 8,
816 } OH_AVCProfile;
817 
818 /**
819  * @brief MPEG2 Profile
820  *
821  * @syscap SystemCapability.Multimedia.Media.CodecBase
822  * @since 17
823  */
824 typedef enum OH_MPEG2Profile {
825     /** Simple profile */
826     MPEG2_PROFILE_SIMPLE  = 0,
827     /** Main profile */
828     MPEG2_PROFILE_MAIN    = 1,
829     /** SNR scalable profile */
830     MPEG2_PROFILE_SNR     = 2,
831     /** Spatially scalable profile */
832     MPEG2_PROFILE_SPATIAL = 3,
833     /** High profile */
834     MPEG2_PROFILE_HIGH    = 4,
835     /** 4:2:2 profile */
836     MPEG2_PROFILE_422     = 5,
837 } OH_MPEG2Profile;
838 
839 /**
840  * @brief MPEG4 Profile
841  *
842  * @syscap SystemCapability.Multimedia.Media.CodecBase
843  * @since 17
844  */
845 typedef enum OH_MPEG4Profile {
846     /** Simple profile */
847     MPEG4_PROFILE_SIMPLE             = 0,
848     /** Simple scalable profile */
849     MPEG4_PROFILE_SIMPLE_SCALABLE    = 1,
850     /** Core profile */
851     MPEG4_PROFILE_CORE               = 2,
852     /** Main profile */
853     MPEG4_PROFILE_MAIN               = 3,
854     /** N-Bit profile */
855     MPEG4_PROFILE_NBIT               = 4,
856     /** Hybrid profile */
857     MPEG4_PROFILE_HYBRID             = 5,
858     /** Basic animated texture profile */
859     MPEG4_PROFILE_BASIC_ANIMATED_TEXTURE = 6,
860     /** Scalable texture profile */
861     MPEG4_PROFILE_SCALABLE_TEXTURE   = 7,
862     /** Simple FA profile */
863     MPEG4_PROFILE_SIMPLE_FA          = 8,
864     /** Advanced real time simple profile */
865     MPEG4_PROFILE_ADVANCED_REAL_TIME_SIMPLE  = 9,
866     /** Core scalable profile */
867     MPEG4_PROFILE_CORE_SCALABLE      = 10,
868     /** Advanced coding efficiency profile */
869     MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 11,
870     /** Advanced core profile */
871     MPEG4_PROFILE_ADVANCED_CORE      = 12,
872     /** Advanced scalable texture profile */
873     MPEG4_PROFILE_ADVANCED_SCALABLE_TEXTURE  = 13,
874     /** Advanced simple profile */
875     MPEG4_PROFILE_ADVANCED_SIMPLE    = 17,
876 } OH_MPEG4Profile;
877 
878 /**
879  * @brief H263 Profile
880  *
881  * @syscap SystemCapability.Multimedia.Media.CodecBase
882  * @since 17
883  */
884 typedef enum OH_H263Profile {
885     /** Baseline profile */
886     H263_PROFILE_BASELINE = 0,
887     /** Version 1 backward compatibility profile */
888     H263_PROFILE_VERSION_1_BACKWARD_COMPATIBILITY = 2,
889 } OH_H263Profile;
890 
891 /**
892  * @brief HEVC Profile.
893  * @syscap SystemCapability.Multimedia.Media.CodecBase
894  * @since 10
895  */
896 typedef enum OH_HEVCProfile {
897     /** HEVC encoding level is the main level. */
898     HEVC_PROFILE_MAIN = 0,
899     /** HEVC encoding level is 10 bit main level. */
900     HEVC_PROFILE_MAIN_10 = 1,
901     /** HEVC encoding level is the main level for still images. */
902     HEVC_PROFILE_MAIN_STILL = 2,
903     /** HEVC encoding level is HDR10 main level.
904      * @deprecated since 14
905     */
906     HEVC_PROFILE_MAIN_10_HDR10 = 3,
907     /** HEVC encoding level is HDR10+ main level.
908      * @deprecated since 14
909     */
910     HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4,
911 } OH_HEVCProfile;
912 
913 /**
914  * @brief VVC Profile: A specified subset of the syntax of VVC.
915  * @syscap SystemCapability.Multimedia.Media.CodecBase
916  * @since 15
917  */
918 typedef enum OH_VVCProfile {
919     /** Main 10 profile */
920     VVC_PROFILE_MAIN_10 = 1,
921     /** Main 12 profile */
922     VVC_PROFILE_MAIN_12 = 2,
923     /** Main 12 Intra profile */
924     VVC_PROFILE_MAIN_12_INTRA = 10,
925     /** Multilayer Main 10 profile */
926     VVC_PROFILE_MULTI_MAIN_10 = 17,
927     /** Main 10 4:4:4 profile */
928     VVC_PROFILE_MAIN_10_444 = 33,
929     /** Main 12 4:4:4 profile */
930     VVC_PROFILE_MAIN_12_444 = 34,
931     /** Main 16 4:4:4 profile */
932     VVC_PROFILE_MAIN_16_444 = 36,
933     /** Main 12 4:4:4 Intra profile */
934     VVC_PROFILE_MAIN_12_444_INTRA = 42,
935     /** Main 16 4:4:4 Intra profile */
936     VVC_PROFILE_MAIN_16_444_INTRA = 44,
937     /** Multilayer Main 10 4:4:4 profile */
938     VVC_PROFILE_MULTI_MAIN_10_444 = 49,
939     /** Main 10 Still Picture profile */
940     VVC_PROFILE_MAIN_10_STILL = 65,
941     /** Main 12 Still Picture profile */
942     VVC_PROFILE_MAIN_12_STILL = 66,
943     /** Main 10 4:4:4 Still Picture profile */
944     VVC_PROFILE_MAIN_10_444_STILL = 97,
945     /** Main 12 4:4:4 Still Picture profile */
946     VVC_PROFILE_MAIN_12_444_STILL = 98,
947     /** Main 16 4:4:4 Still Picture profile */
948     VVC_PROFILE_MAIN_16_444_STILL = 100,
949 } OH_VVCProfile;
950 
951 /**
952  * @brief Enumerates the muxer output file format.
953  * @syscap SystemCapability.Multimedia.Media.CodecBase
954  * @since 10
955  */
956 typedef enum OH_AVOutputFormat {
957     /** Default output file format, default to MP4 format. */
958     AV_OUTPUT_FORMAT_DEFAULT = 0,
959     /** The muxer output MP4 file format. */
960     AV_OUTPUT_FORMAT_MPEG_4 = 2,
961     /** The muxer output M4A file format.*/
962     AV_OUTPUT_FORMAT_M4A = 6,
963     /**
964      * The muxer output amr file format.
965      * @since 12
966      */
967     AV_OUTPUT_FORMAT_AMR = 8,
968     /**
969      * The muxer output mp3 file format.
970      * @since 12
971      */
972     AV_OUTPUT_FORMAT_MP3 = 9,
973     /**
974      * The muxer output wav file format.
975      * @since 12
976      */
977     AV_OUTPUT_FORMAT_WAV = 10,
978     /**
979      * The muxer output aac file format.
980      * @since 18
981      */
982     AV_OUTPUT_FORMAT_AAC = 11,
983 } OH_AVOutputFormat;
984 
985 /**
986  * @brief Seek Mode.
987  * @syscap SystemCapability.Multimedia.Media.CodecBase
988  * @since 10
989  */
990 typedef enum OH_AVSeekMode {
991     /* Seek to sync sample after the time. If there is no I-frame after the time point, the mode may fail to seek. */
992     SEEK_MODE_NEXT_SYNC = 0,
993     /* Seek to sync sample before the time. */
994     SEEK_MODE_PREVIOUS_SYNC,
995     /* Seek to sync sample closest to time. */
996     SEEK_MODE_CLOSEST_SYNC,
997 } OH_AVSeekMode;
998 
999 /**
1000  * @brief Scaling Mode, only used in Surface mode.
1001  * @syscap SystemCapability.Multimedia.Media.CodecBase
1002  * @since 10
1003  * @deprecated since 14
1004  * @useinstead OHScalingModeV2
1005  */
1006 typedef enum OH_ScalingMode {
1007     /* Adaptively adjust the image size based on the window size.
1008      * @deprecated since 14
1009      * @useinstead OH_SCALING_MODE_SCALE_TO_WINDOW_V2
1010     */
1011     SCALING_MODE_SCALE_TO_WINDOW = 1,
1012     /* Crop the image size based on the window size.
1013      * @deprecated since 14
1014      * @useinstead OH_SCALING_MODE_SCALE_CROP_V2
1015      */
1016     SCALING_MODE_SCALE_CROP = 2,
1017 } OH_ScalingMode;
1018 
1019 /**
1020  * @brief enum Audio Bits Per Coded Sample.
1021  * @syscap SystemCapability.Multimedia.Media.CodecBase
1022  * @since 10
1023  */
1024 typedef enum OH_BitsPerSample {
1025     /* 8-bit unsigned integer sampling. */
1026     SAMPLE_U8 = 0,
1027     /* 16-bit signed integer sampling. */
1028     SAMPLE_S16LE = 1,
1029     /* 24-bit signed integer sampling. */
1030     SAMPLE_S24LE = 2,
1031     /* 32-bit signed integer sampling. */
1032     SAMPLE_S32LE = 3,
1033     /* 32-bit float sampling. */
1034     SAMPLE_F32LE = 4,
1035     /* 8-bit unsigned integer plane sampling. */
1036     SAMPLE_U8P = 5,
1037     /* 16-bit unsigned integer plane sampling. */
1038     SAMPLE_S16P = 6,
1039     /* 24-bit unsigned integer plane sampling. */
1040     SAMPLE_S24P = 7,
1041     /* 32-bit unsigned integer plane sampling. */
1042     SAMPLE_S32P = 8,
1043     /* 32-bit float plane sampling. */
1044     SAMPLE_F32P = 9,
1045     /* Invalid sampling format. */
1046     INVALID_WIDTH = -1
1047 } OH_BitsPerSample;
1048 
1049 /**
1050  * @brief Color Primary.
1051  * @syscap SystemCapability.Multimedia.Media.CodecBase
1052  * @since 10
1053  */
1054 typedef enum OH_ColorPrimary {
1055     COLOR_PRIMARY_BT709 = 1,
1056     COLOR_PRIMARY_UNSPECIFIED = 2,
1057     COLOR_PRIMARY_BT470_M = 4,
1058     COLOR_PRIMARY_BT601_625 = 5,
1059     COLOR_PRIMARY_BT601_525 = 6,
1060     COLOR_PRIMARY_SMPTE_ST240 = 7,
1061     COLOR_PRIMARY_GENERIC_FILM = 8,
1062     COLOR_PRIMARY_BT2020 = 9,
1063     COLOR_PRIMARY_SMPTE_ST428 = 10,
1064     COLOR_PRIMARY_P3DCI = 11,
1065     COLOR_PRIMARY_P3D65 = 12,
1066 } OH_ColorPrimary;
1067 
1068 /**
1069  * @brief Transfer Characteristic, both encoding and decoding are supported.
1070  * @syscap SystemCapability.Multimedia.Media.CodecBase
1071  * @since 10
1072  */
1073 typedef enum OH_TransferCharacteristic {
1074     /* BT709 transfer function. */
1075     TRANSFER_CHARACTERISTIC_BT709 = 1,
1076     /* transfer function not specified. */
1077     TRANSFER_CHARACTERISTIC_UNSPECIFIED = 2,
1078     /* GAMMA_2_2 transfer function. */
1079     TRANSFER_CHARACTERISTIC_GAMMA_2_2 = 4,
1080     /* GAMMA_2_8 transfer function. */
1081     TRANSFER_CHARACTERISTIC_GAMMA_2_8 = 5,
1082     /* BT601 transfer function. */
1083     TRANSFER_CHARACTERISTIC_BT601 = 6,
1084     /* SMPTE_ST240 transfer function. */
1085     TRANSFER_CHARACTERISTIC_SMPTE_ST240 = 7,
1086     /* LINEAR transfer function. */
1087     TRANSFER_CHARACTERISTIC_LINEAR = 8,
1088     /* LOG transfer function. */
1089     TRANSFER_CHARACTERISTIC_LOG = 9,
1090     /* LOG_SQRT transfer function. */
1091     TRANSFER_CHARACTERISTIC_LOG_SQRT = 10,
1092     /* IEC_61966_2_4 transfer function. */
1093     TRANSFER_CHARACTERISTIC_IEC_61966_2_4 = 11,
1094     /* BT1361 transfer function. */
1095     TRANSFER_CHARACTERISTIC_BT1361 = 12,
1096     /* IEC_61966_2_1 transfer function. */
1097     TRANSFER_CHARACTERISTIC_IEC_61966_2_1 = 13,
1098     /* BT2020_10BIT transfer function. */
1099     TRANSFER_CHARACTERISTIC_BT2020_10BIT = 14,
1100     /* BT2020_12BIT transfer function. */
1101     TRANSFER_CHARACTERISTIC_BT2020_12BIT = 15,
1102     /* PQ transfer function. */
1103     TRANSFER_CHARACTERISTIC_PQ = 16,
1104     /* SMPTE_ST428 transfer function. */
1105     TRANSFER_CHARACTERISTIC_SMPTE_ST428 = 17,
1106     /* HLG transfer function. */
1107     TRANSFER_CHARACTERISTIC_HLG = 18,
1108 } OH_TransferCharacteristic;
1109 
1110 /**
1111  * @brief Matrix Coefficient, both encoding and decoding are supported.
1112  * @syscap SystemCapability.Multimedia.Media.CodecBase
1113  * @since 10
1114  */
1115 typedef enum OH_MatrixCoefficient {
1116     /* Unit matrix. */
1117     MATRIX_COEFFICIENT_IDENTITY = 0,
1118     /* BT709 conversion matrix. */
1119     MATRIX_COEFFICIENT_BT709 = 1,
1120     /* Conversion matrix not specified. */
1121     MATRIX_COEFFICIENT_UNSPECIFIED = 2,
1122     /* FCC conversion matrix. */
1123     MATRIX_COEFFICIENT_FCC = 4,
1124     /* BT601_625 conversion matrix. */
1125     MATRIX_COEFFICIENT_BT601_625 = 5,
1126     /* BT601_525 conversion matrix. */
1127     MATRIX_COEFFICIENT_BT601_525 = 6,
1128     /* SMPTE_ST240  conversion matrix. */
1129     MATRIX_COEFFICIENT_SMPTE_ST240 = 7,
1130     /* YCGCO conversion matrix. */
1131     MATRIX_COEFFICIENT_YCGCO = 8,
1132     /* BT2020_NCL conversion matrix. */
1133     MATRIX_COEFFICIENT_BT2020_NCL = 9,
1134     /* BT2020_CL conversion matrix. */
1135     MATRIX_COEFFICIENT_BT2020_CL = 10,
1136     /* SMPTE_ST2085 conversion matrix. */
1137     MATRIX_COEFFICIENT_SMPTE_ST2085 = 11,
1138     /* CHROMATICITY_NCL conversion matrix. */
1139     MATRIX_COEFFICIENT_CHROMATICITY_NCL = 12,
1140     /* CHROMATICITY_CL conversion matrix. */
1141     MATRIX_COEFFICIENT_CHROMATICITY_CL = 13,
1142     /* ICTCP conversion matrix. */
1143     MATRIX_COEFFICIENT_ICTCP = 14,
1144 } OH_MatrixCoefficient;
1145 
1146 /**
1147  * @brief MPEG2 Level.
1148  *
1149  * @syscap SystemCapability.Multimedia.Media.CodecBase
1150  * @since 17
1151  */
1152 typedef enum OH_MPEG2Level {
1153     /** Low level */
1154     MPEG2_LEVEL_LL  = 0,
1155     /** Main level */
1156     MPEG2_LEVEL_ML  = 1,
1157     /** High 1440 level */
1158     MPEG2_LEVEL_H14 = 2,
1159     /** High level */
1160     MPEG2_LEVEL_HL  = 3,
1161 }OH_MPEG2Level;
1162 
1163 /**
1164  * @brief MPEG4 Level.
1165  *
1166  * @syscap SystemCapability.Multimedia.Media.CodecBase
1167  * @since 17
1168  */
1169 typedef enum OH_MPEG4Level {
1170     /** 0 level */
1171     MPEG4_LEVEL_0  = 0,
1172     /** 0B level */
1173     MPEG4_LEVEL_0B = 1,
1174     /** 1 level */
1175     MPEG4_LEVEL_1  = 2,
1176     /** 2 level */
1177     MPEG4_LEVEL_2  = 3,
1178     /** 3 level */
1179     MPEG4_LEVEL_3  = 4,
1180      /** 3B level */
1181     MPEG4_LEVEL_3B = 5,
1182     /** 4 level */
1183     MPEG4_LEVEL_4  = 6,
1184     /** 4A level */
1185     MPEG4_LEVEL_4A = 7,
1186     /** 5 level */
1187     MPEG4_LEVEL_5  = 8,
1188     /** 6 level */
1189     MPEG4_LEVEL_6  = 9,
1190 }OH_MPEG4Level;
1191 
1192 /**
1193  * @brief H263 Level.
1194  *
1195  * @syscap SystemCapability.Multimedia.Media.CodecBase
1196  * @since 17
1197  */
1198 typedef enum OH_H263Level {
1199     /** 10 level */
1200     H263_LEVEL_10 = 0,
1201     /** 20 level */
1202     H263_LEVEL_20 = 1,
1203     /** 30 level */
1204     H263_LEVEL_30 = 2,
1205     /** 40 level */
1206     H263_LEVEL_40 = 3,
1207     /** 45 level */
1208     H263_LEVEL_45 = 4,
1209     /** 50 level */
1210     H263_LEVEL_50 = 5,
1211     /** 60 level */
1212     H263_LEVEL_60 = 6,
1213     /** 70 level */
1214     H263_LEVEL_70 = 7
1215 } OH_H263Level;
1216 
1217 /**
1218  * @brief AVC Level.
1219  *
1220  * @syscap SystemCapability.Multimedia.Media.CodecBase
1221  * @since 12
1222  */
1223 typedef enum OH_AVCLevel {
1224     AVC_LEVEL_1 = 0,
1225     AVC_LEVEL_1b = 1,
1226     AVC_LEVEL_11 = 2,
1227     AVC_LEVEL_12 = 3,
1228     AVC_LEVEL_13 = 4,
1229     AVC_LEVEL_2 = 5,
1230     AVC_LEVEL_21 = 6,
1231     AVC_LEVEL_22 = 7,
1232     AVC_LEVEL_3 = 8,
1233     AVC_LEVEL_31 = 9,
1234     AVC_LEVEL_32 = 10,
1235     AVC_LEVEL_4 = 11,
1236     AVC_LEVEL_41 = 12,
1237     AVC_LEVEL_42 = 13,
1238     AVC_LEVEL_5 = 14,
1239     AVC_LEVEL_51 = 15,
1240     AVC_LEVEL_52 = 16,
1241     AVC_LEVEL_6 = 17,
1242     AVC_LEVEL_61 = 18,
1243     AVC_LEVEL_62 = 19,
1244 } OH_AVCLevel;
1245 
1246 /**
1247  * @brief HEVC Level.
1248  *
1249  * @syscap SystemCapability.Multimedia.Media.CodecBase
1250  * @since 12
1251  */
1252 typedef enum OH_HEVCLevel {
1253     HEVC_LEVEL_1 = 0,
1254     HEVC_LEVEL_2 = 1,
1255     HEVC_LEVEL_21 = 2,
1256     HEVC_LEVEL_3 = 3,
1257     HEVC_LEVEL_31 = 4,
1258     HEVC_LEVEL_4 = 5,
1259     HEVC_LEVEL_41 = 6,
1260     HEVC_LEVEL_5 = 7,
1261     HEVC_LEVEL_51 = 8,
1262     HEVC_LEVEL_52 = 9,
1263     HEVC_LEVEL_6 = 10,
1264     HEVC_LEVEL_61 = 11,
1265     HEVC_LEVEL_62 = 12,
1266 } OH_HEVCLevel;
1267 
1268 /**
1269  * @brief VVC Level: A defined set of constraints on the values that may be taken by the syntax elements and variables
1270  * of VVC, or the value of a transform coefficient prior to scaling.
1271  *
1272  * @syscap SystemCapability.Multimedia.Media.CodecBase
1273  * @since 15
1274  */
1275 typedef enum OH_VVCLevel {
1276     /** VVC level 1.0 */
1277     VVC_LEVEL_1 = 16,
1278     /** VVC level 2.0 */
1279     VVC_LEVEL_2 = 32,
1280     /** VVC level 2.1 */
1281     VVC_LEVEL_21 = 35,
1282     /** VVC level 3.0 */
1283     VVC_LEVEL_3 = 48,
1284     /** VVC level 3.1 */
1285     VVC_LEVEL_31 = 51,
1286     /** VVC level 4.0 */
1287     VVC_LEVEL_4 = 64,
1288     /** VVC level 4.1 */
1289     VVC_LEVEL_41 = 67,
1290     /** VVC level 5.0 */
1291     VVC_LEVEL_5 = 80,
1292     /** VVC level 5.1 */
1293     VVC_LEVEL_51 = 83,
1294     /** VVC level 5.2 */
1295     VVC_LEVEL_52 = 86,
1296     /** VVC level 6.0 */
1297     VVC_LEVEL_6 = 96,
1298     /** VVC level 6.1 */
1299     VVC_LEVEL_61 = 99,
1300     /** VVC level 6.2 */
1301     VVC_LEVEL_62 = 102,
1302     /** VVC level 6.3 */
1303     VVC_LEVEL_63 = 105,
1304     /** VVC level 15.5 */
1305     VVC_LEVEL_155 = 255,
1306 } OH_VVCLevel;
1307 
1308 /**
1309  * @brief The bitrate mode of encoder.
1310  * @syscap SystemCapability.Multimedia.Media.CodecBase
1311  * @since 10
1312  */
1313 typedef enum OH_BitrateMode {
1314     /* Constant Bit rate mode. */
1315     BITRATE_MODE_CBR = 0,
1316     /* Variable Bit rate mode. */
1317     BITRATE_MODE_VBR = 1,
1318     /* Constant Quality mode. */
1319     BITRATE_MODE_CQ = 2
1320 } OH_BitrateMode;
1321 
1322 /**
1323  * @brief The reference mode in temporal group of picture.
1324  *
1325  * @syscap SystemCapability.Multimedia.Media.CodecBase
1326  * @since 12
1327  */
1328 typedef enum OH_TemporalGopReferenceMode {
1329     /** Refer to latest short-term reference frame. */
1330     ADJACENT_REFERENCE = 0,
1331     /** Refer to latest long-term reference frame. */
1332     JUMP_REFERENCE = 1,
1333     /** Uniformly scaled reference structure, which has even distribution of video frames after drop the highest
1334      *  enhance layer. The temporal group of pictures must be power of 2. */
1335     UNIFORMLY_SCALED_REFERENCE = 2,
1336 } OH_TemporalGopReferenceMode;
1337 
1338 #ifdef __cplusplus
1339 }
1340 #endif
1341 
1342 #endif // NATIVE_AVCODEC_BASE_H
1343 /** @} */