use std::ffi::c_void;
use crate::qsv_ffi::{MfxBitstream, MfxExtBuffer, MfxFrameSurface1, MfxVideoParam};
pub(super) type MfxStatus = i32;
pub(super) type MfxSession = *mut c_void;
pub(super) type MfxSyncPoint = *mut c_void;
pub(super) type MfxLoader = *mut c_void;
pub(super) type MfxConfig = *mut c_void;
pub(super) const MFX_ERR_NONE: MfxStatus = 0;
pub(super) const MFX_ERR_MORE_DATA: MfxStatus = -10;
#[allow(dead_code)]
pub(super) const MFX_ERR_MORE_SURFACE: MfxStatus = -11;
pub(super) const MFX_WRN_IN_EXECUTION: MfxStatus = 1;
pub(super) const MFX_WRN_INCOMPATIBLE_VIDEO_PARAM: MfxStatus = 5;
pub(super) const MFX_WRN_VIDEO_PARAM_CHANGED: MfxStatus = 3;
pub(super) const MFX_WRN_PARTIAL_ACCELERATION: MfxStatus = 4;
pub(super) const MFX_CODEC_AV1: u32 = 0x20315641; pub(super) const MFX_CODEC_AVC: u32 = 0x20435641; pub(super) const MFX_CODEC_HEVC: u32 = 0x43564548; pub(super) const MFX_FOURCC_NV12: u32 = 0x3231564e; pub(super) const MFX_FOURCC_P010: u32 = 0x30313050; pub(super) const MFX_CHROMAFORMAT_YUV420: u16 = 1;
pub(super) const MFX_IOPATTERN_IN_SYSTEM_MEMORY: u16 = 0x02;
pub(super) const MFX_PICSTRUCT_PROGRESSIVE: u16 = 1;
pub(super) const MFX_FRAMETYPE_I: u16 = 0x0001;
pub(super) const MFX_FRAMETYPE_IDR: u16 = 0x8000;
pub(super) const MFX_RATECONTROL_CQP: u16 = 3;
pub(super) const MFX_RATECONTROL_ICQ: u16 = 9;
pub(super) const MFX_PROFILE_AV1_MAIN: u16 = 1;
pub(super) const MFX_PROFILE_AVC_HIGH: u16 = 100;
pub(super) const MFX_PROFILE_HEVC_MAIN: u16 = 1;
pub(super) const MFX_PROFILE_HEVC_MAIN10: u16 = 2;
pub(super) const MFX_EXTBUFF_AV1_TILE_PARAM: u32 = 0x4c543141; #[allow(dead_code)]
pub(super) const MFX_EXTBUFF_AV1_BITSTREAM_PARAM: u32 = 0x42315641; pub(super) const MFX_EXTBUFF_CODING_OPTION3: u32 = 0x334f4443; pub(super) const MFX_EXTBUFF_VIDEO_SIGNAL_INFO: u32 = 0x4e495356; pub(super) const MFX_TARGET_CHROMAFORMAT_YUV420_PLUS1: u16 = 2;
#[repr(C)]
pub(super) struct MfxExtAv1TileParam {
pub(super) header: MfxExtBuffer,
pub(super) num_tile_rows: u16,
pub(super) num_tile_columns: u16,
pub(super) num_tile_groups: u16,
pub(super) reserved: [u16; 5],
}
#[repr(C)]
pub(super) struct MfxExtCodingOption3 {
pub(super) header: MfxExtBuffer, pub(super) _pad_to_158: [u8; 150], pub(super) target_chroma_format_plus1: u16, pub(super) target_bit_depth_luma: u16, pub(super) target_bit_depth_chroma: u16, pub(super) _tail: [u8; 348], }
#[repr(C)]
pub(super) struct MfxExtVideoSignalInfo {
pub(super) header: MfxExtBuffer,
pub(super) video_format: u16,
pub(super) video_full_range: u16,
pub(super) colour_description_present: u16,
pub(super) colour_primaries: u16,
pub(super) transfer_characteristics: u16,
pub(super) matrix_coefficients: u16,
}
#[repr(C)]
#[allow(dead_code)]
pub(super) struct MfxEncodeCtrl {
pub(super) header: MfxExtBuffer,
pub(super) reserved: [u32; 4],
pub(super) mfx_pic_struct: u16,
pub(super) mfx_skip_frame: u16,
pub(super) qp: u16,
pub(super) frame_type: u16,
pub(super) num_ext_param: u16,
pub(super) _pad: u16,
pub(super) num_payload: u16,
pub(super) _pad2: u16,
pub(super) ext_param: *mut *mut MfxExtBuffer,
pub(super) payload: *mut c_void,
}
pub(super) type FnMfxClose = unsafe extern "C" fn(MfxSession) -> MfxStatus;
pub(super) type FnMfxLoad = unsafe extern "C" fn() -> MfxLoader;
pub(super) type FnMfxUnload = unsafe extern "C" fn(MfxLoader);
pub(super) type FnMfxCreateConfig = unsafe extern "C" fn(MfxLoader) -> MfxConfig;
pub(super) type FnMfxSetConfigFilterProperty =
unsafe extern "C" fn(MfxConfig, *const u8, MfxVariant) -> MfxStatus;
pub(super) type FnMfxCreateSession =
unsafe extern "C" fn(MfxLoader, u32, *mut MfxSession) -> MfxStatus;
pub(super) type FnEncodeQuery =
unsafe extern "C" fn(MfxSession, *mut MfxVideoParam, *mut MfxVideoParam) -> MfxStatus;
pub(super) type FnEncodeInit =
unsafe extern "C" fn(MfxSession, *mut MfxVideoParam) -> MfxStatus;
pub(super) type FnEncodeClose = unsafe extern "C" fn(MfxSession) -> MfxStatus;
pub(super) type FnEncodeFrameAsync = unsafe extern "C" fn(
MfxSession,
*mut c_void,
*mut MfxFrameSurface1,
*mut MfxBitstream,
*mut MfxSyncPoint,
) -> MfxStatus;
pub(super) type FnSyncOperation =
unsafe extern "C" fn(MfxSession, MfxSyncPoint, u32) -> MfxStatus;
#[repr(C)]
#[derive(Clone, Copy)]
pub(super) struct MfxVariant {
pub(super) version: u16,
pub(super) _pad: u16,
pub(super) ty: u32,
pub(super) data: u64, }
const _: () = assert!(std::mem::size_of::<MfxVariant>() == 16);
pub(super) const MFX_VARIANT_TYPE_U32: u32 = 5;
pub(super) const MFX_IMPL_TYPE_HARDWARE: u32 = 2;
const _: () = assert!(std::mem::size_of::<MfxExtAv1TileParam>() == 24);
const _: () = assert!(std::mem::size_of::<MfxEncodeCtrl>() == 56);
const _: () = assert!(std::mem::size_of::<MfxExtCodingOption3>() == 512);
const _: () = assert!(std::mem::size_of::<MfxExtVideoSignalInfo>() >= 20);
const _: () = assert!(MFX_FOURCC_P010 == 0x30313050);
const _: () = assert!(MFX_FOURCC_NV12 == 0x3231564e);
const _: () = assert!(MFX_EXTBUFF_CODING_OPTION3 == 0x334f4443);
const _: () = assert!(MFX_EXTBUFF_VIDEO_SIGNAL_INFO == 0x4e495356);