#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused)]
use std::ffi::c_void;
pub(crate) const EGL_NATIVE_BUFFER_OHOS: u32 = 0x34E1;
use crate::egl::types::EGLClientBuffer;
#[repr(C)]
pub struct NativeWindow {
_unused: [u8; 0],
}
pub type OHNativeWindow = NativeWindow;
#[repr(transparent)]
pub(crate) struct NativeWindowOperation(core::ffi::c_int);
impl NativeWindowOperation {
pub const GET_BUFFER_GEOMETRY: Self = Self(1);
}
#[link(name = "native_window")]
#[link(name = "ace_ndk.z")]
extern "C" {
pub(crate) fn OH_NativeWindow_NativeWindowHandleOpt(
window: *mut OHNativeWindow,
code: NativeWindowOperation,
...
) -> i32;
}
#[link(name = "EGL")]
extern "C" {
pub(crate) fn eglGetNativeClientBufferANDROID(buffer: *const c_void) -> EGLClientBuffer;
}
#[repr(C)]
pub struct OH_NativeBuffer {
_opaque: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Clone)]
pub struct OH_NativeBuffer_Config {
pub width: i32,
pub height: i32,
pub format: OH_NativeBuffer_Format,
pub usage: OH_NativeBuffer_Usage,
pub stride: i32,
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct OH_NativeBuffer_Format(core::ffi::c_int);
impl OH_NativeBuffer_Format {
pub const RGBA_8888: OH_NativeBuffer_Format = OH_NativeBuffer_Format(12);
}
bitflags! {
#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct OH_NativeBuffer_Usage: core::ffi::c_int {
const CPU_READ = 1;
const CPU_WRITE = 1 << 1;
const MEM_DMA = 1 << 3;
const HW_RENDER = 1 << 8;
const HW_TEXTURE = 1 << 9;
const CPU_READ_OFTEN = 1 << 16;
const ALIGNMENT_512 = 1 << 18;
}
}
#[link(name = "native_buffer")]
extern "C" {
pub fn OH_NativeBuffer_Alloc(config: *const OH_NativeBuffer_Config) -> *mut OH_NativeBuffer;
pub fn OH_NativeBuffer_Unreference(buffer: *mut OH_NativeBuffer) -> i32;
}