• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Core
2
3
4## Overview
5
6The **Core** module provides the basic backbone capabilities for the media playback framework, including functions related to the memory, error code, format carrier, and media struct.
7
8**System capability**: SystemCapability.Multimedia.Media.Core
9
10**Since**: 9
11
12
13## Summary
14
15
16### Files
17
18| Name| Description|
19| -------- | -------- |
20| [native_audio_channel_layout.h](native__audio__channel__layout_8h.md) | Declares the audio channel layout, which is used to indicate the appearance and sequence of speakers during recording or playback.|
21| [native_avbuffer.h](native__avbuffer_8h.md) | Declares the functions of the media struct **AVBuffer**.|
22| [native_avbuffer_info.h](native__avbuffer__info_8h.md) | Declares the attribute definition of the media struct **AVBuffer**.|
23| [native_averrors.h](native__averrors_8h.md) | Defines the error code **OH_AVErrCode** of the multimedia subsystem.|
24| [native_avformat.h](native__avformat_8h.md) | Declares the format-related functions and enums.|
25| [native_avmemory.h](native__avmemory_8h.md) | Declares the attribute definition of the media struct **AVMemory**.|
26
27
28### Structs
29
30| Name| Description|
31| -------- | -------- |
32| struct  [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) | Defines the description information about the buffer of an **OH_AVCodec** instance.|
33
34
35### Types
36
37| Name| Description|
38| -------- | -------- |
39| typedef enum [OH_AudioChannelSet](#oh_audiochannelset)[OH_AudioChannelSet](#oh_audiochannelset) | Defines an enum that enumerates the audio channel sets.|
40| typedef enum [OH_AmbAttributeSet](#oh_ambattributeset)[OH_AmbAttributeSet](#oh_ambattributeset) | Defines an enum that enumerates the Hi-Fi stereo reverberation settings.|
41| typedef enum [OH_AudioChannelLayout](#oh_audiochannellayout)[OH_AudioChannelLayout](#oh_audiochannellayout) | Defines an enum that enumerates the audio channel layouts.|
42| typedef enum [OH_AVCodecBufferFlags](#oh_avcodecbufferflags)[OH_AVCodecBufferFlags](#oh_avcodecbufferflags) | Defines an enum that enumerates the flags for the buffer of an **OH_AVCodec** instance.|
43| typedef struct [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md)[OH_AVCodecBufferAttr](#oh_avcodecbufferattr) | Defines the description information about the buffer of an **OH_AVCodec** instance.|
44| typedef enum [OH_AVErrCode](#oh_averrcode)[OH_AVErrCode](#oh_averrcode) | Defines an enum that enumerates the audio and video error codes.|
45| typedef enum [OH_AVPixelFormat](#oh_avpixelformat)[OH_AVPixelFormat](#oh_avpixelformat) | Defines an enum that enumerates the video pixel formats.|
46
47
48### Enums
49
50| Name| Description|
51| -------- | -------- |
52| [OH_AudioChannelSet](#oh_audiochannelset) {<br>CH_SET_FRONT_LEFT = 1ULL &lt;&lt; 0U,<br>CH_SET_FRONT_RIGHT = 1ULL &lt;&lt; 1U,<br>CH_SET_FRONT_CENTER = 1ULL &lt;&lt; 2U,<br>CH_SET_LOW_FREQUENCY = 1ULL &lt;&lt; 3U,<br>CH_SET_BACK_LEFT = 1ULL &lt;&lt; 4U,<br>CH_SET_BACK_RIGHT = 1ULL &lt;&lt; 5U,<br>CH_SET_FRONT_LEFT_OF_CENTER = 1ULL &lt;&lt; 6U,<br>CH_SET_FRONT_RIGHT_OF_CENTER = 1ULL &lt;&lt; 7U,<br>CH_SET_BACK_CENTER = 1ULL &lt;&lt; 8U,<br>CH_SET_SIDE_LEFT = 1ULL &lt;&lt; 9U,<br>CH_SET_SIDE_RIGHT = 1ULL &lt;&lt; 10U,<br>CH_SET_TOP_CENTER = 1ULL &lt;&lt; 11U,<br>CH_SET_TOP_FRONT_LEFT = 1ULL &lt;&lt; 12U,<br>CH_SET_TOP_FRONT_CENTER = 1ULL &lt;&lt; 13U,<br>CH_SET_TOP_FRONT_RIGHT = 1ULL &lt;&lt; 14U,<br>CH_SET_TOP_BACK_LEFT = 1ULL &lt;&lt; 15U,<br>CH_SET_TOP_BACK_CENTER = 1ULL &lt;&lt; 16U,<br>CH_SET_TOP_BACK_RIGHT = 1ULL &lt;&lt; 17U,<br>CH_SET_STEREO_LEFT = 1ULL &lt;&lt; 29U,<br>CH_SET_STEREO_RIGHT = 1ULL &lt;&lt; 30U,<br>CH_SET_WIDE_LEFT = 1ULL &lt;&lt; 31U,<br>CH_SET_WIDE_RIGHT = 1ULL &lt;&lt; 32U,<br>CH_SET_SURROUND_DIRECT_LEFT = 1ULL &lt;&lt; 33U,<br>CH_SET_SURROUND_DIRECT_RIGHT = 1ULL &lt;&lt; 34U,<br>CH_SET_LOW_FREQUENCY_2 = 1ULL &lt;&lt; 35U,<br>CH_SET_TOP_SIDE_LEFT = 1ULL &lt;&lt; 36U,<br>CH_SET_TOP_SIDE_RIGHT = 1ULL &lt;&lt; 37U,<br>CH_SET_BOTTOM_FRONT_CENTER = 1ULL &lt;&lt; 38U,<br>CH_SET_BOTTOM_FRONT_LEFT = 1ULL &lt;&lt; 39U,<br>CH_SET_BOTTOM_FRONT_RIGHT = 1ULL &lt;&lt; 40U<br>} | Enumerates the audio channel sets.|
53| [OH_AmbAttributeSet](#oh_ambattributeset) {<br>AMB_ORD_1 = 1ULL &lt;&lt; 0U,<br>AMB_ORD_2 = 2ULL &lt;&lt; 0U,<br>AMB_ORD_3 = 3ULL &lt;&lt; 0U,<br>AMB_COM_ACN = 0ULL &lt;&lt; 8U,<br>AMB_COM_FUMA = 1ULL &lt;&lt; 8U,<br>AMB_NOR_N3D = 0ULL &lt;&lt; 12U,<br>AMB_NOR_SN3D = 1ULL &lt;&lt; 12U,<br>AMB_MODE = 1ULL &lt;&lt; 44U<br>} | Enumerates the Hi-Fi stereo reverberation settings.|
54| [OH_AudioChannelLayout](#oh_audiochannellayout) {<br>CH_LAYOUT_UNKNOWN = 0ULL,<br>CH_LAYOUT_MONO = CH_SET_FRONT_CENTER,<br>CH_LAYOUT_STEREO = CH_SET_FRONT_LEFT \| CH_SET_FRONT_RIGHT,<br>CH_LAYOUT_STEREO_DOWNMIX = CH_SET_STEREO_LEFT \| CH_SET_STEREO_RIGHT,<br>CH_LAYOUT_2POINT1 = CH_LAYOUT_STEREO \| CH_SET_LOW_FREQUENCY,<br>CH_LAYOUT_3POINT0 = CH_LAYOUT_STEREO \| CH_SET_BACK_CENTER,<br>CH_LAYOUT_SURROUND = CH_LAYOUT_STEREO \| CH_SET_FRONT_CENTER,<br>CH_LAYOUT_3POINT1 = CH_LAYOUT_SURROUND \| CH_SET_LOW_FREQUENCY,<br>CH_LAYOUT_4POINT0 = CH_LAYOUT_SURROUND \| CH_SET_BACK_CENTER,<br>CH_LAYOUT_QUAD_SIDE = CH_LAYOUT_STEREO \| CH_SET_SIDE_LEFT \| CH_SET_SIDE_RIGHT,<br>CH_LAYOUT_QUAD = CH_LAYOUT_STEREO \| CH_SET_BACK_LEFT \| CH_SET_BACK_RIGHT,<br>CH_LAYOUT_2POINT0POINT2 = CH_LAYOUT_STEREO \| CH_SET_TOP_SIDE_LEFT \| CH_SET_TOP_SIDE_RIGHT,<br>CH_LAYOUT_AMB_ORDER1_ACN_N3D = AMB_MODE \| AMB_ORD_1 \| AMB_COM_ACN \| AMB_NOR_N3D, CH_LAYOUT_AMB_ORDER1_ACN_SN3D = AMB_MODE \| AMB_ORD_1 \| AMB_COM_ACN \| AMB_NOR_SN3D,<br>CH_LAYOUT_AMB_ORDER1_FUMA = AMB_MODE \| AMB_ORD_1 \| AMB_COM_FUMA,<br>CH_LAYOUT_4POINT1 = CH_LAYOUT_4POINT0 \| CH_SET_LOW_FREQUENCY,<br>CH_LAYOUT_5POINT0 = CH_LAYOUT_SURROUND \| CH_SET_SIDE_LEFT \| CH_SET_SIDE_RIGHT,<br>CH_LAYOUT_5POINT0_BACK = CH_LAYOUT_SURROUND \| CH_SET_BACK_LEFT \| CH_SET_BACK_RIGHT,<br>CH_LAYOUT_2POINT1POINT2 = CH_LAYOUT_2POINT0POINT2 \| CH_SET_LOW_FREQUENCY,<br>CH_LAYOUT_3POINT0POINT2 = CH_LAYOUT_2POINT0POINT2 \| CH_SET_FRONT_CENTER,<br>CH_LAYOUT_5POINT1 = CH_LAYOUT_5POINT0 \| CH_SET_LOW_FREQUENCY,<br>CH_LAYOUT_5POINT1_BACK = CH_LAYOUT_5POINT0_BACK \| CH_SET_LOW_FREQUENCY,<br>CH_LAYOUT_6POINT0 = CH_LAYOUT_5POINT0 \| CH_SET_BACK_CENTER,<br>CH_LAYOUT_3POINT1POINT2 = CH_LAYOUT_3POINT1 \| CH_SET_TOP_FRONT_LEFT \| CH_SET_TOP_FRONT_RIGHT,<br>CH_LAYOUT_6POINT0_FRONT = CH_LAYOUT_QUAD_SIDE \| CH_SET_FRONT_LEFT_OF_CENTER \| CH_SET_FRONT_RIGHT_OF_CENTER,<br>CH_LAYOUT_HEXAGONAL = CH_LAYOUT_5POINT0_BACK \| CH_SET_BACK_CENTER,<br>CH_LAYOUT_6POINT1 = CH_LAYOUT_5POINT1 \| CH_SET_BACK_CENTER,<br>CH_LAYOUT_6POINT1_BACK = CH_LAYOUT_5POINT1_BACK \| CH_SET_BACK_CENTER,<br>CH_LAYOUT_6POINT1_FRONT = CH_LAYOUT_6POINT0_FRONT \| CH_SET_LOW_FREQUENCY,<br>CH_LAYOUT_7POINT0 = CH_LAYOUT_5POINT0 \| CH_SET_BACK_LEFT \| CH_SET_BACK_RIGHT,<br>CH_LAYOUT_7POINT0_FRONT = CH_LAYOUT_5POINT0 \| CH_SET_FRONT_LEFT_OF_CENTER \| CH_SET_FRONT_RIGHT_OF_CENTER,<br>CH_LAYOUT_7POINT1 = CH_LAYOUT_5POINT1 \| CH_SET_BACK_LEFT \| CH_SET_BACK_RIGHT,<br>CH_LAYOUT_OCTAGONAL = CH_LAYOUT_5POINT0 \| CH_SET_BACK_LEFT \| CH_SET_BACK_CENTER \| CH_SET_BACK_RIGHT,<br>CH_LAYOUT_5POINT1POINT2 = CH_LAYOUT_5POINT1 \| CH_SET_TOP_SIDE_LEFT \| CH_SET_TOP_SIDE_RIGHT,<br>CH_LAYOUT_7POINT1_WIDE = CH_LAYOUT_5POINT1 \| CH_SET_FRONT_LEFT_OF_CENTER \| CH_SET_FRONT_RIGHT_OF_CENTER,<br>CH_LAYOUT_7POINT1_WIDE_BACK = CH_LAYOUT_5POINT1_BACK \| CH_SET_FRONT_LEFT_OF_CENTER \| CH_SET_FRONT_RIGHT_OF_CENTER,<br>CH_LAYOUT_AMB_ORDER2_ACN_N3D = AMB_MODE \| AMB_ORD_2 \| AMB_COM_ACN \| AMB_NOR_N3D,<br>CH_LAYOUT_AMB_ORDER2_ACN_SN3D = AMB_MODE \| AMB_ORD_2 \| AMB_COM_ACN \| AMB_NOR_SN3D,<br>CH_LAYOUT_AMB_ORDER2_FUMA = AMB_MODE \| AMB_ORD_2 \| AMB_COM_FUMA,<br>CH_LAYOUT_5POINT1POINT4,<br>CH_LAYOUT_7POINT1POINT2 = CH_LAYOUT_7POINT1 \| CH_SET_TOP_SIDE_LEFT \| CH_SET_TOP_SIDE_RIGHT,<br>CH_LAYOUT_7POINT1POINT4,<br>CH_LAYOUT_10POINT2,<br>CH_LAYOUT_9POINT1POINT4 = CH_LAYOUT_7POINT1POINT4 \| CH_SET_WIDE_LEFT \| CH_SET_WIDE_RIGHT,<br>CH_LAYOUT_9POINT1POINT6 = CH_LAYOUT_9POINT1POINT4 \| CH_SET_TOP_SIDE_LEFT \| CH_SET_TOP_SIDE_RIGHT,<br>CH_LAYOUT_HEXADECAGONAL,<br>CH_LAYOUT_AMB_ORDER3_ACN_N3D = AMB_MODE \| AMB_ORD_3 \| AMB_COM_ACN \| AMB_NOR_N3D,<br>CH_LAYOUT_AMB_ORDER3_ACN_SN3D = AMB_MODE \| AMB_ORD_3 \| AMB_COM_ACN \| AMB_NOR_SN3D,<br>CH_LAYOUT_AMB_ORDER3_FUMA = AMB_MODE \| AMB_ORD_3 \| AMB_COM_FUMA,<br>CH_LAYOUT_22POINT2<br>} | Enumerates the audio channel layouts.|
55| [OH_AVCodecBufferFlags](#oh_avcodecbufferflags) {<br>AVCODEC_BUFFER_FLAGS_NONE = 0,<br>AVCODEC_BUFFER_FLAGS_EOS = 1 &lt;&lt; 0, AVCODEC_BUFFER_FLAGS_SYNC_FRAME = 1 &lt;&lt; 1, AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 &lt;&lt; 2,<br>AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 &lt;&lt; 3<br>} | Enumerates the flags for the buffer of an **OH_AVCodec** instance.|
56| [OH_AVErrCode](#oh_averrcode) {<br>AV_ERR_OK = 0,<br>AV_ERR_NO_MEMORY = 1,<br>AV_ERR_OPERATE_NOT_PERMIT = 2,<br>AV_ERR_INVALID_VAL = 3,<br>AV_ERR_IO = 4,<br>AV_ERR_TIMEOUT = 5,<br>AV_ERR_UNKNOWN = 6,<br>AV_ERR_SERVICE_DIED = 7,<br>AV_ERR_INVALID_STATE = 8,<br>AV_ERR_UNSUPPORT = 9,<br>AV_ERR_EXTEND_START = 100<br>} | Enumerates the audio and video error codes.|
57| [OH_AVPixelFormat](#oh_avpixelformat) {<br>AV_PIXEL_FORMAT_YUVI420 = 1,<br>AV_PIXEL_FORMAT_NV12 = 2,<br>AV_PIXEL_FORMAT_NV21 = 3,<br>AV_PIXEL_FORMAT_SURFACE_FORMAT = 4,<br>AV_PIXEL_FORMAT_RGBA = 5<br>} | Enumerates the video pixel formats.|
58
59
60### Functions
61
62| Name| Description|
63| -------- | -------- |
64| OH_AVBuffer \* [OH_AVBuffer_Create](#oh_avbuffer_create) (int32_t capacity) | Creates an **OH_AVBuffer** instance. The caller must call [OH_AVBuffer_Destroy](oh_avbuffer_destroy) to manually release the **OH_AVBuffer** instance returned.|
65| [OH_AVErrCode](#oh_averrcode)[OH_AVBuffer_Destroy](#oh_avbuffer_destroy) (OH_AVBuffer \*buffer) | Releases an **OH_AVBuffer** instance.|
66| [OH_AVErrCode](#oh_averrcode)[OH_AVBuffer_GetBufferAttr](#oh_avbuffer_getbufferattr) (OH_AVBuffer \*buffer, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) \*attr) | Obtains the high-frequency attribute of a data buffer.|
67| [OH_AVErrCode](#oh_averrcode)[OH_AVBuffer_SetBufferAttr](#oh_avbuffer_setbufferattr) (OH_AVBuffer \*buffer, const [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) \*attr) | Sets the high-frequency attribute for a data buffer.|
68| OH_AVFormat \* [OH_AVBuffer_GetParameter](#oh_avbuffer_getparameter) (OH_AVBuffer \*buffer) | Obtains the frame parameter of a data buffer.|
69| [OH_AVErrCode](#oh_averrcode)[OH_AVBuffer_SetParameter](#oh_avbuffer_setparameter) (OH_AVBuffer \*buffer, const OH_AVFormat \*format) | Sets the frame parameter for a data buffer.|
70| uint8_t \* [OH_AVBuffer_GetAddr](#oh_avbuffer_getaddr) (OH_AVBuffer \*buffer) | Obtains the virtual address of a data buffer.|
71| int32_t [OH_AVBuffer_GetCapacity](#oh_avbuffer_getcapacity) (OH_AVBuffer \*buffer) | Obtains the capacity of a data buffer.|
72| OH_NativeBuffer \* [OH_AVBuffer_GetNativeBuffer](#oh_avbuffer_getnativebuffer) (OH_AVBuffer \*buffer) | Obtains the pointer of an **OH_NativeBuffer** instance.|
73| struct OH_AVFormat \* [OH_AVFormat_Create](#oh_avformat_create) (void) | Creates an **OH_AVFormat** instance for reading data.|
74| struct OH_AVFormat \* [OH_AVFormat_CreateAudioFormat](#oh_avformat_createaudioformat) (const char \*mimeType, int32_t sampleRate, int32_t channelCount) | Creates an audio **OH_AVFormat** instance for reading and writing data.|
75| struct OH_AVFormat \* [OH_AVFormat_CreateVideoFormat](#oh_avformat_createvideoformat) (const char \*mimeType, int32_t width, int32_t height) | Creates a video **OH_AVFormat** instance for reading and writing data.|
76| void [OH_AVFormat_Destroy](#oh_avformat_destroy) (struct OH_AVFormat \*format) | Destroys an **OH_AVFormat** instance.|
77| bool [OH_AVFormat_Copy](#oh_avformat_copy) (struct OH_AVFormat \*to, struct OH_AVFormat \*from) | Copies an **OH_AVFormat** instance.|
78| bool [OH_AVFormat_SetIntValue](#oh_avformat_setintvalue) (struct OH_AVFormat \*format, const char \*key, int32_t value) | Writes data of the int type to an **OH_AVFormat** instance.|
79| bool [OH_AVFormat_SetLongValue](#oh_avformat_setlongvalue) (struct OH_AVFormat \*format, const char \*key, int64_t value) | Writes data of the long type to an **OH_AVFormat** instance.|
80| bool [OH_AVFormat_SetFloatValue](#oh_avformat_setfloatvalue) (struct OH_AVFormat \*format, const char \*key, float value) | Writes data of the float type to an **OH_AVFormat** instance.|
81| bool [OH_AVFormat_SetDoubleValue](#oh_avformat_setdoublevalue) (struct OH_AVFormat \*format, const char \*key, double value) | Writes data of the double type to an **OH_AVFormat** instance.|
82| bool [OH_AVFormat_SetStringValue](#oh_avformat_setstringvalue) (struct OH_AVFormat \*format, const char \*key, const char \*value) | Writes data of the string type to an **OH_AVFormat** instance.|
83| bool [OH_AVFormat_SetBuffer](#oh_avformat_setbuffer) (struct OH_AVFormat \*format, const char \*key, const uint8_t \*addr, size_t size) | Writes data blocks of a specified length to an **OH_AVFormat** instance.|
84| bool [OH_AVFormat_GetIntValue](#oh_avformat_getintvalue) (struct OH_AVFormat \*format, const char \*key, int32_t \*out) | Reads data of the int type from an **OH_AVFormat** instance.|
85| bool [OH_AVFormat_GetLongValue](#oh_avformat_getlongvalue) (struct OH_AVFormat \*format, const char \*key, int64_t \*out) | Reads data of the long type from an **OH_AVFormat** instance.|
86| bool [OH_AVFormat_GetFloatValue](#oh_avformat_getfloatvalue) (struct OH_AVFormat \*format, const char \*key, float \*out) | Reads data of the float type from an **OH_AVFormat** instance.|
87| bool [OH_AVFormat_GetDoubleValue](#oh_avformat_getdoublevalue) (struct OH_AVFormat \*format, const char \*key, double \*out) | Reads data of the double type from an **OH_AVFormat** instance.|
88| bool [OH_AVFormat_GetStringValue](#oh_avformat_getstringvalue) (struct OH_AVFormat \*format, const char \*key, const char \*\*out) | Reads data of the string type from an **OH_AVFormat** instance.|
89| bool [OH_AVFormat_GetBuffer](#oh_avformat_getbuffer) (struct OH_AVFormat \*format, const char \*key, uint8_t \*\*addr, size_t \*size) | Reads data blocks of a specified length from an **OH_AVFormat** instance.|
90| const char \* [OH_AVFormat_DumpInfo](#oh_avformat_dumpinfo) (struct OH_AVFormat \*format) | Dumps the information contained in an **OH_AVFormat** instance as a string.|
91| OH_AVMemory \* [OH_AVMemory_Create](#oh_avmemory_create) (int32_t size) | Creates an **OH_AVMemory** instance.|
92| uint8_t \* [OH_AVMemory_GetAddr](#oh_avmemory_getaddr) (struct OH_AVMemory \*mem) | Obtains the virtual memory address of an **OH_AVMemory** instance.|
93| int32_t [OH_AVMemory_GetSize](#oh_avmemory_getsize) (struct OH_AVMemory \*mem) | Obtains the memory size of an **OH_AVMemory** instance.|
94| [OH_AVErrCode](#oh_averrcode)[OH_AVMemory_Destroy](#oh_avmemory_destroy) (struct OH_AVMemory \*mem) | Releases an **OH_AVMemory** instance.|
95
96
97## Type Description
98
99
100### OH_AmbAttributeSet
101
102```
103typedef enum OH_AmbAttributeSetOH_AmbAttributeSet
104```
105
106**Description**
107
108Defines an enum that enumerates the Hi-Fi stereo reverberation settings.
109
110Int64 integers are used to indicate the Hi-Fi stereo reverberation attributes.
111
112**System capability**: SystemCapability.Multimedia.Media.Core
113
114**Since**: 11
115
116
117### OH_AudioChannelLayout
118
119```
120typedef enum OH_AudioChannelLayoutOH_AudioChannelLayout
121```
122
123**Description**
124
125Defines an enum that enumerates the audio channel layouts.
126
127Int64 integers are used to indicate the appearance and sequence of speakers during recording or playback.
128
129**System capability**: SystemCapability.Multimedia.Media.Core
130
131**Since**: 11
132
133
134### OH_AudioChannelSet
135
136```
137typedef enum OH_AudioChannelSetOH_AudioChannelSet
138```
139
140**Description**
141
142Defines an enum that enumerates the audio channel sets.
143
144Each audio channel is mapped to an int64 variable.
145
146**System capability**: SystemCapability.Multimedia.Media.Core
147
148**Since**: 11
149
150
151### OH_AVCodecBufferAttr
152
153```
154typedef struct OH_AVCodecBufferAttrOH_AVCodecBufferAttr
155```
156
157**Description**
158
159Defines the description information about the buffer of an **OH_AVCodec** instance.
160
161**System capability**: SystemCapability.Multimedia.Media.Core
162
163**Since**: 9
164
165
166### OH_AVCodecBufferFlags
167
168```
169typedef enum OH_AVCodecBufferFlagsOH_AVCodecBufferFlags
170```
171
172**Description**
173
174Defines an enum that enumerates the flags for the buffer of an **OH_AVCodec** instance.
175
176**System capability**: SystemCapability.Multimedia.Media.Core
177
178**Since**: 9
179
180
181### OH_AVErrCode
182
183```
184typedef enum OH_AVErrCodeOH_AVErrCode
185```
186
187**Description**
188
189Defines an enum that enumerates the audio and video error codes.
190
191**System capability**: SystemCapability.Multimedia.Media.Core
192
193**Since**: 9
194
195
196### OH_AVPixelFormat
197
198```
199typedef enum OH_AVPixelFormatOH_AVPixelFormat
200```
201
202**Description**
203
204Defines an enum that enumerates the video pixel formats.
205
206**System capability**: SystemCapability.Multimedia.Media.Core
207
208**Since**: 9
209
210
211## Enum Description
212
213
214### OH_AmbAttributeSet
215
216```
217enum OH_AmbAttributeSet
218```
219
220**Description**
221
222Enumerates the Hi-Fi stereo reverberation settings.
223
224Int64 integers are used to indicate the Hi-Fi stereo reverberation attributes.
225
226**System capability**: SystemCapability.Multimedia.Media.Core
227
228**Since**: 11
229
230| Value| Description|
231| -------- | -------- |
232| AMB_ORD_1 | First-order Hi-Fi stereo reverberation.|
233| AMB_ORD_2 | Second-order Hi-Fi stereo reverberation.|
234| AMB_ORD_3 | Third-order Hi-Fi stereo reverberation.|
235| AMB_COM_ACN | Hi-Fi stereo reverberation with ACN channel sorting.|
236| AMB_COM_FUMA | Hi-Fi stereo reverberation with FUMA channel sorting.|
237| AMB_NOR_N3D | N3D normalized Hi-Fi stereo reverberation.|
238| AMB_NOR_SN3D | SN3D normalized Hi-Fi stereo reverberation.|
239| AMB_MODE | Audio channel layout for Hi-Fi stereo reverberation.|
240
241
242### OH_AudioChannelLayout
243
244```
245enum OH_AudioChannelLayout
246```
247
248**Description**
249
250Enumerates the audio channel layouts.
251
252Int64 integers are used to indicate the appearance and sequence of speakers during recording or playback.
253
254**System capability**: SystemCapability.Multimedia.Media.Core
255
256**Since**: 11
257
258| Value| Description|
259| -------- | -------- |
260| CH_LAYOUT_UNKNOWN | Unknown.|
261| CH_LAYOUT_MONO | Mono layout; 1 audio channel in total.|
262| CH_LAYOUT_STEREO | Stereo layout; 2 audio channels in total.|
263| CH_LAYOUT_STEREO_DOWNMIX | Stereo downmix layout; 2 audio channels in total.|
264| CH_LAYOUT_2POINT1 | 2.1 layout; 3 audio channels in total.|
265| CH_LAYOUT_3POINT0 | 3.0 layout; 3 audio channels in total.|
266| CH_LAYOUT_SURROUND | Surround; 3 audio channels in total.|
267| CH_LAYOUT_3POINT1 | 3.1 layout; 4 audio channels in total.|
268| CH_LAYOUT_4POINT0 | 4.0 layout; 4 audio channels in total.|
269| CH_LAYOUT_QUAD_SIDE | Quad side layout; 4 audio channels in total.|
270| CH_LAYOUT_QUAD | Quad layout; 4 audio channels in total.|
271| CH_LAYOUT_2POINT0POINT2 | 2.0.2 layout; 4 audio channels in total.|
272| CH_LAYOUT_AMB_ORDER1_ACN_N3D | First-order FOA layout in ACN_N3D (ITU standards); 4 audio channels in total|
273| CH_LAYOUT_AMB_ORDER1_ACN_SN3D | First-order FOA layout in ACN_SN3D (ITU standards); 4 audio channels in total|
274| CH_LAYOUT_AMB_ORDER1_FUMA | First-order FOA layout in FUMA (ITU standards); 4 audio channels in total|
275| CH_LAYOUT_4POINT1 | 4.1 layout; 5 audio channels in total.|
276| CH_LAYOUT_5POINT0 | 5.0 layout; 5 audio channels in total.|
277| CH_LAYOUT_5POINT0_BACK | 5.0 rear layout; 5 audio channels in total.|
278| CH_LAYOUT_2POINT1POINT2 | 2.1.2 layout; 5 audio channels in total.|
279| CH_LAYOUT_3POINT0POINT2 | 3.0.2 layout; 5 audio channels in total.|
280| CH_LAYOUT_5POINT1 | 5.1 layout; 6 audio channels in total.|
281| CH_LAYOUT_5POINT1_BACK | 5.1 rear layout; 6 audio channels in total.|
282| CH_LAYOUT_6POINT0 | 6.0 layout; 6 audio channels in total.|
283| CH_LAYOUT_3POINT1POINT2 | 3.1.2 layout; 6 audio channels in total.|
284| CH_LAYOUT_6POINT0_FRONT | 6.0 front layout; 6 audio channels in total.|
285| CH_LAYOUT_HEXAGONAL | Hexagonal layout; 6 audio channels in total.|
286| CH_LAYOUT_6POINT1 | 6.1 layout; 7 audio channels in total.|
287| CH_LAYOUT_6POINT1_BACK | 6.1 rear layout; 7 audio channels in total.|
288| CH_LAYOUT_6POINT1_FRONT | 6.1 front layout; 7 audio channels in total.|
289| CH_LAYOUT_7POINT0 | 7.0 layout; 7 audio channels in total.|
290| CH_LAYOUT_7POINT0_FRONT | 7.0 front layout; 7 audio channels in total.|
291| CH_LAYOUT_7POINT1 | 7.1 layout; 8 audio channels in total.|
292| CH_LAYOUT_OCTAGONAL | Octagonal layout; 8 audio channels in total.|
293| CH_LAYOUT_5POINT1POINT2 | 5.1.2 layout; 8 audio channels in total.|
294| CH_LAYOUT_7POINT1_WIDE | 7.1 wide layout; 8 audio channels in total.|
295| CH_LAYOUT_7POINT1_WIDE_BACK | 7.1 rear wide layout; 8 audio channels in total.|
296| CH_LAYOUT_AMB_ORDER2_ACN_N3D | Second-order HOA layout in ACN_N3D (ITU standards); 9 audio channels in total|
297| CH_LAYOUT_AMB_ORDER2_ACN_SN3D | Second-order HOA layout in ACN_SN3D (ITU standards); 9 audio channels in total|
298| CH_LAYOUT_AMB_ORDER2_FUMA | Second-order HOA layout in FUMA (ITU standards); 9 audio channels in total|
299| CH_LAYOUT_5POINT1POINT4 | 5.1.4 layout; 10 audio channels in total.|
300| CH_LAYOUT_7POINT1POINT2 | 7.1.2 layout; 10 audio channels in total.|
301| CH_LAYOUT_7POINT1POINT4 | 7.1.4 layout; 12 audio channels in total.|
302| CH_LAYOUT_10POINT2 | 10.2 layout; 12 audio channels in total.|
303| CH_LAYOUT_9POINT1POINT4 | 9.1.4 layout; 14 audio channels in total.|
304| CH_LAYOUT_9POINT1POINT6 | 9.1.6 layout; 16 audio channels in total.|
305| CH_LAYOUT_HEXADECAGONAL | Hexadecagonal layout; 16 audio channels in total.|
306| CH_LAYOUT_AMB_ORDER3_ACN_N3D | Third-order HOA layout in ACN_N3D (ITU standards); 16 audio channels in total|
307| CH_LAYOUT_AMB_ORDER3_ACN_SN3D | Third-order HOA layout in ACN_SN3D (ITU standards); 16 audio channels in total|
308| CH_LAYOUT_AMB_ORDER3_FUMA | Third-order HOA layout in FUMA (ITU standards); 16 audio channels in total|
309| CH_LAYOUT_22POINT2 | 22.2 layout; 24 audio channels in total.|
310
311
312### OH_AudioChannelSet
313
314```
315enum OH_AudioChannelSet
316```
317
318**Description**
319
320Enumerates the audio channel sets.
321
322Each audio channel is mapped to an int64 variable.
323
324**System capability**: SystemCapability.Multimedia.Media.Core
325
326**Since**: 11
327
328| Value| Description|
329| -------- | -------- |
330| CH_SET_FRONT_LEFT | Front left channel.|
331| CH_SET_FRONT_RIGHT | Front right channel|
332| CH_SET_FRONT_CENTER | Front center channel.|
333| CH_SET_LOW_FREQUENCY | Low-frequency channel.|
334| CH_SET_BACK_LEFT | Rear left channel.|
335| CH_SET_BACK_RIGHT | Rear right channel|
336| CH_SET_FRONT_LEFT_OF_CENTER | Front left center channel.|
337| CH_SET_FRONT_RIGHT_OF_CENTER | Front right center channel.|
338| CH_SET_BACK_CENTER | Rear center channel.|
339| CH_SET_SIDE_LEFT | Left channel.|
340| CH_SET_SIDE_RIGHT | Right channel.|
341| CH_SET_TOP_CENTER | Top center channel.|
342| CH_SET_TOP_FRONT_LEFT | Top left front channel.|
343| CH_SET_TOP_FRONT_CENTER | Top center front channel.|
344| CH_SET_TOP_FRONT_RIGHT | Top right front channel.|
345| CH_SET_TOP_BACK_LEFT | Top left rear channel.|
346| CH_SET_TOP_BACK_CENTER | Top center rear channel.|
347| CH_SET_TOP_BACK_RIGHT | Top right rear channel.|
348| CH_SET_STEREO_LEFT | Stereo left channel.|
349| CH_SET_STEREO_RIGHT | Stereo right channel.|
350| CH_SET_WIDE_LEFT | Wide left channel.|
351| CH_SET_WIDE_RIGHT | Wide right channel.|
352| CH_SET_SURROUND_DIRECT_LEFT | Left surround channel.|
353| CH_SET_SURROUND_DIRECT_RIGHT | Right surround channel.|
354| CH_SET_LOW_FREQUENCY_2 | Low-frequency channel 2.|
355| CH_SET_TOP_SIDE_LEFT | Top left channel.|
356| CH_SET_TOP_SIDE_RIGHT | Top right channel.|
357| CH_SET_BOTTOM_FRONT_CENTER | Bottom center front channel.|
358| CH_SET_BOTTOM_FRONT_LEFT | Bottom left front channel.|
359| CH_SET_BOTTOM_FRONT_RIGHT | Bottom right front channel.|
360
361
362### OH_AVCodecBufferFlags
363
364```
365enum OH_AVCodecBufferFlags
366```
367
368**Description**
369
370Enumerates the flags for the buffer of an **OH_AVCodec** instance.
371
372**System capability**: SystemCapability.Multimedia.Media.Core
373
374**Since**: 9
375
376| Value| Description|
377| -------- | -------- |
378| AVCODEC_BUFFER_FLAGS_NONE | Common frame.|
379| AVCODEC_BUFFER_FLAGS_EOS | The buffer is an end-of-stream frame.|
380| AVCODEC_BUFFER_FLAGS_SYNC_FRAME | The buffer contains key frames.|
381| AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME | The data in the buffer is only part of the frame.|
382| AVCODEC_BUFFER_FLAGS_CODEC_DATA | The buffer contains codec-specific data.|
383
384
385### OH_AVErrCode
386
387```
388enum OH_AVErrCode
389```
390
391**Description**
392
393Enumerates the audio and video error codes.
394
395**System capability**: SystemCapability.Multimedia.Media.Core
396
397**Since**: 9
398
399| Value| Description|
400| -------- | -------- |
401| AV_ERR_OK | Operation successful.|
402| AV_ERR_NO_MEMORY | No memory.|
403| AV_ERR_OPERATE_NOT_PERMIT | Operation not allowed.|
404| AV_ERR_INVALID_VAL | Invalid value.|
405| AV_ERR_IO | I/O error.|
406| AV_ERR_TIMEOUT | Timeout.|
407| AV_ERR_UNKNOWN | Unknown error.|
408| AV_ERR_SERVICE_DIED | Unavailable service.|
409| AV_ERR_INVALID_STATE | Unsupported operation in this state.|
410| AV_ERR_UNSUPPORT | Unsupported API.|
411| AV_ERR_EXTEND_START | Initial value for extended error codes.|
412
413
414### OH_AVPixelFormat
415
416```
417enum OH_AVPixelFormat
418```
419
420**Description**
421
422Enumerates the video pixel formats.
423
424**System capability**: SystemCapability.Multimedia.Media.Core
425
426**Since**: 9
427
428| Value| Description|
429| -------- | -------- |
430| AV_PIXEL_FORMAT_YUVI420 | YUV 420 Planar.|
431| AV_PIXEL_FORMAT_NV12 | NV12. YUV 420 semi-planar.|
432| AV_PIXEL_FORMAT_NV21 | NV21. YUV 420 semi-planar.|
433| AV_PIXEL_FORMAT_SURFACE_FORMAT | Surface.|
434| AV_PIXEL_FORMAT_RGBA | RGBA8888.|
435
436
437## Function Description
438
439
440### OH_AVBuffer_Create()
441
442```
443OH_AVBuffer* OH_AVBuffer_Create (int32_t capacity)
444```
445
446**Description**
447
448Creates an **OH_AVBuffer** instance. The caller must call [OH_AVBuffer_Destroy](oh_avbuffer_destroy) to manually release the **OH_AVBuffer** instance returned.
449
450**System capability**: SystemCapability.Multimedia.Media.Core
451
452**Since**: 11
453
454**Parameters**
455
456| Name| Description|
457| -------- | -------- |
458| capacity | Size of the created memory, in bytes.|
459
460**Returns**
461
462Returns the pointer to the **OH_AVBuffer** instance created if the operation is successful; returns a null pointer otherwise.
463
464
465### OH_AVBuffer_Destroy()
466
467```
468OH_AVErrCode OH_AVBuffer_Destroy (OH_AVBuffer *buffer)
469```
470
471**Description**
472
473Releases an **OH_AVBuffer** instance.
474
475**System capability**: SystemCapability.Multimedia.Media.Core
476
477**Since**: 11
478
479**Parameters**
480
481| Name| Description|
482| -------- | -------- |
483| buffer | Pointer to an **OH_AVBuffer** instance.|
484
485**Returns**
486
487Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](#oh_averrcode) otherwise.
488
489
490### OH_AVBuffer_GetAddr()
491
492```
493uint8_t* OH_AVBuffer_GetAddr (OH_AVBuffer *buffer)
494```
495
496**Description**
497
498Obtains the virtual address of a data buffer.
499
500**System capability**: SystemCapability.Multimedia.Media.Core
501
502**Since**: 11
503
504**Parameters**
505
506| Name| Description|
507| -------- | -------- |
508| buffer | Pointer to an **OH_AVBuffer** instance.|
509
510**Returns**
511
512Returns the virtual address if the operation is successful; returns a null pointer otherwise.
513
514
515### OH_AVBuffer_GetBufferAttr()
516
517```
518OH_AVErrCode OH_AVBuffer_GetBufferAttr (OH_AVBuffer *buffer, OH_AVCodecBufferAttr *attr)
519```
520
521**Description**
522
523Obtains the high-frequency attribute of a data buffer.
524
525**System capability**: SystemCapability.Multimedia.Media.Core
526
527**Since**: 11
528
529**Parameters**
530
531| Name| Description|
532| -------- | -------- |
533| buffer | Pointer to an **OH_AVBuffer** instance.|
534| attr | Pointer to an [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) instance.|
535
536**Returns**
537
538Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](#oh_averrcode) otherwise.
539
540
541### OH_AVBuffer_GetCapacity()
542
543```
544int32_t OH_AVBuffer_GetCapacity (OH_AVBuffer *buffer)
545```
546
547**Description**
548
549Obtains the capacity of a data buffer.
550
551**System capability**: SystemCapability.Multimedia.Media.Core
552
553**Since**: 11
554
555**Parameters**
556
557| Name| Description|
558| -------- | -------- |
559| buffer | Pointer to an **OH_AVBuffer** instance.|
560
561**Returns**
562
563Returns the capacity if the operation is successful; returns **-1** otherwise.
564
565
566### OH_AVBuffer_GetNativeBuffer()
567
568```
569OH_NativeBuffer* OH_AVBuffer_GetNativeBuffer (OH_AVBuffer *buffer)
570```
571
572**Description**
573
574Obtains the pointer of an **OH_NativeBuffer** instance. The caller must call [OH_NativeBuffer_Unreference](_o_h___native_buffer.md#oh_nativebuffer_unreference) to manually release the **OH_NativeBuffer** instance returned.
575
576**System capability**: SystemCapability.Multimedia.Media.Core
577
578**Since**: 11
579
580**Parameters**
581
582| Name| Description|
583| -------- | -------- |
584| buffer | Pointer to an **OH_AVBuffer** instance.|
585
586**Returns**
587
588Returns the pointer to the **OH_NativeBuffer** instance created if the operation is successful; returns a null pointer otherwise.
589
590
591### OH_AVBuffer_GetParameter()
592
593```
594OH_AVFormat* OH_AVBuffer_GetParameter (OH_AVBuffer *buffer)
595```
596
597**Description**
598
599Obtains the frame parameter of a data buffer. The caller must call [OH_AVFormat_Destroy](#oh_avformat_destroy) to manually release the **OH_AVFormat** instance returned.
600
601**System capability**: SystemCapability.Multimedia.Media.Core
602
603**Since**: 11
604
605**Parameters**
606
607| Name| Description|
608| -------- | -------- |
609| buffer | Pointer to an **OH_AVBuffer** instance.|
610
611**Returns**
612
613Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](#oh_averrcode) otherwise.
614
615
616### OH_AVBuffer_SetBufferAttr()
617
618```
619OH_AVErrCode OH_AVBuffer_SetBufferAttr (OH_AVBuffer *buffer, const OH_AVCodecBufferAttr *attr)
620```
621
622**Description**
623
624Sets the high-frequency attribute for a data buffer.
625
626**System capability**: SystemCapability.Multimedia.Media.Core
627
628**Since**: 11
629
630**Parameters**
631
632| Name| Description|
633| -------- | -------- |
634| buffer | Pointer to an **OH_AVBuffer** instance.|
635| attr | Pointer to an [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) instance.|
636
637**Returns**
638
639Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](#oh_averrcode) otherwise.
640
641
642### OH_AVBuffer_SetParameter()
643
644```
645OH_AVErrCode OH_AVBuffer_SetParameter (OH_AVBuffer *buffer, const OH_AVFormat *format)
646```
647
648**Description**
649
650Sets the frame parameter for a data buffer.
651
652**System capability**: SystemCapability.Multimedia.Media.Core
653
654**Since**: 11
655
656**Parameters**
657
658| Name| Description|
659| -------- | -------- |
660| buffer | Pointer to an **OH_AVBuffer** instance.|
661| format | Pointer to an **OH_AVFormat** instance.|
662
663**Returns**
664
665Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](#oh_averrcode) otherwise.
666
667
668### OH_AVFormat_Copy()
669
670```
671bool OH_AVFormat_Copy (struct OH_AVFormat *to, struct OH_AVFormat *from)
672```
673
674**Description**
675
676Copies an **OH_AVFormat** instance.
677
678**System capability**: SystemCapability.Multimedia.Media.Core
679
680**Since**: 9
681
682**Parameters**
683
684| Name| Description|
685| -------- | -------- |
686| to | Handle to the **OH_AVFormat** instance to which the data will be copied.|
687| from | Handle to the **OH_AVFormat** instance from which the data will be copied.|
688
689**Returns**
690
691Returns **true** if the operation is successful; returns **false** otherwise.
692
693
694### OH_AVFormat_Create()
695
696```
697struct OH_AVFormat* OH_AVFormat_Create (void)
698```
699
700**Description**
701
702Creates an **OH_AVFormat** instance for reading data.
703
704**System capability**: SystemCapability.Multimedia.Media.Core
705
706**Since**: 9
707
708**Returns**
709
710Returns the pointer to an **OH_AVFormat** instance.
711
712
713### OH_AVFormat_CreateAudioFormat()
714
715```
716struct OH_AVFormat* OH_AVFormat_CreateAudioFormat (const char *mimeType, int32_t sampleRate, int32_t channelCount)
717```
718
719**Description**
720
721Creates an audio **OH_AVFormat** instance for reading and writing data.
722
723**System capability**: SystemCapability.Multimedia.Media.Core
724
725**Since**: 10
726
727**Parameters**
728
729| Name| Description|
730| -------- | -------- |
731| mimeType | Pointer to a string that describes the MIME type. For details, see [AVCODEC_MIMETYPE](_codec_base.md#variables).|
732| sampleRate | Sampling rate, in Hz.|
733| channelCount | Number of audio channels. For example, 1 indicates mono and 2 indicates stereo.|
734
735**Returns**
736
737Returns the pointer to an **OH_AVFormat** instance.
738
739
740### OH_AVFormat_CreateVideoFormat()
741
742```
743struct OH_AVFormat* OH_AVFormat_CreateVideoFormat (const char *mimeType, int32_t width, int32_t height)
744```
745
746**Description**
747
748Creates a video **OH_AVFormat** instance for reading and writing data.
749
750**System capability**: SystemCapability.Multimedia.Media.Core
751
752**Since**: 10
753
754**Parameters**
755
756| Name| Description|
757| -------- | -------- |
758| mimeType | Pointer to a string that describes the MIME type. For details, see [AVCODEC_MIMETYPE](_codec_base.md#variables).|
759| width | Video width, in pixels.|
760| height | Video height, in pixels.|
761
762**Returns**
763
764Returns the pointer to an **OH_AVFormat** instance.
765
766
767### OH_AVFormat_Destroy()
768
769```
770void OH_AVFormat_Destroy (struct OH_AVFormat *format)
771```
772
773**Description**
774
775Destroys an **OH_AVFormat** instance.
776
777**System capability**: SystemCapability.Multimedia.Media.Core
778
779**Since**: 9
780
781**Parameters**
782
783| Name| Description|
784| -------- | -------- |
785| format | Pointer to an **OH_AVFormat** instance.|
786
787
788### OH_AVFormat_DumpInfo()
789
790```
791const char* OH_AVFormat_DumpInfo (struct OH_AVFormat *format)
792```
793
794**Description**
795
796Dumps the information contained in an **OH_AVFormat** instance as a string.
797
798**System capability**: SystemCapability.Multimedia.Media.Core
799
800**Since**: 9
801
802**Parameters**
803
804| Name| Description|
805| -------- | -------- |
806| format | Pointer to an **OH_AVFormat** instance.|
807
808**Returns**
809
810Returns the pointer to a collection of strings, each of which consists of a key and value.
811
812
813### OH_AVFormat_GetBuffer()
814
815```
816bool OH_AVFormat_GetBuffer (struct OH_AVFormat *format, const char *key, uint8_t ** addr, size_t *size)
817```
818
819**Description**
820
821Reads data blocks of a specified length from an **OH_AVFormat** instance.
822
823**System capability**: SystemCapability.Multimedia.Media.Core
824
825**Since**: 9
826
827**Parameters**
828
829| Name| Description|
830| -------- | -------- |
831| format | Pointer to an **OH_AVFormat** instance.|
832| key | Pointer to the key of the data to read.|
833| addr | Double pointer to the address where the data read is stored. The data read is destroyed when the **OH_AVFormat** instance is destroyed. To hold the data for an extended period of time, copy it to the memory.|
834| size | Pointer to the size of the data read.|
835
836**Returns**
837
838Returns **true** if the operation is successful; returns **false** otherwise.
839
840
841### OH_AVFormat_GetDoubleValue()
842
843```
844bool OH_AVFormat_GetDoubleValue (struct OH_AVFormat *format, const char *key, double *out)
845```
846
847**Description**
848
849Reads data of the double type from an **OH_AVFormat** instance.
850
851**System capability**: SystemCapability.Multimedia.Media.Core
852
853**Since**: 9
854
855**Parameters**
856
857| Name| Description|
858| -------- | -------- |
859| format | Pointer to an **OH_AVFormat** instance.|
860| key | Pointer to the key of the data to read.|
861| out | Pointer to the value of the data read.|
862
863**Returns**
864
865Returns **true** if the operation is successful; returns **false** otherwise.
866
867
868### OH_AVFormat_GetFloatValue()
869
870```
871bool OH_AVFormat_GetFloatValue (struct OH_AVFormat *format, const char *key, float *out)
872```
873
874**Description**
875
876Reads data of the float type from an **OH_AVFormat** instance.
877
878**System capability**: SystemCapability.Multimedia.Media.Core
879
880**Since**: 9
881
882**Parameters**
883
884| Name| Description|
885| -------- | -------- |
886| format | Pointer to an **OH_AVFormat** instance.|
887| key | Pointer to the key of the data to read.|
888| out | Pointer to the value of the data read.|
889
890**Returns**
891
892Returns **true** if the operation is successful; returns **false** otherwise.
893
894
895### OH_AVFormat_GetIntValue()
896
897```
898bool OH_AVFormat_GetIntValue (struct OH_AVFormat *format, const char *key, int32_t *out)
899```
900
901**Description**
902
903Reads data of the int type from an **OH_AVFormat** instance.
904
905**System capability**: SystemCapability.Multimedia.Media.Core
906
907**Since**: 9
908
909**Parameters**
910
911| Name| Description|
912| -------- | -------- |
913| format | Pointer to an **OH_AVFormat** instance.|
914| key | Pointer to the key of the data to read.|
915| out | Pointer to the value of the data read.|
916
917**Returns**
918
919Returns **true** if the operation is successful; returns **false** otherwise.
920
921
922### OH_AVFormat_GetLongValue()
923
924```
925bool OH_AVFormat_GetLongValue (struct OH_AVFormat *format, const char *key, int64_t *out)
926```
927
928**Description**
929
930Reads data of the long type from an **OH_AVFormat** instance.
931
932**System capability**: SystemCapability.Multimedia.Media.Core
933
934**Since**: 9
935
936**Parameters**
937
938| Name| Description|
939| -------- | -------- |
940| format | Pointer to an **OH_AVFormat** instance.|
941| key | Pointer to the key of the data to read.|
942| out | Pointer to the value of the data read.|
943
944**Returns**
945
946Returns **true** if the operation is successful; returns **false** otherwise.
947
948
949### OH_AVFormat_GetStringValue()
950
951```
952bool OH_AVFormat_GetStringValue (struct OH_AVFormat *format, const char *key, const char ** out)
953```
954
955**Description**
956
957Reads data of the string type from an **OH_AVFormat** instance.
958
959**System capability**: SystemCapability.Multimedia.Media.Core
960
961**Since**: 9
962
963**Parameters**
964
965| Name| Description|
966| -------- | -------- |
967| format | Pointer to an **OH_AVFormat** instance.|
968| key | Pointer to the key of the data to read.|
969| out | Double pointer to the data read. The data read is destroyed when the **OH_AVFormat** instance is destroyed. To hold the data for an extended period of time, copy it to the memory.|
970
971**Returns**
972
973Returns **true** if the operation is successful; returns **false** otherwise.
974
975
976### OH_AVFormat_SetBuffer()
977
978```
979bool OH_AVFormat_SetBuffer (struct OH_AVFormat *format, const char *key, const uint8_t *addr, size_t size)
980```
981
982**Description**
983
984Writes data blocks of a specified length to an **OH_AVFormat** instance.
985
986**System capability**: SystemCapability.Multimedia.Media.Core
987
988**Since**: 9
989
990**Parameters**
991
992| Name| Description|
993| -------- | -------- |
994| format | Pointer to an **OH_AVFormat** instance.|
995| key | Pointer to the key of the data to write.|
996| addr | Pointer to the address where the data is written.|
997| size | Size of the data written.|
998
999**Returns**
1000
1001Returns **true** if the operation is successful; returns **false** otherwise.
1002
1003
1004### OH_AVFormat_SetDoubleValue()
1005
1006```
1007bool OH_AVFormat_SetDoubleValue (struct OH_AVFormat *format, const char *key, double value)
1008```
1009
1010**Description**
1011
1012Writes data of the double type to an **OH_AVFormat** instance.
1013
1014**System capability**: SystemCapability.Multimedia.Media.Core
1015
1016**Since**: 9
1017
1018**Parameters**
1019
1020| Name| Description|
1021| -------- | -------- |
1022| format | Pointer to an **OH_AVFormat** instance.|
1023| key | Pointer to the key of the data to write.|
1024| value | Value of the data to write.|
1025
1026**Returns**
1027
1028Returns **true** if the operation is successful; returns **false** otherwise.
1029
1030
1031### OH_AVFormat_SetFloatValue()
1032
1033```
1034bool OH_AVFormat_SetFloatValue (struct OH_AVFormat *format, const char *key, float value)
1035```
1036
1037**Description**
1038
1039Writes data of the float type to an **OH_AVFormat** instance.
1040
1041**System capability**: SystemCapability.Multimedia.Media.Core
1042
1043**Since**: 9
1044
1045**Parameters**
1046
1047| Name| Description|
1048| -------- | -------- |
1049| format | Pointer to an **OH_AVFormat** instance.|
1050| key | Pointer to the key of the data to write.|
1051| value | Value of the data to write.|
1052
1053**Returns**
1054
1055Returns **true** if the operation is successful; returns **false** otherwise.
1056
1057
1058### OH_AVFormat_SetIntValue()
1059
1060```
1061bool OH_AVFormat_SetIntValue (struct OH_AVFormat *format, const char *key, int32_t value)
1062```
1063
1064**Description**
1065
1066Writes data of the int type to an **OH_AVFormat** instance.
1067
1068**System capability**: SystemCapability.Multimedia.Media.Core
1069
1070**Since**: 9
1071
1072**Parameters**
1073
1074| Name| Description|
1075| -------- | -------- |
1076| format | Pointer to an **OH_AVFormat** instance.|
1077| key | Pointer to the key of the data to write.|
1078| value | Value of the data to write.|
1079
1080**Returns**
1081
1082Returns **true** if the operation is successful; returns **false** otherwise.
1083
1084
1085### OH_AVFormat_SetLongValue()
1086
1087```
1088bool OH_AVFormat_SetLongValue (struct OH_AVFormat *format, const char *key, int64_t value)
1089```
1090
1091**Description**
1092
1093Writes data of the long type to an **OH_AVFormat** instance.
1094
1095**System capability**: SystemCapability.Multimedia.Media.Core
1096
1097**Since**: 9
1098
1099**Parameters**
1100
1101| Name| Description|
1102| -------- | -------- |
1103| format | Pointer to an **OH_AVFormat** instance.|
1104| key | Pointer to the key of the data to write.|
1105| value | Value of the data to write.|
1106
1107**Returns**
1108
1109Returns **true** if the operation is successful; returns **false** otherwise.
1110
1111
1112### OH_AVFormat_SetStringValue()
1113
1114```
1115bool OH_AVFormat_SetStringValue (struct OH_AVFormat *format, const char *key, const char *value)
1116```
1117
1118**Description**
1119
1120Writes data of the string type to an **OH_AVFormat** instance.
1121
1122**System capability**: SystemCapability.Multimedia.Media.Core
1123
1124**Since**: 9
1125
1126**Parameters**
1127
1128| Name| Description|
1129| -------- | -------- |
1130| format | Pointer to an **OH_AVFormat** instance.|
1131| key | Pointer to the key of the data to write.|
1132| value | Value of the data to write.|
1133
1134**Returns**
1135
1136Returns **true** if the operation is successful; returns **false** otherwise.
1137
1138
1139### OH_AVMemory_Create()
1140
1141```
1142OH_AVMemory* OH_AVMemory_Create (int32_t size)
1143```
1144
1145**Description**
1146
1147Creates an **OH_AVMemory** instance.
1148
1149**System capability**: SystemCapability.Multimedia.Media.Core
1150
1151**Since**: 10
1152
1153**Deprecated from**: 11
1154
1155**Substitute**: [OH_AVBuffer_Create](#oh_avbuffer_create)
1156
1157**Parameters**
1158
1159| Name| Description|
1160| -------- | -------- |
1161| size | Size of the created memory, in bytes.|
1162
1163**Returns**
1164
1165Returns the pointer to the **OH_AVMemory** instance created if the operation is successful; returns a null pointer otherwise. The instance must be released by calling **OH_AVMemory_Destroy** when it is no longer required.
1166
1167
1168### OH_AVMemory_Destroy()
1169
1170```
1171OH_AVErrCode OH_AVMemory_Destroy (struct OH_AVMemory *mem)
1172```
1173
1174**Description**
1175
1176Releases an **OH_AVMemory** instance.
1177
1178**System capability**: SystemCapability.Multimedia.Media.Core
1179
1180**Since**: 10
1181
1182**Deprecated from**: 11
1183
1184**Substitute**: [OH_AVBuffer_Destroy](#oh_avbuffer_destroy)
1185
1186**Parameters**
1187
1188| Name| Description|
1189| -------- | -------- |
1190| mem | Pointer to an **OH_AVMemory** instance.|
1191
1192**Returns**
1193
1194Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](#oh_averrcode) otherwise.
1195
1196
1197### OH_AVMemory_GetAddr()
1198
1199```
1200uint8_t* OH_AVMemory_GetAddr (struct OH_AVMemory *mem)
1201```
1202
1203**Description**
1204
1205Obtains the virtual memory address of an **OH_AVMemory** instance.
1206
1207**System capability**: SystemCapability.Multimedia.Media.Core
1208
1209**Since**: 9
1210
1211**Deprecated from**: 11
1212
1213**Substitute**: [OH_AVBuffer_GetAddr](#oh_avbuffer_getaddr)
1214
1215**Parameters**
1216
1217| Name| Description|
1218| -------- | -------- |
1219| mem | Pointer to an **OH_AVMemory** instance.|
1220
1221**Returns**
1222
1223Returns the pointer to the virtual memory address if the memory is valid; returns a null pointer otherwise.
1224
1225
1226### OH_AVMemory_GetSize()
1227
1228```
1229int32_t OH_AVMemory_GetSize (struct OH_AVMemory *mem)
1230```
1231
1232**Description**
1233
1234Obtains the memory size of an **OH_AVMemory** instance.
1235
1236**System capability**: SystemCapability.Multimedia.Media.Core
1237
1238**Since**: 9
1239
1240**Deprecated from**: 11
1241
1242**Substitute**: [OH_AVBuffer_GetCapacity](#oh_avbuffer_getcapacity)
1243
1244**Parameters**
1245
1246| Name| Description|
1247| -------- | -------- |
1248| mem | Pointer to an **OH_AVMemory** instance.|
1249
1250**Returns**
1251
1252Returns the memory size if the memory is valid; returns **-1** otherwise.
1253