native_buffer.h

概述

定义获取和使用NativeBuffer的相关函数

起始版本:

9

相关模块:

OH_NativeBuffer

汇总

结构体

结构体名称 描述
OH_NativeBuffer_Config OH_NativeBuffer的属性配置,用于申请新的OH_NativeBuffer实例或查询现有实例的相关属性

类型定义

类型名称 描述
OH_NativeBuffer 提供OH_NativeBuffer结构体声明

枚举

名称 描述
OH_NativeBuffer_Usage { NATIVEBUFFER_USAGE_CPU_READ = (1ULL << 0), NATIVEBUFFER_USAGE_CPU_WRITE = (1ULL << 1), NATIVEBUFFER_USAGE_MEM_DMA = (1ULL << 3) } OH_NativeBuffer的用途。
OH_NativeBuffer_Format {
NATIVEBUFFER_PIXEL_FMT_RGB_565 = 3, NATIVEBUFFER_PIXEL_FMT_RGBA_5658, NATIVEBUFFER_PIXEL_FMT_RGBX_4444, NATIVEBUFFER_PIXEL_FMT_RGBA_4444,
NATIVEBUFFER_PIXEL_FMT_RGB_444, NATIVEBUFFER_PIXEL_FMT_RGBX_5551, NATIVEBUFFER_PIXEL_FMT_RGBA_5551, NATIVEBUFFER_PIXEL_FMT_RGB_555,
NATIVEBUFFER_PIXEL_FMT_RGBX_8888, NATIVEBUFFER_PIXEL_FMT_RGBA_8888, NATIVEBUFFER_PIXEL_FMT_RGB_888, NATIVEBUFFER_PIXEL_FMT_BGR_565,
NATIVEBUFFER_PIXEL_FMT_BGRX_4444, NATIVEBUFFER_PIXEL_FMT_BGRA_4444, NATIVEBUFFER_PIXEL_FMT_BGRX_5551, NATIVEBUFFER_PIXEL_FMT_BGRA_5551,
NATIVEBUFFER_PIXEL_FMT_BGRX_8888, NATIVEBUFFER_PIXEL_FMT_BGRA_8888, NATIVEBUFFER_PIXEL_FMT_BUTT = 0X7FFFFFFF
}
OH_NativeBuffer的格式。

函数

函数名称 描述
OH_NativeBuffer_Alloc (const OH_NativeBuffer_Config *config) 通过OH_NativeBuffer_Config创建OH_NativeBuffer实例,每次调用都会产生一个新的OH_NativeBuffer实例
OH_NativeBuffer_Reference (OH_NativeBuffer *buffer) 将OH_NativeBuffer对象的引用计数加1
OH_NativeBuffer_Unreference (OH_NativeBuffer *buffer) 将OH_NativeBuffer对象的引用计数减1,当引用计数为0的时候,该NativeBuffer对象会被析构掉
OH_NativeBuffer_GetConfig (OH_NativeBuffer *buffer, OH_NativeBuffer_Config *config) 用于获取OH_NativeBuffer的属性
OH_NativeBuffer_Map (OH_NativeBuffer *buffer, void **virAddr) 将OH_NativeBuffer对应的ION内存映射到进程空间
OH_NativeBuffer_Unmap (OH_NativeBuffer *buffer) 将OH_NativeBuffer对应的ION内存从进程空间移除
OH_NativeBuffer_GetSeqNum (OH_NativeBuffer *buffer) 获取OH_NativeBuffer的序列号