forked from mirrors/gstreamer-rs
Switch everything from mem::uninitialized() to MaybeUninit or mem::zeroed()
And also fix a few cases where mem::uninitialized() was simply wrong to use.
This commit is contained in:
parent
3ea9a435e2
commit
3a8d05075d
30 changed files with 889 additions and 680 deletions
|
@ -89,6 +89,11 @@ status = "generate"
|
|||
# Use Result<FlowSuccess, FlowError>
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "wait_clock"
|
||||
# Use Result<ClockSuccess, ClockError>
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "GstBase.BaseSrc"
|
||||
status = "generate"
|
||||
|
@ -162,7 +167,22 @@ status = "generate"
|
|||
|
||||
[[object.function]]
|
||||
name = "type_find_helper_for_data"
|
||||
# broken data type
|
||||
# broken return value
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "type_find_helper_for_data_with_extension"
|
||||
# broken return value
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "type_find_helper_for_buffer"
|
||||
# broken return value
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "type_find_helper_for_buffer_with_extension"
|
||||
# broken return value
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
|
|
|
@ -104,7 +104,7 @@ struct Gl {
|
|||
program: gl::types::GLuint,
|
||||
attr_position: gl::types::GLint,
|
||||
attr_texture: gl::types::GLint,
|
||||
vao: gl::types::GLuint,
|
||||
vao: Option<gl::types::GLuint>,
|
||||
vertex_buffer: gl::types::GLuint,
|
||||
vbo_indices: gl::types::GLuint,
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ impl Gl {
|
|||
self.gl.UseProgram(self.program);
|
||||
|
||||
if self.gl.BindVertexArray.is_loaded() {
|
||||
self.gl.BindVertexArray(self.vao);
|
||||
self.gl.BindVertexArray(self.vao.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -242,14 +242,19 @@ fn load(gl_context: &glutin::WindowedContext<glutin::PossiblyCurrent>) -> Gl {
|
|||
let attr_position = gl.GetAttribLocation(program, b"a_position\0".as_ptr() as *const _);
|
||||
let attr_texture = gl.GetAttribLocation(program, b"a_texcoord\0".as_ptr() as *const _);
|
||||
|
||||
let mut vao = mem::uninitialized();
|
||||
if gl.BindVertexArray.is_loaded() {
|
||||
gl.GenVertexArrays(1, &mut vao);
|
||||
let vao = if gl.BindVertexArray.is_loaded() {
|
||||
let mut vao = mem::MaybeUninit::uninit();
|
||||
gl.GenVertexArrays(1, vao.as_mut_ptr());
|
||||
let vao = vao.assume_init();
|
||||
gl.BindVertexArray(vao);
|
||||
}
|
||||
Some(vao)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let mut vertex_buffer = mem::uninitialized();
|
||||
gl.GenBuffers(1, &mut vertex_buffer);
|
||||
let mut vertex_buffer = mem::MaybeUninit::uninit();
|
||||
gl.GenBuffers(1, vertex_buffer.as_mut_ptr());
|
||||
let vertex_buffer = vertex_buffer.assume_init();
|
||||
gl.BindBuffer(gl::ARRAY_BUFFER, vertex_buffer);
|
||||
gl.BufferData(
|
||||
gl::ARRAY_BUFFER,
|
||||
|
@ -258,8 +263,9 @@ fn load(gl_context: &glutin::WindowedContext<glutin::PossiblyCurrent>) -> Gl {
|
|||
gl::STATIC_DRAW,
|
||||
);
|
||||
|
||||
let mut vbo_indices = mem::uninitialized();
|
||||
gl.GenBuffers(1, &mut vbo_indices);
|
||||
let mut vbo_indices = mem::MaybeUninit::uninit();
|
||||
gl.GenBuffers(1, vbo_indices.as_mut_ptr());
|
||||
let vbo_indices = vbo_indices.assume_init();
|
||||
gl.BindBuffer(gl::ELEMENT_ARRAY_BUFFER, vbo_indices);
|
||||
gl.BufferData(
|
||||
gl::ELEMENT_ARRAY_BUFFER,
|
||||
|
|
|
@ -217,10 +217,14 @@ impl AppSrc {
|
|||
|
||||
pub fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime) {
|
||||
unsafe {
|
||||
let mut min = mem::uninitialized();
|
||||
let mut max = mem::uninitialized();
|
||||
gst_app_sys::gst_app_src_get_latency(self.to_glib_none().0, &mut min, &mut max);
|
||||
(from_glib(min), from_glib(max))
|
||||
let mut min = mem::MaybeUninit::uninit();
|
||||
let mut max = mem::MaybeUninit::uninit();
|
||||
gst_app_sys::gst_app_src_get_latency(
|
||||
self.to_glib_none().0,
|
||||
min.as_mut_ptr(),
|
||||
max.as_mut_ptr(),
|
||||
);
|
||||
(from_glib(min.assume_init()), from_glib(max.assume_init()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,15 +48,15 @@ impl AudioChannelPosition {
|
|||
});
|
||||
|
||||
unsafe {
|
||||
let mut mask = mem::uninitialized();
|
||||
let mut mask = mem::MaybeUninit::uninit();
|
||||
let valid: bool = from_glib(gst_audio_sys::gst_audio_channel_positions_to_mask(
|
||||
positions_raw.as_ptr() as *mut _,
|
||||
len as i32,
|
||||
force_order.to_glib(),
|
||||
&mut mask,
|
||||
mask.as_mut_ptr(),
|
||||
));
|
||||
if valid {
|
||||
Some(mask)
|
||||
Some(mask.assume_init())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ pub struct AudioInfoBuilder<'a> {
|
|||
impl<'a> AudioInfoBuilder<'a> {
|
||||
pub fn build(self) -> Option<AudioInfo> {
|
||||
unsafe {
|
||||
let mut info = mem::uninitialized();
|
||||
let mut info = mem::MaybeUninit::uninit();
|
||||
|
||||
let positions = if let Some(p) = self.positions {
|
||||
if p.len() != self.channels as usize || p.len() > 64 {
|
||||
|
@ -88,13 +88,15 @@ impl<'a> AudioInfoBuilder<'a> {
|
|||
.unwrap_or(ptr::null());
|
||||
|
||||
gst_audio_sys::gst_audio_info_set_format(
|
||||
&mut info,
|
||||
info.as_mut_ptr(),
|
||||
self.format.to_glib(),
|
||||
self.rate as i32,
|
||||
self.channels as i32,
|
||||
positions_ptr as *mut _,
|
||||
);
|
||||
|
||||
let mut info = info.assume_init();
|
||||
|
||||
if info.finfo.is_null() || info.rate <= 0 || info.channels <= 0 {
|
||||
return None;
|
||||
}
|
||||
|
@ -153,11 +155,12 @@ impl AudioInfo {
|
|||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
let mut info = mem::uninitialized();
|
||||
let mut info = mem::MaybeUninit::uninit();
|
||||
if from_glib(gst_audio_sys::gst_audio_info_from_caps(
|
||||
&mut info,
|
||||
info.as_mut_ptr(),
|
||||
caps.as_ptr(),
|
||||
)) {
|
||||
let info = info.assume_init();
|
||||
let positions = array_init::array_init_copy(|i| from_glib(info.position[i]));
|
||||
Some(AudioInfo(info, positions))
|
||||
} else {
|
||||
|
@ -178,15 +181,15 @@ impl AudioInfo {
|
|||
|
||||
let src_val = src_val.into();
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
if from_glib(gst_audio_sys::gst_audio_info_convert(
|
||||
&self.0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
)) {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val))
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -202,15 +205,18 @@ impl AudioInfo {
|
|||
|
||||
let src_val = src_val.into();
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
if from_glib(gst_audio_sys::gst_audio_info_convert(
|
||||
&self.0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
dest_fmt.to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
)) {
|
||||
Some(gst::GenericFormattedValue::new(dest_fmt, dest_val))
|
||||
Some(gst::GenericFormattedValue::new(
|
||||
dest_fmt,
|
||||
dest_val.assume_init(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -22,23 +22,23 @@ impl AudioStreamAlign {
|
|||
n_samples: u32,
|
||||
) -> (bool, gst::ClockTime, gst::ClockTime, u64) {
|
||||
unsafe {
|
||||
let mut out_timestamp = mem::uninitialized();
|
||||
let mut out_duration = mem::uninitialized();
|
||||
let mut out_sample_position = mem::uninitialized();
|
||||
let mut out_timestamp = mem::MaybeUninit::uninit();
|
||||
let mut out_duration = mem::MaybeUninit::uninit();
|
||||
let mut out_sample_position = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_audio_sys::gst_audio_stream_align_process(
|
||||
self.to_glib_none_mut().0,
|
||||
discont.to_glib(),
|
||||
timestamp.to_glib(),
|
||||
n_samples,
|
||||
&mut out_timestamp,
|
||||
&mut out_duration,
|
||||
&mut out_sample_position,
|
||||
out_timestamp.as_mut_ptr(),
|
||||
out_duration.as_mut_ptr(),
|
||||
out_sample_position.as_mut_ptr(),
|
||||
));
|
||||
(
|
||||
ret,
|
||||
from_glib(out_timestamp),
|
||||
from_glib(out_duration),
|
||||
out_sample_position,
|
||||
from_glib(out_timestamp.assume_init()),
|
||||
from_glib(out_duration.assume_init()),
|
||||
out_sample_position.assume_init(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ pub fn audio_buffer_clip(
|
|||
buffer: gst::Buffer,
|
||||
segment: &gst::Segment,
|
||||
rate: u32,
|
||||
channels: u32,
|
||||
bpf: u32,
|
||||
) -> Option<gst::Buffer> {
|
||||
skip_assert_initialized!();
|
||||
|
||||
|
@ -63,7 +63,7 @@ pub fn audio_buffer_clip(
|
|||
buffer.into_ptr(),
|
||||
segment.to_glib_none().0,
|
||||
rate as i32,
|
||||
channels as i32,
|
||||
bpf as i32,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,8 +91,6 @@ pub trait BaseSinkExt: 'static {
|
|||
|
||||
fn set_ts_offset(&self, offset: gst::ClockTimeDiff);
|
||||
|
||||
fn wait_clock(&self, time: gst::ClockTime) -> (gst::ClockReturn, gst::ClockTimeDiff);
|
||||
|
||||
fn get_property_async(&self) -> bool;
|
||||
|
||||
fn set_property_async(&self, async: bool);
|
||||
|
@ -394,19 +392,6 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn wait_clock(&self, time: gst::ClockTime) -> (gst::ClockReturn, gst::ClockTimeDiff) {
|
||||
unsafe {
|
||||
let mut jitter = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_base_sys::gst_base_sink_wait_clock(
|
||||
self.as_ref().to_glib_none().0,
|
||||
time.to_glib(),
|
||||
jitter.as_mut_ptr(),
|
||||
));
|
||||
let jitter = jitter.assume_init();
|
||||
(ret, jitter)
|
||||
}
|
||||
}
|
||||
|
||||
fn get_property_async(&self) -> bool {
|
||||
unsafe {
|
||||
let mut value = Value::from_type(<bool as StaticType>::static_type());
|
||||
|
|
|
@ -6,7 +6,6 @@ use glib::object::IsA;
|
|||
use glib::translate::*;
|
||||
use gst;
|
||||
use gst_base_sys;
|
||||
use std::mem;
|
||||
|
||||
pub fn type_find_helper<P: IsA<gst::Pad>>(src: &P, size: u64) -> Option<gst::Caps> {
|
||||
assert_initialized_main_thread!();
|
||||
|
@ -18,67 +17,6 @@ pub fn type_find_helper<P: IsA<gst::Pad>>(src: &P, size: u64) -> Option<gst::Cap
|
|||
}
|
||||
}
|
||||
|
||||
pub fn type_find_helper_for_buffer<P: IsA<gst::Object>>(
|
||||
obj: Option<&P>,
|
||||
buf: &gst::Buffer,
|
||||
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
let mut prob = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib_full(gst_base_sys::gst_type_find_helper_for_buffer(
|
||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||
buf.to_glib_none().0,
|
||||
prob.as_mut_ptr(),
|
||||
));
|
||||
let prob = prob.assume_init();
|
||||
(ret, from_glib(prob))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
pub fn type_find_helper_for_buffer_with_extension<P: IsA<gst::Object>>(
|
||||
obj: Option<&P>,
|
||||
buf: &gst::Buffer,
|
||||
extension: Option<&str>,
|
||||
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
let mut prob = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib_full(
|
||||
gst_base_sys::gst_type_find_helper_for_buffer_with_extension(
|
||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||
buf.to_glib_none().0,
|
||||
extension.to_glib_none().0,
|
||||
prob.as_mut_ptr(),
|
||||
),
|
||||
);
|
||||
let prob = prob.assume_init();
|
||||
(ret, from_glib(prob))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
pub fn type_find_helper_for_data_with_extension<P: IsA<gst::Object>>(
|
||||
obj: Option<&P>,
|
||||
data: &[u8],
|
||||
extension: Option<&str>,
|
||||
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
|
||||
assert_initialized_main_thread!();
|
||||
let size = data.len() as usize;
|
||||
unsafe {
|
||||
let mut prob = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib_full(gst_base_sys::gst_type_find_helper_for_data_with_extension(
|
||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||
data.to_glib_none().0,
|
||||
size,
|
||||
extension.to_glib_none().0,
|
||||
prob.as_mut_ptr(),
|
||||
));
|
||||
let prob = prob.assume_init();
|
||||
(ret, from_glib(prob))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn type_find_helper_for_extension<P: IsA<gst::Object>>(
|
||||
obj: Option<&P>,
|
||||
extension: &str,
|
||||
|
|
|
@ -86,16 +86,16 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
|||
) -> Option<U> {
|
||||
let src_val = src_val.into();
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_base_sys::gst_base_parse_convert_default(
|
||||
self.as_ref().to_glib_none().0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val))
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -109,16 +109,19 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
|||
) -> Option<gst::GenericFormattedValue> {
|
||||
let src_val = src_val.into();
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_base_sys::gst_base_parse_convert_default(
|
||||
self.as_ref().to_glib_none().0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
dest_format.to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(gst::GenericFormattedValue::new(dest_format, dest_val))
|
||||
Some(gst::GenericFormattedValue::new(
|
||||
dest_format,
|
||||
dest_val.assume_init(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ use glib::object::IsA;
|
|||
use glib::translate::*;
|
||||
use gst;
|
||||
use gst_base_sys;
|
||||
use std::mem;
|
||||
use BaseSink;
|
||||
|
||||
pub trait BaseSinkExtManual: 'static {
|
||||
|
@ -22,6 +21,13 @@ pub trait BaseSinkExtManual: 'static {
|
|||
) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff);
|
||||
|
||||
fn wait_preroll(&self) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
fn wait_clock(
|
||||
&self,
|
||||
time: gst::ClockTime,
|
||||
) -> (
|
||||
Result<gst::ClockSuccess, gst::ClockError>,
|
||||
gst::ClockTimeDiff,
|
||||
);
|
||||
}
|
||||
|
||||
impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
||||
|
@ -38,7 +44,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
|||
time: gst::ClockTime,
|
||||
) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff) {
|
||||
unsafe {
|
||||
let mut jitter = mem::uninitialized();
|
||||
let mut jitter = 0;
|
||||
let ret: gst::FlowReturn = from_glib(gst_base_sys::gst_base_sink_wait(
|
||||
self.as_ref().to_glib_none().0,
|
||||
time.to_glib(),
|
||||
|
@ -56,4 +62,22 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
|||
};
|
||||
ret.into_result()
|
||||
}
|
||||
|
||||
fn wait_clock(
|
||||
&self,
|
||||
time: gst::ClockTime,
|
||||
) -> (
|
||||
Result<gst::ClockSuccess, gst::ClockError>,
|
||||
gst::ClockTimeDiff,
|
||||
) {
|
||||
unsafe {
|
||||
let mut jitter = 0;
|
||||
let ret: gst::ClockReturn = from_glib(gst_base_sys::gst_base_sink_wait_clock(
|
||||
self.as_ref().to_glib_none().0,
|
||||
time.to_glib(),
|
||||
&mut jitter,
|
||||
));
|
||||
(ret.into_result(), jitter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,18 +15,91 @@ use std::mem;
|
|||
pub fn type_find_helper_for_data<P: IsA<gst::Object>, R: AsRef<[u8]>>(
|
||||
obj: Option<&P>,
|
||||
data: R,
|
||||
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
|
||||
) -> Option<(gst::Caps, gst::TypeFindProbability)> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
let mut prob = mem::uninitialized();
|
||||
let mut prob = mem::MaybeUninit::uninit();
|
||||
let data = data.as_ref();
|
||||
let (ptr, len) = (data.as_ptr(), data.len());
|
||||
let ret = from_glib_full(gst_base_sys::gst_type_find_helper_for_data(
|
||||
let ret = gst_base_sys::gst_type_find_helper_for_data(
|
||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||
mut_override(ptr),
|
||||
len,
|
||||
&mut prob,
|
||||
));
|
||||
(ret, from_glib(prob))
|
||||
prob.as_mut_ptr(),
|
||||
);
|
||||
if ret.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
pub fn type_find_helper_for_data_with_extension<P: IsA<gst::Object>, R: AsRef<[u8]>>(
|
||||
obj: Option<&P>,
|
||||
data: R,
|
||||
extension: Option<&str>,
|
||||
) -> Option<(gst::Caps, gst::TypeFindProbability)> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
let mut prob = mem::MaybeUninit::uninit();
|
||||
let data = data.as_ref();
|
||||
let (ptr, len) = (data.as_ptr(), data.len());
|
||||
let ret = gst_base_sys::gst_type_find_helper_for_data_with_extension(
|
||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||
mut_override(ptr),
|
||||
len,
|
||||
extension.to_glib_none().0,
|
||||
prob.as_mut_ptr(),
|
||||
);
|
||||
if ret.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn type_find_helper_for_buffer<P: IsA<gst::Object>>(
|
||||
obj: Option<&P>,
|
||||
buf: &gst::Buffer,
|
||||
) -> Option<(gst::Caps, gst::TypeFindProbability)> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
let mut prob = mem::MaybeUninit::uninit();
|
||||
let ret = gst_base_sys::gst_type_find_helper_for_buffer(
|
||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||
buf.to_glib_none().0,
|
||||
prob.as_mut_ptr(),
|
||||
);
|
||||
if ret.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
pub fn type_find_helper_for_buffer_with_extension<P: IsA<gst::Object>>(
|
||||
obj: Option<&P>,
|
||||
buf: &gst::Buffer,
|
||||
extension: Option<&str>,
|
||||
) -> Option<(gst::Caps, gst::TypeFindProbability)> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
let mut prob = mem::MaybeUninit::uninit();
|
||||
let ret = gst_base_sys::gst_type_find_helper_for_buffer_with_extension(
|
||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||
buf.to_glib_none().0,
|
||||
extension.to_glib_none().0,
|
||||
prob.as_mut_ptr(),
|
||||
);
|
||||
if ret.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,22 +162,23 @@ impl<T: BaseParseImpl + ObjectImpl> BaseParseImplExt for T {
|
|||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass;
|
||||
let src_val = src_val.into();
|
||||
let res = (*parent_class).convert.map(|f| {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
|
||||
let res = from_glib(f(
|
||||
element.to_glib_none().0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
dest_format.to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
(res, dest_val)
|
||||
});
|
||||
|
||||
match res {
|
||||
Some((true, dest_val)) => {
|
||||
Some(gst::GenericFormattedValue::new(dest_format, dest_val))
|
||||
}
|
||||
Some((true, dest_val)) => Some(gst::GenericFormattedValue::new(
|
||||
dest_format,
|
||||
dest_val.assume_init(),
|
||||
)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ use glib::subclass::prelude::*;
|
|||
use gst;
|
||||
use gst::subclass::prelude::*;
|
||||
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
use BaseSrc;
|
||||
|
@ -205,9 +206,9 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
|
|||
(*parent_class)
|
||||
.get_size
|
||||
.map(|f| {
|
||||
let mut size = 0;
|
||||
if from_glib(f(element.to_glib_none().0, &mut size)) {
|
||||
Some(size)
|
||||
let mut size = mem::MaybeUninit::uninit();
|
||||
if from_glib(f(element.to_glib_none().0, size.as_mut_ptr())) {
|
||||
Some(size.assume_init())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ use glib::subclass::prelude::*;
|
|||
use gst;
|
||||
use gst::subclass::prelude::*;
|
||||
|
||||
use std::mem;
|
||||
|
||||
use BaseTransform;
|
||||
use BaseTransformClass;
|
||||
|
||||
|
@ -372,17 +374,17 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
|
|||
(*parent_class)
|
||||
.transform_size
|
||||
.map(|f| {
|
||||
let mut othersize = 0;
|
||||
let mut othersize = mem::MaybeUninit::uninit();
|
||||
let res: bool = from_glib(f(
|
||||
element.to_glib_none().0,
|
||||
direction.to_glib(),
|
||||
caps.to_glib_none().0,
|
||||
size,
|
||||
othercaps.to_glib_none().0,
|
||||
&mut othersize,
|
||||
othersize.as_mut_ptr(),
|
||||
));
|
||||
if res {
|
||||
Some(othersize)
|
||||
Some(othersize.assume_init())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -410,13 +412,13 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
|
|||
}
|
||||
});
|
||||
|
||||
let mut size = 0;
|
||||
let mut size = mem::MaybeUninit::uninit();
|
||||
if from_glib(f(
|
||||
element.to_glib_none().0,
|
||||
caps.to_glib_none().0,
|
||||
&mut size,
|
||||
size.as_mut_ptr(),
|
||||
)) {
|
||||
Some(size)
|
||||
Some(size.assume_init())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -15,27 +15,27 @@ use PlayerVideoInfo;
|
|||
impl PlayerVideoInfo {
|
||||
pub fn get_framerate(&self) -> gst::Fraction {
|
||||
unsafe {
|
||||
let mut fps_n = mem::uninitialized();
|
||||
let mut fps_d = mem::uninitialized();
|
||||
let mut fps_n = mem::MaybeUninit::uninit();
|
||||
let mut fps_d = mem::MaybeUninit::uninit();
|
||||
gst_player_sys::gst_player_video_info_get_framerate(
|
||||
self.to_glib_none().0,
|
||||
&mut fps_n,
|
||||
&mut fps_d,
|
||||
fps_n.as_mut_ptr(),
|
||||
fps_d.as_mut_ptr(),
|
||||
);
|
||||
(fps_n as i32, fps_d as i32).into()
|
||||
(fps_n.assume_init() as i32, fps_d.as_mut_ptr() as i32).into()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_pixel_aspect_ratio(&self) -> gst::Fraction {
|
||||
unsafe {
|
||||
let mut par_n = mem::uninitialized();
|
||||
let mut par_d = mem::uninitialized();
|
||||
let mut par_n = mem::MaybeUninit::uninit();
|
||||
let mut par_d = mem::MaybeUninit::uninit();
|
||||
gst_player_sys::gst_player_video_info_get_pixel_aspect_ratio(
|
||||
self.to_glib_none().0,
|
||||
&mut par_n,
|
||||
&mut par_d,
|
||||
par_n.as_mut_ptr(),
|
||||
par_d.as_mut_ptr(),
|
||||
);
|
||||
(par_n as i32, par_d as i32).into()
|
||||
(par_n.assume_init() as i32, par_d.assume_init() as i32).into()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,29 +160,29 @@ pub fn parse_downstream_force_key_unit_event(
|
|||
event: &gst::EventRef,
|
||||
) -> Option<DownstreamForceKeyUnitEvent> {
|
||||
unsafe {
|
||||
let mut timestamp = mem::uninitialized();
|
||||
let mut stream_time = mem::uninitialized();
|
||||
let mut running_time = mem::uninitialized();
|
||||
let mut all_headers = mem::uninitialized();
|
||||
let mut count = mem::uninitialized();
|
||||
let mut timestamp = mem::MaybeUninit::uninit();
|
||||
let mut stream_time = mem::MaybeUninit::uninit();
|
||||
let mut running_time = mem::MaybeUninit::uninit();
|
||||
let mut all_headers = mem::MaybeUninit::uninit();
|
||||
let mut count = mem::MaybeUninit::uninit();
|
||||
|
||||
let res: bool = from_glib(
|
||||
gst_video_sys::gst_video_event_parse_downstream_force_key_unit(
|
||||
event.as_mut_ptr(),
|
||||
&mut timestamp,
|
||||
&mut stream_time,
|
||||
&mut running_time,
|
||||
&mut all_headers,
|
||||
&mut count,
|
||||
timestamp.as_mut_ptr(),
|
||||
stream_time.as_mut_ptr(),
|
||||
running_time.as_mut_ptr(),
|
||||
all_headers.as_mut_ptr(),
|
||||
count.as_mut_ptr(),
|
||||
),
|
||||
);
|
||||
if res {
|
||||
Some(DownstreamForceKeyUnitEvent {
|
||||
timestamp: from_glib(timestamp),
|
||||
stream_time: from_glib(stream_time),
|
||||
running_time: from_glib(running_time),
|
||||
all_headers: from_glib(all_headers),
|
||||
count,
|
||||
timestamp: from_glib(timestamp.assume_init()),
|
||||
stream_time: from_glib(stream_time.assume_init()),
|
||||
running_time: from_glib(running_time.assume_init()),
|
||||
all_headers: from_glib(all_headers.assume_init()),
|
||||
count: count.assume_init(),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
@ -254,23 +254,23 @@ pub fn parse_upstream_force_key_unit_event(
|
|||
event: &gst::EventRef,
|
||||
) -> Option<UpstreamForceKeyUnitEvent> {
|
||||
unsafe {
|
||||
let mut running_time = mem::uninitialized();
|
||||
let mut all_headers = mem::uninitialized();
|
||||
let mut count = mem::uninitialized();
|
||||
let mut running_time = mem::MaybeUninit::uninit();
|
||||
let mut all_headers = mem::MaybeUninit::uninit();
|
||||
let mut count = mem::MaybeUninit::uninit();
|
||||
|
||||
let res: bool = from_glib(
|
||||
gst_video_sys::gst_video_event_parse_upstream_force_key_unit(
|
||||
event.as_mut_ptr(),
|
||||
&mut running_time,
|
||||
&mut all_headers,
|
||||
&mut count,
|
||||
running_time.as_mut_ptr(),
|
||||
all_headers.as_mut_ptr(),
|
||||
count.as_mut_ptr(),
|
||||
),
|
||||
);
|
||||
if res {
|
||||
Some(UpstreamForceKeyUnitEvent {
|
||||
running_time: from_glib(running_time),
|
||||
all_headers: from_glib(all_headers),
|
||||
count,
|
||||
running_time: from_glib(running_time.assume_init()),
|
||||
all_headers: from_glib(all_headers.assume_init()),
|
||||
count: count.assume_init(),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
@ -326,15 +326,15 @@ pub struct StillFrameEvent {
|
|||
|
||||
pub fn parse_still_frame_event(event: &gst::EventRef) -> Option<StillFrameEvent> {
|
||||
unsafe {
|
||||
let mut in_still = mem::uninitialized();
|
||||
let mut in_still = mem::MaybeUninit::uninit();
|
||||
|
||||
let res: bool = from_glib(gst_video_sys::gst_video_event_parse_still_frame(
|
||||
event.as_mut_ptr(),
|
||||
&mut in_still,
|
||||
in_still.as_mut_ptr(),
|
||||
));
|
||||
if res {
|
||||
Some(StillFrameEvent {
|
||||
in_still: from_glib(in_still),
|
||||
in_still: from_glib(in_still.assume_init()),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -270,41 +270,52 @@ pub struct VideoInfoBuilder<'a> {
|
|||
impl<'a> VideoInfoBuilder<'a> {
|
||||
pub fn build(self) -> Option<VideoInfo> {
|
||||
unsafe {
|
||||
let mut info = mem::uninitialized();
|
||||
let mut info = mem::MaybeUninit::uninit();
|
||||
|
||||
#[cfg(not(feature = "v1_16"))]
|
||||
{
|
||||
gst_video_sys::gst_video_info_set_format(
|
||||
&mut info,
|
||||
let res: bool = {
|
||||
let res = from_glib(gst_video_sys::gst_video_info_set_format(
|
||||
info.as_mut_ptr(),
|
||||
self.format.to_glib(),
|
||||
self.width,
|
||||
self.height,
|
||||
);
|
||||
));
|
||||
|
||||
if let Some(interlace_mode) = self.interlace_mode {
|
||||
info.interlace_mode = interlace_mode.to_glib();
|
||||
if res {
|
||||
if let Some(interlace_mode) = self.interlace_mode {
|
||||
let info = info.as_mut_ptr();
|
||||
(*info).interlace_mode = interlace_mode.to_glib();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res
|
||||
};
|
||||
#[cfg(feature = "v1_16")]
|
||||
{
|
||||
if let Some(interlace_mode) = self.interlace_mode {
|
||||
let res: bool = {
|
||||
from_glib(if let Some(interlace_mode) = self.interlace_mode {
|
||||
gst_video_sys::gst_video_info_set_interlaced_format(
|
||||
&mut info,
|
||||
info.as_mut_ptr(),
|
||||
self.format.to_glib(),
|
||||
interlace_mode.to_glib(),
|
||||
self.width,
|
||||
self.height,
|
||||
);
|
||||
)
|
||||
} else {
|
||||
gst_video_sys::gst_video_info_set_format(
|
||||
&mut info,
|
||||
info.as_mut_ptr(),
|
||||
self.format.to_glib(),
|
||||
self.width,
|
||||
self.height,
|
||||
);
|
||||
}
|
||||
)
|
||||
})
|
||||
};
|
||||
|
||||
if !res {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut info = info.assume_init();
|
||||
|
||||
if info.finfo.is_null() || info.width <= 0 || info.height <= 0 {
|
||||
return None;
|
||||
}
|
||||
|
@ -524,12 +535,12 @@ impl VideoInfo {
|
|||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
let mut info = mem::uninitialized();
|
||||
let mut info = mem::MaybeUninit::uninit();
|
||||
if from_glib(gst_video_sys::gst_video_info_from_caps(
|
||||
&mut info,
|
||||
info.as_mut_ptr(),
|
||||
caps.as_ptr(),
|
||||
)) {
|
||||
Some(VideoInfo(info))
|
||||
Some(VideoInfo(info.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -658,15 +669,15 @@ impl VideoInfo {
|
|||
|
||||
let src_val = src_val.into();
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
if from_glib(gst_video_sys::gst_video_info_convert(
|
||||
&self.0 as *const _ as *mut _,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
)) {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val))
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -682,15 +693,18 @@ impl VideoInfo {
|
|||
|
||||
let src_val = src_val.into();
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
if from_glib(gst_video_sys::gst_video_info_convert(
|
||||
&self.0 as *const _ as *mut _,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
dest_fmt.to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
)) {
|
||||
Some(gst::GenericFormattedValue::new(dest_fmt, dest_val))
|
||||
Some(gst::GenericFormattedValue::new(
|
||||
dest_fmt,
|
||||
dest_val.assume_init(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
|
||||
use gst;
|
||||
use gst::miniobject::*;
|
||||
|
@ -81,20 +82,25 @@ impl VideoOverlayRectangleRef {
|
|||
|
||||
pub fn get_render_rectangle(&self) -> (i32, i32, u32, u32) {
|
||||
unsafe {
|
||||
let mut render_x = 0;
|
||||
let mut render_y = 0;
|
||||
let mut render_width = 0;
|
||||
let mut render_height = 0;
|
||||
let mut render_x = mem::MaybeUninit::uninit();
|
||||
let mut render_y = mem::MaybeUninit::uninit();
|
||||
let mut render_width = mem::MaybeUninit::uninit();
|
||||
let mut render_height = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_video_sys::gst_video_overlay_rectangle_get_render_rectangle(
|
||||
self.as_mut_ptr(),
|
||||
&mut render_x,
|
||||
&mut render_y,
|
||||
&mut render_width,
|
||||
&mut render_height,
|
||||
render_x.as_mut_ptr(),
|
||||
render_y.as_mut_ptr(),
|
||||
render_width.as_mut_ptr(),
|
||||
render_height.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(render_x, render_y, render_width, render_height)
|
||||
(
|
||||
render_x.assume_init(),
|
||||
render_y.assume_init(),
|
||||
render_width.assume_init(),
|
||||
render_height.assume_init(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -297,19 +297,18 @@ impl BufferRef {
|
|||
}
|
||||
|
||||
pub fn get_maxsize(&self) -> usize {
|
||||
let mut maxsize: usize = 0;
|
||||
|
||||
unsafe {
|
||||
let mut maxsize = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_buffer_get_sizes_range(
|
||||
self.as_mut_ptr(),
|
||||
0,
|
||||
-1,
|
||||
ptr::null_mut(),
|
||||
&mut maxsize,
|
||||
maxsize.as_mut_ptr(),
|
||||
);
|
||||
};
|
||||
|
||||
maxsize
|
||||
maxsize.assume_init()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_size(&mut self, size: usize) {
|
||||
|
@ -412,24 +411,25 @@ impl BufferRef {
|
|||
}
|
||||
|
||||
pub fn find_memory(&self, offset: usize, size: Option<usize>) -> Option<(u32, u32, usize)> {
|
||||
let mut idx = 0;
|
||||
let mut length = 0;
|
||||
let mut skip = 0;
|
||||
let res;
|
||||
unsafe {
|
||||
res = from_glib(gst_sys::gst_buffer_find_memory(
|
||||
let mut idx = mem::MaybeUninit::uninit();
|
||||
let mut length = mem::MaybeUninit::uninit();
|
||||
let mut skip = mem::MaybeUninit::uninit();
|
||||
|
||||
let res = from_glib(gst_sys::gst_buffer_find_memory(
|
||||
self.as_mut_ptr(),
|
||||
offset,
|
||||
size.unwrap_or(usize::MAX),
|
||||
&mut idx,
|
||||
&mut length,
|
||||
&mut skip,
|
||||
))
|
||||
}
|
||||
if res {
|
||||
Some((idx, length, skip))
|
||||
} else {
|
||||
None
|
||||
idx.as_mut_ptr(),
|
||||
length.as_mut_ptr(),
|
||||
skip.as_mut_ptr(),
|
||||
));
|
||||
|
||||
if res {
|
||||
Some((idx.assume_init(), length.assume_init(), skip.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,22 +106,27 @@ impl BufferPoolConfig {
|
|||
pub fn get_params(&self) -> Option<(Option<::Caps>, u32, u32, u32)> {
|
||||
unsafe {
|
||||
let mut caps = ptr::null_mut();
|
||||
let mut size = mem::uninitialized();
|
||||
let mut min_buffers = mem::uninitialized();
|
||||
let mut max_buffers = mem::uninitialized();
|
||||
let mut size = mem::MaybeUninit::uninit();
|
||||
let mut min_buffers = mem::MaybeUninit::uninit();
|
||||
let mut max_buffers = mem::MaybeUninit::uninit();
|
||||
|
||||
let ret: bool = from_glib(gst_sys::gst_buffer_pool_config_get_params(
|
||||
self.0.to_glib_none().0,
|
||||
&mut caps,
|
||||
&mut size,
|
||||
&mut min_buffers,
|
||||
&mut max_buffers,
|
||||
size.as_mut_ptr(),
|
||||
min_buffers.as_mut_ptr(),
|
||||
max_buffers.as_mut_ptr(),
|
||||
));
|
||||
if !ret {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some((from_glib_none(caps), size, min_buffers, max_buffers))
|
||||
Some((
|
||||
from_glib_none(caps),
|
||||
size.assume_init(),
|
||||
min_buffers.assume_init(),
|
||||
max_buffers.assume_init(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ use glib_sys::{gboolean, gpointer};
|
|||
use gst_sys;
|
||||
use libc::c_void;
|
||||
use std::cmp;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use Clock;
|
||||
use ClockError;
|
||||
|
@ -74,7 +73,7 @@ impl ClockId {
|
|||
|
||||
pub fn wait(&self) -> (Result<ClockSuccess, ClockError>, ClockTimeDiff) {
|
||||
unsafe {
|
||||
let mut jitter = mem::uninitialized();
|
||||
let mut jitter = 0;
|
||||
let res: ClockReturn = from_glib(gst_sys::gst_clock_id_wait(
|
||||
self.to_glib_none().0,
|
||||
&mut jitter,
|
||||
|
|
|
@ -285,15 +285,19 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
timeout: ClockTime,
|
||||
) -> (Result<StateChangeSuccess, StateChangeError>, State, State) {
|
||||
unsafe {
|
||||
let mut state = mem::uninitialized();
|
||||
let mut pending = mem::uninitialized();
|
||||
let mut state = mem::MaybeUninit::uninit();
|
||||
let mut pending = mem::MaybeUninit::uninit();
|
||||
let ret: StateChangeReturn = from_glib(gst_sys::gst_element_get_state(
|
||||
self.as_ref().to_glib_none().0,
|
||||
&mut state,
|
||||
&mut pending,
|
||||
state.as_mut_ptr(),
|
||||
pending.as_mut_ptr(),
|
||||
timeout.to_glib(),
|
||||
));
|
||||
(ret.into_result(), from_glib(state), from_glib(pending))
|
||||
(
|
||||
ret.into_result(),
|
||||
from_glib(state.assume_init()),
|
||||
from_glib(pending.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -548,16 +552,16 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
) -> Option<U> {
|
||||
let src_val = src_val.into();
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_element_query_convert(
|
||||
self.as_ref().to_glib_none().0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val))
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -571,16 +575,19 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
) -> Option<GenericFormattedValue> {
|
||||
let src_val = src_val.into();
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_element_query_convert(
|
||||
self.as_ref().to_glib_none().0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.get_value(),
|
||||
dest_format.to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(GenericFormattedValue::new(dest_format, dest_val))
|
||||
Some(GenericFormattedValue::new(
|
||||
dest_format,
|
||||
dest_val.assume_init(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -589,14 +596,14 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
|
||||
fn query_duration<T: SpecificFormattedValue>(&self) -> Option<T> {
|
||||
unsafe {
|
||||
let mut duration = mem::uninitialized();
|
||||
let mut duration = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_element_query_duration(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
&mut duration,
|
||||
duration.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), duration))
|
||||
Some(T::from_raw(T::get_default_format(), duration.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -605,14 +612,14 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
|
||||
fn query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue> {
|
||||
unsafe {
|
||||
let mut duration = mem::uninitialized();
|
||||
let mut duration = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_element_query_duration(
|
||||
self.as_ref().to_glib_none().0,
|
||||
format.to_glib(),
|
||||
&mut duration,
|
||||
duration.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(GenericFormattedValue::new(format, duration))
|
||||
Some(GenericFormattedValue::new(format, duration.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -621,14 +628,14 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
|
||||
fn query_position<T: SpecificFormattedValue>(&self) -> Option<T> {
|
||||
unsafe {
|
||||
let mut cur = mem::uninitialized();
|
||||
let mut cur = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_element_query_position(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
&mut cur,
|
||||
cur.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), cur))
|
||||
Some(T::from_raw(T::get_default_format(), cur.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -637,14 +644,14 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
|
||||
fn query_position_generic(&self, format: Format) -> Option<GenericFormattedValue> {
|
||||
unsafe {
|
||||
let mut cur = mem::uninitialized();
|
||||
let mut cur = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_element_query_position(
|
||||
self.as_ref().to_glib_none().0,
|
||||
format.to_glib(),
|
||||
&mut cur,
|
||||
cur.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(GenericFormattedValue::new(format, cur))
|
||||
Some(GenericFormattedValue::new(format, cur.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -520,11 +520,11 @@ declare_concrete_event!(FlushStop);
|
|||
impl<'a> FlushStop<'a> {
|
||||
pub fn get_reset_time(&self) -> bool {
|
||||
unsafe {
|
||||
let mut reset_time = mem::uninitialized();
|
||||
let mut reset_time = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_flush_stop(self.as_mut_ptr(), &mut reset_time);
|
||||
gst_sys::gst_event_parse_flush_stop(self.as_mut_ptr(), reset_time.as_mut_ptr());
|
||||
|
||||
from_glib(reset_time)
|
||||
from_glib(reset_time.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -542,21 +542,21 @@ impl<'a> StreamStart<'a> {
|
|||
|
||||
pub fn get_stream_flags(&self) -> ::StreamFlags {
|
||||
unsafe {
|
||||
let mut stream_flags = mem::uninitialized();
|
||||
let mut stream_flags = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_stream_flags(self.as_mut_ptr(), &mut stream_flags);
|
||||
gst_sys::gst_event_parse_stream_flags(self.as_mut_ptr(), stream_flags.as_mut_ptr());
|
||||
|
||||
from_glib(stream_flags)
|
||||
from_glib(stream_flags.assume_init())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_group_id(&self) -> GroupId {
|
||||
unsafe {
|
||||
let mut group_id = mem::uninitialized();
|
||||
let mut group_id = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_group_id(self.as_mut_ptr(), &mut group_id);
|
||||
gst_sys::gst_event_parse_group_id(self.as_mut_ptr(), group_id.as_mut_ptr());
|
||||
|
||||
from_glib(group_id)
|
||||
from_glib(group_id.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -622,22 +622,22 @@ declare_concrete_event!(BufferSize);
|
|||
impl<'a> BufferSize<'a> {
|
||||
pub fn get(&self) -> (GenericFormattedValue, GenericFormattedValue, bool) {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut minsize = mem::uninitialized();
|
||||
let mut maxsize = mem::uninitialized();
|
||||
let mut async = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
let mut minsize = mem::MaybeUninit::uninit();
|
||||
let mut maxsize = mem::MaybeUninit::uninit();
|
||||
let mut async_ = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_buffer_size(
|
||||
self.as_mut_ptr(),
|
||||
&mut fmt,
|
||||
&mut minsize,
|
||||
&mut maxsize,
|
||||
&mut async,
|
||||
fmt.as_mut_ptr(),
|
||||
minsize.as_mut_ptr(),
|
||||
maxsize.as_mut_ptr(),
|
||||
async_.as_mut_ptr(),
|
||||
);
|
||||
(
|
||||
GenericFormattedValue::new(from_glib(fmt), minsize),
|
||||
GenericFormattedValue::new(from_glib(fmt), maxsize),
|
||||
from_glib(async),
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), minsize.assume_init()),
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), maxsize.assume_init()),
|
||||
from_glib(async_.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -660,11 +660,11 @@ impl<'a> StreamGroupDone<'a> {
|
|||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub fn get_group_id(&self) -> GroupId {
|
||||
unsafe {
|
||||
let mut group_id = mem::uninitialized();
|
||||
let mut group_id = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_stream_group_done(self.as_mut_ptr(), &mut group_id);
|
||||
gst_sys::gst_event_parse_stream_group_done(self.as_mut_ptr(), group_id.as_mut_ptr());
|
||||
|
||||
from_glib(group_id)
|
||||
from_glib(group_id.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -676,10 +676,10 @@ impl<'a> Toc<'a> {
|
|||
pub fn get_toc(&self) -> (&'a ::TocRef, bool) {
|
||||
unsafe {
|
||||
let mut toc = ptr::null_mut();
|
||||
let mut updated = mem::uninitialized();
|
||||
let mut updated = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_toc(self.as_mut_ptr(), &mut toc, &mut updated);
|
||||
(::TocRef::from_ptr(toc), from_glib(updated))
|
||||
gst_sys::gst_event_parse_toc(self.as_mut_ptr(), &mut toc, updated.as_mut_ptr());
|
||||
(::TocRef::from_ptr(toc), from_glib(updated.assume_init()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -730,12 +730,16 @@ declare_concrete_event!(SegmentDone);
|
|||
impl<'a> SegmentDone<'a> {
|
||||
pub fn get(&self) -> GenericFormattedValue {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut position = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
let mut position = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_segment_done(self.as_mut_ptr(), &mut fmt, &mut position);
|
||||
gst_sys::gst_event_parse_segment_done(
|
||||
self.as_mut_ptr(),
|
||||
fmt.as_mut_ptr(),
|
||||
position.as_mut_ptr(),
|
||||
);
|
||||
|
||||
GenericFormattedValue::new(from_glib(fmt), position)
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), position.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -744,12 +748,19 @@ declare_concrete_event!(Gap);
|
|||
impl<'a> Gap<'a> {
|
||||
pub fn get(&self) -> (::ClockTime, ::ClockTime) {
|
||||
unsafe {
|
||||
let mut timestamp = mem::uninitialized();
|
||||
let mut duration = mem::uninitialized();
|
||||
let mut timestamp = mem::MaybeUninit::uninit();
|
||||
let mut duration = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_gap(self.as_mut_ptr(), &mut timestamp, &mut duration);
|
||||
gst_sys::gst_event_parse_gap(
|
||||
self.as_mut_ptr(),
|
||||
timestamp.as_mut_ptr(),
|
||||
duration.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(from_glib(timestamp), from_glib(duration))
|
||||
(
|
||||
from_glib(timestamp.assume_init()),
|
||||
from_glib(duration.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -758,20 +769,25 @@ declare_concrete_event!(Qos);
|
|||
impl<'a> Qos<'a> {
|
||||
pub fn get(&self) -> (::QOSType, f64, i64, ::ClockTime) {
|
||||
unsafe {
|
||||
let mut type_ = mem::uninitialized();
|
||||
let mut proportion = mem::uninitialized();
|
||||
let mut diff = mem::uninitialized();
|
||||
let mut timestamp = mem::uninitialized();
|
||||
let mut type_ = mem::MaybeUninit::uninit();
|
||||
let mut proportion = mem::MaybeUninit::uninit();
|
||||
let mut diff = mem::MaybeUninit::uninit();
|
||||
let mut timestamp = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_qos(
|
||||
self.as_mut_ptr(),
|
||||
&mut type_,
|
||||
&mut proportion,
|
||||
&mut diff,
|
||||
&mut timestamp,
|
||||
type_.as_mut_ptr(),
|
||||
proportion.as_mut_ptr(),
|
||||
diff.as_mut_ptr(),
|
||||
timestamp.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(from_glib(type_), proportion, diff, from_glib(timestamp))
|
||||
(
|
||||
from_glib(type_.assume_init()),
|
||||
proportion.assume_init(),
|
||||
diff.assume_init(),
|
||||
from_glib(timestamp.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -789,32 +805,32 @@ impl<'a> Seek<'a> {
|
|||
GenericFormattedValue,
|
||||
) {
|
||||
unsafe {
|
||||
let mut rate = mem::uninitialized();
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut flags = mem::uninitialized();
|
||||
let mut start_type = mem::uninitialized();
|
||||
let mut start = mem::uninitialized();
|
||||
let mut stop_type = mem::uninitialized();
|
||||
let mut stop = mem::uninitialized();
|
||||
let mut rate = mem::MaybeUninit::uninit();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
let mut flags = mem::MaybeUninit::uninit();
|
||||
let mut start_type = mem::MaybeUninit::uninit();
|
||||
let mut start = mem::MaybeUninit::uninit();
|
||||
let mut stop_type = mem::MaybeUninit::uninit();
|
||||
let mut stop = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_seek(
|
||||
self.as_mut_ptr(),
|
||||
&mut rate,
|
||||
&mut fmt,
|
||||
&mut flags,
|
||||
&mut start_type,
|
||||
&mut start,
|
||||
&mut stop_type,
|
||||
&mut stop,
|
||||
rate.as_mut_ptr(),
|
||||
fmt.as_mut_ptr(),
|
||||
flags.as_mut_ptr(),
|
||||
start_type.as_mut_ptr(),
|
||||
start.as_mut_ptr(),
|
||||
stop_type.as_mut_ptr(),
|
||||
stop.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(
|
||||
rate,
|
||||
from_glib(flags),
|
||||
from_glib(start_type),
|
||||
GenericFormattedValue::new(from_glib(fmt), start),
|
||||
from_glib(stop_type),
|
||||
GenericFormattedValue::new(from_glib(fmt), stop),
|
||||
rate.assume_init(),
|
||||
from_glib(flags.assume_init()),
|
||||
from_glib(start_type.assume_init()),
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), start.assume_init()),
|
||||
from_glib(stop_type.assume_init()),
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), stop.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -822,14 +838,14 @@ impl<'a> Seek<'a> {
|
|||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
pub fn get_trickmode_interval(&self) -> ::ClockTime {
|
||||
unsafe {
|
||||
let mut trickmode_interval = mem::uninitialized();
|
||||
let mut trickmode_interval = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_seek_trickmode_interval(
|
||||
self.as_mut_ptr(),
|
||||
&mut trickmode_interval,
|
||||
trickmode_interval.as_mut_ptr(),
|
||||
);
|
||||
|
||||
from_glib(trickmode_interval)
|
||||
from_glib(trickmode_interval.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -840,11 +856,11 @@ declare_concrete_event!(Latency);
|
|||
impl<'a> Latency<'a> {
|
||||
pub fn get_latency(&self) -> ::ClockTime {
|
||||
unsafe {
|
||||
let mut latency = mem::uninitialized();
|
||||
let mut latency = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_latency(self.as_mut_ptr(), &mut latency);
|
||||
gst_sys::gst_event_parse_latency(self.as_mut_ptr(), latency.as_mut_ptr());
|
||||
|
||||
from_glib(latency)
|
||||
from_glib(latency.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -853,26 +869,29 @@ declare_concrete_event!(Step);
|
|||
impl<'a> Step<'a> {
|
||||
pub fn get(&self) -> (GenericFormattedValue, f64, bool, bool) {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut amount = mem::uninitialized();
|
||||
let mut rate = mem::uninitialized();
|
||||
let mut flush = mem::uninitialized();
|
||||
let mut intermediate = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
let mut amount = mem::MaybeUninit::uninit();
|
||||
let mut rate = mem::MaybeUninit::uninit();
|
||||
let mut flush = mem::MaybeUninit::uninit();
|
||||
let mut intermediate = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_event_parse_step(
|
||||
self.as_mut_ptr(),
|
||||
&mut fmt,
|
||||
&mut amount,
|
||||
&mut rate,
|
||||
&mut flush,
|
||||
&mut intermediate,
|
||||
fmt.as_mut_ptr(),
|
||||
amount.as_mut_ptr(),
|
||||
rate.as_mut_ptr(),
|
||||
flush.as_mut_ptr(),
|
||||
intermediate.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(
|
||||
GenericFormattedValue::new(from_glib(fmt), amount as i64),
|
||||
rate,
|
||||
from_glib(flush),
|
||||
from_glib(intermediate),
|
||||
GenericFormattedValue::new(
|
||||
from_glib(fmt.assume_init()),
|
||||
amount.assume_init() as i64,
|
||||
),
|
||||
rate.assume_init(),
|
||||
from_glib(flush.assume_init()),
|
||||
from_glib(intermediate.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,14 +223,14 @@ impl MemoryRef {
|
|||
|
||||
pub fn is_span(&self, mem2: &MemoryRef) -> Option<usize> {
|
||||
unsafe {
|
||||
let mut offset = 0;
|
||||
let mut offset = mem::MaybeUninit::uninit();
|
||||
let res = from_glib(gst_sys::gst_memory_is_span(
|
||||
self.as_mut_ptr(),
|
||||
mem2.as_mut_ptr(),
|
||||
&mut offset,
|
||||
offset.as_mut_ptr(),
|
||||
));
|
||||
if res {
|
||||
Some(offset)
|
||||
Some(offset.assume_init())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -562,28 +562,33 @@ declare_concrete_message!(Buffering);
|
|||
impl<'a> Buffering<'a> {
|
||||
pub fn get_percent(&self) -> i32 {
|
||||
unsafe {
|
||||
let mut p = mem::uninitialized();
|
||||
gst_sys::gst_message_parse_buffering(self.as_mut_ptr(), &mut p);
|
||||
p
|
||||
let mut p = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_message_parse_buffering(self.as_mut_ptr(), p.as_mut_ptr());
|
||||
p.assume_init()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_buffering_stats(&self) -> (::BufferingMode, i32, i32, i64) {
|
||||
unsafe {
|
||||
let mut mode = mem::uninitialized();
|
||||
let mut avg_in = mem::uninitialized();
|
||||
let mut avg_out = mem::uninitialized();
|
||||
let mut buffering_left = mem::uninitialized();
|
||||
let mut mode = mem::MaybeUninit::uninit();
|
||||
let mut avg_in = mem::MaybeUninit::uninit();
|
||||
let mut avg_out = mem::MaybeUninit::uninit();
|
||||
let mut buffering_left = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_buffering_stats(
|
||||
self.as_mut_ptr(),
|
||||
&mut mode,
|
||||
&mut avg_in,
|
||||
&mut avg_out,
|
||||
&mut buffering_left,
|
||||
mode.as_mut_ptr(),
|
||||
avg_in.as_mut_ptr(),
|
||||
avg_out.as_mut_ptr(),
|
||||
buffering_left.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(from_glib(mode), avg_in, avg_out, buffering_left)
|
||||
(
|
||||
from_glib(mode.assume_init()),
|
||||
avg_in.assume_init(),
|
||||
avg_out.assume_init(),
|
||||
buffering_left.assume_init(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -592,46 +597,46 @@ declare_concrete_message!(StateChanged);
|
|||
impl<'a> StateChanged<'a> {
|
||||
pub fn get_old(&self) -> ::State {
|
||||
unsafe {
|
||||
let mut state = mem::uninitialized();
|
||||
let mut state = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_state_changed(
|
||||
self.as_mut_ptr(),
|
||||
&mut state,
|
||||
state.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
);
|
||||
|
||||
from_glib(state)
|
||||
from_glib(state.assume_init())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_current(&self) -> ::State {
|
||||
unsafe {
|
||||
let mut state = mem::uninitialized();
|
||||
let mut state = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_state_changed(
|
||||
self.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
&mut state,
|
||||
state.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
);
|
||||
|
||||
from_glib(state)
|
||||
from_glib(state.assume_init())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_pending(&self) -> ::State {
|
||||
unsafe {
|
||||
let mut state = mem::uninitialized();
|
||||
let mut state = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_state_changed(
|
||||
self.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
&mut state,
|
||||
state.as_mut_ptr(),
|
||||
);
|
||||
|
||||
from_glib(state)
|
||||
from_glib(state.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -651,32 +656,38 @@ impl<'a> StepDone<'a> {
|
|||
bool,
|
||||
) {
|
||||
unsafe {
|
||||
let mut format = mem::uninitialized();
|
||||
let mut amount = mem::uninitialized();
|
||||
let mut rate = mem::uninitialized();
|
||||
let mut flush = mem::uninitialized();
|
||||
let mut intermediate = mem::uninitialized();
|
||||
let mut duration = mem::uninitialized();
|
||||
let mut eos = mem::uninitialized();
|
||||
let mut format = mem::MaybeUninit::uninit();
|
||||
let mut amount = mem::MaybeUninit::uninit();
|
||||
let mut rate = mem::MaybeUninit::uninit();
|
||||
let mut flush = mem::MaybeUninit::uninit();
|
||||
let mut intermediate = mem::MaybeUninit::uninit();
|
||||
let mut duration = mem::MaybeUninit::uninit();
|
||||
let mut eos = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_step_done(
|
||||
self.as_mut_ptr(),
|
||||
&mut format,
|
||||
&mut amount,
|
||||
&mut rate,
|
||||
&mut flush,
|
||||
&mut intermediate,
|
||||
&mut duration,
|
||||
&mut eos,
|
||||
format.as_mut_ptr(),
|
||||
amount.as_mut_ptr(),
|
||||
rate.as_mut_ptr(),
|
||||
flush.as_mut_ptr(),
|
||||
intermediate.as_mut_ptr(),
|
||||
duration.as_mut_ptr(),
|
||||
eos.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(
|
||||
GenericFormattedValue::new(from_glib(format), amount as i64),
|
||||
rate,
|
||||
from_glib(flush),
|
||||
from_glib(intermediate),
|
||||
GenericFormattedValue::new(from_glib(format), duration as i64),
|
||||
from_glib(eos),
|
||||
GenericFormattedValue::new(
|
||||
from_glib(format.assume_init()),
|
||||
amount.assume_init() as i64,
|
||||
),
|
||||
rate.assume_init(),
|
||||
from_glib(flush.assume_init()),
|
||||
from_glib(intermediate.assume_init()),
|
||||
GenericFormattedValue::new(
|
||||
from_glib(format.assume_init()),
|
||||
duration.assume_init() as i64,
|
||||
),
|
||||
from_glib(eos.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -700,15 +711,15 @@ impl<'a> ClockProvide<'a> {
|
|||
|
||||
pub fn get_ready(&self) -> bool {
|
||||
unsafe {
|
||||
let mut ready = mem::uninitialized();
|
||||
let mut ready = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_clock_provide(
|
||||
self.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
&mut ready,
|
||||
ready.as_mut_ptr(),
|
||||
);
|
||||
|
||||
from_glib(ready)
|
||||
from_glib(ready.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -743,18 +754,22 @@ declare_concrete_message!(StructureChange);
|
|||
impl<'a> StructureChange<'a> {
|
||||
pub fn get(&self) -> (::StructureChangeType, ::Element, bool) {
|
||||
unsafe {
|
||||
let mut type_ = mem::uninitialized();
|
||||
let mut type_ = mem::MaybeUninit::uninit();
|
||||
let mut owner = ptr::null_mut();
|
||||
let mut busy = mem::uninitialized();
|
||||
let mut busy = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_structure_change(
|
||||
self.as_mut_ptr(),
|
||||
&mut type_,
|
||||
type_.as_mut_ptr(),
|
||||
&mut owner,
|
||||
&mut busy,
|
||||
busy.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(from_glib(type_), from_glib_none(owner), from_glib(busy))
|
||||
(
|
||||
from_glib(type_.assume_init()),
|
||||
from_glib_none(owner),
|
||||
from_glib(busy.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -763,12 +778,16 @@ declare_concrete_message!(StreamStatus);
|
|||
impl<'a> StreamStatus<'a> {
|
||||
pub fn get(&self) -> (::StreamStatusType, ::Element) {
|
||||
unsafe {
|
||||
let mut type_ = mem::uninitialized();
|
||||
let mut type_ = mem::MaybeUninit::uninit();
|
||||
let mut owner = ptr::null_mut();
|
||||
|
||||
gst_sys::gst_message_parse_stream_status(self.as_mut_ptr(), &mut type_, &mut owner);
|
||||
gst_sys::gst_message_parse_stream_status(
|
||||
self.as_mut_ptr(),
|
||||
type_.as_mut_ptr(),
|
||||
&mut owner,
|
||||
);
|
||||
|
||||
(from_glib(type_), from_glib_none(owner))
|
||||
(from_glib(type_.assume_init()), from_glib_none(owner))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -789,12 +808,16 @@ declare_concrete_message!(SegmentStart);
|
|||
impl<'a> SegmentStart<'a> {
|
||||
pub fn get(&self) -> GenericFormattedValue {
|
||||
unsafe {
|
||||
let mut format = mem::uninitialized();
|
||||
let mut position = mem::uninitialized();
|
||||
let mut format = mem::MaybeUninit::uninit();
|
||||
let mut position = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_segment_start(self.as_mut_ptr(), &mut format, &mut position);
|
||||
gst_sys::gst_message_parse_segment_start(
|
||||
self.as_mut_ptr(),
|
||||
format.as_mut_ptr(),
|
||||
position.as_mut_ptr(),
|
||||
);
|
||||
|
||||
GenericFormattedValue::new(from_glib(format), position)
|
||||
GenericFormattedValue::new(from_glib(format.assume_init()), position.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -803,12 +826,16 @@ declare_concrete_message!(SegmentDone);
|
|||
impl<'a> SegmentDone<'a> {
|
||||
pub fn get(&self) -> GenericFormattedValue {
|
||||
unsafe {
|
||||
let mut format = mem::uninitialized();
|
||||
let mut position = mem::uninitialized();
|
||||
let mut format = mem::MaybeUninit::uninit();
|
||||
let mut position = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_segment_done(self.as_mut_ptr(), &mut format, &mut position);
|
||||
gst_sys::gst_message_parse_segment_done(
|
||||
self.as_mut_ptr(),
|
||||
format.as_mut_ptr(),
|
||||
position.as_mut_ptr(),
|
||||
);
|
||||
|
||||
GenericFormattedValue::new(from_glib(format), position)
|
||||
GenericFormattedValue::new(from_glib(format.assume_init()), position.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -821,11 +848,11 @@ declare_concrete_message!(AsyncDone);
|
|||
impl<'a> AsyncDone<'a> {
|
||||
pub fn get_running_time(&self) -> ::ClockTime {
|
||||
unsafe {
|
||||
let mut running_time = mem::uninitialized();
|
||||
let mut running_time = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_async_done(self.as_mut_ptr(), &mut running_time);
|
||||
gst_sys::gst_message_parse_async_done(self.as_mut_ptr(), running_time.as_mut_ptr());
|
||||
|
||||
from_glib(running_time)
|
||||
from_glib(running_time.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -834,11 +861,11 @@ declare_concrete_message!(RequestState);
|
|||
impl<'a> RequestState<'a> {
|
||||
pub fn get_requested_state(&self) -> ::State {
|
||||
unsafe {
|
||||
let mut state = mem::uninitialized();
|
||||
let mut state = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_request_state(self.as_mut_ptr(), &mut state);
|
||||
gst_sys::gst_message_parse_request_state(self.as_mut_ptr(), state.as_mut_ptr());
|
||||
|
||||
from_glib(state)
|
||||
from_glib(state.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -847,29 +874,32 @@ declare_concrete_message!(StepStart);
|
|||
impl<'a> StepStart<'a> {
|
||||
pub fn get(&self) -> (bool, GenericFormattedValue, f64, bool, bool) {
|
||||
unsafe {
|
||||
let mut active = mem::uninitialized();
|
||||
let mut format = mem::uninitialized();
|
||||
let mut amount = mem::uninitialized();
|
||||
let mut rate = mem::uninitialized();
|
||||
let mut flush = mem::uninitialized();
|
||||
let mut intermediate = mem::uninitialized();
|
||||
let mut active = mem::MaybeUninit::uninit();
|
||||
let mut format = mem::MaybeUninit::uninit();
|
||||
let mut amount = mem::MaybeUninit::uninit();
|
||||
let mut rate = mem::MaybeUninit::uninit();
|
||||
let mut flush = mem::MaybeUninit::uninit();
|
||||
let mut intermediate = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_step_start(
|
||||
self.as_mut_ptr(),
|
||||
&mut active,
|
||||
&mut format,
|
||||
&mut amount,
|
||||
&mut rate,
|
||||
&mut flush,
|
||||
&mut intermediate,
|
||||
active.as_mut_ptr(),
|
||||
format.as_mut_ptr(),
|
||||
amount.as_mut_ptr(),
|
||||
rate.as_mut_ptr(),
|
||||
flush.as_mut_ptr(),
|
||||
intermediate.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(
|
||||
from_glib(active),
|
||||
GenericFormattedValue::new(from_glib(format), amount as i64),
|
||||
rate,
|
||||
from_glib(flush),
|
||||
from_glib(intermediate),
|
||||
from_glib(active.assume_init()),
|
||||
GenericFormattedValue::new(
|
||||
from_glib(format.assume_init()),
|
||||
amount.assume_init() as i64,
|
||||
),
|
||||
rate.assume_init(),
|
||||
from_glib(flush.assume_init()),
|
||||
from_glib(intermediate.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -879,64 +909,74 @@ declare_concrete_message!(Qos);
|
|||
impl<'a> Qos<'a> {
|
||||
pub fn get(&self) -> (bool, ::ClockTime, ::ClockTime, ::ClockTime, ::ClockTime) {
|
||||
unsafe {
|
||||
let mut live = mem::uninitialized();
|
||||
let mut running_time = mem::uninitialized();
|
||||
let mut stream_time = mem::uninitialized();
|
||||
let mut timestamp = mem::uninitialized();
|
||||
let mut duration = mem::uninitialized();
|
||||
let mut live = mem::MaybeUninit::uninit();
|
||||
let mut running_time = mem::MaybeUninit::uninit();
|
||||
let mut stream_time = mem::MaybeUninit::uninit();
|
||||
let mut timestamp = mem::MaybeUninit::uninit();
|
||||
let mut duration = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_qos(
|
||||
self.as_mut_ptr(),
|
||||
&mut live,
|
||||
&mut running_time,
|
||||
&mut stream_time,
|
||||
&mut timestamp,
|
||||
&mut duration,
|
||||
live.as_mut_ptr(),
|
||||
running_time.as_mut_ptr(),
|
||||
stream_time.as_mut_ptr(),
|
||||
timestamp.as_mut_ptr(),
|
||||
duration.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(
|
||||
from_glib(live),
|
||||
from_glib(running_time),
|
||||
from_glib(stream_time),
|
||||
from_glib(timestamp),
|
||||
from_glib(duration),
|
||||
from_glib(live.assume_init()),
|
||||
from_glib(running_time.assume_init()),
|
||||
from_glib(stream_time.assume_init()),
|
||||
from_glib(timestamp.assume_init()),
|
||||
from_glib(duration.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_values(&self) -> (i64, f64, i32) {
|
||||
unsafe {
|
||||
let mut jitter = mem::uninitialized();
|
||||
let mut proportion = mem::uninitialized();
|
||||
let mut quality = mem::uninitialized();
|
||||
let mut jitter = mem::MaybeUninit::uninit();
|
||||
let mut proportion = mem::MaybeUninit::uninit();
|
||||
let mut quality = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_qos_values(
|
||||
self.as_mut_ptr(),
|
||||
&mut jitter,
|
||||
&mut proportion,
|
||||
&mut quality,
|
||||
jitter.as_mut_ptr(),
|
||||
proportion.as_mut_ptr(),
|
||||
quality.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(jitter, proportion, quality)
|
||||
(
|
||||
jitter.assume_init(),
|
||||
proportion.assume_init(),
|
||||
quality.assume_init(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_stats(&self) -> (GenericFormattedValue, GenericFormattedValue) {
|
||||
unsafe {
|
||||
let mut format = mem::uninitialized();
|
||||
let mut processed = mem::uninitialized();
|
||||
let mut dropped = mem::uninitialized();
|
||||
let mut format = mem::MaybeUninit::uninit();
|
||||
let mut processed = mem::MaybeUninit::uninit();
|
||||
let mut dropped = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_qos_stats(
|
||||
self.as_mut_ptr(),
|
||||
&mut format,
|
||||
&mut processed,
|
||||
&mut dropped,
|
||||
format.as_mut_ptr(),
|
||||
processed.as_mut_ptr(),
|
||||
dropped.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(
|
||||
GenericFormattedValue::new(from_glib(format), processed as i64),
|
||||
GenericFormattedValue::new(from_glib(format), dropped as i64),
|
||||
GenericFormattedValue::new(
|
||||
from_glib(format.assume_init()),
|
||||
processed.assume_init() as i64,
|
||||
),
|
||||
GenericFormattedValue::new(
|
||||
from_glib(format.assume_init()),
|
||||
dropped.assume_init() as i64,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -946,13 +986,13 @@ declare_concrete_message!(Progress);
|
|||
impl<'a> Progress<'a> {
|
||||
pub fn get(&self) -> (::ProgressType, &'a str, &'a str) {
|
||||
unsafe {
|
||||
let mut type_ = mem::uninitialized();
|
||||
let mut type_ = mem::MaybeUninit::uninit();
|
||||
let mut code = ptr::null_mut();
|
||||
let mut text = ptr::null_mut();
|
||||
|
||||
gst_sys::gst_message_parse_progress(
|
||||
self.as_mut_ptr(),
|
||||
&mut type_,
|
||||
type_.as_mut_ptr(),
|
||||
&mut code,
|
||||
&mut text,
|
||||
);
|
||||
|
@ -960,7 +1000,7 @@ impl<'a> Progress<'a> {
|
|||
let code = CStr::from_ptr(code).to_str().unwrap();
|
||||
let text = CStr::from_ptr(text).to_str().unwrap();
|
||||
|
||||
(from_glib(type_), code, text)
|
||||
(from_glib(type_.assume_init()), code, text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -970,9 +1010,9 @@ impl<'a> Toc<'a> {
|
|||
pub fn get_toc(&self) -> (::Toc, bool) {
|
||||
unsafe {
|
||||
let mut toc = ptr::null_mut();
|
||||
let mut updated = mem::uninitialized();
|
||||
gst_sys::gst_message_parse_toc(self.as_mut_ptr(), &mut toc, &mut updated);
|
||||
(from_glib_full(toc), from_glib(updated))
|
||||
let mut updated = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_message_parse_toc(self.as_mut_ptr(), &mut toc, updated.as_mut_ptr());
|
||||
(from_glib_full(toc), from_glib(updated.assume_init()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -981,11 +1021,11 @@ declare_concrete_message!(ResetTime);
|
|||
impl<'a> ResetTime<'a> {
|
||||
pub fn get_running_time(&self) -> ::ClockTime {
|
||||
unsafe {
|
||||
let mut running_time = mem::uninitialized();
|
||||
let mut running_time = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_message_parse_reset_time(self.as_mut_ptr(), &mut running_time);
|
||||
gst_sys::gst_message_parse_reset_time(self.as_mut_ptr(), running_time.as_mut_ptr());
|
||||
|
||||
from_glib(running_time)
|
||||
from_glib(running_time.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -994,13 +1034,13 @@ declare_concrete_message!(StreamStart);
|
|||
impl<'a> StreamStart<'a> {
|
||||
pub fn get_group_id(&self) -> Option<GroupId> {
|
||||
unsafe {
|
||||
let mut group_id = mem::uninitialized();
|
||||
let mut group_id = mem::MaybeUninit::uninit();
|
||||
|
||||
if from_glib(gst_sys::gst_message_parse_group_id(
|
||||
self.as_mut_ptr(),
|
||||
&mut group_id,
|
||||
group_id.as_mut_ptr(),
|
||||
)) {
|
||||
Some(from_glib(group_id))
|
||||
Some(from_glib(group_id.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -702,16 +702,16 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
) -> Option<U> {
|
||||
let src_val = src_val.into();
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_peer_query_convert(
|
||||
self.as_ref().to_glib_none().0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val))
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -725,16 +725,19 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
) -> Option<GenericFormattedValue> {
|
||||
let src_val = src_val.into();
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_peer_query_convert(
|
||||
self.as_ref().to_glib_none().0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
dest_format.to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(GenericFormattedValue::new(dest_format, dest_val))
|
||||
Some(GenericFormattedValue::new(
|
||||
dest_format,
|
||||
dest_val.assume_init(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -743,14 +746,14 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn peer_query_duration<T: SpecificFormattedValue>(&self) -> Option<T> {
|
||||
unsafe {
|
||||
let mut duration = mem::uninitialized();
|
||||
let mut duration = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_peer_query_duration(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
&mut duration,
|
||||
duration.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), duration))
|
||||
Some(T::from_raw(T::get_default_format(), duration.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -759,14 +762,14 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn peer_query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue> {
|
||||
unsafe {
|
||||
let mut duration = mem::uninitialized();
|
||||
let mut duration = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_peer_query_duration(
|
||||
self.as_ref().to_glib_none().0,
|
||||
format.to_glib(),
|
||||
&mut duration,
|
||||
duration.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(GenericFormattedValue::new(format, duration))
|
||||
Some(GenericFormattedValue::new(format, duration.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -775,14 +778,14 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn peer_query_position<T: SpecificFormattedValue>(&self) -> Option<T> {
|
||||
unsafe {
|
||||
let mut cur = mem::uninitialized();
|
||||
let mut cur = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_peer_query_position(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
&mut cur,
|
||||
cur.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), cur))
|
||||
Some(T::from_raw(T::get_default_format(), cur.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -791,14 +794,14 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn peer_query_position_generic(&self, format: Format) -> Option<GenericFormattedValue> {
|
||||
unsafe {
|
||||
let mut cur = mem::uninitialized();
|
||||
let mut cur = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_peer_query_position(
|
||||
self.as_ref().to_glib_none().0,
|
||||
format.to_glib(),
|
||||
&mut cur,
|
||||
cur.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(GenericFormattedValue::new(format, cur))
|
||||
Some(GenericFormattedValue::new(format, cur.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -812,16 +815,16 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
let src_val = src_val.into();
|
||||
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_query_convert(
|
||||
self.as_ref().to_glib_none().0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val))
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -836,16 +839,19 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
let src_val = src_val.into();
|
||||
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
let mut dest_val = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_query_convert(
|
||||
self.as_ref().to_glib_none().0,
|
||||
src_val.get_format().to_glib(),
|
||||
src_val.get_value(),
|
||||
dest_format.to_glib(),
|
||||
&mut dest_val,
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(GenericFormattedValue::new(dest_format, dest_val))
|
||||
Some(GenericFormattedValue::new(
|
||||
dest_format,
|
||||
dest_val.assume_init(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -854,14 +860,14 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn query_duration<T: SpecificFormattedValue>(&self) -> Option<T> {
|
||||
unsafe {
|
||||
let mut duration = mem::uninitialized();
|
||||
let mut duration = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_query_duration(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
&mut duration,
|
||||
duration.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), duration))
|
||||
Some(T::from_raw(T::get_default_format(), duration.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -870,14 +876,14 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue> {
|
||||
unsafe {
|
||||
let mut duration = mem::uninitialized();
|
||||
let mut duration = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_query_duration(
|
||||
self.as_ref().to_glib_none().0,
|
||||
format.to_glib(),
|
||||
&mut duration,
|
||||
duration.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(GenericFormattedValue::new(format, duration))
|
||||
Some(GenericFormattedValue::new(format, duration.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -886,14 +892,14 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn query_position<T: SpecificFormattedValue>(&self) -> Option<T> {
|
||||
unsafe {
|
||||
let mut cur = mem::uninitialized();
|
||||
let mut cur = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_query_position(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
&mut cur,
|
||||
cur.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), cur))
|
||||
Some(T::from_raw(T::get_default_format(), cur.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -902,14 +908,14 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn query_position_generic(&self, format: Format) -> Option<GenericFormattedValue> {
|
||||
unsafe {
|
||||
let mut cur = mem::uninitialized();
|
||||
let mut cur = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_pad_query_position(
|
||||
self.as_ref().to_glib_none().0,
|
||||
format.to_glib(),
|
||||
&mut cur,
|
||||
cur.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(GenericFormattedValue::new(format, cur))
|
||||
Some(GenericFormattedValue::new(format, cur.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -365,22 +365,22 @@ declare_concrete_query!(Position, T);
|
|||
impl<T: AsPtr> Position<T> {
|
||||
pub fn get_result(&self) -> GenericFormattedValue {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut pos = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
let mut pos = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_position(self.0.as_ptr(), &mut fmt, &mut pos);
|
||||
gst_sys::gst_query_parse_position(self.0.as_ptr(), fmt.as_mut_ptr(), pos.as_mut_ptr());
|
||||
|
||||
GenericFormattedValue::new(from_glib(fmt), pos)
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), pos.assume_init())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_format(&self) -> ::Format {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_position(self.0.as_ptr(), &mut fmt, ptr::null_mut());
|
||||
gst_sys::gst_query_parse_position(self.0.as_ptr(), fmt.as_mut_ptr(), ptr::null_mut());
|
||||
|
||||
from_glib(fmt)
|
||||
from_glib(fmt.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -403,22 +403,22 @@ declare_concrete_query!(Duration, T);
|
|||
impl<T: AsPtr> Duration<T> {
|
||||
pub fn get_result(&self) -> GenericFormattedValue {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut pos = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
let mut pos = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_duration(self.0.as_ptr(), &mut fmt, &mut pos);
|
||||
gst_sys::gst_query_parse_duration(self.0.as_ptr(), fmt.as_mut_ptr(), pos.as_mut_ptr());
|
||||
|
||||
GenericFormattedValue::new(from_glib(fmt), pos)
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), pos.assume_init())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_format(&self) -> ::Format {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_duration(self.0.as_ptr(), &mut fmt, ptr::null_mut());
|
||||
gst_sys::gst_query_parse_duration(self.0.as_ptr(), fmt.as_mut_ptr(), ptr::null_mut());
|
||||
|
||||
from_glib(fmt)
|
||||
from_glib(fmt.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -441,13 +441,22 @@ declare_concrete_query!(Latency, T);
|
|||
impl<T: AsPtr> Latency<T> {
|
||||
pub fn get_result(&self) -> (bool, ::ClockTime, ::ClockTime) {
|
||||
unsafe {
|
||||
let mut live = mem::uninitialized();
|
||||
let mut min = mem::uninitialized();
|
||||
let mut max = mem::uninitialized();
|
||||
let mut live = mem::MaybeUninit::uninit();
|
||||
let mut min = mem::MaybeUninit::uninit();
|
||||
let mut max = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_latency(self.0.as_ptr(), &mut live, &mut min, &mut max);
|
||||
gst_sys::gst_query_parse_latency(
|
||||
self.0.as_ptr(),
|
||||
live.as_mut_ptr(),
|
||||
min.as_mut_ptr(),
|
||||
max.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(from_glib(live), from_glib(min), from_glib(max))
|
||||
(
|
||||
from_glib(live.assume_init()),
|
||||
from_glib(min.assume_init()),
|
||||
from_glib(max.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -472,38 +481,38 @@ declare_concrete_query!(Seeking, T);
|
|||
impl<T: AsPtr> Seeking<T> {
|
||||
pub fn get_result(&self) -> (bool, GenericFormattedValue, GenericFormattedValue) {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut seekable = mem::uninitialized();
|
||||
let mut start = mem::uninitialized();
|
||||
let mut end = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
let mut seekable = mem::MaybeUninit::uninit();
|
||||
let mut start = mem::MaybeUninit::uninit();
|
||||
let mut end = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_query_parse_seeking(
|
||||
self.0.as_ptr(),
|
||||
&mut fmt,
|
||||
&mut seekable,
|
||||
&mut start,
|
||||
&mut end,
|
||||
fmt.as_mut_ptr(),
|
||||
seekable.as_mut_ptr(),
|
||||
start.as_mut_ptr(),
|
||||
end.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(
|
||||
from_glib(seekable),
|
||||
GenericFormattedValue::new(from_glib(fmt), start),
|
||||
GenericFormattedValue::new(from_glib(fmt), end),
|
||||
from_glib(seekable.assume_init()),
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), start.assume_init()),
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), end.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_format(&self) -> ::Format {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_query_parse_seeking(
|
||||
self.0.as_ptr(),
|
||||
&mut fmt,
|
||||
fmt.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
);
|
||||
|
||||
from_glib(fmt)
|
||||
from_glib(fmt.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -532,38 +541,38 @@ declare_concrete_query!(Segment, T);
|
|||
impl<T: AsPtr> Segment<T> {
|
||||
pub fn get_result(&self) -> (f64, GenericFormattedValue, GenericFormattedValue) {
|
||||
unsafe {
|
||||
let mut rate = mem::uninitialized();
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut start = mem::uninitialized();
|
||||
let mut stop = mem::uninitialized();
|
||||
let mut rate = mem::MaybeUninit::uninit();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
let mut start = mem::MaybeUninit::uninit();
|
||||
let mut stop = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_segment(
|
||||
self.0.as_ptr(),
|
||||
&mut rate,
|
||||
&mut fmt,
|
||||
&mut start,
|
||||
&mut stop,
|
||||
rate.as_mut_ptr(),
|
||||
fmt.as_mut_ptr(),
|
||||
start.as_mut_ptr(),
|
||||
stop.as_mut_ptr(),
|
||||
);
|
||||
(
|
||||
rate,
|
||||
GenericFormattedValue::new(from_glib(fmt), start),
|
||||
GenericFormattedValue::new(from_glib(fmt), stop),
|
||||
rate.assume_init(),
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), start.assume_init()),
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), stop.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_format(&self) -> ::Format {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_segment(
|
||||
self.0.as_ptr(),
|
||||
ptr::null_mut(),
|
||||
&mut fmt,
|
||||
fmt.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
);
|
||||
from_glib(fmt)
|
||||
from_glib(fmt.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -591,41 +600,41 @@ declare_concrete_query!(Convert, T);
|
|||
impl<T: AsPtr> Convert<T> {
|
||||
pub fn get_result(&self) -> (GenericFormattedValue, GenericFormattedValue) {
|
||||
unsafe {
|
||||
let mut src_fmt = mem::uninitialized();
|
||||
let mut src = mem::uninitialized();
|
||||
let mut dest_fmt = mem::uninitialized();
|
||||
let mut dest = mem::uninitialized();
|
||||
let mut src_fmt = mem::MaybeUninit::uninit();
|
||||
let mut src = mem::MaybeUninit::uninit();
|
||||
let mut dest_fmt = mem::MaybeUninit::uninit();
|
||||
let mut dest = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_convert(
|
||||
self.0.as_ptr(),
|
||||
&mut src_fmt,
|
||||
&mut src,
|
||||
&mut dest_fmt,
|
||||
&mut dest,
|
||||
src_fmt.as_mut_ptr(),
|
||||
src.as_mut_ptr(),
|
||||
dest_fmt.as_mut_ptr(),
|
||||
dest.as_mut_ptr(),
|
||||
);
|
||||
(
|
||||
GenericFormattedValue::new(from_glib(src_fmt), src),
|
||||
GenericFormattedValue::new(from_glib(dest_fmt), dest),
|
||||
GenericFormattedValue::new(from_glib(src_fmt.assume_init()), src.assume_init()),
|
||||
GenericFormattedValue::new(from_glib(dest_fmt.assume_init()), dest.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(&self) -> (GenericFormattedValue, ::Format) {
|
||||
unsafe {
|
||||
let mut src_fmt = mem::uninitialized();
|
||||
let mut src = mem::uninitialized();
|
||||
let mut dest_fmt = mem::uninitialized();
|
||||
let mut src_fmt = mem::MaybeUninit::uninit();
|
||||
let mut src = mem::MaybeUninit::uninit();
|
||||
let mut dest_fmt = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_convert(
|
||||
self.0.as_ptr(),
|
||||
&mut src_fmt,
|
||||
&mut src,
|
||||
&mut dest_fmt,
|
||||
src_fmt.as_mut_ptr(),
|
||||
src.as_mut_ptr(),
|
||||
dest_fmt.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
);
|
||||
(
|
||||
GenericFormattedValue::new(from_glib(src_fmt), src),
|
||||
from_glib(dest_fmt),
|
||||
GenericFormattedValue::new(from_glib(src_fmt.assume_init()), src.assume_init()),
|
||||
from_glib(dest_fmt.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -652,14 +661,15 @@ declare_concrete_query!(Formats, T);
|
|||
impl<T: AsPtr> Formats<T> {
|
||||
pub fn get_result(&self) -> Vec<::Format> {
|
||||
unsafe {
|
||||
let mut n = mem::uninitialized();
|
||||
gst_sys::gst_query_parse_n_formats(self.0.as_ptr(), &mut n);
|
||||
let mut n = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_query_parse_n_formats(self.0.as_ptr(), n.as_mut_ptr());
|
||||
let n = n.assume_init();
|
||||
let mut res = Vec::with_capacity(n as usize);
|
||||
|
||||
for i in 0..n {
|
||||
let mut fmt = mem::uninitialized();
|
||||
gst_sys::gst_query_parse_nth_format(self.0.as_ptr(), i, &mut fmt);
|
||||
res.push(from_glib(fmt));
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_query_parse_nth_format(self.0.as_ptr(), i, fmt.as_mut_ptr());
|
||||
res.push(from_glib(fmt.assume_init()));
|
||||
}
|
||||
|
||||
res
|
||||
|
@ -684,99 +694,108 @@ declare_concrete_query!(Buffering, T);
|
|||
impl<T: AsPtr> Buffering<T> {
|
||||
pub fn get_format(&self) -> ::Format {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_buffering_range(
|
||||
self.0.as_ptr(),
|
||||
&mut fmt,
|
||||
fmt.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
);
|
||||
|
||||
from_glib(fmt)
|
||||
from_glib(fmt.assume_init())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_percent(&self) -> (bool, i32) {
|
||||
unsafe {
|
||||
let mut busy = mem::uninitialized();
|
||||
let mut percent = mem::uninitialized();
|
||||
let mut busy = mem::MaybeUninit::uninit();
|
||||
let mut percent = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_buffering_percent(self.0.as_ptr(), &mut busy, &mut percent);
|
||||
gst_sys::gst_query_parse_buffering_percent(
|
||||
self.0.as_ptr(),
|
||||
busy.as_mut_ptr(),
|
||||
percent.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(from_glib(busy), percent)
|
||||
(from_glib(busy.assume_init()), percent.assume_init())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_range(&self) -> (GenericFormattedValue, GenericFormattedValue, i64) {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut start = mem::uninitialized();
|
||||
let mut stop = mem::uninitialized();
|
||||
let mut estimated_total = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
let mut start = mem::MaybeUninit::uninit();
|
||||
let mut stop = mem::MaybeUninit::uninit();
|
||||
let mut estimated_total = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_buffering_range(
|
||||
self.0.as_ptr(),
|
||||
&mut fmt,
|
||||
&mut start,
|
||||
&mut stop,
|
||||
&mut estimated_total,
|
||||
fmt.as_mut_ptr(),
|
||||
start.as_mut_ptr(),
|
||||
stop.as_mut_ptr(),
|
||||
estimated_total.as_mut_ptr(),
|
||||
);
|
||||
(
|
||||
GenericFormattedValue::new(from_glib(fmt), start),
|
||||
GenericFormattedValue::new(from_glib(fmt), stop),
|
||||
estimated_total,
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), start.assume_init()),
|
||||
GenericFormattedValue::new(from_glib(fmt.assume_init()), stop.assume_init()),
|
||||
estimated_total.assume_init(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_stats(&self) -> (::BufferingMode, i32, i32, i64) {
|
||||
unsafe {
|
||||
let mut mode = mem::uninitialized();
|
||||
let mut avg_in = mem::uninitialized();
|
||||
let mut avg_out = mem::uninitialized();
|
||||
let mut buffering_left = mem::uninitialized();
|
||||
let mut mode = mem::MaybeUninit::uninit();
|
||||
let mut avg_in = mem::MaybeUninit::uninit();
|
||||
let mut avg_out = mem::MaybeUninit::uninit();
|
||||
let mut buffering_left = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_buffering_stats(
|
||||
self.0.as_ptr(),
|
||||
&mut mode,
|
||||
&mut avg_in,
|
||||
&mut avg_out,
|
||||
&mut buffering_left,
|
||||
mode.as_mut_ptr(),
|
||||
avg_in.as_mut_ptr(),
|
||||
avg_out.as_mut_ptr(),
|
||||
buffering_left.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(from_glib(mode), avg_in, avg_out, buffering_left)
|
||||
(
|
||||
from_glib(mode.assume_init()),
|
||||
avg_in.assume_init(),
|
||||
avg_out.assume_init(),
|
||||
buffering_left.assume_init(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_ranges(&self) -> Vec<(GenericFormattedValue, GenericFormattedValue)> {
|
||||
unsafe {
|
||||
let mut fmt = mem::uninitialized();
|
||||
let mut fmt = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_query_parse_buffering_range(
|
||||
self.0.as_ptr(),
|
||||
&mut fmt,
|
||||
fmt.as_mut_ptr(),
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
);
|
||||
let fmt = from_glib(fmt);
|
||||
let fmt = from_glib(fmt.assume_init());
|
||||
|
||||
let n = gst_sys::gst_query_get_n_buffering_ranges(self.0.as_ptr());
|
||||
let mut res = Vec::with_capacity(n as usize);
|
||||
for i in 0..n {
|
||||
let mut start = mem::uninitialized();
|
||||
let mut stop = mem::uninitialized();
|
||||
let mut start = mem::MaybeUninit::uninit();
|
||||
let mut stop = mem::MaybeUninit::uninit();
|
||||
let s: bool = from_glib(gst_sys::gst_query_parse_nth_buffering_range(
|
||||
self.0.as_ptr(),
|
||||
i,
|
||||
&mut start,
|
||||
&mut stop,
|
||||
start.as_mut_ptr(),
|
||||
stop.as_mut_ptr(),
|
||||
));
|
||||
if s {
|
||||
res.push((
|
||||
GenericFormattedValue::new(fmt, start),
|
||||
GenericFormattedValue::new(fmt, stop),
|
||||
GenericFormattedValue::new(fmt, start.assume_init()),
|
||||
GenericFormattedValue::new(fmt, stop.assume_init()),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -873,10 +892,13 @@ impl<T: AsPtr> Uri<T> {
|
|||
unsafe {
|
||||
let mut uri = ptr::null_mut();
|
||||
gst_sys::gst_query_parse_uri_redirection(self.0.as_ptr(), &mut uri);
|
||||
let mut permanent = mem::uninitialized();
|
||||
gst_sys::gst_query_parse_uri_redirection_permanent(self.0.as_ptr(), &mut permanent);
|
||||
let mut permanent = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_query_parse_uri_redirection_permanent(
|
||||
self.0.as_ptr(),
|
||||
permanent.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(from_glib_full(uri), from_glib(permanent))
|
||||
(from_glib_full(uri), from_glib(permanent.assume_init()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -906,10 +928,13 @@ impl<T: AsPtr> Allocation<T> {
|
|||
pub fn get(&self) -> (&::CapsRef, bool) {
|
||||
unsafe {
|
||||
let mut caps = ptr::null_mut();
|
||||
let mut need_pool = 0;
|
||||
let mut need_pool = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_allocation(self.0.as_ptr(), &mut caps, &mut need_pool);
|
||||
(::CapsRef::from_ptr(caps), from_glib(need_pool))
|
||||
gst_sys::gst_query_parse_allocation(self.0.as_ptr(), &mut caps, need_pool.as_mut_ptr());
|
||||
(
|
||||
::CapsRef::from_ptr(caps),
|
||||
from_glib(need_pool.assume_init()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -926,19 +951,24 @@ impl<T: AsPtr> Allocation<T> {
|
|||
let mut pools = Vec::with_capacity(n as usize);
|
||||
for i in 0..n {
|
||||
let mut pool = ptr::null_mut();
|
||||
let mut size = 0;
|
||||
let mut min_buffers = 0;
|
||||
let mut max_buffers = 0;
|
||||
let mut size = mem::MaybeUninit::uninit();
|
||||
let mut min_buffers = mem::MaybeUninit::uninit();
|
||||
let mut max_buffers = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_nth_allocation_pool(
|
||||
self.0.as_ptr(),
|
||||
i,
|
||||
&mut pool,
|
||||
&mut size,
|
||||
&mut min_buffers,
|
||||
&mut max_buffers,
|
||||
size.as_mut_ptr(),
|
||||
min_buffers.as_mut_ptr(),
|
||||
max_buffers.as_mut_ptr(),
|
||||
);
|
||||
pools.push((from_glib_full(pool), size, min_buffers, max_buffers));
|
||||
pools.push((
|
||||
from_glib_full(pool),
|
||||
size.assume_init(),
|
||||
min_buffers.assume_init(),
|
||||
max_buffers.assume_init(),
|
||||
));
|
||||
}
|
||||
|
||||
pools
|
||||
|
@ -973,14 +1003,14 @@ impl<T: AsPtr> Allocation<T> {
|
|||
|
||||
pub fn find_allocation_meta<U: ::MetaAPI>(&self) -> Option<u32> {
|
||||
unsafe {
|
||||
let mut idx = 0;
|
||||
let mut idx = mem::MaybeUninit::uninit();
|
||||
if gst_sys::gst_query_find_allocation_meta(
|
||||
self.0.as_ptr(),
|
||||
U::get_meta_api().to_glib(),
|
||||
&mut idx,
|
||||
idx.as_mut_ptr(),
|
||||
) != glib_sys::GFALSE
|
||||
{
|
||||
Some(idx)
|
||||
Some(idx.assume_init())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -1097,20 +1127,25 @@ impl<T: AsPtr> Scheduling<T> {
|
|||
|
||||
pub fn get_result(&self) -> (::SchedulingFlags, i32, i32, i32) {
|
||||
unsafe {
|
||||
let mut flags = mem::uninitialized();
|
||||
let mut minsize = mem::uninitialized();
|
||||
let mut maxsize = mem::uninitialized();
|
||||
let mut align = mem::uninitialized();
|
||||
let mut flags = mem::MaybeUninit::uninit();
|
||||
let mut minsize = mem::MaybeUninit::uninit();
|
||||
let mut maxsize = mem::MaybeUninit::uninit();
|
||||
let mut align = mem::MaybeUninit::uninit();
|
||||
|
||||
gst_sys::gst_query_parse_scheduling(
|
||||
self.0.as_ptr(),
|
||||
&mut flags,
|
||||
&mut minsize,
|
||||
&mut maxsize,
|
||||
&mut align,
|
||||
flags.as_mut_ptr(),
|
||||
minsize.as_mut_ptr(),
|
||||
maxsize.as_mut_ptr(),
|
||||
align.as_mut_ptr(),
|
||||
);
|
||||
|
||||
(from_glib(flags), minsize, maxsize, align)
|
||||
(
|
||||
from_glib(flags.assume_init()),
|
||||
minsize.assume_init(),
|
||||
maxsize.assume_init(),
|
||||
align.assume_init(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1153,9 +1188,9 @@ impl<T: AsPtr> AcceptCaps<T> {
|
|||
|
||||
pub fn get_result(&self) -> bool {
|
||||
unsafe {
|
||||
let mut accepted = mem::uninitialized();
|
||||
gst_sys::gst_query_parse_accept_caps_result(self.0.as_ptr(), &mut accepted);
|
||||
from_glib(accepted)
|
||||
let mut accepted = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_query_parse_accept_caps_result(self.0.as_ptr(), accepted.as_mut_ptr());
|
||||
from_glib(accepted.assume_init())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1256,9 +1291,9 @@ impl<T: AsPtr> Bitrate<T> {
|
|||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
pub fn get_bitrate(&self) -> u32 {
|
||||
unsafe {
|
||||
let mut bitrate = 0;
|
||||
gst_sys::gst_query_parse_bitrate(self.0.as_ptr(), &mut bitrate);
|
||||
bitrate
|
||||
let mut bitrate = mem::MaybeUninit::uninit();
|
||||
gst_sys::gst_query_parse_bitrate(self.0.as_ptr(), bitrate.as_mut_ptr());
|
||||
bitrate.assume_init()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,20 +110,20 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
}
|
||||
|
||||
unsafe {
|
||||
let mut clip_start = mem::uninitialized();
|
||||
let mut clip_stop = mem::uninitialized();
|
||||
let mut clip_start = mem::MaybeUninit::uninit();
|
||||
let mut clip_stop = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_segment_clip(
|
||||
&self.0,
|
||||
start.get_format().to_glib(),
|
||||
start.to_raw_value() as u64,
|
||||
stop.to_raw_value() as u64,
|
||||
&mut clip_start,
|
||||
&mut clip_stop,
|
||||
clip_start.as_mut_ptr(),
|
||||
clip_stop.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some((
|
||||
T::from_raw(self.get_format(), clip_start as i64),
|
||||
T::from_raw(self.get_format(), clip_stop as i64),
|
||||
T::from_raw(self.get_format(), clip_start.assume_init() as i64),
|
||||
T::from_raw(self.get_format(), clip_stop.assume_init() as i64),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
|
@ -151,7 +151,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
}
|
||||
|
||||
unsafe {
|
||||
let mut update = mem::uninitialized();
|
||||
let mut update = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(gst_sys::gst_segment_do_seek(
|
||||
&mut self.0,
|
||||
rate,
|
||||
|
@ -161,10 +161,10 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
start.to_raw_value() as u64,
|
||||
stop_type.to_glib(),
|
||||
stop.to_raw_value() as u64,
|
||||
&mut update,
|
||||
update.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(from_glib(update))
|
||||
Some(from_glib(update.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -211,14 +211,17 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
}
|
||||
|
||||
unsafe {
|
||||
let mut position = mem::uninitialized();
|
||||
let mut position = mem::MaybeUninit::uninit();
|
||||
let ret = gst_sys::gst_segment_position_from_running_time_full(
|
||||
&self.0,
|
||||
self.get_format().to_glib(),
|
||||
running_time.to_raw_value() as u64,
|
||||
&mut position,
|
||||
position.as_mut_ptr(),
|
||||
);
|
||||
(ret, T::from_raw(self.get_format(), position as i64))
|
||||
(
|
||||
ret,
|
||||
T::from_raw(self.get_format(), position.assume_init() as i64),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,14 +252,17 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
}
|
||||
|
||||
unsafe {
|
||||
let mut position = mem::uninitialized();
|
||||
let mut position = mem::MaybeUninit::uninit();
|
||||
let ret = gst_sys::gst_segment_position_from_stream_time_full(
|
||||
&self.0,
|
||||
self.get_format().to_glib(),
|
||||
stream_time.to_raw_value() as u64,
|
||||
&mut position,
|
||||
position.as_mut_ptr(),
|
||||
);
|
||||
(ret, T::from_raw(self.get_format(), position as i64))
|
||||
(
|
||||
ret,
|
||||
T::from_raw(self.get_format(), position.assume_init() as i64),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,14 +312,17 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
}
|
||||
|
||||
unsafe {
|
||||
let mut running_time = mem::uninitialized();
|
||||
let mut running_time = mem::MaybeUninit::uninit();
|
||||
let ret = gst_sys::gst_segment_to_running_time_full(
|
||||
&self.0,
|
||||
self.get_format().to_glib(),
|
||||
position.to_raw_value() as u64,
|
||||
&mut running_time,
|
||||
running_time.as_mut_ptr(),
|
||||
);
|
||||
(ret, T::from_raw(self.get_format(), running_time as i64))
|
||||
(
|
||||
ret,
|
||||
T::from_raw(self.get_format(), running_time.assume_init() as i64),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,14 +353,17 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
}
|
||||
|
||||
unsafe {
|
||||
let mut stream_time = mem::uninitialized();
|
||||
let mut stream_time = mem::MaybeUninit::uninit();
|
||||
let ret = gst_sys::gst_segment_to_stream_time_full(
|
||||
&self.0,
|
||||
self.get_format().to_glib(),
|
||||
position.to_raw_value() as u64,
|
||||
&mut stream_time,
|
||||
stream_time.as_mut_ptr(),
|
||||
);
|
||||
(ret, T::from_raw(self.get_format(), stream_time as i64))
|
||||
(
|
||||
ret,
|
||||
T::from_raw(self.get_format(), stream_time.assume_init() as i64),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,15 +145,15 @@ impl TocEntryRef {
|
|||
|
||||
pub fn get_start_stop_times(&self) -> Option<(i64, i64)> {
|
||||
unsafe {
|
||||
let mut start = mem::uninitialized();
|
||||
let mut stop = mem::uninitialized();
|
||||
let mut start = mem::MaybeUninit::uninit();
|
||||
let mut stop = mem::MaybeUninit::uninit();
|
||||
|
||||
if from_glib(gst_sys::gst_toc_entry_get_start_stop_times(
|
||||
self.as_ptr(),
|
||||
&mut start,
|
||||
&mut stop,
|
||||
start.as_mut_ptr(),
|
||||
stop.as_mut_ptr(),
|
||||
)) {
|
||||
Some((start, stop))
|
||||
Some((start.assume_init(), stop.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -196,14 +196,17 @@ impl TocEntryRef {
|
|||
|
||||
pub fn get_loop(&self) -> Option<(TocLoopType, i32)> {
|
||||
unsafe {
|
||||
let mut loop_type = mem::uninitialized();
|
||||
let mut repeat_count = mem::uninitialized();
|
||||
let mut loop_type = mem::MaybeUninit::uninit();
|
||||
let mut repeat_count = mem::MaybeUninit::uninit();
|
||||
if from_glib(gst_sys::gst_toc_entry_get_loop(
|
||||
self.as_ptr(),
|
||||
&mut loop_type,
|
||||
&mut repeat_count,
|
||||
loop_type.as_mut_ptr(),
|
||||
repeat_count.as_mut_ptr(),
|
||||
)) {
|
||||
Some((from_glib(loop_type), repeat_count))
|
||||
Some((
|
||||
from_glib(loop_type.assume_init()),
|
||||
repeat_count.assume_init(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue