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 Core 18 * @{ 19 * 20 * @brief The Core module provides basic backbone capabilities for media frameworks, 21 * including functions such as memory, error codes, and media data structures. 22 * 23 * @syscap SystemCapability.Multimedia.Media.Core 24 * @since 9 25 */ 26 27 /** 28 * @file native_avbuffer_info.h 29 * 30 * @brief Declared the definition of the AVBuffer property for media data structures. 31 * 32 * @kit AVCodecKit 33 * @library libnative_media_core.so 34 * @syscap SystemCapability.Multimedia.Media.Core 35 * @since 9 36 */ 37 38 #ifndef NATIVE_AVBUFFER_INFO_H 39 #define NATIVE_AVBUFFER_INFO_H 40 41 #include <stdint.h> 42 #include <stdio.h> 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 /** 48 * @brief Enumerate the categories of OH_AVCodec's Buffer tags. 49 * @syscap SystemCapability.Multimedia.Media.Core 50 * @since 9 51 */ 52 typedef enum OH_AVCodecBufferFlags { 53 AVCODEC_BUFFER_FLAGS_NONE = 0, 54 /** Indicates that the Buffer is an End-of-Stream frame. */ 55 AVCODEC_BUFFER_FLAGS_EOS = 1 << 0, 56 /** Indicates that the Buffer contains keyframes. */ 57 AVCODEC_BUFFER_FLAGS_SYNC_FRAME = 1 << 1, 58 /** Indicates that the data contained in the Buffer is only part of a frame. */ 59 AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2, 60 /** Indicates that the Buffer contains Codec-Specific-Data. */ 61 AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3, 62 /** Flag is used to discard packets which are required to maintain valid decoder state but are not required 63 * for output and should be dropped after decoding. 64 * @since 12 65 */ 66 AVCODEC_BUFFER_FLAGS_DISCARD = 1 << 4, 67 /** Flag is used to indicate packets that contain frames that can be discarded by the decoder, 68 * I.e. Non-reference frames. 69 * @since 12 70 */ 71 AVCODEC_BUFFER_FLAGS_DISPOSABLE = 1 << 5, 72 } OH_AVCodecBufferFlags; 73 74 /** 75 * @brief Define the Buffer description information of OH_AVCodec 76 * @syscap SystemCapability.Multimedia.Media.Core 77 * @since 9 78 */ 79 typedef struct OH_AVCodecBufferAttr { 80 /* Presentation timestamp of this Buffer in microseconds */ 81 int64_t pts; 82 /* The size of the data contained in the Buffer in bytes */ 83 int32_t size; 84 /* The starting offset of valid data in this Buffer */ 85 int32_t offset; 86 /* The flags this Buffer has, which is also a combination of multiple {@link OH_AVCodecBufferFlags}. */ 87 uint32_t flags; 88 } OH_AVCodecBufferAttr; 89 90 #ifdef __cplusplus 91 } 92 #endif 93 94 #endif // NATIVE_AVBUFFER_INFO_H 95 /** @} */ 96