• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Core
2
3
4## Overview
5
6The Core module provides the basic backbone capabilities for the media system, including functions related to the memory, error code, and media data 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| [media_types.h](media__types_8h.md) | Declares the common media types.|
21| [native_audio_channel_layout.h](native__audio__channel__layout_8h.md) | Declares the functions related to the speaker layout during recording and playback.|
22| [native_avbuffer.h](native__avbuffer_8h.md) | Declares the functions of the media struct **AVBuffer**.|
23| [native_avbuffer_info.h](native__avbuffer__info_8h.md) | Declares the attribute definition of the media struct **AVBuffer**.|
24| [native_averrors.h](native__averrors_8h.md) | Declares the error codes used by the media system.|
25| [native_avformat.h](native__avformat_8h.md) | Declares the functions and enums related to **OH_AVFormat**.|
26| [native_avmemory.h](native__avmemory_8h.md) | Declares the attribute definition of the media struct **AVMemory**.|
27
28
29### Structs
30
31| Name| Description|
32| -------- | -------- |
33| struct  [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) | Describes the description information about the buffer of an **OH_AVCodec** instance. |
34
35
36### Types
37
38| Name| Description|
39| -------- | -------- |
40| typedef enum [OH_Core_HdrType](#oh_core_hdrtype) [OH_Core_HdrType](#oh_core_hdrtype) | Defines an enum for the HDR types.|
41| typedef enum [OH_AudioChannelSet](#oh_audiochannelset-1) [OH_AudioChannelSet](#oh_audiochannelset) | Defines an enum for the audio channel sets.|
42| typedef enum [OH_AmbAttributeSet](#oh_ambattributeset-1) [OH_AmbAttributeSet](#oh_ambattributeset) | Defines an enum for the Hi-Fi stereo reverberation settings.|
43| typedef enum [OH_AudioChannelLayout](#oh_audiochannellayout-1) [OH_AudioChannelLayout](#oh_audiochannellayout) | Defines an enum for the audio channel layouts.|
44| typedef struct [OH_AVBuffer](#oh_avbuffer) [OH_AVBuffer](#oh_avbuffer) | Defines a struct that describes a native object for the media memory interface.|
45| typedef struct [OH_NativeBuffer](#oh_nativebuffer) [OH_NativeBuffer](#oh_nativebuffer) | Defines a struct that describes a native object for the graphics memory interface.|
46| typedef enum [OH_AVCodecBufferFlags](#oh_avcodecbufferflags-1) [OH_AVCodecBufferFlags](#oh_avcodecbufferflags) | Defines an enum for the flags for the buffer of an **OH_AVCodec** instance.|
47| 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.|
48| typedef enum [OH_AVErrCode](#oh_averrcode-1) [OH_AVErrCode](#oh_averrcode) | Defines an enum for the error codes used by the media system.|
49| typedef struct [OH_AVFormat](#oh_avformat) [OH_AVFormat](#oh_avformat) | Defines a struct for a native object for the **OH_AVFormat** interface.|
50| typedef enum [OH_AVPixelFormat](#oh_avpixelformat-1) [OH_AVPixelFormat](#oh_avpixelformat) | Defines an enum for the video pixel formats.|
51| typedef struct [OH_AVMemory](#oh_avmemory) [OH_AVMemory](#oh_avmemory) | Defines a struct that describes a native object for the audio and video memory interface.|
52
53
54### Enums
55
56| Name| Description|
57| -------- | -------- |
58| [OH_Core_HdrType](#oh_core_hdrtype-1) {<br> OH_CORE_HDR_TYPE_NONE = 0, <br>OH_CORE_HDR_TYPE_VIVID = 1 } | Enumerates the HDR types.|
59| [OH_AudioChannelSet](#oh_audiochannelset-1) {<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.|
60| [OH_AmbAttributeSet](#oh_ambattributeset-1) {<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.|
61| [OH_AudioChannelLayout](#oh_audiochannellayout-1) {<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.|
62| [OH_AVCodecBufferFlags](#oh_avcodecbufferflags-1) {<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>AVCODEC_BUFFER_FLAGS_DISCARD = 1 &lt;&lt; 4, <br>AVCODEC_BUFFER_FLAGS_DISPOSABLE = 1 &lt;&lt; 5<br>} | Enumerates the flags for the buffer of an **OH_AVCodec** instance. |
63| [OH_AVErrCode](#oh_averrcode-1)  {<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_UNSUPPORTED_FORMAT = 11,<br>AV_ERR_EXTEND_START = 100,<br>AV_ERR_DRM_BASE = 200,<br>AV_ERR_DRM_DECRYPT_FAILED = 201,<br>AV_ERR_VIDEO_BASE = 300,<br>AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION = 301<br>} | Enumerates the error codes used by the media system. |
64| [OH_AVPixelFormat](#oh_avpixelformat-1) {<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.|
65
66
67### Functions
68
69| Name| Description|
70| -------- | -------- |
71| [OH_AVBuffer](#oh_avbuffer) \* [OH_AVBuffer_Create](#oh_avbuffer_create) (int32_t capacity) | Creates an **OH_AVBuffer** instance. You must call [OH_AVBuffer_Destroy](#oh_avbuffer_destroy) to manually release the **OH_AVBuffer** instance returned.|
72| [OH_AVErrCode](#oh_averrcode) [OH_AVBuffer_Destroy](#oh_avbuffer_destroy) ([OH_AVBuffer](#oh_avbuffer) \*buffer) | Releases an **OH_AVBuffer** instance.|
73| [OH_AVErrCode](#oh_averrcode) [OH_AVBuffer_GetBufferAttr](#oh_avbuffer_getbufferattr) ([OH_AVBuffer](#oh_avbuffer) \*buffer, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) \*attr) | Obtains the basic attributes, including **pts**, **size**, **offset**, and **flags**, of a buffer.|
74| [OH_AVErrCode](#oh_averrcode) [OH_AVBuffer_SetBufferAttr](#oh_avbuffer_setbufferattr) ([OH_AVBuffer](#oh_avbuffer) \*buffer, const [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) \*attr) | Sets the basic attributes, including **pts**, **size**, **offset**, and **flags**, of a buffer.|
75| [OH_AVFormat](#oh_avformat) \* [OH_AVBuffer_GetParameter](#oh_avbuffer_getparameter) ([OH_AVBuffer](#oh_avbuffer) \*buffer) | Obtains parameters except basic attributes of a buffer. The information is carried in an **OH_AVFormat** instance.|
76| [OH_AVErrCode](#oh_averrcode) [OH_AVBuffer_SetParameter](#oh_avbuffer_setparameter) ([OH_AVBuffer](#oh_avbuffer) \*buffer, const [OH_AVFormat](#oh_avformat) \*format) | Sets parameters except basic attributes of a buffer. The information is carried in an **OH_AVFormat** instance.|
77| uint8_t \* [OH_AVBuffer_GetAddr](#oh_avbuffer_getaddr) ([OH_AVBuffer](#oh_avbuffer) \*buffer) | Obtains the virtual address of a data buffer.|
78| int32_t [OH_AVBuffer_GetCapacity](#oh_avbuffer_getcapacity) ([OH_AVBuffer](#oh_avbuffer) \*buffer) | Obtains the capacity (in bytes) of a buffer.|
79| [OH_NativeBuffer](#oh_nativebuffer) \* [OH_AVBuffer_GetNativeBuffer](#oh_avbuffer_getnativebuffer) ([OH_AVBuffer](#oh_avbuffer) \*buffer) | Obtains the pointer to an **OH_NativeBuffer** instance.|
80| struct [OH_AVFormat](#oh_avformat) \* [OH_AVFormat_Create](#oh_avformat_create) (void) | Create an **OH_AVFormat** instance for reading and writing data.|
81| struct [OH_AVFormat](#oh_avformat) \* [OH_AVFormat_CreateAudioFormat](#oh_avformat_createaudioformat) (const char \*mimeType, int32_t sampleRate, int32_t channelCount) | Creates an audio **OH_AVFormat** instance with specified parameters for reading and writing data.|
82| struct [OH_AVFormat](#oh_avformat) \* [OH_AVFormat_CreateVideoFormat](#oh_avformat_createvideoformat) (const char \*mimeType, int32_t width, int32_t height) | Creates a video **OH_AVFormat** instance with specified parameters for reading and writing data.|
83| void [OH_AVFormat_Destroy](#oh_avformat_destroy) (struct [OH_AVFormat](#oh_avformat) \*format) | Destroys an **OH_AVFormat** instance.|
84| bool [OH_AVFormat_Copy](#oh_avformat_copy) (struct [OH_AVFormat](#oh_avformat) \*to, struct [OH_AVFormat](#oh_avformat) \*from) | Copies an **OH_AVFormat** instance.|
85| bool [OH_AVFormat_SetIntValue](#oh_avformat_setintvalue) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, int32_t value) | Assigns a value of the int type to a key in an **OH_AVFormat** instance.|
86| bool [OH_AVFormat_SetLongValue](#oh_avformat_setlongvalue) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, int64_t value) | Assigns a value of the long type to a key in an **OH_AVFormat** instance.|
87| bool [OH_AVFormat_SetFloatValue](#oh_avformat_setfloatvalue) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, float value) | Assigns a value of the float type to a key in an **OH_AVFormat** instance.|
88| bool [OH_AVFormat_SetDoubleValue](#oh_avformat_setdoublevalue) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, double value) | Assigns a value of the double type to a key in an **OH_AVFormat** instance.|
89| bool [OH_AVFormat_SetStringValue](#oh_avformat_setstringvalue) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, const char \*value) | Assigns a value of the string type to a key in an **OH_AVFormat** instance.|
90| bool [OH_AVFormat_SetBuffer](#oh_avformat_setbuffer) (struct [OH_AVFormat](#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.|
91| bool [OH_AVFormat_GetIntValue](#oh_avformat_getintvalue) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, int32_t \*out) | Obtains the value of the int type of a key in an **OH_AVFormat** instance.|
92| bool [OH_AVFormat_GetLongValue](#oh_avformat_getlongvalue) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, int64_t \*out) | Obtains the value of the long type of a key in an **OH_AVFormat** instance.|
93| bool [OH_AVFormat_GetFloatValue](#oh_avformat_getfloatvalue) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, float \*out) | Obtains the value of the float type of a key in an **OH_AVFormat** instance.|
94| bool [OH_AVFormat_GetDoubleValue](#oh_avformat_getdoublevalue) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, double \*out) | Obtains the value of the double type of a key in an **OH_AVFormat** instance.|
95| bool [OH_AVFormat_GetStringValue](#oh_avformat_getstringvalue) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, const char \*\*out) | Obtains the value of the string type of a key in an **OH_AVFormat** instance.|
96| bool [OH_AVFormat_GetBuffer](#oh_avformat_getbuffer) (struct [OH_AVFormat](#oh_avformat) \*format, const char \*key, uint8_t \*\*addr, size_t \*size) | Reads data blocks of a specified length from an **OH_AVFormat** instance.|
97| const char \* [OH_AVFormat_DumpInfo](#oh_avformat_dumpinfo) (struct [OH_AVFormat](#oh_avformat) \*format) | Returns a string consisting of key-value pairs contained in an **OH_AVFormat** instance.|
98| [OH_AVMemory](#oh_avmemory) \* [OH_AVMemory_Create](#oh_avmemory_create) (int32_t size) | Creates an **OH_AVMemory** instance. (This function is deprecated in API version 11.)|
99| uint8_t \* [OH_AVMemory_GetAddr](#oh_avmemory_getaddr) (struct [OH_AVMemory](#oh_avmemory) \*mem) | Obtains the virtual memory address. (This function is deprecated in API version 11.)|
100| int32_t [OH_AVMemory_GetSize](#oh_avmemory_getsize) (struct [OH_AVMemory](#oh_avmemory) \*mem) | Obtains the memory length. (This function is deprecated in API version 11.)|
101| [OH_AVErrCode](#oh_averrcode) [OH_AVMemory_Destroy](#oh_avmemory_destroy) (struct [OH_AVMemory](#oh_avmemory) \*mem) | Releases an **OH_AVMemory** instance. (This function is deprecated in API version 11.)|
102
103
104## Type Description
105
106
107### OH_AmbAttributeSet
108
109```
110typedef enum OH_AmbAttributeSet OH_AmbAttributeSet
111```
112
113**Description**
114
115Defines an enum for the Hi-Fi stereo reverberation settings.
116
117int64_t integers are used to indicate the Hi-Fi stereo reverberation attributes.
118
119**System capability**: SystemCapability.Multimedia.Media.Core
120
121**Since**: 11
122
123
124### OH_AudioChannelLayout
125
126```
127typedef enum OH_AudioChannelLayout OH_AudioChannelLayout
128```
129
130**Description**
131
132Defines an enum for the audio channel layouts.
133
134int64_t integers are used to indicate the appearance and sequence of speakers during recording or playback.
135
136**System capability**: SystemCapability.Multimedia.Media.Core
137
138**Since**: 11
139
140
141### OH_AudioChannelSet
142
143```
144typedef enum OH_AudioChannelSet OH_AudioChannelSet
145```
146
147**Description**
148
149Defines an enum for the audio channel sets.
150
151Each audio channel is mapped to an int64_t variable.
152
153**System capability**: SystemCapability.Multimedia.Media.Core
154
155**Since**: 11
156
157
158### OH_AVBuffer
159
160```
161typedef struct OH_AVBuffer OH_AVBuffer
162```
163**Description**
164
165Defines a struct that describes a native object for the media memory interface.
166
167**Since**: 11
168
169
170### OH_AVCodecBufferAttr
171
172```
173typedef struct OH_AVCodecBufferAttr OH_AVCodecBufferAttr
174```
175
176**Description**
177
178Defines the description information about the buffer of an **OH_AVCodec** instance.
179
180**System capability**: SystemCapability.Multimedia.Media.Core
181
182**Since**: 9
183
184
185### OH_AVCodecBufferFlags
186
187```
188typedef enum OH_AVCodecBufferFlags OH_AVCodecBufferFlags
189```
190
191**Description**
192
193Defines an enum for the flags for the buffer of an **OH_AVCodec** instance.
194
195**System capability**: SystemCapability.Multimedia.Media.Core
196
197**Since**: 9
198
199
200### OH_AVErrCode
201
202```
203typedef enum OH_AVErrCode OH_AVErrCode
204```
205
206**Description**
207
208Defines an enum for the error codes used by the media system.
209
210**System capability**: SystemCapability.Multimedia.Media.Core
211
212**Since**: 9
213
214
215### OH_AVFormat
216
217```
218typedef struct OH_AVFormat OH_AVFormat
219```
220**Description**
221
222Defines a struct for a native object for the **OH_AVFormat** interface.
223
224**Since**: 9
225
226
227### OH_AVMemory
228
229```
230typedef struct OH_AVMemory OH_AVMemory
231```
232**Description**
233
234Defines a struct that describes a native object for the audio and video memory interface.
235
236**Since**: 9
237
238
239### OH_AVPixelFormat
240
241```
242typedef enum OH_AVPixelFormat OH_AVPixelFormat
243```
244
245**Description**
246
247Defines an enum for the video pixel formats.
248
249**System capability**: SystemCapability.Multimedia.Media.Core
250
251**Since**: 9
252
253
254### OH_NativeBuffer
255
256```
257typedef struct OH_NativeBuffer OH_NativeBuffer
258```
259**Description**
260
261Defines a struct that describes a native object for the graphics memory interface.
262
263**Since**: 11
264
265
266### OH_Core_HdrType
267
268```
269typedef enum OH_Core_HdrType OH_Core_HdrType
270```
271
272**Description**
273
274Defines an enum for the HDR types.
275
276**System capability**: SystemCapability.Multimedia.Media.Core
277
278**Since**: 18
279
280
281## Enum Description
282
283
284### OH_AmbAttributeSet
285
286```
287enum OH_AmbAttributeSet
288```
289
290**Description**
291
292Enumerates the Hi-Fi stereo reverberation settings.
293
294int64_t integers are used to indicate the Hi-Fi stereo reverberation attributes.
295
296**System capability**: SystemCapability.Multimedia.Media.Core
297
298**Since**: 11
299
300| Value| Description|
301| -------- | -------- |
302| AMB_ORD_1 | First-order Hi-Fi stereo reverberation.|
303| AMB_ORD_2 | Second-order Hi-Fi stereo reverberation.|
304| AMB_ORD_3 | Third-order Hi-Fi stereo reverberation.|
305| AMB_COM_ACN | Hi-Fi stereo reverberation with ACN channel sorting.|
306| AMB_COM_FUMA | Hi-Fi stereo reverberation with FUMA channel sorting.|
307| AMB_NOR_N3D | N3D normalized Hi-Fi stereo reverberation.|
308| AMB_NOR_SN3D | SN3D normalized Hi-Fi stereo reverberation.|
309| AMB_MODE | Audio channel layout for Hi-Fi stereo reverberation.|
310
311
312### OH_AudioChannelLayout
313
314```
315enum OH_AudioChannelLayout
316```
317
318**Description**
319
320Enumerates the audio channel layouts.
321
322int64_t integers are used to indicate the appearance and sequence of speakers during recording or playback.
323
324**System capability**: SystemCapability.Multimedia.Media.Core
325
326**Since**: 11
327
328| Value| Description|
329| -------- | -------- |
330| CH_LAYOUT_UNKNOWN | Unknown.|
331| CH_LAYOUT_MONO | Mono layout; 1 audio channel in total.|
332| CH_LAYOUT_STEREO | Stereo layout; 2 audio channels in total.|
333| CH_LAYOUT_STEREO_DOWNMIX | Stereo downmix layout; 2 audio channels in total.|
334| CH_LAYOUT_2POINT1 | 2.1 layout; 3 audio channels in total.|
335| CH_LAYOUT_3POINT0 | 3.0 layout; 3 audio channels in total.|
336| CH_LAYOUT_SURROUND | Surround; 3 audio channels in total.|
337| CH_LAYOUT_3POINT1 | 3.1 layout; 4 audio channels in total.|
338| CH_LAYOUT_4POINT0 | 4.0 layout; 4 audio channels in total.|
339| CH_LAYOUT_QUAD_SIDE | Quad side layout; 4 audio channels in total.|
340| CH_LAYOUT_QUAD | Quad layout; 4 audio channels in total.|
341| CH_LAYOUT_2POINT0POINT2 | 2.0.2 layout; 4 audio channels in total.|
342| CH_LAYOUT_AMB_ORDER1_ACN_N3D | First-order FOA layout in ACN_N3D (ITU standards); 4 audio channels in total|
343| CH_LAYOUT_AMB_ORDER1_ACN_SN3D | First-order FOA layout in ACN_SN3D (ITU standards); 4 audio channels in total|
344| CH_LAYOUT_AMB_ORDER1_FUMA | First-order FOA layout in FUMA (ITU standards); 4 audio channels in total|
345| CH_LAYOUT_4POINT1 | 4.1 layout; 5 audio channels in total.|
346| CH_LAYOUT_5POINT0 | 5.0 layout; 5 audio channels in total.|
347| CH_LAYOUT_5POINT0_BACK | 5.0 rear layout; 5 audio channels in total.|
348| CH_LAYOUT_2POINT1POINT2 | 2.1.2 layout; 5 audio channels in total.|
349| CH_LAYOUT_3POINT0POINT2 | 3.0.2 layout; 5 audio channels in total.|
350| CH_LAYOUT_5POINT1 | 5.1 layout; 6 audio channels in total.|
351| CH_LAYOUT_5POINT1_BACK | 5.1 rear layout; 6 audio channels in total.|
352| CH_LAYOUT_6POINT0 | 6.0 layout; 6 audio channels in total.|
353| CH_LAYOUT_3POINT1POINT2 | 3.1.2 layout; 6 audio channels in total.|
354| CH_LAYOUT_6POINT0_FRONT | 6.0 front layout; 6 audio channels in total.|
355| CH_LAYOUT_HEXAGONAL | Hexagonal layout; 6 audio channels in total.|
356| CH_LAYOUT_6POINT1 | 6.1 layout; 7 audio channels in total.|
357| CH_LAYOUT_6POINT1_BACK | 6.1 rear layout; 7 audio channels in total.|
358| CH_LAYOUT_6POINT1_FRONT | 6.1 front layout; 7 audio channels in total.|
359| CH_LAYOUT_7POINT0 | 7.0 layout; 7 audio channels in total.|
360| CH_LAYOUT_7POINT0_FRONT | 7.0 front layout; 7 audio channels in total.|
361| CH_LAYOUT_7POINT1 | 7.1 layout; 8 audio channels in total.|
362| CH_LAYOUT_OCTAGONAL | Octagonal layout; 8 audio channels in total.|
363| CH_LAYOUT_5POINT1POINT2 | 5.1.2 layout; 8 audio channels in total.|
364| CH_LAYOUT_7POINT1_WIDE | 7.1 wide layout; 8 audio channels in total.|
365| CH_LAYOUT_7POINT1_WIDE_BACK | 7.1 rear wide layout; 8 audio channels in total.|
366| CH_LAYOUT_AMB_ORDER2_ACN_N3D | Second-order HOA layout in ACN_N3D (ITU standards); 9 audio channels in total|
367| CH_LAYOUT_AMB_ORDER2_ACN_SN3D | Second-order HOA layout in ACN_SN3D (ITU standards); 9 audio channels in total|
368| CH_LAYOUT_AMB_ORDER2_FUMA | Second-order HOA layout in FUMA (ITU standards); 9 audio channels in total|
369| CH_LAYOUT_5POINT1POINT4 | 5.1.4 layout; 10 audio channels in total.|
370| CH_LAYOUT_7POINT1POINT2 | 7.1.2 layout; 10 audio channels in total.|
371| CH_LAYOUT_7POINT1POINT4 | 7.1.4 layout; 12 audio channels in total.|
372| CH_LAYOUT_10POINT2 | 10.2 layout; 12 audio channels in total.|
373| CH_LAYOUT_9POINT1POINT4 | 9.1.4 layout; 14 audio channels in total.|
374| CH_LAYOUT_9POINT1POINT6 | 9.1.6 layout; 16 audio channels in total.|
375| CH_LAYOUT_HEXADECAGONAL | Hexadecagonal layout; 16 audio channels in total.|
376| CH_LAYOUT_AMB_ORDER3_ACN_N3D | Third-order HOA layout in ACN_N3D (ITU standards); 16 audio channels in total|
377| CH_LAYOUT_AMB_ORDER3_ACN_SN3D | Third-order HOA layout in ACN_SN3D (ITU standards); 16 audio channels in total|
378| CH_LAYOUT_AMB_ORDER3_FUMA | Third-order HOA layout in FUMA (ITU standards); 16 audio channels in total|
379| CH_LAYOUT_22POINT2 | 22.2 layout; 24 audio channels in total.|
380
381
382### OH_AudioChannelSet
383
384```
385enum OH_AudioChannelSet
386```
387
388**Description**
389
390Enumerates the audio channel sets.
391
392Each audio channel is mapped to an int64_t variable.
393
394**System capability**: SystemCapability.Multimedia.Media.Core
395
396**Since**: 11
397
398| Value| Description|
399| -------- | -------- |
400| CH_SET_FRONT_LEFT | Front left channel.|
401| CH_SET_FRONT_RIGHT | Front right channel|
402| CH_SET_FRONT_CENTER | Front center channel.|
403| CH_SET_LOW_FREQUENCY | Low-frequency channel.|
404| CH_SET_BACK_LEFT | Rear left channel.|
405| CH_SET_BACK_RIGHT | Rear right channel|
406| CH_SET_FRONT_LEFT_OF_CENTER | Front left center channel.|
407| CH_SET_FRONT_RIGHT_OF_CENTER | Front right center channel.|
408| CH_SET_BACK_CENTER | Rear center channel.|
409| CH_SET_SIDE_LEFT | Left channel.|
410| CH_SET_SIDE_RIGHT | Right channel.|
411| CH_SET_TOP_CENTER | Top center channel.|
412| CH_SET_TOP_FRONT_LEFT | Top left front channel.|
413| CH_SET_TOP_FRONT_CENTER | Top center front channel.|
414| CH_SET_TOP_FRONT_RIGHT | Top right front channel.|
415| CH_SET_TOP_BACK_LEFT | Top left rear channel.|
416| CH_SET_TOP_BACK_CENTER | Top center rear channel.|
417| CH_SET_TOP_BACK_RIGHT | Top right rear channel.|
418| CH_SET_STEREO_LEFT | Stereo left channel.|
419| CH_SET_STEREO_RIGHT | Stereo right channel.|
420| CH_SET_WIDE_LEFT | Wide left channel.|
421| CH_SET_WIDE_RIGHT | Wide right channel.|
422| CH_SET_SURROUND_DIRECT_LEFT | Left surround channel.|
423| CH_SET_SURROUND_DIRECT_RIGHT | Right surround channel.|
424| CH_SET_LOW_FREQUENCY_2 | Low-frequency channel 2.|
425| CH_SET_TOP_SIDE_LEFT | Top left channel.|
426| CH_SET_TOP_SIDE_RIGHT | Top right channel.|
427| CH_SET_BOTTOM_FRONT_CENTER | Bottom center front channel.|
428| CH_SET_BOTTOM_FRONT_LEFT | Bottom left front channel.|
429| CH_SET_BOTTOM_FRONT_RIGHT | Bottom right front channel.|
430
431
432### OH_AVCodecBufferFlags
433
434```
435enum OH_AVCodecBufferFlags
436```
437
438**Description**
439
440Enumerates the flags for the buffer of an **OH_AVCodec** instance.
441
442**System capability**: SystemCapability.Multimedia.Media.Core
443
444**Since**: 9
445
446| Value| Description|
447| -------- | -------- |
448| AVCODEC_BUFFER_FLAGS_NONE | Common frame.|
449| AVCODEC_BUFFER_FLAGS_EOS | The buffer is an end-of-stream frame.|
450| AVCODEC_BUFFER_FLAGS_SYNC_FRAME | The buffer contains key frames.|
451| AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME | The data in the buffer is only part of the frame.|
452| AVCODEC_BUFFER_FLAGS_CODEC_DATA | The buffer contains codec-specific data.|
453| AVCODEC_BUFFER_FLAGS_DISCARD  | The decoding process depends on the buffer, and the decoded data can be discarded.<br>**Since**: 12|
454| AVCODEC_BUFFER_FLAGS_DISPOSABLE  | The buffer can be disposed directly.<br>**Since**: 12|
455
456
457### OH_AVErrCode
458
459```
460enum OH_AVErrCode
461```
462
463**Description**
464
465Enumerates the error codes used by the media system.
466
467**System capability**: SystemCapability.Multimedia.Media.Core
468
469**Since**: 9
470
471| Value| Description|
472| -------- | -------- |
473| AV_ERR_OK  | Operation successful.  |
474| AV_ERR_NO_MEMORY  | No memory.  |
475| AV_ERR_OPERATE_NOT_PERMIT  | Operation not allowed.  |
476| AV_ERR_INVALID_VAL  | Invalid value.  |
477| AV_ERR_IO  | I/O error.  |
478| AV_ERR_TIMEOUT  | Timeout.  |
479| AV_ERR_UNKNOWN  | Unknown error.  |
480| AV_ERR_SERVICE_DIED  | Unavailable service.  |
481| AV_ERR_INVALID_STATE  | Unsupported operation in this state.  |
482| AV_ERR_UNSUPPORT  | Unsupported feature.  |
483| AV_ERR_UNSUPPORTED_FORMAT | Coding format not supported.<br>**Since**: 18|
484| AV_ERR_EXTEND_START  | Initial value for extended error codes.  |
485| AV_ERR_DRM_BASE  | DRM start error code.<br>**Since**: 12|
486| AV_ERR_DRM_DECRYPT_FAILED  | DRM decryption failed.<br>**Since**: 12|
487| AV_ERR_VIDEO_BASE   | Video start error code.<br>**Since**: 12|
488| AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION   | Color Space Conversion (CSC) is not supported.<br>**Since**: 12|
489
490### OH_AVPixelFormat
491
492```
493enum OH_AVPixelFormat
494```
495
496**Description**
497
498Enumerates the video pixel formats.
499
500**System capability**: SystemCapability.Multimedia.Media.Core
501
502**Since**: 9
503
504| Value| Description|
505| -------- | -------- |
506| AV_PIXEL_FORMAT_YUVI420 | YUV 420 Planar.|
507| AV_PIXEL_FORMAT_NV12 | NV12. YUV 420 semi-planar.|
508| AV_PIXEL_FORMAT_NV21 | NV21. YVU 420 semi-planar.|
509| AV_PIXEL_FORMAT_SURFACE_FORMAT | Pixel format obtained from the surface. This value takes effect only in surface mode.|
510| AV_PIXEL_FORMAT_RGBA | RGBA8888.|
511
512
513### OH_Core_HdrType
514
515```
516enum OH_Core_HdrType
517```
518
519**Description**
520
521Enumerates the HDR types.
522
523**System capability**: SystemCapability.Multimedia.Media.Core
524
525**Since**: 18
526
527| Value| Description|
528| -------- | -------- |
529| OH_CORE_HDR_TYPE_NONE | Non-HDR type.|
530| OH_CORE_HDR_TYPE_VIVID | HDR Vivid type.|
531
532
533## Function Description
534
535
536### OH_AVBuffer_Create()
537
538```
539OH_AVBuffer* OH_AVBuffer_Create (int32_t capacity)
540```
541
542**Description**
543
544Creates an **OH_AVBuffer** instance. You must call [OH_AVBuffer_Destroy](#oh_avbuffer_destroy) to manually release the **OH_AVBuffer** instance returned.
545
546**System capability**: SystemCapability.Multimedia.Media.Core
547
548**Since**: 11
549
550**Parameters**
551
552| Name| Description|
553| -------- | -------- |
554| capacity | Size of the created memory, in bytes.|
555
556**Returns**
557
558Returns the pointer to the **OH_AVBuffer** instance created if the operation is successful; returns NULL otherwise.
559
560The possible causes of an operation failure are as follows:
561
5621. The value of **capacity** is less than or equal to 0.
5632. An internal error occurs, or the system does not have resources.
564
565
566### OH_AVBuffer_Destroy()
567
568```
569OH_AVErrCode OH_AVBuffer_Destroy (OH_AVBuffer *buffer)
570```
571
572**Description**
573
574Releases an **OH_AVBuffer** instance. A buffer cannot be destroyed repeatedly.
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 any of the following result code:
589
590**AV_ERR_OK**: The operation is successful.
591
592**AV_ERR_INVALID_VAL**: The passed-in value of **buffer** is a null pointer or fails parameter structure verification.
593
594**AV_ERR_OPERATE_NOT_PERMIT**: The input buffer is not created by the user.
595
596
597### OH_AVBuffer_GetAddr()
598
599```
600uint8_t* OH_AVBuffer_GetAddr (OH_AVBuffer *buffer)
601```
602
603**Description**
604
605Obtains the virtual address of a data buffer.
606
607The capability to obtain virtual addresses varies in scenarios, as described in the table below.
608
609**Encoding**
610| Mode| Data Filling Mode|  Capability to Obtain Virtual Addresses|
611| --------------- | -------- | -------- |
612| Surface| OnNeedInputBuffer input | Not supported|
613| Surface| OnNewOutputBuffer output | Supported|
614| Buffer | OnNeedInputBuffer input | Supported|
615| Buffer | OnNewOutputBuffer output | Supported|
616
617**Decoding**
618| Mode| Data Filling Mode|  Capability to Obtain Virtual Addresses|
619| --------------- | -------- | -------- |
620| Surface| OnNeedInputBuffer input | Supported|
621| Surface| OnNewOutputBuffer output | Not supported|
622| Buffer | OnNeedInputBuffer input | Supported|
623| Buffer | OnNewOutputBuffer output | Supported|
624
625**System capability**: SystemCapability.Multimedia.Media.Core
626
627**Since**: 11
628
629**Parameters**
630
631| Name| Description|
632| -------- | -------- |
633| buffer | Pointer to an **OH_AVBuffer** instance.|
634
635**Returns**
636
637Returns the virtual address if the operation is successful; returns NULL otherwise.
638
639The possible causes of an operation failure are as follows:
640
6411. The passed-in value of **buffer** is a null pointer.
6422. The passed-in value of **OH_AVBuffer** fails parameter structure verification.
6433. An internal error occurred.
644
645
646### OH_AVBuffer_GetBufferAttr()
647
648```
649OH_AVErrCode OH_AVBuffer_GetBufferAttr (OH_AVBuffer *buffer, OH_AVCodecBufferAttr *attr)
650```
651
652**Description**
653
654Obtains the basic attributes, including **pts**, **size**, **offset**, and **flags**, of a buffer.
655
656**System capability**: SystemCapability.Multimedia.Media.Core
657
658**Since**: 11
659
660**Parameters**
661
662| Name| Description|
663| -------- | -------- |
664| buffer | Pointer to an **OH_AVBuffer** instance.|
665| attr | Pointer to an [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) instance.|
666
667**Returns**
668
669Returns any of the following result code:
670
671**AV_ERR_OK**: The operation is successful.
672
673**AV_ERR_INVALID_VAL**: The operation fails.
674
675    Possible causes are as follows:
676    1. The passed-in value of **buffer** or **attr** is a null pointer.
677    2. The passed-in value of **buffer** fails parameter structure verification.
678
679
680### OH_AVBuffer_GetCapacity()
681
682```
683int32_t OH_AVBuffer_GetCapacity (OH_AVBuffer *buffer)
684```
685
686**Description**
687
688Obtains the capacity (in bytes) of a buffer.
689
690**System capability**: SystemCapability.Multimedia.Media.Core
691
692**Since**: 11
693
694**Parameters**
695
696| Name| Description|
697| -------- | -------- |
698| buffer | Pointer to an **OH_AVBuffer** instance.|
699
700**Returns**
701
702Returns the capacity if the operation is successful; returns **-1** otherwise.
703
704The possible causes of an operation failure are as follows:
705
7061. The passed-in value of **buffer** is a null pointer.
7072. The passed-in value of **OH_AVBuffer** fails parameter structure verification.
7083. An internal error occurred.
709
710
711### OH_AVBuffer_GetNativeBuffer()
712
713```
714OH_NativeBuffer* OH_AVBuffer_GetNativeBuffer (OH_AVBuffer *buffer)
715```
716
717**Description**
718
719Obtains the pointer to an **OH_NativeBuffer** instance. You must call [OH_NativeBuffer_Unreference](../apis-arkgraphics2d/_o_h___native_buffer.md#oh_nativebuffer_unreference) to manually release the **OH_NativeBuffer** instance returned.
720
721**System capability**: SystemCapability.Multimedia.Media.Core
722
723**Since**: 11
724
725**Parameters**
726
727| Name| Description|
728| -------- | -------- |
729| buffer | Pointer to an **OH_AVBuffer** instance.|
730
731**Returns**
732
733Returns the pointer to the **OH_NativeBuffer** instance created if the operation is successful; returns NULL otherwise.
734
735The possible causes of an operation failure are as follows:
736
7371. The passed-in value of **buffer** is a null pointer.
7382. The passed-in value of **OH_AVBuffer** fails parameter structure verification.
7393. An internal error occurred.
740
741
742### OH_AVBuffer_GetParameter()
743
744```
745OH_AVFormat* OH_AVBuffer_GetParameter (OH_AVBuffer *buffer)
746```
747
748**Description**
749
750Obtains parameters except basic attributes of a buffer. The information is carried in an **OH_AVFormat** instance. You must call [OH_AVFormat_Destroy](#oh_avformat_destroy) to manually release the **OH_AVFormat** instance returned.
751
752**System capability**: SystemCapability.Multimedia.Media.Core
753
754**Since**: 11
755
756**Parameters**
757
758| Name| Description|
759| -------- | -------- |
760| buffer | Pointer to an **OH_AVBuffer** instance.|
761
762**Returns**
763
764Returns any of the following result code:
765
766**AV_ERR_OK**: The operation is successful.
767
768**AV_ERR_INVALID_VAL**: The operation fails.
769
770    Possible causes are as follows:
771    1. The passed-in value of **buffer** is a null pointer.
772    2. The meta of the buffer is a null pointer.
773    3. The passed-in value of **buffer** fails parameter structure verification.
774
775
776### OH_AVBuffer_SetBufferAttr()
777
778```
779OH_AVErrCode OH_AVBuffer_SetBufferAttr (OH_AVBuffer *buffer, const OH_AVCodecBufferAttr *attr)
780```
781
782**Description**
783
784Sets the basic attributes, including **pts**, **size**, **offset**, and **flags**, of a buffer.
785
786**System capability**: SystemCapability.Multimedia.Media.Core
787
788**Since**: 11
789
790**Parameters**
791
792| Name| Description|
793| -------- | -------- |
794| buffer | Pointer to an **OH_AVBuffer** instance.|
795| attr | Pointer to an [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) instance.|
796
797**Returns**
798
799Returns any of the following result code:
800
801**AV_ERR_OK**: The operation is successful.
802
803**AV_ERR_INVALID_VAL**: The operation fails.
804
805    Possible causes are as follows:
806    1. The passed-in value of **buffer** or **attr** is a null pointer.
807    2. The passed-in value of **buffer** fails parameter structure verification.
808    3. The memory size or offset of the buffer is invalid.
809
810
811### OH_AVBuffer_SetParameter()
812
813```
814OH_AVErrCode OH_AVBuffer_SetParameter (OH_AVBuffer *buffer, const OH_AVFormat *format)
815```
816
817**Description**
818
819Sets parameters except basic attributes of a buffer. The information is carried in an **OH_AVFormat** instance.
820
821**System capability**: SystemCapability.Multimedia.Media.Core
822
823**Since**: 11
824
825**Parameters**
826
827| Name| Description|
828| -------- | -------- |
829| buffer | Pointer to an **OH_AVBuffer** instance.|
830| format | Pointer to an **OH_AVFormat** instance.|
831
832**Returns**
833
834Returns any of the following result code:
835
836**AV_ERR_OK**: The operation is successful.
837
838**AV_ERR_INVALID_VAL**: The operation fails.
839
840    Possible causes are as follows:
841    1. The passed-in value of **buffer** or **format** is a null pointer.
842    2. The meta of the buffer is a null pointer.
843    3. The passed-in value of **buffer** fails parameter structure verification.
844
845
846### OH_AVFormat_Copy()
847
848```
849bool OH_AVFormat_Copy (struct OH_AVFormat *to, struct OH_AVFormat *from)
850```
851
852**Description**
853
854Copies an **OH_AVFormat** instance.
855
856**System capability**: SystemCapability.Multimedia.Media.Core
857
858**Since**: 9
859
860**Parameters**
861
862| Name| Description|
863| -------- | -------- |
864| to | Pointer to the **OH_AVFormat** instance to which the data will be copied.|
865| from | Pointer to the **OH_AVFormat** instance from which the data will be copied.|
866
867**Returns**
868
869Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
870
871The possible causes of an operation failure are as follows:
872
8731. The input parameter is a null pointer.
8742. The passed-in value of **OH_AVFormat** fails parameter structure verification.
875
876
877### OH_AVFormat_Create()
878
879```
880struct OH_AVFormat* OH_AVFormat_Create (void)
881```
882
883**Description**
884
885Create an **OH_AVFormat** instance for reading and writing data.
886
887**System capability**: SystemCapability.Multimedia.Media.Core
888
889**Since**: 9
890
891**Returns**
892
893Returns the pointer to an **OH_AVFormat** instance; returns NULL if system resources are insufficient.
894
895
896### OH_AVFormat_CreateAudioFormat()
897
898```
899struct OH_AVFormat* OH_AVFormat_CreateAudioFormat (const char *mimeType, int32_t sampleRate, int32_t channelCount)
900```
901
902**Description**
903
904Creates an audio **OH_AVFormat** instance with specified parameters for reading and writing data.
905
906**System capability**: SystemCapability.Multimedia.Media.Core
907
908**Since**: 10
909
910**Parameters**
911
912| Name| Description|
913| -------- | -------- |
914| mimeType | Pointer to a string that describes the MIME type. For details, see [AVCODEC_MIMETYPE](_codec_base.md#variables).|
915| sampleRate | Sampling rate, in Hz.|
916| channelCount | Number of audio channels. For example, 1 indicates mono and 2 indicates stereo.|
917
918**Returns**
919
920Returns the pointer to an **OH_AVFormat** instance; returns NULL if the passed-in value of **mimeType** is NULL or system resources are insufficient.
921
922
923### OH_AVFormat_CreateVideoFormat()
924
925```
926struct OH_AVFormat* OH_AVFormat_CreateVideoFormat (const char *mimeType, int32_t width, int32_t height)
927```
928
929**Description**
930
931Creates a video **OH_AVFormat** instance with specified parameters for reading and writing data.
932
933**System capability**: SystemCapability.Multimedia.Media.Core
934
935**Since**: 10
936
937**Parameters**
938
939| Name| Description|
940| -------- | -------- |
941| mimeType | Pointer to a string that describes the MIME type. For details, see [AVCODEC_MIMETYPE](_codec_base.md#variables).|
942| width | Luminance width, in pixels.|
943| height | Luminance height, in pixels.|
944
945**Returns**
946
947Returns the pointer to an **OH_AVFormat** instance; returns NULL if the passed-in value of **mimeType** is NULL or system resources are insufficient.
948
949
950### OH_AVFormat_Destroy()
951
952```
953void OH_AVFormat_Destroy (struct OH_AVFormat *format)
954```
955
956**Description**
957
958Destroys an **OH_AVFormat** instance. The instance cannot be destroyed repeatedly.
959
960**System capability**: SystemCapability.Multimedia.Media.Core
961
962**Since**: 9
963
964**Parameters**
965
966| Name| Description|
967| -------- | -------- |
968| format | Pointer to an **OH_AVFormat** instance.|
969
970**Returns**
971
972No return value.
973
974### OH_AVFormat_DumpInfo()
975
976```
977const char* OH_AVFormat_DumpInfo (struct OH_AVFormat *format)
978```
979
980**Description**
981
982Returns a string consisting of key-value pairs contained in an **OH_AVFormat** instance. A string of up to 1024 bytes can be returned. The string pointer is released when the **OH_AVFormat** instance is destroyed.
983
984**System capability**: SystemCapability.Multimedia.Media.Core
985
986**Since**: 9
987
988**Parameters**
989
990| Name| Description|
991| -------- | -------- |
992| format | Pointer to an **OH_AVFormat** instance.|
993
994**Returns**
995
996Returns the pointer to a collection of strings, in the format of key-value pairs; returns NULL if the passed-in value of **format** is NULL or system resources are insufficient.
997
998
999### OH_AVFormat_GetBuffer()
1000
1001```
1002bool OH_AVFormat_GetBuffer (struct OH_AVFormat *format, const char *key, uint8_t ** addr, size_t *size)
1003```
1004
1005**Description**
1006
1007Reads data blocks of a specified length from an **OH_AVFormat** instance.
1008
1009**System capability**: SystemCapability.Multimedia.Media.Core
1010
1011**Since**: 9
1012
1013**Parameters**
1014
1015| Name| Description|
1016| -------- | -------- |
1017| format | Pointer to an **OH_AVFormat** instance.|
1018| key | Pointer to the key of the data to read.|
1019| 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.|
1020| size | Pointer to the size of the data read.|
1021
1022**Returns**
1023
1024Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1025
1026The possible causes of an operation failure are as follows:
1027
10281. The passed-in value of **format** is a null pointer.
10292. The passed-in value of **format** fails parameter structure verification.
10303. The passed-in value of **key** is a null pointer.
10314. The passed-in value of **addr** is a null pointer.
10325. The passed-in value of **size** is a null pointer.
10336. The obtained key does not exist or is not set.
1034
1035
1036### OH_AVFormat_GetDoubleValue()
1037
1038```
1039bool OH_AVFormat_GetDoubleValue (struct OH_AVFormat *format, const char *key, double *out)
1040```
1041
1042**Description**
1043
1044Obtains the value of the double type of a [key](_codec_base.md#media-data-key-value-pairs) in an **OH_AVFormat** instance.
1045
1046**System capability**: SystemCapability.Multimedia.Media.Core
1047
1048**Since**: 9
1049
1050**Parameters**
1051
1052| Name| Description|
1053| -------- | -------- |
1054| format | Pointer to an **OH_AVFormat** instance.|
1055| key | Pointer to the key of the data to read.|
1056| out | Pointer to the value of the data read.|
1057
1058**Returns**
1059
1060Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1061
1062The possible causes of an operation failure are as follows:
1063
10641. The passed-in value of **format** is a null pointer.
10652. The passed-in value of **format** fails parameter structure verification.
10663. The passed-in value of **key** is a null pointer.
10674. The passed-in value of **out** is a null pointer.
10685. The obtained key does not exist or is not set.
1069
1070
1071### OH_AVFormat_GetFloatValue()
1072
1073```
1074bool OH_AVFormat_GetFloatValue (struct OH_AVFormat *format, const char *key, float *out)
1075```
1076
1077**Description**
1078
1079Obtains the value of the float type of a [key](_codec_base.md#media-data-key-value-pairs) in an **OH_AVFormat** instance.
1080
1081**System capability**: SystemCapability.Multimedia.Media.Core
1082
1083**Since**: 9
1084
1085**Parameters**
1086
1087| Name| Description|
1088| -------- | -------- |
1089| format | Pointer to an **OH_AVFormat** instance.|
1090| key | Pointer to the key of the data to read.|
1091| out | Pointer to the value of the data read.|
1092
1093**Returns**
1094
1095Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1096
1097The possible causes of an operation failure are as follows:
1098
10991. The passed-in value of **format** is a null pointer.
11002. The passed-in value of **format** fails parameter structure verification.
11013. The passed-in value of **key** is a null pointer.
11024. The passed-in value of **out** is a null pointer.
11035. The obtained key does not exist or is not set.
1104
1105
1106### OH_AVFormat_GetIntValue()
1107
1108```
1109bool OH_AVFormat_GetIntValue (struct OH_AVFormat *format, const char *key, int32_t *out)
1110```
1111
1112**Description**
1113
1114Obtains the value of the int type of a [key](_codec_base.md#media-data-key-value-pairs) in an **OH_AVFormat** instance.
1115
1116**System capability**: SystemCapability.Multimedia.Media.Core
1117
1118**Since**: 9
1119
1120**Parameters**
1121
1122| Name| Description|
1123| -------- | -------- |
1124| format | Pointer to an **OH_AVFormat** instance.|
1125| key | Pointer to the key of the data to read.|
1126| out | Pointer to the value of the data read.|
1127
1128**Returns**
1129
1130Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1131
1132The possible causes of an operation failure are as follows:
1133
11341. The passed-in value of **format** is a null pointer.
11352. The passed-in value of **format** fails parameter structure verification.
11363. The passed-in value of **key** is a null pointer.
11374. The passed-in value of **out** is a null pointer.
11385. The obtained key does not exist or is not set.
1139
1140
1141### OH_AVFormat_GetLongValue()
1142
1143```
1144bool OH_AVFormat_GetLongValue (struct OH_AVFormat *format, const char *key, int64_t *out)
1145```
1146
1147**Description**
1148
1149Obtains the value of the long type of a [key](_codec_base.md#media-data-key-value-pairs) in an **OH_AVFormat** instance.
1150
1151**System capability**: SystemCapability.Multimedia.Media.Core
1152
1153**Since**: 9
1154
1155**Parameters**
1156
1157| Name| Description|
1158| -------- | -------- |
1159| format | Pointer to an **OH_AVFormat** instance.|
1160| key | Pointer to the key of the data to read.|
1161| out | Pointer to the value of the data read.|
1162
1163**Returns**
1164
1165Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1166
1167The possible causes of an operation failure are as follows:
1168
11691. The passed-in value of **format** is a null pointer.
11702. The passed-in value of **format** fails parameter structure verification.
11713. The passed-in value of **key** is a null pointer.
11724. The passed-in value of **out** is a null pointer.
11735. The obtained key does not exist or is not set.
1174
1175
1176### OH_AVFormat_GetStringValue()
1177
1178```
1179bool OH_AVFormat_GetStringValue (struct OH_AVFormat *format, const char *key, const char ** out)
1180```
1181
1182**Description**
1183
1184Obtains the value of the string type of a [key](_codec_base.md#media-data-key-value-pairs) in an **OH_AVFormat** instance.
1185
1186**System capability**: SystemCapability.Multimedia.Media.Core
1187
1188**Since**: 9
1189
1190**Parameters**
1191
1192| Name| Description|
1193| -------- | -------- |
1194| format | Pointer to an **OH_AVFormat** instance.|
1195| key | Pointer to the key of the data to read.|
1196| out | Double pointer to the string read. The lifecycle of the **out** data matches the string in **format**. To keep the **out** data for an extended period of time, you must copy it to the memory. The maximum length of the output string is 256 bytes. If the length exceeds 256 bytes, **false** is returned.|
1197
1198**Returns**
1199
1200Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1201
1202The possible causes of an operation failure are as follows:
1203
12041. The passed-in value of **format** is a null pointer.
12052. The passed-in value of **format** fails parameter structure verification.
12063. The passed-in value of **key** is a null pointer.
12074. The passed-in value of **out** is a null pointer.
12085. The system resources are insufficient.
12096. The obtained key does not exist or is not set.
12107. The length of the **out** data exceeds 256 bytes.
1211
1212
1213### OH_AVFormat_SetBuffer()
1214
1215```
1216bool OH_AVFormat_SetBuffer (struct OH_AVFormat *format, const char *key, const uint8_t *addr, size_t size)
1217```
1218
1219**Description**
1220
1221Writes data blocks of a specified length to an **OH_AVFormat** instance. This function can be used to set only parameters of the buffer type. For details, see [CodecBase](_codec_base.md).
1222
1223**System capability**: SystemCapability.Multimedia.Media.Core
1224
1225**Since**: 9
1226
1227**Parameters**
1228
1229| Name| Description|
1230| -------- | -------- |
1231| format | Pointer to an **OH_AVFormat** instance.|
1232| key | Pointer to the key of the data to write.|
1233| addr | Double-pointer to the address to which data is written. The lifecycle is managed by the developer.|
1234| size | Length of the data written, in MB. The value range is (0, 1].|
1235
1236**Returns**
1237
1238Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1239
1240The possible causes of an operation failure are as follows:
1241
12421. The passed-in value of **format** is a null pointer.
12432. The passed-in value of **format** fails parameter structure verification.
12443. The passed-in value of **key** is a null pointer.
12454. The passed-in value of **addr** is a null pointer.
12465. The size is 0 or exceeds the upper limit (1 MB).
12476. The value type corresponding to the key is incorrect.
1248
1249
1250### OH_AVFormat_SetDoubleValue()
1251
1252```
1253bool OH_AVFormat_SetDoubleValue (struct OH_AVFormat *format, const char *key, double value)
1254```
1255
1256**Description**
1257
1258Assigns a value of the double type to a [key](_codec_base.md#media-data-key-value-pairs) in an **OH_AVFormat** instance. This function can be used to set only parameters of the double type. For details, see [CodecBase](_codec_base.md).
1259
1260**System capability**: SystemCapability.Multimedia.Media.Core
1261
1262**Since**: 9
1263
1264**Parameters**
1265
1266| Name| Description|
1267| -------- | -------- |
1268| format | Pointer to an **OH_AVFormat** instance.|
1269| key | Pointer to the key of the data to write.|
1270| value | Value of the data to write.|
1271
1272**Returns**
1273
1274Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1275
1276The possible causes of an operation failure are as follows:
1277
12781. The passed-in value of **format** is a null pointer.
12792. The passed-in value of **format** fails parameter structure verification.
12803. The passed-in value of **key** is a null pointer.
12814. The value type corresponding to the key is incorrect.
1282
1283
1284### OH_AVFormat_SetFloatValue()
1285
1286```
1287bool OH_AVFormat_SetFloatValue (struct OH_AVFormat *format, const char *key, float value)
1288```
1289
1290**Description**
1291
1292Assigns a value of the float type to a [key](_codec_base.md#media-data-key-value-pairs) in an **OH_AVFormat** instance. This function can be used to set only parameters of the float type. For details, see [CodecBase](_codec_base.md).
1293
1294**System capability**: SystemCapability.Multimedia.Media.Core
1295
1296**Since**: 9
1297
1298**Parameters**
1299
1300| Name| Description|
1301| -------- | -------- |
1302| format | Pointer to an **OH_AVFormat** instance.|
1303| key | Pointer to the key of the data to write.|
1304| value | Value of the data to write.|
1305
1306**Returns**
1307
1308Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1309
1310The possible causes of an operation failure are as follows:
1311
13121. The passed-in value of **format** is a null pointer.
13132. The passed-in value of **format** fails parameter structure verification.
13143. The passed-in value of **key** is a null pointer.
13154. The value type corresponding to the key is incorrect.
1316
1317### OH_AVFormat_SetIntValue()
1318
1319```
1320bool OH_AVFormat_SetIntValue (struct OH_AVFormat *format, const char *key, int32_t value)
1321```
1322
1323**Description**
1324
1325Assigns a value of the int type to a [key](_codec_base.md#media-data-key-value-pairs) in an **OH_AVFormat** instance. This function can be used to set only parameters of the int type. For details, see [CodecBase](_codec_base.md).
1326
1327**System capability**: SystemCapability.Multimedia.Media.Core
1328
1329**Since**: 9
1330
1331**Parameters**
1332
1333| Name| Description|
1334| -------- | -------- |
1335| format | Pointer to an **OH_AVFormat** instance.|
1336| key | Pointer to the key of the data to write.|
1337| value | Value of the data to write.|
1338
1339**Returns**
1340
1341Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1342
1343The possible causes of an operation failure are as follows:
1344
13451. The passed-in value of **format** is a null pointer.
13462. The passed-in value of **format** fails parameter structure verification.
13473. The passed-in value of **key** is a null pointer.
13484. The value type corresponding to the key is incorrect.
1349
1350
1351### OH_AVFormat_SetLongValue()
1352
1353```
1354bool OH_AVFormat_SetLongValue (struct OH_AVFormat *format, const char *key, int64_t value)
1355```
1356
1357**Description**
1358
1359Assigns a value of the long type to a [key](_codec_base.md#media-data-key-value-pairs) in an **OH_AVFormat** instance. This function can be used to set only parameters of the long type. For details, see [CodecBase](_codec_base.md).
1360
1361**System capability**: SystemCapability.Multimedia.Media.Core
1362
1363**Since**: 9
1364
1365**Parameters**
1366
1367| Name| Description|
1368| -------- | -------- |
1369| format | Pointer to an **OH_AVFormat** instance.|
1370| key | Pointer to the key of the data to write.|
1371| value | Value of the data to write.|
1372
1373**Returns**
1374
1375Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1376
1377The possible causes of an operation failure are as follows:
1378
13791. The passed-in value of **format** is a null pointer.
13802. The passed-in value of **format** fails parameter structure verification.
13813. The passed-in value of **key** is a null pointer.
13824. The value type corresponding to the key is incorrect.
1383
1384
1385### OH_AVFormat_SetStringValue()
1386
1387```
1388bool OH_AVFormat_SetStringValue (struct OH_AVFormat *format, const char *key, const char *value)
1389```
1390
1391**Description**
1392
1393Assigns a value of the string type to a [key](_codec_base.md#media-data-key-value-pairs) in an **OH_AVFormat** instance. This function can be used to set only parameters of the string type. For details, see [CodecBase](_codec_base.md).
1394
1395**System capability**: SystemCapability.Multimedia.Media.Core
1396
1397**Since**: 9
1398
1399**Parameters**
1400
1401| Name| Description|
1402| -------- | -------- |
1403| format | Pointer to an **OH_AVFormat** instance.|
1404| key | Pointer to the key of the data to write.|
1405| value | Pointer to the data to be written to the string. The length should not exceed 256 bytes.|
1406
1407**Returns**
1408
1409Returns **TRUE** if the operation is successful; returns **FALSE** otherwise.
1410
1411The possible causes of an operation failure are as follows:
1412
14131. The passed-in value of **format** is a null pointer.
14142. The passed-in value of **format** fails parameter structure verification.
14153. The passed-in value of **key** is a null pointer.
14164. The passed-in value of **value** is a null pointer.
14175. The value type corresponding to the key is incorrect.
1418
1419
1420### OH_AVMemory_Create()
1421
1422```
1423OH_AVMemory* OH_AVMemory_Create (int32_t size)
1424```
1425
1426**Description**
1427
1428Creates an **OH_AVMemory** instance.
1429
1430**System capability**: SystemCapability.Multimedia.Media.Core
1431
1432**Since**: 10
1433
1434**Deprecated from**: 11
1435
1436**Substitute**: [OH_AVBuffer_Create](#oh_avbuffer_create)
1437
1438**Parameters**
1439
1440| Name| Description|
1441| -------- | -------- |
1442| size | Size of the created memory, in bytes.|
1443
1444**Returns**
1445
1446Returns the pointer to the **OH_AVMemory** instance created if the operation is successful; returns NULL otherwise. The instance must be released by calling **OH_AVMemory_Destroy** when it is no longer required.
1447
1448
1449### OH_AVMemory_Destroy()
1450
1451```
1452OH_AVErrCode OH_AVMemory_Destroy (struct OH_AVMemory *mem)
1453```
1454
1455**Description**
1456
1457Releases an **OH_AVMemory** instance.
1458
1459**System capability**: SystemCapability.Multimedia.Media.Core
1460
1461**Since**: 10
1462
1463**Deprecated from**: 11
1464
1465**Substitute**: [OH_AVBuffer_Destroy](#oh_avbuffer_destroy)
1466
1467**Parameters**
1468
1469| Name| Description|
1470| -------- | -------- |
1471| mem | Pointer to an **OH_AVMemory** instance.|
1472
1473**Returns**
1474
1475Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](#oh_averrcode-1) otherwise.
1476
1477
1478### OH_AVMemory_GetAddr()
1479
1480```
1481uint8_t* OH_AVMemory_GetAddr (struct OH_AVMemory *mem)
1482```
1483
1484**Description**
1485
1486Obtains the virtual memory address.
1487
1488**System capability**: SystemCapability.Multimedia.Media.Core
1489
1490**Since**: 9
1491
1492**Deprecated from**: 11
1493
1494**Substitute**: [OH_AVBuffer_GetAddr](#oh_avbuffer_getaddr)
1495
1496**Parameters**
1497
1498| Name| Description|
1499| -------- | -------- |
1500| mem | Pointer to an **OH_AVMemory** instance.|
1501
1502**Returns**
1503
1504Returns the pointer to the virtual memory address if the memory is valid; returns NULL otherwise.
1505
1506The possible causes of an operation failure are as follows:
1507
15081. The passed-in value of **mem** is a null pointer.
15092. The passed-in value of **mem** fails parameter structure verification.
15103. The memory in the passed-in value of **mem** is a null pointer.
1511
1512
1513### OH_AVMemory_GetSize()
1514
1515```
1516int32_t OH_AVMemory_GetSize (struct OH_AVMemory *mem)
1517```
1518
1519**Description**
1520
1521Obtains the memory length.
1522
1523**System capability**: SystemCapability.Multimedia.Media.Core
1524
1525**Since**: 9
1526
1527**Deprecated from**: 11
1528
1529**Substitute**: [OH_AVBuffer_GetCapacity](#oh_avbuffer_getcapacity)
1530
1531**Parameters**
1532
1533| Name| Description|
1534| -------- | -------- |
1535| mem | Pointer to an **OH_AVMemory** instance.|
1536
1537**Returns**
1538
1539Returns the memory size if the memory is valid; returns **-1** otherwise.
1540
1541The possible causes of an operation failure are as follows:
1542
15431. The passed-in value of **mem** is a null pointer.
15442. The passed-in value of **mem** fails parameter structure verification.
15453. The memory in the passed-in value of **mem** is a null pointer.
1546