1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef NATIVE_AVBUFFER_INFO_H 17 #define NATIVE_AVBUFFER_INFO_H 18 19 #include <stdint.h> 20 #include <stdio.h> 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 /** 26 * @brief Enumerate the categories of OH_AVCodec's Buffer tags. 27 * @syscap SystemCapability.Multimedia.Media.Core 28 * @since 9 29 */ 30 typedef enum OH_AVCodecBufferFlags { 31 AVCODEC_BUFFER_FLAGS_NONE = 0, 32 /** Indicates that the Buffer is an End-of-Stream frame. */ 33 AVCODEC_BUFFER_FLAGS_EOS = 1 << 0, 34 /** Indicates that the Buffer contains keyframes. */ 35 AVCODEC_BUFFER_FLAGS_SYNC_FRAME = 1 << 1, 36 /** Indicates that the data contained in the Buffer is only part of a frame. */ 37 AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2, 38 /** Indicates that the Buffer contains Codec-Specific-Data. */ 39 AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3, 40 /** Flag is used to discard packets which are required to maintain valid decoder state but are not required 41 * for output and should be dropped after decoding. 42 * @since 12 43 */ 44 AVCODEC_BUFFER_FLAGS_DISCARD = 1 << 4, 45 /** Flag is used to indicate packets that contain frames that can be discarded by the decoder, 46 * I.e. Non-reference frames. 47 * @since 12 48 */ 49 AVCODEC_BUFFER_FLAGS_DISPOSABLE = 1 << 5, 50 } OH_AVCodecBufferFlags; 51 52 /** 53 * @brief Define the Buffer description information of OH_AVCodec 54 * @syscap SystemCapability.Multimedia.Media.Core 55 * @since 9 56 */ 57 typedef struct OH_AVCodecBufferAttr { 58 /* Presentation timestamp of this Buffer in microseconds */ 59 int64_t pts; 60 /* The size of the data contained in the Buffer in bytes */ 61 int32_t size; 62 /* The starting offset of valid data in this Buffer */ 63 int32_t offset; 64 /* The flags this Buffer has, which is also a combination of multiple {@link OH_AVCodecBufferFlags}. */ 65 uint32_t flags; 66 } OH_AVCodecBufferAttr; 67 68 #ifdef __cplusplus 69 } 70 #endif 71 72 #endif // NATIVE_AVBUFFER_INFO_H 73