1# native_avformat.h 2 3 4## 概述 5 6声明了格式相关的函数和枚举。 7 8**库:** libnative_media_core.so 9 10**系统能力:** SystemCapability.Multimedia.Media.Core 11 12**起始版本:** 9 13 14**相关模块:**[Core](_core.md) 15 16 17## 汇总 18 19 20### 类型定义 21 22| 名称 | 描述 | 23| -------- | -------- | 24| typedef enum [OH_AVPixelFormat](_core.md#oh_avpixelformat)[OH_AVPixelFormat](_core.md#oh_avpixelformat) | 视频像素格式的枚举类。 | 25 26 27### 枚举 28 29| 名称 | 描述 | 30| -------- | -------- | 31| [OH_AVPixelFormat](_core.md#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/>} | 视频像素格式的枚举类 | 32 33 34### 函数 35 36| 名称 | 描述 | 37| -------- | -------- | 38| struct OH_AVFormat \* [OH_AVFormat_Create](_core.md#oh_avformat_create) (void) | 创建OH_AVFormat句柄,用于读取数据。 | 39| struct OH_AVFormat \* [OH_AVFormat_CreateAudioFormat](_core.md#oh_avformat_createaudioformat) (const char \*mimeType, int32_t sampleRate, int32_t channelCount) | 创建音频OH_AVFormat句柄指针,用于读写数据。 | 40| struct OH_AVFormat \* [OH_AVFormat_CreateVideoFormat](_core.md#oh_avformat_createvideoformat) (const char \*mimeType, int32_t width, int32_t height) | 创建视频OH_AVFormat句柄指针,用于读写数据。 | 41| void [OH_AVFormat_Destroy](_core.md#oh_avformat_destroy) (struct OH_AVFormat \*format) | 销毁OH_AVFormat句柄。 | 42| bool [OH_AVFormat_Copy](_core.md#oh_avformat_copy) (struct OH_AVFormat \*to, struct OH_AVFormat \*from) | 复制OH_AVFormat句柄。 | 43| bool [OH_AVFormat_SetIntValue](_core.md#oh_avformat_setintvalue) (struct OH_AVFormat \*format, const char \*key, int32_t value) | 将int数据写入OH_AVFormat。 | 44| bool [OH_AVFormat_SetLongValue](_core.md#oh_avformat_setlongvalue) (struct OH_AVFormat \*format, const char \*key, int64_t value) | 将long数据写入OH_AVFormat。 | 45| bool [OH_AVFormat_SetFloatValue](_core.md#oh_avformat_setfloatvalue) (struct OH_AVFormat \*format, const char \*key, float value) | 将float数据写入OH_AVFormat。 | 46| bool [OH_AVFormat_SetDoubleValue](_core.md#oh_avformat_setdoublevalue) (struct OH_AVFormat \*format, const char \*key, double value) | 将double数据写入OH_AVFormat。 | 47| bool [OH_AVFormat_SetStringValue](_core.md#oh_avformat_setstringvalue) (struct OH_AVFormat \*format, const char \*key, const char \*value) | 将string数据写入OH_AVFormat。 | 48| bool [OH_AVFormat_SetBuffer](_core.md#oh_avformat_setbuffer) (struct OH_AVFormat \*format, const char \*key, const uint8_t \*addr, size_t size) | 将指定长度的数据块写入OH_AVFormat。 | 49| bool [OH_AVFormat_GetIntValue](_core.md#oh_avformat_getintvalue) (struct OH_AVFormat \*format, const char \*key, int32_t \*out) | 从OH_AVFormat读取int数据。 | 50| bool [OH_AVFormat_GetLongValue](_core.md#oh_avformat_getlongvalue) (struct OH_AVFormat \*format, const char \*key, int64_t \*out) | 从OH_AVFormat读取long数据。 | 51| bool [OH_AVFormat_GetFloatValue](_core.md#oh_avformat_getfloatvalue) (struct OH_AVFormat \*format, const char \*key, float \*out) | 从OH_AVFormat读取float数据。 | 52| bool [OH_AVFormat_GetDoubleValue](_core.md#oh_avformat_getdoublevalue) (struct OH_AVFormat \*format, const char \*key, double \*out) | 从OH_AVFormat读取double数据。 | 53| bool [OH_AVFormat_GetStringValue](_core.md#oh_avformat_getstringvalue) (struct OH_AVFormat \*format, const char \*key, const char \*\*out) | 从OH_AVFormat读取string数据。 | 54| bool [OH_AVFormat_GetBuffer](_core.md#oh_avformat_getbuffer) (struct OH_AVFormat \*format, const char \*key, uint8_t \*\*addr, size_t \*size) | 从OH_AVFormat中读取指定长度的数据块。 | 55| const char \* [OH_AVFormat_DumpInfo](_core.md#oh_avformat_dumpinfo) (struct OH_AVFormat \*format) | 输出OH_AVFormat中包含的字符串。 | 56