diff --git a/video/external/src/decoder.rs b/video/external/src/decoder.rs index 52bf6ab5b31e..c257ef29518d 100644 --- a/video/external/src/decoder.rs +++ b/video/external/src/decoder.rs @@ -1,11 +1,10 @@ +// cargo install bindgen-cli // bindgen ../openh264/codec/api/wels/codec_api.h --no-prepend-enum-name \ -// --dynamic-loading OpenH264 -o openh264_sys.rs +// --no-layout-tests --dynamic-loading OpenH264 -o openh264_sys.rs #[cfg(feature = "openh264")] -#[allow(non_upper_case_globals)] -#[allow(non_camel_case_types)] -#[allow(non_snake_case)] +#[allow(nonstandard_style)] #[allow(dead_code)] -#[allow(unpredictable_function_pointer_comparisons)] +#[allow(unsafe_op_in_unsafe_fn)] mod openh264_sys; #[cfg(feature = "openh264")] diff --git a/video/external/src/decoder/openh264.rs b/video/external/src/decoder/openh264.rs index 2231209a2b4c..b05117b295ab 100644 --- a/video/external/src/decoder/openh264.rs +++ b/video/external/src/decoder/openh264.rs @@ -5,7 +5,7 @@ use std::fs::File; use std::io::copy; use std::path::{Path, PathBuf}; use std::ptr; -use std::sync::Arc; +use std::rc::Rc; use crate::decoder::VideoDecoder; use crate::decoder::openh264_sys::{self, ISVCDecoder, OpenH264, videoFormatI420}; @@ -39,11 +39,11 @@ pub enum OpenH264Error { /// OpenH264 codec representation. pub struct OpenH264Codec { - openh264: Arc, + openh264: Rc, } impl OpenH264Codec { - const VERSION: OpenH264Version = OpenH264Version(2, 4, 1); + const VERSION: OpenH264Version = OpenH264Version(2, 6, 0); /// Returns the OpenH264 library data for the current platform. fn get_data() -> Result> { @@ -51,44 +51,48 @@ impl OpenH264Codec { const ARCH: &str = std::env::consts::ARCH; let local_filenames = match OS { - "linux" => ["libopenh264.so.7", "libopenh264.so.2.4.1", "libopenh264.so"].as_slice(), + "linux" => ["libopenh264.so.8", "libopenh264.so.2.6.0", "libopenh264.so"].as_slice(), // TODO: investigate other OSes _ => [].as_slice(), }; - // Source: https://github.com/cisco/openh264/releases/tag/v2.4.1 + // Source: https://github.com/cisco/openh264/releases/tag/v2.6.0 let (download_filename, download_sha256) = match (OS, ARCH) { ("linux", "x86") => ( - "libopenh264-2.4.1-linux32.7.so", - "b7cf0e407f99056d90cbf62787a34820a7595b2129b165319d50766e00a66704", + "libopenh264-2.6.0-linux32.8.so", + "a46589ccc95df7565ff8b1722d3dead29c0809be28322dc763767e0aa35a6443", ), ("linux", "x86_64") => ( - "libopenh264-2.4.1-linux64.7.so", - "1392d21466bc638e68151b716d5b2086d54cd812afd43253f1adb5b6e0185f51", + "libopenh264-2.6.0-linux64.8.so", + "2f0cde7c6a6abcf5cae76942894ea42897fa677bce4ed6c91a24dd1b041d5f04", ), ("linux", "arm") => ( - "libopenh264-2.4.1-linux-arm.7.so", - "fd1dfb27d30bb72e903c9d2b4c650104a4369d2e7ffe8a4a533e8db2e7e9b19e", + "libopenh264-2.6.0-linux-arm.8.so", + "df91866de0e93773019e30a8f2bdee8b15de4abe2bf89a228ae9f064ff1e85bb", ), ("linux", "aarch64") => ( - "libopenh264-2.4.1-linux-arm64.7.so", - "e8ea7e42855ceb4a90e7bd0b3abeba0c58b5f97166e8b0a30eefd58e099557a4", + "libopenh264-2.6.0-linux-arm64.8.so", + "12e7b33623667cdab0e575170c147b1b36eadb77d0d2aa7ceb5afd3e58902140", ), ("macos", "x86_64") => ( - "libopenh264-2.4.1-mac-x64.dylib", - "cc0ba518a63791c37571f3c851f0aa03a4fbda5410acc214ecd4f24f8d1c478e", + "libopenh264-2.6.0-mac-x64.dylib", + "e3dc8bc01fe69363f61fd3c02fd27798537a585eadd38cd808f303d1ee505a19", ), ("macos", "aarch64") => ( - "libopenh264-2.4.1-mac-arm64.dylib", - "213ff93831cfa3dd6d7ad0c3a3403a6ceedf4ac1341e1278b5b869d42fefb496", + "libopenh264-2.6.0-mac-arm64.dylib", + "052e98bfcf7a9167d22f3bbb3f5988ef79065591f36af8b52924b22b13624551", ), ("windows", "x86") => ( - "openh264-2.4.1-win32.dll", - "83270149640469c994a62cc32a6d8c0413cd7b802b7f1f2f532159f5bdc1cedd", + "openh264-2.6.0-win32.dll", + "b0098db6acbd290a1fe13997d61d461e7327e39b42bf868db41faf498b7621a2", ), ("windows", "x86_64") => ( - "openh264-2.4.1-win64.dll", - "081b0c081480d177cbfddfbc90b1613640e702f875897b30d8de195cde73dd34", + "openh264-2.6.0-win64.dll", + "2076cb5675ec6c1a4c70e7a2a322552f547b6eeed649d6dfcd9e02a543b24691", + ), + ("windows", "aarch64") => ( + "openh264-2.6.0-win-arm64.dll", + "fb75103938f4f47d119b983e06334df41a803bc72fb5c46e3623f6fea5782732", ), (os, arch) => return Err(format!("Unsupported OS/arch: {os}/{arch}").into()), }; @@ -164,7 +168,7 @@ impl OpenH264Codec { } Ok(Self { - openh264: Arc::new(openh264), + openh264: Rc::new(openh264), }) } @@ -197,7 +201,7 @@ pub struct H264Decoder { /// How many bytes are used to store the length of the NALU (1, 2, 3, or 4). length_size: u8, - openh264: Arc, + openh264: Rc, decoder: *mut ISVCDecoder, } diff --git a/video/external/src/decoder/openh264_sys.rs b/video/external/src/decoder/openh264_sys.rs index 9329a28a4626..4aaefc9fab63 100644 --- a/video/external/src/decoder/openh264_sys.rs +++ b/video/external/src/decoder/openh264_sys.rs @@ -1,6 +1,4 @@ -#![expect(unsafe_op_in_unsafe_fn)] - -/* automatically generated by rust-bindgen 0.69.1 */ +/* automatically generated by rust-bindgen 0.72.1 */ pub const __bool_true_false_are_defined: u32 = 1; pub const true_: u32 = 1; @@ -116,7 +114,7 @@ pub const ET_RFS: _bindgen_ty_2 = 128; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; #[doc = " @brief Information of coded Slice(=NAL)(s)"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct SliceInformation { #[doc = "< base buffer of coded slice(s)"] pub pBufferOfSlices: *mut ::std::os::raw::c_uchar, @@ -139,22 +137,13 @@ pub struct SliceInformation { #[doc = "< whether final NAL is involved in buffer of coded slices, flag used in Pause feature in T27"] pub uiContainingFinalNal: ::std::os::raw::c_uchar, } -impl Default for SliceInformation { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief Information of coded Slice(=NAL)(s)"] pub type SliceInfo = SliceInformation; #[doc = " @brief Information of coded Slice(=NAL)(s)"] pub type PSliceInfo = *mut SliceInformation; #[doc = " @brief thresholds of the initial, maximal and minimal rate"] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct SRateThresholds { #[doc = "< frame width"] pub iWidth: ::std::os::raw::c_int, @@ -177,7 +166,7 @@ pub struct SRateThresholds { pub type PRateThresholds = *mut SRateThresholds; #[doc = " @brief Structure for decoder memery"] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct TagSysMemBuffer { #[doc = "< width of decoded pic for display"] pub iWidth: ::std::os::raw::c_int, @@ -210,33 +199,11 @@ pub union TagBufferInfo__bindgen_ty_1 { #[doc = "< memory info for one picture"] pub sSystemBuffer: SSysMEMBuffer, } -impl Default for TagBufferInfo__bindgen_ty_1 { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} -impl Default for TagBufferInfo { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief Buffer info"] pub type SBufferInfo = TagBufferInfo; -unsafe extern "C" { - #[doc = " @brief In a GOP, multiple of the key frame number, derived from\n the number of layers(index or array below)"] - pub static kiKeyNumMultiple: [::std::os::raw::c_char; 6usize]; -} #[doc = " @brief Struct of OpenH264 version\n/\n///\n/// E.g. SDK version is 1.2.0.0, major version number is 1, minor version number is 2, and revision number is 0."] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct _tagVersion { #[doc = "< The major version number"] pub uMajor: ::std::os::raw::c_uint, @@ -410,7 +377,7 @@ pub const LTR_MARKING_FAILED: KEY_FRAME_REQUEST_TYPE = 5; pub type KEY_FRAME_REQUEST_TYPE = ::std::os::raw::c_uint; #[doc = " @brief Structure for LTR recover request"] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct SLTRRecoverRequest { #[doc = "< IDR request or LTR recovery request"] pub uiFeedbackType: ::std::os::raw::c_uint, @@ -423,7 +390,7 @@ pub struct SLTRRecoverRequest { } #[doc = " @brief Structure for LTR marking feedback"] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct SLTRMarkingFeedback { #[doc = "< mark failed or successful"] pub uiFeedbackType: ::std::os::raw::c_uint, @@ -435,7 +402,7 @@ pub struct SLTRMarkingFeedback { } #[doc = " @brief Structure for LTR configuration"] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct SLTRConfig { #[doc = "< 1: on, 0: off"] pub bEnableLongTermReference: bool, @@ -520,7 +487,7 @@ pub const SM_RESERVED: SliceModeEnum = 4; pub type SliceModeEnum = ::std::os::raw::c_uint; #[doc = " @brief Structure for slice argument"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct SSliceArgument { #[doc = "< by default, uiSliceMode will be SM_SINGLE_SLICE"] pub uiSliceMode: SliceModeEnum, @@ -531,15 +498,6 @@ pub struct SSliceArgument { #[doc = "< now only used when uiSliceMode=4"] pub uiSliceSizeConstraint: ::std::os::raw::c_uint, } -impl Default for SSliceArgument { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} pub const VF_COMPONENT: EVideoFormatSPS = 0; pub const VF_PAL: EVideoFormatSPS = 1; pub const VF_NTSC: EVideoFormatSPS = 2; @@ -614,7 +572,7 @@ pub const ASP_EXT_SAR: ESampleAspectRatio = 255; pub type ESampleAspectRatio = ::std::os::raw::c_uint; #[doc = " @brief Structure for spatial layer configuration"] #[repr(C)] -#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)] +#[derive(Debug, Copy, Clone)] pub struct SSpatialLayerConfig { #[doc = "< width of picture in luminance samples of a layer"] pub iVideoWidth: ::std::os::raw::c_int, @@ -649,15 +607,6 @@ pub struct SSpatialLayerConfig { #[doc = "< use if aspect ratio idc == 255"] pub sAspectRatioExtHeight: ::std::os::raw::c_ushort, } -impl Default for SSpatialLayerConfig { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = "< camera video for real-time communication"] pub const CAMERA_VIDEO_REAL_TIME: EUsageType = 0; #[doc = "< screen content signal"] @@ -687,7 +636,7 @@ pub const SPS_PPS_LISTING: EParameterSetStrategy = 6; pub type EParameterSetStrategy = ::std::os::raw::c_uint; #[doc = " @brief SVC Encoding Parameters"] #[repr(C)] -#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)] +#[derive(Debug, Copy, Clone)] pub struct TagEncParamBase { #[doc = "< application type; please refer to the definition of EUsageType"] pub iUsageType: EUsageType, @@ -702,22 +651,13 @@ pub struct TagEncParamBase { #[doc = "< maximal input frame rate"] pub fMaxFrameRate: f32, } -impl Default for TagEncParamBase { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief SVC Encoding Parameters"] pub type SEncParamBase = TagEncParamBase; #[doc = " @brief SVC Encoding Parameters"] pub type PEncParamBase = *mut TagEncParamBase; #[doc = " @brief SVC Encoding Parameters extention"] #[repr(C)] -#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)] +#[derive(Debug, Copy, Clone)] pub struct TagEncParamExt { #[doc = "< same as in TagEncParamBase"] pub iUsageType: EUsageType, @@ -794,39 +734,27 @@ pub struct TagEncParamExt { pub bFixRCOverShoot: bool, #[doc = "< the target bits of IDR is (idr_bitrate_ratio/100) * average target bit per frame."] pub iIdrBitrateRatio: ::std::os::raw::c_int, -} -impl Default for TagEncParamExt { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } + #[doc = "< get Y PSNR stats for the whole video sequence"] + pub bPsnrY: bool, + #[doc = "< get U PSNR stats for the whole video sequence"] + pub bPsnrU: bool, + #[doc = "< get V PSNR stats for the whole video sequence"] + pub bPsnrV: bool, } #[doc = " @brief SVC Encoding Parameters extention"] pub type SEncParamExt = TagEncParamExt; #[doc = " @brief Define a new struct to show the property of video bitstream."] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct SVideoProperty { #[doc = "< size of the struct"] pub size: ::std::os::raw::c_uint, #[doc = "< video stream type (AVC/SVC)"] pub eVideoBsType: VIDEO_BITSTREAM_TYPE, } -impl Default for SVideoProperty { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief SVC Decoding Parameters, reserved here and potential applicable in the future"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct TagSVCDecodingParam { #[doc = "< file name of reconstructed frame used for PSNR calculation based debug"] pub pFileNameRestructed: *mut ::std::os::raw::c_char, @@ -841,22 +769,13 @@ pub struct TagSVCDecodingParam { #[doc = "< video stream property"] pub sVideoProperty: SVideoProperty, } -impl Default for TagSVCDecodingParam { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief SVC Decoding Parameters, reserved here and potential applicable in the future"] pub type SDecodingParam = TagSVCDecodingParam; #[doc = " @brief SVC Decoding Parameters, reserved here and potential applicable in the future"] pub type PDecodingParam = *mut TagSVCDecodingParam; #[doc = " @brief Bitstream inforamtion of a layer being encoded"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct SLayerBSInfo { pub uiTemporalId: ::std::os::raw::c_uchar, pub uiSpatialId: ::std::os::raw::c_uchar, @@ -871,21 +790,14 @@ pub struct SLayerBSInfo { pub pNalLengthInByte: *mut ::std::os::raw::c_int, #[doc = "< buffer of bitstream contained"] pub pBsBuf: *mut ::std::os::raw::c_uchar, -} -impl Default for SLayerBSInfo { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } + #[doc = "< PSNR values for Y/U/V"] + pub rPsnr: [f32; 3usize], } #[doc = " @brief Bitstream inforamtion of a layer being encoded"] pub type PLayerBSInfo = *mut SLayerBSInfo; #[doc = " @brief Frame bit stream info"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct SFrameBSInfo { pub iLayerNum: ::std::os::raw::c_int, pub sLayerInfo: [SLayerBSInfo; 128usize], @@ -893,20 +805,11 @@ pub struct SFrameBSInfo { pub iFrameSizeInBytes: ::std::os::raw::c_int, pub uiTimeStamp: ::std::os::raw::c_longlong, } -impl Default for SFrameBSInfo { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief Frame bit stream info"] pub type PFrameBSInfo = *mut SFrameBSInfo; #[doc = " @brief Structure for source picture"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct Source_Picture_s { #[doc = "< color space type"] pub iColorFormat: ::std::os::raw::c_int, @@ -920,96 +823,57 @@ pub struct Source_Picture_s { pub iPicHeight: ::std::os::raw::c_int, #[doc = "< timestamp of the source picture, unit: millisecond"] pub uiTimeStamp: ::std::os::raw::c_longlong, -} -impl Default for Source_Picture_s { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } + #[doc = "< get Y PSNR for this frame"] + pub bPsnrY: bool, + #[doc = "< get U PSNR for this frame"] + pub bPsnrU: bool, + #[doc = "< get V PSNR for this frame"] + pub bPsnrV: bool, } #[doc = " @brief Structure for source picture"] pub type SSourcePicture = Source_Picture_s; #[doc = " @brief Structure for bit rate info"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct TagBitrateInfo { pub iLayer: LAYER_NUM, #[doc = "< the maximum bitrate"] pub iBitrate: ::std::os::raw::c_int, } -impl Default for TagBitrateInfo { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief Structure for bit rate info"] pub type SBitrateInfo = TagBitrateInfo; #[doc = " @brief Structure for dump layer info"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct TagDumpLayer { pub iLayer: ::std::os::raw::c_int, pub pFileName: *mut ::std::os::raw::c_char, } -impl Default for TagDumpLayer { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief Structure for dump layer info"] pub type SDumpLayer = TagDumpLayer; #[doc = " @brief Structure for profile info in layer"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct TagProfileInfo { pub iLayer: ::std::os::raw::c_int, #[doc = "< the profile info"] pub uiProfileIdc: EProfileIdc, } -impl Default for TagProfileInfo { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief Structure for profile info in layer"] pub type SProfileInfo = TagProfileInfo; #[doc = " @brief Structure for level info in layer"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct TagLevelInfo { pub iLayer: ::std::os::raw::c_int, #[doc = "< the level info"] pub uiLevelIdc: ELevelIdc, } -impl Default for TagLevelInfo { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief Structure for level info in layer"] pub type SLevelInfo = TagLevelInfo; #[doc = " @brief Structure for dilivery status"] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct TagDeliveryStatus { #[doc = "< 0: the previous frame isn't delivered,1: the previous frame is delivered"] pub bDeliveryFlag: bool, @@ -1022,7 +886,7 @@ pub struct TagDeliveryStatus { pub type SDeliveryStatus = TagDeliveryStatus; #[doc = " @brief The capability of decoder, for SDP negotiation"] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct TagDecoderCapability { #[doc = "< profile_idc"] pub iProfileIdc: ::std::os::raw::c_int, @@ -1047,7 +911,7 @@ pub struct TagDecoderCapability { pub type SDecoderCapability = TagDecoderCapability; #[doc = " @brief Structure for parse only output"] #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct TagParserBsInfo { #[doc = "< total NAL number in current AU"] pub iNalNum: ::std::os::raw::c_int, @@ -1064,22 +928,13 @@ pub struct TagParserBsInfo { #[doc = "< output BS timestamp"] pub uiOutBsTimeStamp: ::std::os::raw::c_ulonglong, } -impl Default for TagParserBsInfo { - fn default() -> Self { - let mut s = ::std::mem::MaybeUninit::::uninit(); - unsafe { - ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); - s.assume_init() - } - } -} #[doc = " @brief Structure for parse only output"] pub type SParserBsInfo = TagParserBsInfo; #[doc = " @brief Structure for parse only output"] pub type PParserBsInfo = *mut TagParserBsInfo; #[doc = " @brief Structure for encoder statistics"] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)] +#[derive(Debug, Copy, Clone)] pub struct TagVideoEncoderStatistics { #[doc = "< the width of encoded frame"] pub uiWidth: ::std::os::raw::c_uint, @@ -1117,7 +972,7 @@ pub struct TagVideoEncoderStatistics { pub type SEncoderStatistics = TagVideoEncoderStatistics; #[doc = " @brief Structure for decoder statistics"] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)] +#[derive(Debug, Copy, Clone)] pub struct TagVideoDecoderStatistics { #[doc = "< the width of encode/decode frame"] pub uiWidth: ::std::os::raw::c_uint, @@ -1176,7 +1031,7 @@ pub struct TagVideoDecoderStatistics { pub type SDecoderStatistics = TagVideoDecoderStatistics; #[doc = " @brief Structure for sample aspect ratio (SAR) info in VUI"] #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct TagVuiSarInfo { #[doc = "< SAR width"] pub uiSarWidth: ::std::os::raw::c_uint, @@ -1191,7 +1046,7 @@ pub type SVuiSarInfo = TagVuiSarInfo; pub type PVuiSarInfo = *mut TagVuiSarInfo; pub type ISVCEncoder = *const ISVCEncoderVtbl; #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct ISVCEncoderVtbl { pub Initialize: ::std::option::Option< unsafe extern "C" fn( @@ -1247,7 +1102,7 @@ pub struct ISVCEncoderVtbl { } pub type ISVCDecoder = *const ISVCDecoderVtbl; #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Debug, Copy, Clone)] pub struct ISVCDecoderVtbl { pub Initialize: ::std::option::Option< unsafe extern "C" fn( @@ -1337,9 +1192,9 @@ pub type WelsTraceCallback = ::std::option::Option< string: *const ::std::os::raw::c_char, ), >; -extern crate libloading; pub struct OpenH264 { __library: ::libloading::Library, + pub kiKeyNumMultiple: Result<*mut [::std::os::raw::c_char; 6usize], ::libloading::Error>, pub WelsCreateSVCEncoder: Result< unsafe extern "C" fn(ppEncoder: *mut *mut ISVCEncoder) -> ::std::os::raw::c_int, ::libloading::Error, @@ -1361,11 +1216,11 @@ pub struct OpenH264 { Result, } impl OpenH264 { - pub unsafe fn new

(filename: P) -> Result + pub unsafe fn new

(path: P) -> Result where P: AsRef<::std::ffi::OsStr>, { - let library = ::libloading::Library::new(filename)?; + let library = ::libloading::Library::new(path)?; Self::from_library(library) } pub unsafe fn from_library(library: L) -> Result @@ -1373,6 +1228,9 @@ impl OpenH264 { L: Into<::libloading::Library>, { let __library = library.into(); + let kiKeyNumMultiple = __library + .get::<*mut [::std::os::raw::c_char; 6usize]>(b"kiKeyNumMultiple\0") + .map(|sym| *sym); let WelsCreateSVCEncoder = __library.get(b"WelsCreateSVCEncoder\0").map(|sym| *sym); let WelsDestroySVCEncoder = __library.get(b"WelsDestroySVCEncoder\0").map(|sym| *sym); let WelsGetDecoderCapability = __library.get(b"WelsGetDecoderCapability\0").map(|sym| *sym); @@ -1382,6 +1240,7 @@ impl OpenH264 { let WelsGetCodecVersionEx = __library.get(b"WelsGetCodecVersionEx\0").map(|sym| *sym); Ok(OpenH264 { __library, + kiKeyNumMultiple, WelsCreateSVCEncoder, WelsDestroySVCEncoder, WelsGetDecoderCapability, @@ -1391,6 +1250,12 @@ impl OpenH264 { WelsGetCodecVersionEx, }) } + pub unsafe fn kiKeyNumMultiple(&self) -> *mut [::std::os::raw::c_char; 6usize] { + *self + .kiKeyNumMultiple + .as_ref() + .expect("Expected variable, got error.") + } #[doc = " @brief Create encoder\n @param ppEncoder encoder\n @return 0 - success; otherwise - failed;"] pub unsafe fn WelsCreateSVCEncoder( &self,