forked from mirrors/gstreamer-rs
Use uninitialized stack memory for out parameters instead of zeroed memory if applicable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1187>
This commit is contained in:
parent
1b022a6b7c
commit
f07727ee6d
26 changed files with 61 additions and 61 deletions
|
@ -100,13 +100,13 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
|
||||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut allocator = ptr::null_mut();
|
let mut allocator = ptr::null_mut();
|
||||||
let mut params = mem::zeroed();
|
let mut params = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_audio_decoder_get_allocator(
|
ffi::gst_audio_decoder_get_allocator(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
&mut allocator,
|
&mut allocator,
|
||||||
&mut params,
|
params.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
(from_glib_full(allocator), params.into())
|
(from_glib_full(allocator), params.assume_init().into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,13 +56,13 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExtManual for O {
|
||||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut allocator = ptr::null_mut();
|
let mut allocator = ptr::null_mut();
|
||||||
let mut params = mem::zeroed();
|
let mut params = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_audio_encoder_get_allocator(
|
ffi::gst_audio_encoder_get_allocator(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
&mut allocator,
|
&mut allocator,
|
||||||
&mut params,
|
params.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
(from_glib_full(allocator), params.into())
|
(from_glib_full(allocator), params.assume_init().into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,13 +84,13 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
||||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut allocator = ptr::null_mut();
|
let mut allocator = ptr::null_mut();
|
||||||
let mut params = mem::zeroed();
|
let mut params = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_aggregator_get_allocator(
|
ffi::gst_aggregator_get_allocator(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
&mut allocator,
|
&mut allocator,
|
||||||
&mut params,
|
params.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
(from_glib_full(allocator), params.into())
|
(from_glib_full(allocator), params.assume_init().into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,13 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
||||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut allocator = ptr::null_mut();
|
let mut allocator = ptr::null_mut();
|
||||||
let mut params = mem::zeroed();
|
let mut params = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_base_src_get_allocator(
|
ffi::gst_base_src_get_allocator(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
&mut allocator,
|
&mut allocator,
|
||||||
&mut params,
|
params.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
(from_glib_full(allocator), params.into())
|
(from_glib_full(allocator), params.assume_init().into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,13 @@ impl<O: IsA<BaseTransform>> BaseTransformExtManual for O {
|
||||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut allocator = ptr::null_mut();
|
let mut allocator = ptr::null_mut();
|
||||||
let mut params = mem::zeroed();
|
let mut params = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_base_transform_get_allocator(
|
ffi::gst_base_transform_get_allocator(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
&mut allocator,
|
&mut allocator,
|
||||||
&mut params,
|
params.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
(from_glib_full(allocator), params.into())
|
(from_glib_full(allocator), params.assume_init().into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl<'a> VideoFrameGLExt for gst_video::VideoFrameRef<&'a gst::BufferRef> {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(gst_video::ffi::gst_video_frame_map(
|
let res: bool = from_glib(gst_video::ffi::gst_video_frame_map(
|
||||||
frame.as_mut_ptr(),
|
frame.as_mut_ptr(),
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
|
@ -108,7 +108,7 @@ impl<'a> VideoFrameGLExt for gst_video::VideoFrameRef<&'a gst::BufferRef> {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(gst_video::ffi::gst_video_frame_map(
|
let res: bool = from_glib(gst_video::ffi::gst_video_frame_map(
|
||||||
frame.as_mut_ptr(),
|
frame.as_mut_ptr(),
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
|
|
|
@ -15,7 +15,7 @@ impl SDPAttribute {
|
||||||
pub fn new(key: &str, value: Option<&str>) -> Self {
|
pub fn new(key: &str, value: Option<&str>) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut attr = mem::MaybeUninit::zeroed();
|
let mut attr = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_attribute_set(
|
ffi::gst_sdp_attribute_set(
|
||||||
attr.as_mut_ptr(),
|
attr.as_mut_ptr(),
|
||||||
key.to_glib_none().0,
|
key.to_glib_none().0,
|
||||||
|
|
|
@ -15,7 +15,7 @@ impl SDPBandwidth {
|
||||||
pub fn new(bwtype: &str, bandwidth: u32) -> Self {
|
pub fn new(bwtype: &str, bandwidth: u32) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut bw = mem::MaybeUninit::zeroed();
|
let mut bw = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_bandwidth_set(bw.as_mut_ptr(), bwtype.to_glib_none().0, bandwidth);
|
ffi::gst_sdp_bandwidth_set(bw.as_mut_ptr(), bwtype.to_glib_none().0, bandwidth);
|
||||||
SDPBandwidth(bw.assume_init())
|
SDPBandwidth(bw.assume_init())
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ impl Clone for SDPBandwidth {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut bw = mem::MaybeUninit::zeroed();
|
let mut bw = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_bandwidth_set(bw.as_mut_ptr(), self.0.bwtype, self.0.bandwidth);
|
ffi::gst_sdp_bandwidth_set(bw.as_mut_ptr(), self.0.bwtype, self.0.bandwidth);
|
||||||
SDPBandwidth(bw.assume_init())
|
SDPBandwidth(bw.assume_init())
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ impl SDPConnection {
|
||||||
pub fn new(nettype: &str, addrtype: &str, address: &str, ttl: u32, addr_number: u32) -> Self {
|
pub fn new(nettype: &str, addrtype: &str, address: &str, ttl: u32, addr_number: u32) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut conn = mem::MaybeUninit::zeroed();
|
let mut conn = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_connection_set(
|
ffi::gst_sdp_connection_set(
|
||||||
conn.as_mut_ptr(),
|
conn.as_mut_ptr(),
|
||||||
nettype.to_glib_none().0,
|
nettype.to_glib_none().0,
|
||||||
|
@ -71,7 +71,7 @@ impl Clone for SDPConnection {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut conn = mem::MaybeUninit::zeroed();
|
let mut conn = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_connection_set(
|
ffi::gst_sdp_connection_set(
|
||||||
conn.as_mut_ptr(),
|
conn.as_mut_ptr(),
|
||||||
self.0.nettype,
|
self.0.nettype,
|
||||||
|
|
|
@ -15,7 +15,7 @@ impl SDPTime {
|
||||||
pub fn new(start: &str, stop: &str, repeat: &[&str]) -> Self {
|
pub fn new(start: &str, stop: &str, repeat: &[&str]) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut time = mem::MaybeUninit::zeroed();
|
let mut time = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_time_set(
|
ffi::gst_sdp_time_set(
|
||||||
time.as_mut_ptr(),
|
time.as_mut_ptr(),
|
||||||
start.to_glib_none().0,
|
start.to_glib_none().0,
|
||||||
|
@ -69,7 +69,7 @@ impl Clone for SDPTime {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
#[allow(clippy::cast_ptr_alignment)]
|
#[allow(clippy::cast_ptr_alignment)]
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut time = mem::MaybeUninit::zeroed();
|
let mut time = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_time_set(
|
ffi::gst_sdp_time_set(
|
||||||
time.as_mut_ptr(),
|
time.as_mut_ptr(),
|
||||||
self.0.start,
|
self.0.start,
|
||||||
|
|
|
@ -15,7 +15,7 @@ impl SDPZone {
|
||||||
pub fn new(time: &str, typed_time: &str) -> Self {
|
pub fn new(time: &str, typed_time: &str) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut zone = mem::MaybeUninit::zeroed();
|
let mut zone = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_zone_set(
|
ffi::gst_sdp_zone_set(
|
||||||
zone.as_mut_ptr(),
|
zone.as_mut_ptr(),
|
||||||
time.to_glib_none().0,
|
time.to_glib_none().0,
|
||||||
|
@ -50,7 +50,7 @@ impl Clone for SDPZone {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut zone = mem::MaybeUninit::zeroed();
|
let mut zone = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_zone_set(zone.as_mut_ptr(), self.0.time, self.0.typed_time);
|
ffi::gst_sdp_zone_set(zone.as_mut_ptr(), self.0.time, self.0.typed_time);
|
||||||
SDPZone(zone.assume_init())
|
SDPZone(zone.assume_init())
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ impl<T: VideoAggregatorImpl> VideoAggregatorImplExt for T {
|
||||||
let data = Self::type_data();
|
let data = Self::type_data();
|
||||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoAggregatorClass;
|
let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoAggregatorClass;
|
||||||
(*parent_class).find_best_format.and_then(|f| {
|
(*parent_class).find_best_format.and_then(|f| {
|
||||||
let mut info = mem::MaybeUninit::zeroed();
|
let mut info = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_video_info_init(info.as_mut_ptr());
|
ffi::gst_video_info_init(info.as_mut_ptr());
|
||||||
let mut info = info.assume_init();
|
let mut info = info.assume_init();
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ impl VideoBufferPoolConfig for gst::BufferPoolConfigRef {
|
||||||
#[doc(alias = "gst_buffer_pool_config_get_video_alignment")]
|
#[doc(alias = "gst_buffer_pool_config_get_video_alignment")]
|
||||||
fn video_alignment(&self) -> Option<VideoAlignment> {
|
fn video_alignment(&self) -> Option<VideoAlignment> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut alignment = mem::MaybeUninit::zeroed();
|
let mut alignment = mem::MaybeUninit::uninit();
|
||||||
let ret = from_glib(ffi::gst_buffer_pool_config_get_video_alignment(
|
let ret = from_glib(ffi::gst_buffer_pool_config_get_video_alignment(
|
||||||
self.as_ref().as_mut_ptr(),
|
self.as_ref().as_mut_ptr(),
|
||||||
alignment.as_mut_ptr(),
|
alignment.as_mut_ptr(),
|
||||||
|
|
|
@ -116,13 +116,13 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
||||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut allocator = ptr::null_mut();
|
let mut allocator = ptr::null_mut();
|
||||||
let mut params = mem::zeroed();
|
let mut params = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_video_decoder_get_allocator(
|
ffi::gst_video_decoder_get_allocator(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
&mut allocator,
|
&mut allocator,
|
||||||
&mut params,
|
params.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
(from_glib_full(allocator), params.into())
|
(from_glib_full(allocator), params.assume_init().into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,13 +89,13 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
|
||||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut allocator = ptr::null_mut();
|
let mut allocator = ptr::null_mut();
|
||||||
let mut params = mem::zeroed();
|
let mut params = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_video_encoder_get_allocator(
|
ffi::gst_video_encoder_get_allocator(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
&mut allocator,
|
&mut allocator,
|
||||||
&mut params,
|
params.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
(from_glib_full(allocator), params.into())
|
(from_glib_full(allocator), params.assume_init().into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,7 @@ impl VideoFrame<Readable> {
|
||||||
assert!(info.is_valid());
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_video_frame_map(
|
let res: bool = from_glib(ffi::gst_video_frame_map(
|
||||||
frame.as_mut_ptr(),
|
frame.as_mut_ptr(),
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
|
@ -301,7 +301,7 @@ impl VideoFrame<Readable> {
|
||||||
assert!(info.is_valid());
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_video_frame_map_id(
|
let res: bool = from_glib(ffi::gst_video_frame_map_id(
|
||||||
frame.as_mut_ptr(),
|
frame.as_mut_ptr(),
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
|
@ -340,7 +340,7 @@ impl VideoFrame<Writable> {
|
||||||
assert!(info.is_valid());
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_video_frame_map(
|
let res: bool = from_glib(ffi::gst_video_frame_map(
|
||||||
frame.as_mut_ptr(),
|
frame.as_mut_ptr(),
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
|
@ -375,7 +375,7 @@ impl VideoFrame<Writable> {
|
||||||
assert!(info.is_valid());
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_video_frame_map_id(
|
let res: bool = from_glib(ffi::gst_video_frame_map_id(
|
||||||
frame.as_mut_ptr(),
|
frame.as_mut_ptr(),
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
|
@ -693,7 +693,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
||||||
assert!(info.is_valid());
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_video_frame_map(
|
let res: bool = from_glib(ffi::gst_video_frame_map(
|
||||||
frame.as_mut_ptr(),
|
frame.as_mut_ptr(),
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
|
@ -726,7 +726,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
||||||
assert!(info.is_valid());
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_video_frame_map_id(
|
let res: bool = from_glib(ffi::gst_video_frame_map_id(
|
||||||
frame.as_mut_ptr(),
|
frame.as_mut_ptr(),
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
|
@ -788,7 +788,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
||||||
assert!(info.is_valid());
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_video_frame_map(
|
let res: bool = from_glib(ffi::gst_video_frame_map(
|
||||||
frame.as_mut_ptr(),
|
frame.as_mut_ptr(),
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
|
@ -823,7 +823,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
||||||
assert!(info.is_valid());
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_video_frame_map_id(
|
let res: bool = from_glib(ffi::gst_video_frame_map_id(
|
||||||
frame.as_mut_ptr(),
|
frame.as_mut_ptr(),
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl VideoContentLightLevel {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut info = mem::MaybeUninit::zeroed();
|
let mut info = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_video_content_light_level_from_caps(
|
let res: bool = from_glib(ffi::gst_video_content_light_level_from_caps(
|
||||||
info.as_mut_ptr(),
|
info.as_mut_ptr(),
|
||||||
caps.as_ptr(),
|
caps.as_ptr(),
|
||||||
|
@ -101,7 +101,7 @@ impl str::FromStr for VideoContentLightLevel {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut colorimetry = mem::MaybeUninit::zeroed();
|
let mut colorimetry = mem::MaybeUninit::uninit();
|
||||||
let valid: bool = from_glib(ffi::gst_video_content_light_level_from_string(
|
let valid: bool = from_glib(ffi::gst_video_content_light_level_from_string(
|
||||||
colorimetry.as_mut_ptr(),
|
colorimetry.as_mut_ptr(),
|
||||||
s.to_glib_none().0,
|
s.to_glib_none().0,
|
||||||
|
@ -206,7 +206,7 @@ impl VideoMasteringDisplayInfo {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut info = mem::MaybeUninit::zeroed();
|
let mut info = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_video_mastering_display_info_from_caps(
|
let res: bool = from_glib(ffi::gst_video_mastering_display_info_from_caps(
|
||||||
info.as_mut_ptr(),
|
info.as_mut_ptr(),
|
||||||
caps.as_ptr(),
|
caps.as_ptr(),
|
||||||
|
@ -254,7 +254,7 @@ impl str::FromStr for VideoMasteringDisplayInfo {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut colorimetry = mem::MaybeUninit::zeroed();
|
let mut colorimetry = mem::MaybeUninit::uninit();
|
||||||
let valid: bool = from_glib(ffi::gst_video_mastering_display_info_from_string(
|
let valid: bool = from_glib(ffi::gst_video_mastering_display_info_from_string(
|
||||||
colorimetry.as_mut_ptr(),
|
colorimetry.as_mut_ptr(),
|
||||||
s.to_glib_none().0,
|
s.to_glib_none().0,
|
||||||
|
|
|
@ -158,7 +158,7 @@ impl str::FromStr for crate::VideoColorimetry {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut colorimetry = mem::MaybeUninit::zeroed();
|
let mut colorimetry = mem::MaybeUninit::uninit();
|
||||||
let valid: bool = from_glib(ffi::gst_video_colorimetry_from_string(
|
let valid: bool = from_glib(ffi::gst_video_colorimetry_from_string(
|
||||||
colorimetry.as_mut_ptr(),
|
colorimetry.as_mut_ptr(),
|
||||||
s.to_glib_none().0,
|
s.to_glib_none().0,
|
||||||
|
|
|
@ -77,7 +77,7 @@ impl VideoTimeCode {
|
||||||
) -> Self {
|
) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut v = mem::MaybeUninit::zeroed();
|
let mut v = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_video_time_code_init(
|
ffi::gst_video_time_code_init(
|
||||||
v.as_mut_ptr(),
|
v.as_mut_ptr(),
|
||||||
fps.numer() as u32,
|
fps.numer() as u32,
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl VideoTimeCodeInterval {
|
||||||
pub fn new(hours: u32, minutes: u32, seconds: u32, frames: u32) -> Self {
|
pub fn new(hours: u32, minutes: u32, seconds: u32, frames: u32) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut v = mem::MaybeUninit::zeroed();
|
let mut v = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_video_time_code_interval_init(v.as_mut_ptr(), hours, minutes, seconds, frames);
|
ffi::gst_video_time_code_interval_init(v.as_mut_ptr(), hours, minutes, seconds, frames);
|
||||||
Self {
|
Self {
|
||||||
inner: v.assume_init(),
|
inner: v.assume_init(),
|
||||||
|
|
|
@ -110,7 +110,7 @@ impl Buffer {
|
||||||
#[doc(alias = "gst_buffer_map")]
|
#[doc(alias = "gst_buffer_map")]
|
||||||
pub fn into_mapped_buffer_readable(self) -> Result<MappedBuffer<Readable>, Self> {
|
pub fn into_mapped_buffer_readable(self) -> Result<MappedBuffer<Readable>, Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut map_info = mem::MaybeUninit::zeroed();
|
let mut map_info = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_buffer_map(
|
let res: bool = from_glib(ffi::gst_buffer_map(
|
||||||
self.as_mut_ptr(),
|
self.as_mut_ptr(),
|
||||||
map_info.as_mut_ptr(),
|
map_info.as_mut_ptr(),
|
||||||
|
@ -131,7 +131,7 @@ impl Buffer {
|
||||||
#[doc(alias = "gst_buffer_map")]
|
#[doc(alias = "gst_buffer_map")]
|
||||||
pub fn into_mapped_buffer_writable(self) -> Result<MappedBuffer<Writable>, Self> {
|
pub fn into_mapped_buffer_writable(self) -> Result<MappedBuffer<Writable>, Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut map_info = mem::MaybeUninit::zeroed();
|
let mut map_info = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_buffer_map(
|
let res: bool = from_glib(ffi::gst_buffer_map(
|
||||||
self.as_mut_ptr(),
|
self.as_mut_ptr(),
|
||||||
map_info.as_mut_ptr(),
|
map_info.as_mut_ptr(),
|
||||||
|
@ -177,7 +177,7 @@ impl BufferRef {
|
||||||
#[doc(alias = "gst_buffer_map")]
|
#[doc(alias = "gst_buffer_map")]
|
||||||
pub fn map_readable(&self) -> Result<BufferMap<Readable>, glib::BoolError> {
|
pub fn map_readable(&self) -> Result<BufferMap<Readable>, glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut map_info = mem::MaybeUninit::zeroed();
|
let mut map_info = mem::MaybeUninit::uninit();
|
||||||
let res =
|
let res =
|
||||||
ffi::gst_buffer_map(self.as_mut_ptr(), map_info.as_mut_ptr(), ffi::GST_MAP_READ);
|
ffi::gst_buffer_map(self.as_mut_ptr(), map_info.as_mut_ptr(), ffi::GST_MAP_READ);
|
||||||
if res == glib::ffi::GTRUE {
|
if res == glib::ffi::GTRUE {
|
||||||
|
@ -195,7 +195,7 @@ impl BufferRef {
|
||||||
#[doc(alias = "gst_buffer_map")]
|
#[doc(alias = "gst_buffer_map")]
|
||||||
pub fn map_writable(&mut self) -> Result<BufferMap<Writable>, glib::BoolError> {
|
pub fn map_writable(&mut self) -> Result<BufferMap<Writable>, glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut map_info = mem::MaybeUninit::zeroed();
|
let mut map_info = mem::MaybeUninit::uninit();
|
||||||
let res = ffi::gst_buffer_map(
|
let res = ffi::gst_buffer_map(
|
||||||
self.as_mut_ptr(),
|
self.as_mut_ptr(),
|
||||||
map_info.as_mut_ptr(),
|
map_info.as_mut_ptr(),
|
||||||
|
|
|
@ -207,7 +207,7 @@ impl BufferPoolConfigRef {
|
||||||
pub fn allocator(&self) -> Option<(Option<Allocator>, AllocationParams)> {
|
pub fn allocator(&self) -> Option<(Option<Allocator>, AllocationParams)> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut allocator = ptr::null_mut();
|
let mut allocator = ptr::null_mut();
|
||||||
let mut params = mem::MaybeUninit::zeroed();
|
let mut params = mem::MaybeUninit::uninit();
|
||||||
let ret = from_glib(ffi::gst_buffer_pool_config_get_allocator(
|
let ret = from_glib(ffi::gst_buffer_pool_config_get_allocator(
|
||||||
self.0.as_mut_ptr(),
|
self.0.as_mut_ptr(),
|
||||||
&mut allocator,
|
&mut allocator,
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl UnixBusExtManual for Bus {
|
||||||
fn pollfd(&self) -> unix::io::RawFd {
|
fn pollfd(&self) -> unix::io::RawFd {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut pollfd = mem::MaybeUninit::zeroed();
|
let mut pollfd = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_bus_get_pollfd(self.to_glib_none().0, pollfd.as_mut_ptr());
|
ffi::gst_bus_get_pollfd(self.to_glib_none().0, pollfd.as_mut_ptr());
|
||||||
let pollfd = pollfd.assume_init();
|
let pollfd = pollfd.assume_init();
|
||||||
pollfd.fd
|
pollfd.fd
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl WindowsBusExtManual for Bus {
|
||||||
fn pollfd(&self) -> windows::io::RawHandle {
|
fn pollfd(&self) -> windows::io::RawHandle {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut pollfd = mem::MaybeUninit::zeroed();
|
let mut pollfd = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_bus_get_pollfd(self.to_glib_none().0, pollfd.as_mut_ptr());
|
ffi::gst_bus_get_pollfd(self.to_glib_none().0, pollfd.as_mut_ptr());
|
||||||
let pollfd = pollfd.assume_init();
|
let pollfd = pollfd.assume_init();
|
||||||
pollfd.fd as *mut _
|
pollfd.fd as *mut _
|
||||||
|
|
|
@ -125,7 +125,7 @@ impl Memory {
|
||||||
|
|
||||||
pub fn into_mapped_memory_readable(self) -> Result<MappedMemory<Readable>, Self> {
|
pub fn into_mapped_memory_readable(self) -> Result<MappedMemory<Readable>, Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut map_info = mem::MaybeUninit::zeroed();
|
let mut map_info = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_memory_map(
|
let res: bool = from_glib(ffi::gst_memory_map(
|
||||||
self.as_mut_ptr(),
|
self.as_mut_ptr(),
|
||||||
map_info.as_mut_ptr(),
|
map_info.as_mut_ptr(),
|
||||||
|
@ -145,7 +145,7 @@ impl Memory {
|
||||||
|
|
||||||
pub fn into_mapped_memory_writable(self) -> Result<MappedMemory<Writable>, Self> {
|
pub fn into_mapped_memory_writable(self) -> Result<MappedMemory<Writable>, Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut map_info = mem::MaybeUninit::zeroed();
|
let mut map_info = mem::MaybeUninit::uninit();
|
||||||
let res: bool = from_glib(ffi::gst_memory_map(
|
let res: bool = from_glib(ffi::gst_memory_map(
|
||||||
self.as_mut_ptr(),
|
self.as_mut_ptr(),
|
||||||
map_info.as_mut_ptr(),
|
map_info.as_mut_ptr(),
|
||||||
|
@ -259,7 +259,7 @@ impl MemoryRef {
|
||||||
|
|
||||||
pub fn map_readable(&self) -> Result<MemoryMap<Readable>, glib::BoolError> {
|
pub fn map_readable(&self) -> Result<MemoryMap<Readable>, glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut map_info = mem::MaybeUninit::zeroed();
|
let mut map_info = mem::MaybeUninit::uninit();
|
||||||
let res =
|
let res =
|
||||||
ffi::gst_memory_map(self.as_mut_ptr(), map_info.as_mut_ptr(), ffi::GST_MAP_READ);
|
ffi::gst_memory_map(self.as_mut_ptr(), map_info.as_mut_ptr(), ffi::GST_MAP_READ);
|
||||||
if res == glib::ffi::GTRUE {
|
if res == glib::ffi::GTRUE {
|
||||||
|
@ -276,7 +276,7 @@ impl MemoryRef {
|
||||||
|
|
||||||
pub fn map_writable(&mut self) -> Result<MemoryMap<Writable>, glib::BoolError> {
|
pub fn map_writable(&mut self) -> Result<MemoryMap<Writable>, glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut map_info = mem::MaybeUninit::zeroed();
|
let mut map_info = mem::MaybeUninit::uninit();
|
||||||
let res = ffi::gst_memory_map(
|
let res = ffi::gst_memory_map(
|
||||||
self.as_mut_ptr(),
|
self.as_mut_ptr(),
|
||||||
map_info.as_mut_ptr(),
|
map_info.as_mut_ptr(),
|
||||||
|
|
|
@ -76,7 +76,7 @@ impl<T: FormattedValueIntrinsic> FormattedSegment<T> {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
let segment = unsafe {
|
let segment = unsafe {
|
||||||
let mut segment = mem::MaybeUninit::zeroed();
|
let mut segment = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_segment_init(segment.as_mut_ptr(), T::default_format().into_glib());
|
ffi::gst_segment_init(segment.as_mut_ptr(), T::default_format().into_glib());
|
||||||
segment.assume_init()
|
segment.assume_init()
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue