native_avformat.h

概述

声明了格式相关的函数和枚举。

库: libnative_media_core.so

系统能力: SystemCapability.Multimedia.Media.Core

起始版本: 9

相关模块:Core

汇总

类型定义

名称 描述
typedef struct OH_AVFormat OH_AVFormat 为媒体格式接口定义native层对象。
typedef enum OH_AVPixelFormat OH_AVPixelFormat 视频像素格式的枚举类。

枚举

名称 描述
OH_AVPixelFormat {
AV_PIXEL_FORMAT_YUVI420 = 1,
AV_PIXEL_FORMAT_NV12 = 2,
AV_PIXEL_FORMAT_NV21 = 3,
AV_PIXEL_FORMAT_SURFACE_FORMAT = 4,
AV_PIXEL_FORMAT_RGBA = 5
}
视频像素格式的枚举类

函数

名称 描述
struct OH_AVFormat * OH_AVFormat_Create (void) 创建OH_AVFormat句柄,用于读取数据。
struct OH_AVFormat * OH_AVFormat_CreateAudioFormat (const char *mimeType, int32_t sampleRate, int32_t channelCount) 创建音频OH_AVFormat句柄指针,用于读写数据。
struct OH_AVFormat * OH_AVFormat_CreateVideoFormat (const char *mimeType, int32_t width, int32_t height) 创建视频OH_AVFormat句柄指针,用于读写数据。
void OH_AVFormat_Destroy (struct OH_AVFormat *format) 销毁OH_AVFormat句柄。
bool OH_AVFormat_Copy (struct OH_AVFormat *to, struct OH_AVFormat *from) 复制OH_AVFormat句柄。
bool OH_AVFormat_SetIntValue (struct OH_AVFormat *format, const char *key, int32_t value) 将int数据写入OH_AVFormat。
bool OH_AVFormat_SetLongValue (struct OH_AVFormat *format, const char *key, int64_t value) 将long数据写入OH_AVFormat。
bool OH_AVFormat_SetFloatValue (struct OH_AVFormat *format, const char *key, float value) 将float数据写入OH_AVFormat。
bool OH_AVFormat_SetDoubleValue (struct OH_AVFormat *format, const char *key, double value) 将double数据写入OH_AVFormat。
bool OH_AVFormat_SetStringValue (struct OH_AVFormat *format, const char *key, const char *value) 将string数据写入OH_AVFormat。
bool OH_AVFormat_SetBuffer (struct OH_AVFormat *format, const char *key, const uint8_t *addr, size_t size) 将指定长度的数据块写入OH_AVFormat。
bool OH_AVFormat_GetIntValue (struct OH_AVFormat *format, const char *key, int32_t *out) 从OH_AVFormat读取int数据。
bool OH_AVFormat_GetLongValue (struct OH_AVFormat *format, const char *key, int64_t *out) 从OH_AVFormat读取long数据。
bool OH_AVFormat_GetFloatValue (struct OH_AVFormat *format, const char *key, float *out) 从OH_AVFormat读取float数据。
bool OH_AVFormat_GetDoubleValue (struct OH_AVFormat *format, const char *key, double *out) 从OH_AVFormat读取double数据。
bool OH_AVFormat_GetStringValue (struct OH_AVFormat *format, const char *key, const char **out) 从OH_AVFormat读取string数据。
bool OH_AVFormat_GetBuffer (struct OH_AVFormat *format, const char *key, uint8_t **addr, size_t *size) 从OH_AVFormat中读取指定长度的数据块。
const char * OH_AVFormat_DumpInfo (struct OH_AVFormat *format) 输出OH_AVFormat中包含的字符串。