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