forked from mirrors/gstreamer-rs
Change some assertions to debug assertions
These assertions can only trigger because of bugs in the bindings implementation or in the C code and not because of bugs in calling code, so using debug assertions is perfectly fine for them and reduces the number of assertions inlined everywhere in release builds. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1188>
This commit is contained in:
parent
f235dc987d
commit
37bfb78fdc
77 changed files with 229 additions and 257 deletions
|
@ -37,7 +37,7 @@ impl fmt::Debug for DmaBufMemoryRef {
|
||||||
impl DmaBufMemoryRef {
|
impl DmaBufMemoryRef {
|
||||||
#[doc(alias = "gst_dmabuf_memory_get_fd")]
|
#[doc(alias = "gst_dmabuf_memory_get_fd")]
|
||||||
pub fn fd(&self) -> RawFd {
|
pub fn fd(&self) -> RawFd {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe { ffi::gst_dmabuf_memory_get_fd(self.as_mut_ptr()) }
|
unsafe { ffi::gst_dmabuf_memory_get_fd(self.as_mut_ptr()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ impl DmaBufAllocator {
|
||||||
fd: A,
|
fd: A,
|
||||||
size: usize,
|
size: usize,
|
||||||
) -> Result<gst::Memory, glib::BoolError> {
|
) -> Result<gst::Memory, glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Option::<_>::from_glib_full(ffi::gst_dmabuf_allocator_alloc(
|
Option::<_>::from_glib_full(ffi::gst_dmabuf_allocator_alloc(
|
||||||
self.unsafe_cast_ref::<gst::Allocator>().to_glib_none().0,
|
self.unsafe_cast_ref::<gst::Allocator>().to_glib_none().0,
|
||||||
fd.into_raw_fd(),
|
fd.into_raw_fd(),
|
||||||
|
@ -67,7 +67,7 @@ impl DmaBufAllocator {
|
||||||
size: usize,
|
size: usize,
|
||||||
flags: FdMemoryFlags,
|
flags: FdMemoryFlags,
|
||||||
) -> Result<gst::Memory, glib::BoolError> {
|
) -> Result<gst::Memory, glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Option::<_>::from_glib_full(ffi::gst_dmabuf_allocator_alloc_with_flags(
|
Option::<_>::from_glib_full(ffi::gst_dmabuf_allocator_alloc_with_flags(
|
||||||
self.unsafe_cast_ref::<gst::Allocator>().to_glib_none().0,
|
self.unsafe_cast_ref::<gst::Allocator>().to_glib_none().0,
|
||||||
fd,
|
fd,
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl fmt::Debug for FdMemoryRef {
|
||||||
impl FdMemoryRef {
|
impl FdMemoryRef {
|
||||||
#[doc(alias = "gst_fd_memory_get_fd")]
|
#[doc(alias = "gst_fd_memory_get_fd")]
|
||||||
pub fn fd(&self) -> RawFd {
|
pub fn fd(&self) -> RawFd {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe { ffi::gst_fd_memory_get_fd(self.as_mut_ptr()) }
|
unsafe { ffi::gst_fd_memory_get_fd(self.as_mut_ptr()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ impl FdAllocator {
|
||||||
size: usize,
|
size: usize,
|
||||||
flags: FdMemoryFlags,
|
flags: FdMemoryFlags,
|
||||||
) -> Result<gst::Memory, glib::BoolError> {
|
) -> Result<gst::Memory, glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Option::<_>::from_glib_full(ffi::gst_fd_allocator_alloc(
|
Option::<_>::from_glib_full(ffi::gst_fd_allocator_alloc(
|
||||||
self.unsafe_cast_ref::<gst::Allocator>().to_glib_none().0,
|
self.unsafe_cast_ref::<gst::Allocator>().to_glib_none().0,
|
||||||
fd,
|
fd,
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl fmt::Debug for PhysMemoryRef {
|
||||||
impl PhysMemoryRef {
|
impl PhysMemoryRef {
|
||||||
#[doc(alias = "gst_phys_memory_get_phys_addr")]
|
#[doc(alias = "gst_phys_memory_get_phys_addr")]
|
||||||
pub fn phys_addr(&self) -> libc::uintptr_t {
|
pub fn phys_addr(&self) -> libc::uintptr_t {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe { ffi::gst_phys_memory_get_phys_addr(self.as_mut_ptr()) }
|
unsafe { ffi::gst_phys_memory_get_phys_addr(self.as_mut_ptr()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,7 +397,7 @@ impl<T> AudioBufferRef<T> {
|
||||||
impl<'a> AudioBufferRef<&'a gst::BufferRef> {
|
impl<'a> AudioBufferRef<&'a gst::BufferRef> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_borrow(audio_buffer: *const ffi::GstAudioBuffer) -> Borrowed<Self> {
|
pub unsafe fn from_glib_borrow(audio_buffer: *const ffi::GstAudioBuffer) -> Borrowed<Self> {
|
||||||
assert!(!audio_buffer.is_null());
|
debug_assert!(!audio_buffer.is_null());
|
||||||
|
|
||||||
let info = crate::AudioInfo::from_glib_none(
|
let info = crate::AudioInfo::from_glib_none(
|
||||||
&(*audio_buffer).info as *const _ as *mut ffi::GstAudioInfo,
|
&(*audio_buffer).info as *const _ as *mut ffi::GstAudioInfo,
|
||||||
|
@ -455,7 +455,7 @@ impl<'a> AudioBufferRef<&'a gst::BufferRef> {
|
||||||
impl<'a> AudioBufferRef<&'a mut gst::BufferRef> {
|
impl<'a> AudioBufferRef<&'a mut gst::BufferRef> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_borrow_mut(audio_buffer: *mut ffi::GstAudioBuffer) -> Borrowed<Self> {
|
pub unsafe fn from_glib_borrow_mut(audio_buffer: *mut ffi::GstAudioBuffer) -> Borrowed<Self> {
|
||||||
assert!(!audio_buffer.is_null());
|
debug_assert!(!audio_buffer.is_null());
|
||||||
|
|
||||||
let info = crate::AudioInfo::from_glib_none(
|
let info = crate::AudioInfo::from_glib_none(
|
||||||
&(*audio_buffer).info as *const _ as *mut ffi::GstAudioInfo,
|
&(*audio_buffer).info as *const _ as *mut ffi::GstAudioInfo,
|
||||||
|
|
|
@ -164,7 +164,7 @@ pub fn buffer_reorder_channels(
|
||||||
from: &[AudioChannelPosition],
|
from: &[AudioChannelPosition],
|
||||||
to: &[AudioChannelPosition],
|
to: &[AudioChannelPosition],
|
||||||
) -> Result<(), glib::BoolError> {
|
) -> Result<(), glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
if from.len() != to.len() || from.len() > 64 {
|
if from.len() != to.len() || from.len() > 64 {
|
||||||
return Err(glib::bool_error!("Invalid number of channels"));
|
return Err(glib::bool_error!("Invalid number of channels"));
|
||||||
|
|
|
@ -18,7 +18,7 @@ impl FromGlib<i32> for AudioEndianness {
|
||||||
#[allow(unused_unsafe)]
|
#[allow(unused_unsafe)]
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib(value: i32) -> Self {
|
unsafe fn from_glib(value: i32) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
match value {
|
match value {
|
||||||
1234 => Self::LittleEndian,
|
1234 => Self::LittleEndian,
|
||||||
|
@ -52,7 +52,7 @@ impl AudioFormatInfo {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let info = ffi::gst_audio_format_get_info(format.into_glib());
|
let info = ffi::gst_audio_format_get_info(format.into_glib());
|
||||||
assert!(!info.is_null());
|
debug_assert!(!info.is_null());
|
||||||
|
|
||||||
Self(&*info)
|
Self(&*info)
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ pub fn audio_make_raw_caps(
|
||||||
formats: &[crate::AudioFormat],
|
formats: &[crate::AudioFormat],
|
||||||
layout: crate::AudioLayout,
|
layout: crate::AudioLayout,
|
||||||
) -> crate::AudioCapsBuilder<gst::caps::NoFeature> {
|
) -> crate::AudioCapsBuilder<gst::caps::NoFeature> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let formats = formats.iter().copied().map(|f| match f {
|
let formats = formats.iter().copied().map(|f| match f {
|
||||||
crate::AudioFormat::Encoded => panic!("Invalid encoded format"),
|
crate::AudioFormat::Encoded => panic!("Invalid encoded format"),
|
||||||
|
|
|
@ -80,7 +80,7 @@ impl<'a> BaseParseFrame<'a> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) unsafe fn new(frame: *mut ffi::GstBaseParseFrame, _parse: &'a BaseParse) -> Self {
|
pub(crate) unsafe fn new(frame: *mut ffi::GstBaseParseFrame, _parse: &'a BaseParse) -> Self {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
assert!(!frame.is_null());
|
debug_assert!(!frame.is_null());
|
||||||
Self(ptr::NonNull::new_unchecked(frame), PhantomData)
|
Self(ptr::NonNull::new_unchecked(frame), PhantomData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,19 +146,14 @@ impl<'a> BaseParseFrame<'a> {
|
||||||
|
|
||||||
pub fn set_output_buffer(&mut self, output_buffer: gst::Buffer) {
|
pub fn set_output_buffer(&mut self, output_buffer: gst::Buffer) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
assert!(output_buffer.is_writable());
|
||||||
let prev = (*self.to_glib_none().0).out_buffer;
|
let prev = (*self.to_glib_none().0).out_buffer;
|
||||||
|
|
||||||
if !prev.is_null() {
|
if !prev.is_null() {
|
||||||
gst::ffi::gst_mini_object_unref(prev as *mut gst::ffi::GstMiniObject);
|
gst::ffi::gst_mini_object_unref(prev as *mut gst::ffi::GstMiniObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
let ptr = output_buffer.into_glib_ptr();
|
(*self.to_glib_none().0).out_buffer = output_buffer.into_glib_ptr();
|
||||||
let writable: bool = from_glib(gst::ffi::gst_mini_object_is_writable(
|
|
||||||
ptr as *const gst::ffi::GstMiniObject,
|
|
||||||
));
|
|
||||||
assert!(writable);
|
|
||||||
|
|
||||||
(*self.to_glib_none().0).out_buffer = ptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ pub fn type_find_helper_for_buffer<P: IsA<gst::Object>>(
|
||||||
obj: Option<&P>,
|
obj: Option<&P>,
|
||||||
buf: &gst::BufferRef,
|
buf: &gst::BufferRef,
|
||||||
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut prob = mem::MaybeUninit::uninit();
|
let mut prob = mem::MaybeUninit::uninit();
|
||||||
let ret = ffi::gst_type_find_helper_for_buffer(
|
let ret = ffi::gst_type_find_helper_for_buffer(
|
||||||
|
@ -85,7 +85,7 @@ pub fn type_find_helper_for_buffer_with_extension<P: IsA<gst::Object>>(
|
||||||
buf: &gst::BufferRef,
|
buf: &gst::BufferRef,
|
||||||
extension: Option<&str>,
|
extension: Option<&str>,
|
||||||
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut prob = mem::MaybeUninit::uninit();
|
let mut prob = mem::MaybeUninit::uninit();
|
||||||
let ret = ffi::gst_type_find_helper_for_buffer_with_extension(
|
let ret = ffi::gst_type_find_helper_for_buffer_with_extension(
|
||||||
|
@ -110,7 +110,7 @@ pub fn type_find_helper_for_buffer_with_caps(
|
||||||
buf: &gst::BufferRef,
|
buf: &gst::BufferRef,
|
||||||
caps: &gst::CapsRef,
|
caps: &gst::CapsRef,
|
||||||
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
|
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut prob = mem::MaybeUninit::uninit();
|
let mut prob = mem::MaybeUninit::uninit();
|
||||||
let ret = from_glib_full(ffi::gst_type_find_helper_for_buffer_with_caps(
|
let ret = from_glib_full(ffi::gst_type_find_helper_for_buffer_with_caps(
|
||||||
|
@ -131,7 +131,7 @@ pub fn type_find_helper_for_data_with_caps(
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
caps: &gst::CapsRef,
|
caps: &gst::CapsRef,
|
||||||
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
|
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let size = data.len() as _;
|
let size = data.len() as _;
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut prob = mem::MaybeUninit::uninit();
|
let mut prob = mem::MaybeUninit::uninit();
|
||||||
|
@ -153,7 +153,7 @@ pub fn type_find_list_factories_for_caps(
|
||||||
obj: Option<&impl IsA<gst::Object>>,
|
obj: Option<&impl IsA<gst::Object>>,
|
||||||
caps: &gst::CapsRef,
|
caps: &gst::CapsRef,
|
||||||
) -> glib::List<gst::TypeFindFactory> {
|
) -> glib::List<gst::TypeFindFactory> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::collections::List::from_glib_full(ffi::gst_type_find_list_factories_for_caps(
|
glib::collections::List::from_glib_full(ffi::gst_type_find_list_factories_for_caps(
|
||||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
|
|
|
@ -595,7 +595,7 @@ impl Harness {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_full(ptr: *mut ffi::GstHarness) -> Harness {
|
unsafe fn from_glib_full(ptr: *mut ffi::GstHarness) -> Harness {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
Harness(ptr::NonNull::new_unchecked(ptr))
|
Harness(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
|
@ -646,7 +646,7 @@ impl Harness {
|
||||||
element_sinkpad_name: Option<&str>,
|
element_sinkpad_name: Option<&str>,
|
||||||
element_srcpad_name: Option<&str>,
|
element_srcpad_name: Option<&str>,
|
||||||
) -> Harness {
|
) -> Harness {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let element_sinkpad_name = element_sinkpad_name.to_glib_none();
|
let element_sinkpad_name = element_sinkpad_name.to_glib_none();
|
||||||
let element_srcpad_name = element_srcpad_name.to_glib_none();
|
let element_srcpad_name = element_srcpad_name.to_glib_none();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -17,6 +17,10 @@ macro_rules! assert_initialized_main_thread {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! skip_assert_initialized {
|
||||||
|
() => {};
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::unreadable_literal)]
|
#[allow(clippy::unreadable_literal)]
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
#[allow(clippy::match_same_arms)]
|
#[allow(clippy::match_same_arms)]
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub fn gl_handle_context_query(
|
||||||
context: Option<&impl IsA<GLContext>>,
|
context: Option<&impl IsA<GLContext>>,
|
||||||
other_context: Option<&impl IsA<GLContext>>,
|
other_context: Option<&impl IsA<GLContext>>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(ffi::gst_gl_handle_context_query(
|
from_glib(ffi::gst_gl_handle_context_query(
|
||||||
element.as_ref().to_glib_none().0,
|
element.as_ref().to_glib_none().0,
|
||||||
|
@ -29,7 +29,7 @@ pub fn gl_handle_set_context(
|
||||||
element: &impl IsA<gst::Element>,
|
element: &impl IsA<gst::Element>,
|
||||||
context: &gst::Context,
|
context: &gst::Context,
|
||||||
) -> (Option<GLDisplay>, Option<GLContext>) {
|
) -> (Option<GLDisplay>, Option<GLContext>) {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut display = ptr::null_mut();
|
let mut display = ptr::null_mut();
|
||||||
let mut other_context = ptr::null_mut();
|
let mut other_context = ptr::null_mut();
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl PtpClock {
|
||||||
Box::into_raw(user_data) as glib::ffi::gpointer,
|
Box::into_raw(user_data) as glib::ffi::gpointer,
|
||||||
Some(destroy::<F>),
|
Some(destroy::<F>),
|
||||||
);
|
);
|
||||||
assert_ne!(id, 0);
|
debug_assert_ne!(id, 0);
|
||||||
|
|
||||||
PtpStatisticsCallback(NonZeroU64::new_unchecked(id as _))
|
PtpStatisticsCallback(NonZeroU64::new_unchecked(id as _))
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ impl ElementProperties {
|
||||||
let structure_name = self.0.name();
|
let structure_name = self.0.name();
|
||||||
|
|
||||||
if structure_name != "element-properties" {
|
if structure_name != "element-properties" {
|
||||||
assert_eq!(structure_name, "element-properties-map");
|
debug_assert_eq!(structure_name, "element-properties-map");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ impl EncodingContainerProfile {
|
||||||
profile.upcast().into_glib_ptr(),
|
profile.upcast().into_glib_ptr(),
|
||||||
);
|
);
|
||||||
// Can't possibly fail unless we pass random pointers
|
// Can't possibly fail unless we pass random pointers
|
||||||
assert_ne!(res, glib::ffi::GFALSE);
|
debug_assert_ne!(res, glib::ffi::GFALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,13 @@ impl PlayConfig {
|
||||||
#[doc(alias = "get_position_update_interval")]
|
#[doc(alias = "get_position_update_interval")]
|
||||||
#[doc(alias = "gst_play_config_get_position_update_interval")]
|
#[doc(alias = "gst_play_config_get_position_update_interval")]
|
||||||
pub fn position_update_interval(&self) -> u32 {
|
pub fn position_update_interval(&self) -> u32 {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe { ffi::gst_play_config_get_position_update_interval(self.0.to_glib_none().0) }
|
unsafe { ffi::gst_play_config_get_position_update_interval(self.0.to_glib_none().0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "get_seek_accurate")]
|
#[doc(alias = "get_seek_accurate")]
|
||||||
pub fn is_seek_accurate(&self) -> bool {
|
pub fn is_seek_accurate(&self) -> bool {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(ffi::gst_play_config_get_seek_accurate(
|
from_glib(ffi::gst_play_config_get_seek_accurate(
|
||||||
self.0.to_glib_none().0,
|
self.0.to_glib_none().0,
|
||||||
|
@ -58,13 +58,13 @@ impl PlayConfig {
|
||||||
#[doc(alias = "get_user_agent")]
|
#[doc(alias = "get_user_agent")]
|
||||||
#[doc(alias = "gst_play_config_get_user_agent")]
|
#[doc(alias = "gst_play_config_get_user_agent")]
|
||||||
pub fn user_agent(&self) -> Option<String> {
|
pub fn user_agent(&self) -> Option<String> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe { from_glib_full(ffi::gst_play_config_get_user_agent(self.0.to_glib_none().0)) }
|
unsafe { from_glib_full(ffi::gst_play_config_get_user_agent(self.0.to_glib_none().0)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "gst_play_config_set_position_update_interval")]
|
#[doc(alias = "gst_play_config_set_position_update_interval")]
|
||||||
pub fn set_position_update_interval(&mut self, interval: u32) {
|
pub fn set_position_update_interval(&mut self, interval: u32) {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_play_config_set_position_update_interval(
|
ffi::gst_play_config_set_position_update_interval(
|
||||||
self.0.to_glib_none_mut().0,
|
self.0.to_glib_none_mut().0,
|
||||||
|
@ -74,7 +74,7 @@ impl PlayConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_seek_accurate(&mut self, accurate: bool) {
|
pub fn set_seek_accurate(&mut self, accurate: bool) {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
// FIXME: Work-around for
|
// FIXME: Work-around for
|
||||||
// http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=cc58bd6ae071dec4ea7b4be626034accd0372755
|
// http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=cc58bd6ae071dec4ea7b4be626034accd0372755
|
||||||
self.set("accurate-seek", accurate);
|
self.set("accurate-seek", accurate);
|
||||||
|
@ -82,7 +82,7 @@ impl PlayConfig {
|
||||||
|
|
||||||
#[doc(alias = "gst_play_config_set_user_agent")]
|
#[doc(alias = "gst_play_config_set_user_agent")]
|
||||||
pub fn set_user_agent(&mut self, agent: &str) {
|
pub fn set_user_agent(&mut self, agent: &str) {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_play_config_set_user_agent(
|
ffi::gst_play_config_set_user_agent(
|
||||||
self.0.to_glib_none_mut().0,
|
self.0.to_glib_none_mut().0,
|
||||||
|
|
|
@ -20,7 +20,7 @@ impl PlayVideoOverlayVideoRenderer {
|
||||||
window_handle: uintptr_t,
|
window_handle: uintptr_t,
|
||||||
video_sink: &P,
|
video_sink: &P,
|
||||||
) -> PlayVideoOverlayVideoRenderer {
|
) -> PlayVideoOverlayVideoRenderer {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
from_glib_full(ffi::gst_play_video_overlay_video_renderer_new_with_sink(
|
from_glib_full(ffi::gst_play_video_overlay_video_renderer_new_with_sink(
|
||||||
window_handle as *mut _,
|
window_handle as *mut _,
|
||||||
|
@ -30,7 +30,7 @@ impl PlayVideoOverlayVideoRenderer {
|
||||||
|
|
||||||
#[doc(alias = "gst_play_video_overlay_video_renderer_new_with_sink")]
|
#[doc(alias = "gst_play_video_overlay_video_renderer_new_with_sink")]
|
||||||
pub fn with_sink<P: IsA<gst::Element>>(video_sink: &P) -> PlayVideoOverlayVideoRenderer {
|
pub fn with_sink<P: IsA<gst::Element>>(video_sink: &P) -> PlayVideoOverlayVideoRenderer {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(ffi::gst_play_video_overlay_video_renderer_new_with_sink(
|
from_glib_full(ffi::gst_play_video_overlay_video_renderer_new_with_sink(
|
||||||
|
|
|
@ -41,13 +41,13 @@ impl PlayerConfig {
|
||||||
#[doc(alias = "get_position_update_interval")]
|
#[doc(alias = "get_position_update_interval")]
|
||||||
#[doc(alias = "gst_player_config_get_position_update_interval")]
|
#[doc(alias = "gst_player_config_get_position_update_interval")]
|
||||||
pub fn position_update_interval(&self) -> u32 {
|
pub fn position_update_interval(&self) -> u32 {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe { ffi::gst_player_config_get_position_update_interval(self.0.to_glib_none().0) }
|
unsafe { ffi::gst_player_config_get_position_update_interval(self.0.to_glib_none().0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "get_seek_accurate")]
|
#[doc(alias = "get_seek_accurate")]
|
||||||
pub fn is_seek_accurate(&self) -> bool {
|
pub fn is_seek_accurate(&self) -> bool {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(ffi::gst_player_config_get_seek_accurate(
|
from_glib(ffi::gst_player_config_get_seek_accurate(
|
||||||
self.0.to_glib_none().0,
|
self.0.to_glib_none().0,
|
||||||
|
@ -58,7 +58,7 @@ impl PlayerConfig {
|
||||||
#[doc(alias = "get_user_agent")]
|
#[doc(alias = "get_user_agent")]
|
||||||
#[doc(alias = "gst_player_config_get_user_agent")]
|
#[doc(alias = "gst_player_config_get_user_agent")]
|
||||||
pub fn user_agent(&self) -> Option<String> {
|
pub fn user_agent(&self) -> Option<String> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(ffi::gst_player_config_get_user_agent(
|
from_glib_full(ffi::gst_player_config_get_user_agent(
|
||||||
self.0.to_glib_none().0,
|
self.0.to_glib_none().0,
|
||||||
|
@ -68,7 +68,7 @@ impl PlayerConfig {
|
||||||
|
|
||||||
#[doc(alias = "gst_player_config_set_position_update_interval")]
|
#[doc(alias = "gst_player_config_set_position_update_interval")]
|
||||||
pub fn set_position_update_interval(&mut self, interval: u32) {
|
pub fn set_position_update_interval(&mut self, interval: u32) {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_player_config_set_position_update_interval(
|
ffi::gst_player_config_set_position_update_interval(
|
||||||
self.0.to_glib_none_mut().0,
|
self.0.to_glib_none_mut().0,
|
||||||
|
@ -78,7 +78,7 @@ impl PlayerConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_seek_accurate(&mut self, accurate: bool) {
|
pub fn set_seek_accurate(&mut self, accurate: bool) {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
// FIXME: Work-around for
|
// FIXME: Work-around for
|
||||||
// http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=cc58bd6ae071dec4ea7b4be626034accd0372755
|
// http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=cc58bd6ae071dec4ea7b4be626034accd0372755
|
||||||
self.set("accurate-seek", accurate);
|
self.set("accurate-seek", accurate);
|
||||||
|
@ -86,7 +86,7 @@ impl PlayerConfig {
|
||||||
|
|
||||||
#[doc(alias = "gst_player_config_set_user_agent")]
|
#[doc(alias = "gst_player_config_set_user_agent")]
|
||||||
pub fn set_user_agent(&mut self, agent: &str) {
|
pub fn set_user_agent(&mut self, agent: &str) {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_player_config_set_user_agent(
|
ffi::gst_player_config_set_user_agent(
|
||||||
self.0.to_glib_none_mut().0,
|
self.0.to_glib_none_mut().0,
|
||||||
|
|
|
@ -20,7 +20,7 @@ impl PlayerVideoOverlayVideoRenderer {
|
||||||
window_handle: uintptr_t,
|
window_handle: uintptr_t,
|
||||||
video_sink: &P,
|
video_sink: &P,
|
||||||
) -> PlayerVideoOverlayVideoRenderer {
|
) -> PlayerVideoOverlayVideoRenderer {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink(
|
from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink(
|
||||||
window_handle as *mut _,
|
window_handle as *mut _,
|
||||||
|
@ -30,7 +30,7 @@ impl PlayerVideoOverlayVideoRenderer {
|
||||||
|
|
||||||
#[doc(alias = "gst_player_video_overlay_video_renderer_new_with_sink")]
|
#[doc(alias = "gst_player_video_overlay_video_renderer_new_with_sink")]
|
||||||
pub fn with_sink<P: IsA<gst::Element>>(video_sink: &P) -> PlayerVideoOverlayVideoRenderer {
|
pub fn with_sink<P: IsA<gst::Element>>(video_sink: &P) -> PlayerVideoOverlayVideoRenderer {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink(
|
from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink(
|
||||||
|
|
|
@ -319,7 +319,7 @@ impl<'a, T> RTPBuffer<'a, T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = self.rtp_buffer.buffer;
|
let ptr = self.rtp_buffer.buffer;
|
||||||
|
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
gst::BufferRef::from_ptr(ptr)
|
gst::BufferRef::from_ptr(ptr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl RTSPContext {
|
||||||
impl FromGlibPtrBorrow<*mut ffi::GstRTSPContext> for RTSPContext {
|
impl FromGlibPtrBorrow<*mut ffi::GstRTSPContext> for RTSPContext {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_borrow(ptr: *mut ffi::GstRTSPContext) -> Borrowed<Self> {
|
unsafe fn from_glib_borrow(ptr: *mut ffi::GstRTSPContext) -> Borrowed<Self> {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
Borrowed::new(RTSPContext(ptr::NonNull::new_unchecked(ptr)))
|
Borrowed::new(RTSPContext(ptr::NonNull::new_unchecked(ptr)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl RTSPToken {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(values: &[(&str, &(dyn ToSendValue + Sync))]) -> Self {
|
pub fn new(values: &[(&str, &(dyn ToSendValue + Sync))]) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let mut token = RTSPToken::new_empty();
|
let mut token = RTSPToken::new_empty();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl SDPBandwidth {
|
||||||
|
|
||||||
impl Clone for SDPBandwidth {
|
impl Clone for SDPBandwidth {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut bw = mem::MaybeUninit::uninit();
|
let mut bw = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_bandwidth_set(bw.as_mut_ptr(), self.0.bwtype, self.0.bandwidth);
|
ffi::gst_sdp_bandwidth_set(bw.as_mut_ptr(), self.0.bwtype, self.0.bandwidth);
|
||||||
|
|
|
@ -69,7 +69,7 @@ impl SDPConnection {
|
||||||
|
|
||||||
impl Clone for SDPConnection {
|
impl Clone for SDPConnection {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut conn = mem::MaybeUninit::uninit();
|
let mut conn = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_connection_set(
|
ffi::gst_sdp_connection_set(
|
||||||
|
|
|
@ -21,11 +21,13 @@ glib::wrapper! {
|
||||||
match fn {
|
match fn {
|
||||||
copy => |ptr| {
|
copy => |ptr| {
|
||||||
let mut copy = ptr::null_mut();
|
let mut copy = ptr::null_mut();
|
||||||
assert_eq!(ffi::gst_sdp_media_copy(ptr, &mut copy), ffi::GST_SDP_OK);
|
let res = ffi::gst_sdp_media_copy(ptr, &mut copy);
|
||||||
|
debug_assert_eq!(res, ffi::GST_SDP_OK);
|
||||||
copy
|
copy
|
||||||
},
|
},
|
||||||
free => |ptr| {
|
free => |ptr| {
|
||||||
ffi::gst_sdp_media_free(ptr);
|
let res = ffi::gst_sdp_media_free(ptr);
|
||||||
|
debug_assert_eq!(res, ffi::GST_SDP_OK);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,7 +614,7 @@ impl SDPMediaRef {
|
||||||
caps: &gst::CapsRef,
|
caps: &gst::CapsRef,
|
||||||
media: &mut SDPMedia,
|
media: &mut SDPMedia,
|
||||||
) -> Result<(), glib::BoolError> {
|
) -> Result<(), glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let result = unsafe {
|
let result = unsafe {
|
||||||
ffi::gst_sdp_media_set_media_from_caps(caps.as_ptr(), media.to_glib_none_mut().0)
|
ffi::gst_sdp_media_set_media_from_caps(caps.as_ptr(), media.to_glib_none_mut().0)
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,10 +27,14 @@ glib::wrapper! {
|
||||||
match fn {
|
match fn {
|
||||||
copy => |ptr| {
|
copy => |ptr| {
|
||||||
let mut copy = std::ptr::null_mut();
|
let mut copy = std::ptr::null_mut();
|
||||||
assert_eq!(ffi::gst_sdp_message_copy(ptr, &mut copy), ffi::GST_SDP_OK);
|
let res = ffi::gst_sdp_message_copy(ptr, &mut copy);
|
||||||
|
debug_assert_eq!(res, ffi::GST_SDP_OK);
|
||||||
copy
|
copy
|
||||||
},
|
},
|
||||||
free => |ptr| assert_eq!(ffi::gst_sdp_message_free(ptr), ffi::GST_SDP_OK),
|
free => |ptr| {
|
||||||
|
let res = ffi::gst_sdp_message_free(ptr);
|
||||||
|
debug_assert_eq!(res, ffi::GST_SDP_OK);
|
||||||
|
},
|
||||||
type_ => || ffi::gst_sdp_message_get_type(),
|
type_ => || ffi::gst_sdp_message_get_type(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -887,7 +891,7 @@ impl SDPMessageRef {
|
||||||
|
|
||||||
#[doc(alias = "gst_sdp_message_as_uri")]
|
#[doc(alias = "gst_sdp_message_as_uri")]
|
||||||
pub fn as_uri(&self, scheme: &str) -> Result<String, glib::error::BoolError> {
|
pub fn as_uri(&self, scheme: &str) -> Result<String, glib::error::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
match from_glib_full(ffi::gst_sdp_message_as_uri(
|
match from_glib_full(ffi::gst_sdp_message_as_uri(
|
||||||
scheme.to_glib_none().0,
|
scheme.to_glib_none().0,
|
||||||
|
|
|
@ -66,7 +66,7 @@ impl SDPTime {
|
||||||
|
|
||||||
impl Clone for SDPTime {
|
impl Clone for SDPTime {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
#[allow(clippy::cast_ptr_alignment)]
|
#[allow(clippy::cast_ptr_alignment)]
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut time = mem::MaybeUninit::uninit();
|
let mut time = mem::MaybeUninit::uninit();
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl SDPZone {
|
||||||
|
|
||||||
impl Clone for SDPZone {
|
impl Clone for SDPZone {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut zone = mem::MaybeUninit::uninit();
|
let mut zone = mem::MaybeUninit::uninit();
|
||||||
ffi::gst_sdp_zone_set(zone.as_mut_ptr(), self.0.time, self.0.typed_time);
|
ffi::gst_sdp_zone_set(zone.as_mut_ptr(), self.0.time, self.0.typed_time);
|
||||||
|
|
|
@ -16,7 +16,7 @@ use crate::VideoOrientationMethod;
|
||||||
impl VideoCaptionType {
|
impl VideoCaptionType {
|
||||||
#[doc(alias = "gst_video_caption_type_from_caps")]
|
#[doc(alias = "gst_video_caption_type_from_caps")]
|
||||||
pub fn from_caps(caps: &gst::CapsRef) -> VideoCaptionType {
|
pub fn from_caps(caps: &gst::CapsRef) -> VideoCaptionType {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe { from_glib(ffi::gst_video_caption_type_from_caps(caps.as_ptr())) }
|
unsafe { from_glib(ffi::gst_video_caption_type_from_caps(caps.as_ptr())) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ impl VideoOrientationMethod {
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
#[doc(alias = "gst_video_orientation_from_tag")]
|
#[doc(alias = "gst_video_orientation_from_tag")]
|
||||||
pub fn from_tag(taglist: &gst::TagListRef) -> Option<VideoOrientationMethod> {
|
pub fn from_tag(taglist: &gst::TagListRef) -> Option<VideoOrientationMethod> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
|
@ -212,7 +212,7 @@ pub fn is_common_aspect_ratio(width: u32, height: u32, par: gst::Fraction) -> bo
|
||||||
pub fn video_make_raw_caps(
|
pub fn video_make_raw_caps(
|
||||||
formats: &[crate::VideoFormat],
|
formats: &[crate::VideoFormat],
|
||||||
) -> crate::VideoCapsBuilder<gst::caps::NoFeature> {
|
) -> crate::VideoCapsBuilder<gst::caps::NoFeature> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let formats = formats.iter().copied().map(|f| match f {
|
let formats = formats.iter().copied().map(|f| match f {
|
||||||
crate::VideoFormat::Encoded => panic!("Invalid encoded format"),
|
crate::VideoFormat::Encoded => panic!("Invalid encoded format"),
|
||||||
|
|
|
@ -66,7 +66,7 @@ impl VideoAlignment {
|
||||||
padding_right: u32,
|
padding_right: u32,
|
||||||
stride_align: &[u32; ffi::GST_VIDEO_MAX_PLANES as usize],
|
stride_align: &[u32; ffi::GST_VIDEO_MAX_PLANES as usize],
|
||||||
) -> Self {
|
) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let videoalignment = ffi::GstVideoAlignment {
|
let videoalignment = ffi::GstVideoAlignment {
|
||||||
padding_top,
|
padding_top,
|
||||||
|
|
|
@ -192,7 +192,7 @@ impl<'a> VideoCodecFrame<'a> {
|
||||||
let writable: bool = from_glib(gst::ffi::gst_mini_object_is_writable(
|
let writable: bool = from_glib(gst::ffi::gst_mini_object_is_writable(
|
||||||
ptr as *const gst::ffi::GstMiniObject,
|
ptr as *const gst::ffi::GstMiniObject,
|
||||||
));
|
));
|
||||||
assert!(writable);
|
debug_assert!(writable);
|
||||||
|
|
||||||
Some(gst::BufferRef::from_mut_ptr(ptr))
|
Some(gst::BufferRef::from_mut_ptr(ptr))
|
||||||
}
|
}
|
||||||
|
@ -201,19 +201,14 @@ impl<'a> VideoCodecFrame<'a> {
|
||||||
|
|
||||||
pub fn set_output_buffer(&mut self, output_buffer: gst::Buffer) {
|
pub fn set_output_buffer(&mut self, output_buffer: gst::Buffer) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
assert!(output_buffer.is_writable());
|
||||||
let prev = (*self.to_glib_none().0).output_buffer;
|
let prev = (*self.to_glib_none().0).output_buffer;
|
||||||
|
|
||||||
if !prev.is_null() {
|
if !prev.is_null() {
|
||||||
gst::ffi::gst_mini_object_unref(prev as *mut gst::ffi::GstMiniObject);
|
gst::ffi::gst_mini_object_unref(prev as *mut gst::ffi::GstMiniObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
let ptr = output_buffer.into_glib_ptr();
|
(*self.to_glib_none().0).output_buffer = output_buffer.into_glib_ptr();
|
||||||
let writable: bool = from_glib(gst::ffi::gst_mini_object_is_writable(
|
|
||||||
ptr as *const gst::ffi::GstMiniObject,
|
|
||||||
));
|
|
||||||
assert!(writable);
|
|
||||||
|
|
||||||
(*self.to_glib_none().0).output_buffer = ptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl VideoConverter {
|
||||||
out_info: &crate::VideoInfo,
|
out_info: &crate::VideoInfo,
|
||||||
config: Option<VideoConverterConfig>,
|
config: Option<VideoConverterConfig>,
|
||||||
) -> Result<Self, glib::BoolError> {
|
) -> Result<Self, glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
if in_info.fps() != out_info.fps() {
|
if in_info.fps() != out_info.fps() {
|
||||||
return Err(glib::bool_error!("Can't do framerate conversion"));
|
return Err(glib::bool_error!("Can't do framerate conversion"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ macro_rules! event_builder_generic_impl {
|
||||||
|
|
||||||
#[must_use = "Building the event without using it has no effect"]
|
#[must_use = "Building the event without using it has no effect"]
|
||||||
pub fn build(mut self) -> gst::Event {
|
pub fn build(mut self) -> gst::Event {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let event = $new_fn(&mut self);
|
let event = $new_fn(&mut self);
|
||||||
if let Some(seqnum) = self.seqnum {
|
if let Some(seqnum) = self.seqnum {
|
||||||
|
@ -151,6 +151,7 @@ pub struct DownstreamForceKeyUnitEvent {
|
||||||
|
|
||||||
impl DownstreamForceKeyUnitEvent {
|
impl DownstreamForceKeyUnitEvent {
|
||||||
pub fn builder<'a>() -> DownstreamForceKeyUnitEventBuilder<'a> {
|
pub fn builder<'a>() -> DownstreamForceKeyUnitEventBuilder<'a> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
DownstreamForceKeyUnitEventBuilder::new()
|
DownstreamForceKeyUnitEventBuilder::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +247,7 @@ pub struct UpstreamForceKeyUnitEvent {
|
||||||
|
|
||||||
impl UpstreamForceKeyUnitEvent {
|
impl UpstreamForceKeyUnitEvent {
|
||||||
pub fn builder<'a>() -> UpstreamForceKeyUnitEventBuilder<'a> {
|
pub fn builder<'a>() -> UpstreamForceKeyUnitEventBuilder<'a> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
UpstreamForceKeyUnitEventBuilder::new()
|
UpstreamForceKeyUnitEventBuilder::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +372,7 @@ macro_rules! nav_event_builder {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> $builder<'a> {
|
impl<'a> $builder<'a> {
|
||||||
pub fn new($($event_field: $event_type)?) -> Self {
|
fn new($($event_field: $event_type)?) -> Self {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
seqnum: None,
|
seqnum: None,
|
||||||
|
@ -500,7 +502,7 @@ pub struct CommandEventBuilder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CommandEventBuilder<'a> {
|
impl<'a> CommandEventBuilder<'a> {
|
||||||
pub fn new(command: NavigationCommand) -> Self {
|
fn new(command: NavigationCommand) -> Self {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
seqnum: None,
|
seqnum: None,
|
||||||
|
@ -958,7 +960,7 @@ impl NavigationEvent {
|
||||||
|
|
||||||
#[doc(alias = "gst_navigation_event_get_type")]
|
#[doc(alias = "gst_navigation_event_get_type")]
|
||||||
pub fn type_(event: &gst::EventRef) -> NavigationEventType {
|
pub fn type_(event: &gst::EventRef) -> NavigationEventType {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe { from_glib(ffi::gst_navigation_event_get_type(event.as_mut_ptr())) }
|
unsafe { from_glib(ffi::gst_navigation_event_get_type(event.as_mut_ptr())) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,18 +11,16 @@ pub struct VideoFormatInfo(&'static ffi::GstVideoFormatInfo);
|
||||||
impl VideoFormatInfo {
|
impl VideoFormatInfo {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_ptr(format_info: *const ffi::GstVideoFormatInfo) -> Self {
|
pub unsafe fn from_ptr(format_info: *const ffi::GstVideoFormatInfo) -> Self {
|
||||||
assert_initialized_main_thread!();
|
debug_assert!(!format_info.is_null());
|
||||||
assert!(!format_info.is_null());
|
|
||||||
Self(&*format_info)
|
Self(&*format_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn from_format(format: crate::VideoFormat) -> Self {
|
pub fn from_format(format: crate::VideoFormat) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let info = ffi::gst_video_format_get_info(format.into_glib());
|
let info = ffi::gst_video_format_get_info(format.into_glib());
|
||||||
assert!(!info.is_null());
|
debug_assert!(!info.is_null());
|
||||||
|
|
||||||
Self(&*info)
|
Self(&*info)
|
||||||
}
|
}
|
||||||
|
|
|
@ -732,7 +732,7 @@ impl<T> VideoFrameRef<T> {
|
||||||
impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_borrow(frame: *const ffi::GstVideoFrame) -> Borrowed<Self> {
|
pub unsafe fn from_glib_borrow(frame: *const ffi::GstVideoFrame) -> Borrowed<Self> {
|
||||||
assert!(!frame.is_null());
|
debug_assert!(!frame.is_null());
|
||||||
|
|
||||||
let frame = ptr::read(frame);
|
let frame = ptr::read(frame);
|
||||||
let info = crate::VideoInfo(ptr::read(&frame.info));
|
let info = crate::VideoInfo(ptr::read(&frame.info));
|
||||||
|
@ -832,7 +832,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
||||||
impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_borrow_mut(frame: *mut ffi::GstVideoFrame) -> Self {
|
pub unsafe fn from_glib_borrow_mut(frame: *mut ffi::GstVideoFrame) -> Self {
|
||||||
assert!(!frame.is_null());
|
debug_assert!(!frame.is_null());
|
||||||
|
|
||||||
let frame = ptr::read(frame);
|
let frame = ptr::read(frame);
|
||||||
let info = crate::VideoInfo(ptr::read(&frame.info));
|
let info = crate::VideoInfo(ptr::read(&frame.info));
|
||||||
|
|
|
@ -10,7 +10,7 @@ pub struct VideoContentLightLevel(ffi::GstVideoContentLightLevel);
|
||||||
|
|
||||||
impl VideoContentLightLevel {
|
impl VideoContentLightLevel {
|
||||||
pub fn new(max_content_light_level: u16, max_frame_average_light_level: u16) -> Self {
|
pub fn new(max_content_light_level: u16, max_frame_average_light_level: u16) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
VideoContentLightLevel(ffi::GstVideoContentLightLevel {
|
VideoContentLightLevel(ffi::GstVideoContentLightLevel {
|
||||||
max_content_light_level,
|
max_content_light_level,
|
||||||
|
@ -148,7 +148,7 @@ impl VideoMasteringDisplayInfo {
|
||||||
max_display_mastering_luminance: u32,
|
max_display_mastering_luminance: u32,
|
||||||
min_display_mastering_luminance: u32,
|
min_display_mastering_luminance: u32,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
VideoMasteringDisplayInfo(ffi::GstVideoMasteringDisplayInfo {
|
VideoMasteringDisplayInfo(ffi::GstVideoMasteringDisplayInfo {
|
||||||
display_primaries: unsafe { mem::transmute(display_primaries) },
|
display_primaries: unsafe { mem::transmute(display_primaries) },
|
||||||
|
|
|
@ -101,7 +101,7 @@ impl VideoColorimetry {
|
||||||
transfer: crate::VideoTransferFunction,
|
transfer: crate::VideoTransferFunction,
|
||||||
primaries: crate::VideoColorPrimaries,
|
primaries: crate::VideoColorPrimaries,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let colorimetry = ffi::GstVideoColorimetry {
|
let colorimetry = ffi::GstVideoColorimetry {
|
||||||
range: range.into_glib(),
|
range: range.into_glib(),
|
||||||
|
|
|
@ -42,7 +42,7 @@ macro_rules! message_builder_generic_impl {
|
||||||
|
|
||||||
#[must_use = "Building the message without using it has no effect"]
|
#[must_use = "Building the message without using it has no effect"]
|
||||||
pub fn build(mut self) -> Message {
|
pub fn build(mut self) -> Message {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let src = self.builder.src.to_glib_none().0;
|
let src = self.builder.src.to_glib_none().0;
|
||||||
let msg = $new_fn(&mut self, src);
|
let msg = $new_fn(&mut self, src);
|
||||||
|
@ -77,8 +77,8 @@ struct MessageBuilder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MessageBuilder<'a> {
|
impl<'a> MessageBuilder<'a> {
|
||||||
pub fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
src: None,
|
src: None,
|
||||||
seqnum: None,
|
seqnum: None,
|
||||||
|
@ -151,18 +151,18 @@ impl NavigationEventMessage {
|
||||||
#[doc(alias = "gst_navigation_message_new_event")]
|
#[doc(alias = "gst_navigation_message_new_event")]
|
||||||
#[allow(clippy::new_ret_no_self)]
|
#[allow(clippy::new_ret_no_self)]
|
||||||
pub fn new(event: gst::Event) -> gst::Message {
|
pub fn new(event: gst::Event) -> gst::Message {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
NavigationEventMessageBuilder::new(event).build()
|
NavigationEventMessageBuilder::new(event).build()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn builder<'a>(event: gst::Event) -> NavigationEventMessageBuilder<'a> {
|
pub fn builder<'a>(event: gst::Event) -> NavigationEventMessageBuilder<'a> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
NavigationEventMessageBuilder::new(event)
|
NavigationEventMessageBuilder::new(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "gst_navigation_message_parse_event")]
|
#[doc(alias = "gst_navigation_message_parse_event")]
|
||||||
pub fn parse(msg: &gst::MessageRef) -> Result<Self, glib::error::BoolError> {
|
pub fn parse(msg: &gst::MessageRef) -> Result<Self, glib::error::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut event = ptr::null_mut();
|
let mut event = ptr::null_mut();
|
||||||
let ret = from_glib(ffi::gst_navigation_message_parse_event(
|
let ret = from_glib(ffi::gst_navigation_message_parse_event(
|
||||||
|
@ -188,7 +188,7 @@ pub enum NavigationMessage {
|
||||||
impl NavigationMessage {
|
impl NavigationMessage {
|
||||||
#[doc(alias = "gst_navigation_message_get_type")]
|
#[doc(alias = "gst_navigation_message_get_type")]
|
||||||
pub fn type_(msg: &gst::MessageRef) -> NavigationMessageType {
|
pub fn type_(msg: &gst::MessageRef) -> NavigationMessageType {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe { from_glib(ffi::gst_navigation_message_get_type(msg.as_mut_ptr())) }
|
unsafe { from_glib(ffi::gst_navigation_message_get_type(msg.as_mut_ptr())) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl VideoOverlayRectangle {
|
||||||
render_height: u32,
|
render_height: u32,
|
||||||
flags: crate::VideoOverlayFormatFlags,
|
flags: crate::VideoOverlayFormatFlags,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
assert!(buffer.meta::<crate::VideoMeta>().is_some());
|
assert!(buffer.meta::<crate::VideoMeta>().is_some());
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(ffi::gst_video_overlay_rectangle_new_raw(
|
from_glib_full(ffi::gst_video_overlay_rectangle_new_raw(
|
||||||
|
|
|
@ -203,7 +203,7 @@ impl ValidVideoTimeCode {
|
||||||
frames: u32,
|
frames: u32,
|
||||||
field_count: u32,
|
field_count: u32,
|
||||||
) -> Result<Self, glib::error::BoolError> {
|
) -> Result<Self, glib::error::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let tc = VideoTimeCode::new(
|
let tc = VideoTimeCode::new(
|
||||||
fps,
|
fps,
|
||||||
latest_daily_jam,
|
latest_daily_jam,
|
||||||
|
@ -233,7 +233,6 @@ impl ValidVideoTimeCode {
|
||||||
|
|
||||||
#[doc(alias = "gst_video_time_code_add_frames")]
|
#[doc(alias = "gst_video_time_code_add_frames")]
|
||||||
pub fn add_frames(&mut self, frames: i64) {
|
pub fn add_frames(&mut self, frames: i64) {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_video_time_code_add_frames(self.to_glib_none_mut().0, frames);
|
ffi::gst_video_time_code_add_frames(self.to_glib_none_mut().0, frames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,6 @@ pub use glib;
|
||||||
pub use gst;
|
pub use gst;
|
||||||
pub use gst_sdp;
|
pub use gst_sdp;
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
|
||||||
() => {
|
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
|
||||||
gst::assert_initialized();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! skip_assert_initialized {
|
macro_rules! skip_assert_initialized {
|
||||||
() => {};
|
() => {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::{WebRTCSDPType, WebRTCSessionDescription};
|
||||||
impl WebRTCSessionDescription {
|
impl WebRTCSessionDescription {
|
||||||
#[doc(alias = "gst_webrtc_session_description_new")]
|
#[doc(alias = "gst_webrtc_session_description_new")]
|
||||||
pub fn new(type_: WebRTCSDPType, sdp: gst_sdp::SDPMessage) -> WebRTCSessionDescription {
|
pub fn new(type_: WebRTCSDPType, sdp: gst_sdp::SDPMessage) -> WebRTCSessionDescription {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut sdp = mem::ManuallyDrop::new(sdp);
|
let mut sdp = mem::ManuallyDrop::new(sdp);
|
||||||
from_glib_full(ffi::gst_webrtc_session_description_new(
|
from_glib_full(ffi::gst_webrtc_session_description_new(
|
||||||
|
|
|
@ -82,7 +82,7 @@ impl FromGlib<ffi::GstAllocationParams> for AllocationParams {
|
||||||
#[allow(unused_unsafe)]
|
#[allow(unused_unsafe)]
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib(value: ffi::GstAllocationParams) -> Self {
|
unsafe fn from_glib(value: ffi::GstAllocationParams) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Self::from(value)
|
Self::from(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,6 @@ impl Buffer {
|
||||||
|
|
||||||
#[doc(alias = "gst_buffer_append")]
|
#[doc(alias = "gst_buffer_append")]
|
||||||
pub fn append(&mut self, other: Self) {
|
pub fn append(&mut self, other: Self) {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_buffer_append(self.as_mut_ptr(), other.into_glib_ptr());
|
let ptr = ffi::gst_buffer_append(self.as_mut_ptr(), other.into_glib_ptr());
|
||||||
self.replace_ptr(ptr);
|
self.replace_ptr(ptr);
|
||||||
|
@ -1001,8 +1000,7 @@ impl<'a> IntoIterator for &'a BufferRef {
|
||||||
|
|
||||||
impl std::iter::FromIterator<Memory> for Buffer {
|
impl std::iter::FromIterator<Memory> for Buffer {
|
||||||
fn from_iter<T: IntoIterator<Item = Memory>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = Memory>>(iter: T) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let iter = iter.into_iter();
|
let iter = iter.into_iter();
|
||||||
|
|
||||||
let mut buffer = Buffer::new();
|
let mut buffer = Buffer::new();
|
||||||
|
|
|
@ -112,7 +112,7 @@ macro_rules! define_read_write_fn_impl(
|
||||||
buffer_ref($self).as_mut_ptr(),
|
buffer_ref($self).as_mut_ptr(),
|
||||||
$self.cur_mem_idx,
|
$self.cur_mem_idx,
|
||||||
);
|
);
|
||||||
assert!(!memory.is_null());
|
debug_assert!(!memory.is_null());
|
||||||
|
|
||||||
if ffi::gst_memory_map(memory, &mut $self.map_info, $map_flags)
|
if ffi::gst_memory_map(memory, &mut $self.map_info, $map_flags)
|
||||||
== glib::ffi::GFALSE
|
== glib::ffi::GFALSE
|
||||||
|
@ -124,10 +124,10 @@ macro_rules! define_read_write_fn_impl(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert!($self.cur_mem_offset < $self.map_info.size);
|
debug_assert!($self.cur_mem_offset < $self.map_info.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert!(!$self.map_info.memory.is_null());
|
debug_assert!(!$self.map_info.memory.is_null());
|
||||||
|
|
||||||
// Copy all data we can currently copy
|
// Copy all data we can currently copy
|
||||||
let data_left = $self.map_info.size - $self.cur_mem_offset;
|
let data_left = $self.map_info.size - $self.cur_mem_offset;
|
||||||
|
|
|
@ -52,7 +52,7 @@ pub struct BufferPoolConfigRef(StructureRef);
|
||||||
impl BufferPoolConfigRef {
|
impl BufferPoolConfigRef {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_borrow<'a>(ptr: *const ffi::GstStructure) -> &'a BufferPoolConfigRef {
|
pub unsafe fn from_glib_borrow<'a>(ptr: *const ffi::GstStructure) -> &'a BufferPoolConfigRef {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
&*(ptr as *mut StructureRef as *mut BufferPoolConfigRef)
|
&*(ptr as *mut StructureRef as *mut BufferPoolConfigRef)
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ impl BufferPoolConfigRef {
|
||||||
pub unsafe fn from_glib_borrow_mut<'a>(
|
pub unsafe fn from_glib_borrow_mut<'a>(
|
||||||
ptr: *mut ffi::GstStructure,
|
ptr: *mut ffi::GstStructure,
|
||||||
) -> &'a mut BufferPoolConfigRef {
|
) -> &'a mut BufferPoolConfigRef {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
&mut *(ptr as *mut StructureRef as *mut BufferPoolConfigRef)
|
&mut *(ptr as *mut StructureRef as *mut BufferPoolConfigRef)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl Caps {
|
||||||
|
|
||||||
#[doc(alias = "gst_caps_new_simple")]
|
#[doc(alias = "gst_caps_new_simple")]
|
||||||
pub fn new_simple(name: &str, values: &[(&str, &(dyn ToSendValue + Sync))]) -> Self {
|
pub fn new_simple(name: &str, values: &[(&str, &(dyn ToSendValue + Sync))]) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let mut caps = Caps::new_empty();
|
let mut caps = Caps::new_empty();
|
||||||
|
|
||||||
let structure = Structure::new(name, values);
|
let structure = Structure::new(name, values);
|
||||||
|
@ -68,7 +68,6 @@ impl Caps {
|
||||||
|
|
||||||
#[doc(alias = "gst_caps_fixate")]
|
#[doc(alias = "gst_caps_fixate")]
|
||||||
pub fn fixate(&mut self) {
|
pub fn fixate(&mut self) {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
// See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/388
|
// See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/388
|
||||||
assert!(!self.is_any());
|
assert!(!self.is_any());
|
||||||
|
@ -83,7 +82,6 @@ impl Caps {
|
||||||
|
|
||||||
#[doc(alias = "gst_caps_merge")]
|
#[doc(alias = "gst_caps_merge")]
|
||||||
pub fn merge(&mut self, other: Self) {
|
pub fn merge(&mut self, other: Self) {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_caps_merge(self.as_mut_ptr(), other.into_glib_ptr());
|
let ptr = ffi::gst_caps_merge(self.as_mut_ptr(), other.into_glib_ptr());
|
||||||
self.replace_ptr(ptr);
|
self.replace_ptr(ptr);
|
||||||
|
@ -92,7 +90,6 @@ impl Caps {
|
||||||
|
|
||||||
#[doc(alias = "gst_caps_merge_structure")]
|
#[doc(alias = "gst_caps_merge_structure")]
|
||||||
pub fn merge_structure(&mut self, structure: Structure) {
|
pub fn merge_structure(&mut self, structure: Structure) {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_caps_merge_structure(self.as_mut_ptr(), structure.into_glib_ptr());
|
let ptr = ffi::gst_caps_merge_structure(self.as_mut_ptr(), structure.into_glib_ptr());
|
||||||
self.replace_ptr(ptr);
|
self.replace_ptr(ptr);
|
||||||
|
@ -101,7 +98,6 @@ impl Caps {
|
||||||
|
|
||||||
#[doc(alias = "gst_caps_merge_structure_full")]
|
#[doc(alias = "gst_caps_merge_structure_full")]
|
||||||
pub fn merge_structure_full(&mut self, structure: Structure, features: Option<CapsFeatures>) {
|
pub fn merge_structure_full(&mut self, structure: Structure, features: Option<CapsFeatures>) {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_caps_merge_structure_full(
|
let ptr = ffi::gst_caps_merge_structure_full(
|
||||||
self.as_mut_ptr(),
|
self.as_mut_ptr(),
|
||||||
|
@ -116,7 +112,6 @@ impl Caps {
|
||||||
|
|
||||||
#[doc(alias = "gst_caps_normalize")]
|
#[doc(alias = "gst_caps_normalize")]
|
||||||
pub fn normalize(&mut self) {
|
pub fn normalize(&mut self) {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_caps_normalize(self.as_mut_ptr());
|
let ptr = ffi::gst_caps_normalize(self.as_mut_ptr());
|
||||||
self.replace_ptr(ptr);
|
self.replace_ptr(ptr);
|
||||||
|
@ -125,7 +120,6 @@ impl Caps {
|
||||||
|
|
||||||
#[doc(alias = "gst_caps_simplify")]
|
#[doc(alias = "gst_caps_simplify")]
|
||||||
pub fn simplify(&mut self) {
|
pub fn simplify(&mut self) {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_caps_simplify(self.as_mut_ptr());
|
let ptr = ffi::gst_caps_simplify(self.as_mut_ptr());
|
||||||
self.replace_ptr(ptr);
|
self.replace_ptr(ptr);
|
||||||
|
@ -134,7 +128,6 @@ impl Caps {
|
||||||
|
|
||||||
#[doc(alias = "gst_caps_truncate")]
|
#[doc(alias = "gst_caps_truncate")]
|
||||||
pub fn truncate(&mut self) {
|
pub fn truncate(&mut self) {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_caps_truncate(self.as_mut_ptr());
|
let ptr = ffi::gst_caps_truncate(self.as_mut_ptr());
|
||||||
self.replace_ptr(ptr);
|
self.replace_ptr(ptr);
|
||||||
|
@ -157,7 +150,7 @@ impl str::FromStr for Caps {
|
||||||
|
|
||||||
impl std::iter::FromIterator<Structure> for Caps {
|
impl std::iter::FromIterator<Structure> for Caps {
|
||||||
fn from_iter<T: IntoIterator<Item = Structure>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = Structure>>(iter: T) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let mut caps = Caps::new_empty();
|
let mut caps = Caps::new_empty();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -171,7 +164,7 @@ impl std::iter::FromIterator<Structure> for Caps {
|
||||||
|
|
||||||
impl std::iter::FromIterator<(Structure, CapsFeatures)> for Caps {
|
impl std::iter::FromIterator<(Structure, CapsFeatures)> for Caps {
|
||||||
fn from_iter<T: IntoIterator<Item = (Structure, CapsFeatures)>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = (Structure, CapsFeatures)>>(iter: T) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let mut caps = Caps::new_empty();
|
let mut caps = Caps::new_empty();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -186,7 +179,7 @@ impl std::iter::FromIterator<(Structure, CapsFeatures)> for Caps {
|
||||||
|
|
||||||
impl std::iter::FromIterator<(Structure, Option<CapsFeatures>)> for Caps {
|
impl std::iter::FromIterator<(Structure, Option<CapsFeatures>)> for Caps {
|
||||||
fn from_iter<T: IntoIterator<Item = (Structure, Option<CapsFeatures>)>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = (Structure, Option<CapsFeatures>)>>(iter: T) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let mut caps = Caps::new_empty();
|
let mut caps = Caps::new_empty();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -201,7 +194,7 @@ impl std::iter::FromIterator<(Structure, Option<CapsFeatures>)> for Caps {
|
||||||
|
|
||||||
impl std::iter::FromIterator<Caps> for Caps {
|
impl std::iter::FromIterator<Caps> for Caps {
|
||||||
fn from_iter<T: IntoIterator<Item = Caps>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = Caps>>(iter: T) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let mut caps = Caps::new_empty();
|
let mut caps = Caps::new_empty();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -493,7 +486,6 @@ impl CapsRef {
|
||||||
|
|
||||||
#[doc(alias = "gst_caps_subtract")]
|
#[doc(alias = "gst_caps_subtract")]
|
||||||
pub fn subtract(&self, other: &Self) -> Caps {
|
pub fn subtract(&self, other: &Self) -> Caps {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(ffi::gst_caps_subtract(
|
from_glib_full(ffi::gst_caps_subtract(
|
||||||
self.as_mut_ptr(),
|
self.as_mut_ptr(),
|
||||||
|
|
|
@ -22,7 +22,7 @@ unsafe impl Sync for CapsFeatures {}
|
||||||
impl CapsFeatures {
|
impl CapsFeatures {
|
||||||
#[doc(alias = "gst_caps_features_new")]
|
#[doc(alias = "gst_caps_features_new")]
|
||||||
pub fn new(features: &[&str]) -> Self {
|
pub fn new(features: &[&str]) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let mut f = Self::new_empty();
|
let mut f = Self::new_empty();
|
||||||
|
|
||||||
for feature in features {
|
for feature in features {
|
||||||
|
@ -34,7 +34,7 @@ impl CapsFeatures {
|
||||||
|
|
||||||
#[doc(alias = "gst_caps_features_new_id")]
|
#[doc(alias = "gst_caps_features_new_id")]
|
||||||
pub fn from_quarks(features: &[glib::Quark]) -> Self {
|
pub fn from_quarks(features: &[glib::Quark]) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let mut f = Self::new_empty();
|
let mut f = Self::new_empty();
|
||||||
|
|
||||||
for feature in features {
|
for feature in features {
|
||||||
|
@ -104,7 +104,7 @@ impl Clone for CapsFeatures {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_caps_features_copy(self.0.as_ref());
|
let ptr = ffi::gst_caps_features_copy(self.0.as_ref());
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
CapsFeatures(ptr::NonNull::new_unchecked(ptr))
|
CapsFeatures(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,9 +218,9 @@ impl<'a> ToGlibPtrMut<'a, *mut ffi::GstCapsFeatures> for CapsFeatures {
|
||||||
impl FromGlibPtrNone<*const ffi::GstCapsFeatures> for CapsFeatures {
|
impl FromGlibPtrNone<*const ffi::GstCapsFeatures> for CapsFeatures {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *const ffi::GstCapsFeatures) -> Self {
|
unsafe fn from_glib_none(ptr: *const ffi::GstCapsFeatures) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
let ptr = ffi::gst_caps_features_copy(ptr);
|
let ptr = ffi::gst_caps_features_copy(ptr);
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
CapsFeatures(ptr::NonNull::new_unchecked(ptr))
|
CapsFeatures(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,9 +228,9 @@ impl FromGlibPtrNone<*const ffi::GstCapsFeatures> for CapsFeatures {
|
||||||
impl FromGlibPtrNone<*mut ffi::GstCapsFeatures> for CapsFeatures {
|
impl FromGlibPtrNone<*mut ffi::GstCapsFeatures> for CapsFeatures {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *mut ffi::GstCapsFeatures) -> Self {
|
unsafe fn from_glib_none(ptr: *mut ffi::GstCapsFeatures) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
let ptr = ffi::gst_caps_features_copy(ptr);
|
let ptr = ffi::gst_caps_features_copy(ptr);
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
CapsFeatures(ptr::NonNull::new_unchecked(ptr))
|
CapsFeatures(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ impl FromGlibPtrNone<*mut ffi::GstCapsFeatures> for CapsFeatures {
|
||||||
impl FromGlibPtrFull<*const ffi::GstCapsFeatures> for CapsFeatures {
|
impl FromGlibPtrFull<*const ffi::GstCapsFeatures> for CapsFeatures {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_full(ptr: *const ffi::GstCapsFeatures) -> Self {
|
unsafe fn from_glib_full(ptr: *const ffi::GstCapsFeatures) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
CapsFeatures(ptr::NonNull::new_unchecked(
|
CapsFeatures(ptr::NonNull::new_unchecked(
|
||||||
ptr as *mut ffi::GstCapsFeatures,
|
ptr as *mut ffi::GstCapsFeatures,
|
||||||
))
|
))
|
||||||
|
@ -248,7 +248,7 @@ impl FromGlibPtrFull<*const ffi::GstCapsFeatures> for CapsFeatures {
|
||||||
impl FromGlibPtrFull<*mut ffi::GstCapsFeatures> for CapsFeatures {
|
impl FromGlibPtrFull<*mut ffi::GstCapsFeatures> for CapsFeatures {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_full(ptr: *mut ffi::GstCapsFeatures) -> Self {
|
unsafe fn from_glib_full(ptr: *mut ffi::GstCapsFeatures) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
CapsFeatures(ptr::NonNull::new_unchecked(ptr))
|
CapsFeatures(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ pub struct CapsFeaturesRef(ffi::GstCapsFeatures);
|
||||||
impl CapsFeaturesRef {
|
impl CapsFeaturesRef {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_borrow<'a>(ptr: *const ffi::GstCapsFeatures) -> &'a CapsFeaturesRef {
|
pub unsafe fn from_glib_borrow<'a>(ptr: *const ffi::GstCapsFeatures) -> &'a CapsFeaturesRef {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
&*(ptr as *mut CapsFeaturesRef)
|
&*(ptr as *mut CapsFeaturesRef)
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ impl CapsFeaturesRef {
|
||||||
pub unsafe fn from_glib_borrow_mut<'a>(
|
pub unsafe fn from_glib_borrow_mut<'a>(
|
||||||
ptr: *mut ffi::GstCapsFeatures,
|
ptr: *mut ffi::GstCapsFeatures,
|
||||||
) -> &'a mut CapsFeaturesRef {
|
) -> &'a mut CapsFeaturesRef {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
&mut *(ptr as *mut CapsFeaturesRef)
|
&mut *(ptr as *mut CapsFeaturesRef)
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ impl<'a> Iterator for Iter<'a> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let feature =
|
let feature =
|
||||||
ffi::gst_caps_features_get_nth(self.caps_features.as_ptr(), self.idx as u32);
|
ffi::gst_caps_features_get_nth(self.caps_features.as_ptr(), self.idx as u32);
|
||||||
assert!(!feature.is_null());
|
debug_assert!(!feature.is_null());
|
||||||
|
|
||||||
self.idx += 1;
|
self.idx += 1;
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ impl<'a> Iterator for Iter<'a> {
|
||||||
self.idx = end + 1;
|
self.idx = end + 1;
|
||||||
let feature =
|
let feature =
|
||||||
ffi::gst_caps_features_get_nth(self.caps_features.as_ptr(), end as u32);
|
ffi::gst_caps_features_get_nth(self.caps_features.as_ptr(), end as u32);
|
||||||
assert!(!feature.is_null());
|
debug_assert!(!feature.is_null());
|
||||||
Some(CStr::from_ptr(feature).to_str().unwrap())
|
Some(CStr::from_ptr(feature).to_str().unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -591,7 +591,7 @@ impl<'a> Iterator for Iter<'a> {
|
||||||
self.caps_features.as_ptr(),
|
self.caps_features.as_ptr(),
|
||||||
self.n_features as u32 - 1,
|
self.n_features as u32 - 1,
|
||||||
);
|
);
|
||||||
assert!(!feature.is_null());
|
debug_assert!(!feature.is_null());
|
||||||
Some(CStr::from_ptr(feature).to_str().unwrap())
|
Some(CStr::from_ptr(feature).to_str().unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let feature =
|
let feature =
|
||||||
ffi::gst_caps_features_get_nth(self.caps_features.as_ptr(), self.n_features as u32);
|
ffi::gst_caps_features_get_nth(self.caps_features.as_ptr(), self.n_features as u32);
|
||||||
assert!(!feature.is_null());
|
debug_assert!(!feature.is_null());
|
||||||
|
|
||||||
Some(CStr::from_ptr(feature).to_str().unwrap())
|
Some(CStr::from_ptr(feature).to_str().unwrap())
|
||||||
}
|
}
|
||||||
|
@ -627,7 +627,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
|
||||||
self.caps_features.as_ptr(),
|
self.caps_features.as_ptr(),
|
||||||
self.n_features as u32,
|
self.n_features as u32,
|
||||||
);
|
);
|
||||||
assert!(!feature.is_null());
|
debug_assert!(!feature.is_null());
|
||||||
|
|
||||||
Some(CStr::from_ptr(feature).to_str().unwrap())
|
Some(CStr::from_ptr(feature).to_str().unwrap())
|
||||||
}
|
}
|
||||||
|
@ -650,8 +650,7 @@ impl<'a> IntoIterator for &'a CapsFeaturesRef {
|
||||||
|
|
||||||
impl<'a> std::iter::FromIterator<&'a str> for CapsFeatures {
|
impl<'a> std::iter::FromIterator<&'a str> for CapsFeatures {
|
||||||
fn from_iter<T: IntoIterator<Item = &'a str>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = &'a str>>(iter: T) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let mut features = CapsFeatures::new_empty();
|
let mut features = CapsFeatures::new_empty();
|
||||||
|
|
||||||
iter.into_iter().for_each(|f| features.add(f));
|
iter.into_iter().for_each(|f| features.add(f));
|
||||||
|
@ -662,8 +661,7 @@ impl<'a> std::iter::FromIterator<&'a str> for CapsFeatures {
|
||||||
|
|
||||||
impl std::iter::FromIterator<String> for CapsFeatures {
|
impl std::iter::FromIterator<String> for CapsFeatures {
|
||||||
fn from_iter<T: IntoIterator<Item = String>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = String>>(iter: T) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let mut features = CapsFeatures::new_empty();
|
let mut features = CapsFeatures::new_empty();
|
||||||
|
|
||||||
iter.into_iter().for_each(|f| features.add(&f));
|
iter.into_iter().for_each(|f| features.add(&f));
|
||||||
|
@ -674,8 +672,7 @@ impl std::iter::FromIterator<String> for CapsFeatures {
|
||||||
|
|
||||||
impl std::iter::FromIterator<glib::Quark> for CapsFeatures {
|
impl std::iter::FromIterator<glib::Quark> for CapsFeatures {
|
||||||
fn from_iter<T: IntoIterator<Item = glib::Quark>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = glib::Quark>>(iter: T) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let mut features = CapsFeatures::new_empty();
|
let mut features = CapsFeatures::new_empty();
|
||||||
|
|
||||||
iter.into_iter().for_each(|f| features.add_from_quark(f));
|
iter.into_iter().for_each(|f| features.add_from_quark(f));
|
||||||
|
|
|
@ -469,7 +469,6 @@ impl<O: IsA<Clock>> ClockExtManual for O {
|
||||||
start_time: ClockTime,
|
start_time: ClockTime,
|
||||||
interval: ClockTime,
|
interval: ClockTime,
|
||||||
) -> Result<(), glib::BoolError> {
|
) -> Result<(), glib::BoolError> {
|
||||||
skip_assert_initialized!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let res: bool = from_glib(ffi::gst_clock_periodic_id_reinit(
|
let res: bool = from_glib(ffi::gst_clock_periodic_id_reinit(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
|
|
|
@ -22,7 +22,7 @@ impl FromGlib<libc::c_uint> for DeviceMonitorFilterId {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib(val: libc::c_uint) -> DeviceMonitorFilterId {
|
unsafe fn from_glib(val: libc::c_uint) -> DeviceMonitorFilterId {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
assert_ne!(val, 0);
|
debug_assert_ne!(val, 0);
|
||||||
DeviceMonitorFilterId(NonZeroU32::new_unchecked(val))
|
DeviceMonitorFilterId(NonZeroU32::new_unchecked(val))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ impl DeviceProvider {
|
||||||
rank: Rank,
|
rank: Rank,
|
||||||
type_: glib::types::Type,
|
type_: glib::types::Type,
|
||||||
) -> Result<(), glib::error::BoolError> {
|
) -> Result<(), glib::error::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::result_from_gboolean!(
|
glib::result_from_gboolean!(
|
||||||
ffi::gst_device_provider_register(
|
ffi::gst_device_provider_register(
|
||||||
|
|
|
@ -56,7 +56,7 @@ impl Element {
|
||||||
rank: Rank,
|
rank: Rank,
|
||||||
type_: glib::types::Type,
|
type_: glib::types::Type,
|
||||||
) -> Result<(), glib::error::BoolError> {
|
) -> Result<(), glib::error::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::result_from_gboolean!(
|
glib::result_from_gboolean!(
|
||||||
ffi::gst_element_register(
|
ffi::gst_element_register(
|
||||||
|
@ -94,7 +94,7 @@ impl FromGlib<libc::c_ulong> for NotifyWatchId {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib(val: libc::c_ulong) -> NotifyWatchId {
|
unsafe fn from_glib(val: libc::c_ulong) -> NotifyWatchId {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
assert_ne!(val, 0);
|
debug_assert_ne!(val, 0);
|
||||||
NotifyWatchId(NonZeroU64::new_unchecked(val as _))
|
NotifyWatchId(NonZeroU64::new_unchecked(val as _))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,6 @@ impl ElementFactory {
|
||||||
&self,
|
&self,
|
||||||
properties: &[(&str, &dyn ToValue)],
|
properties: &[(&str, &dyn ToValue)],
|
||||||
) -> Result<Element, glib::BoolError> {
|
) -> Result<Element, glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
|
||||||
|
|
||||||
let mut builder = self.create();
|
let mut builder = self.create();
|
||||||
builder.properties = properties
|
builder.properties = properties
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -33,8 +31,7 @@ impl ElementFactory {
|
||||||
factoryname: &str,
|
factoryname: &str,
|
||||||
properties: &[(&str, &dyn ToValue)],
|
properties: &[(&str, &dyn ToValue)],
|
||||||
) -> Result<Element, glib::BoolError> {
|
) -> Result<Element, glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let mut builder = Self::make(factoryname);
|
let mut builder = Self::make(factoryname);
|
||||||
builder.properties = properties
|
builder.properties = properties
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -47,6 +44,8 @@ impl ElementFactory {
|
||||||
#[doc(alias = "gst_element_factory_create_with_properties")]
|
#[doc(alias = "gst_element_factory_create_with_properties")]
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn create(&self) -> ElementBuilder {
|
pub fn create(&self) -> ElementBuilder {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
ElementBuilder {
|
ElementBuilder {
|
||||||
name_or_factory: NameOrFactory::Factory(self),
|
name_or_factory: NameOrFactory::Factory(self),
|
||||||
properties: Vec::new(),
|
properties: Vec::new(),
|
||||||
|
@ -81,8 +80,7 @@ impl ElementFactory {
|
||||||
factoryname: &str,
|
factoryname: &str,
|
||||||
name: Option<&str>,
|
name: Option<&str>,
|
||||||
) -> Result<Element, glib::BoolError> {
|
) -> Result<Element, glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let mut builder = Self::make(factoryname);
|
let mut builder = Self::make(factoryname);
|
||||||
if let Some(name) = name {
|
if let Some(name) = name {
|
||||||
builder = builder.name(name);
|
builder = builder.name(name);
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl ErrorMessage {
|
||||||
function: &'static str,
|
function: &'static str,
|
||||||
line: u32,
|
line: u32,
|
||||||
) -> ErrorMessage {
|
) -> ErrorMessage {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let error_domain = T::domain();
|
let error_domain = T::domain();
|
||||||
let error_code = error.code();
|
let error_code = error.code();
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ pub struct LoggableError {
|
||||||
|
|
||||||
impl LoggableError {
|
impl LoggableError {
|
||||||
pub fn new(category: crate::DebugCategory, bool_error: glib::BoolError) -> LoggableError {
|
pub fn new(category: crate::DebugCategory, bool_error: glib::BoolError) -> LoggableError {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
LoggableError {
|
LoggableError {
|
||||||
category,
|
category,
|
||||||
bool_error,
|
bool_error,
|
||||||
|
|
|
@ -157,7 +157,7 @@ impl EventRef {
|
||||||
pub fn seqnum(&self) -> Seqnum {
|
pub fn seqnum(&self) -> Seqnum {
|
||||||
unsafe {
|
unsafe {
|
||||||
let seqnum = ffi::gst_event_get_seqnum(self.as_mut_ptr());
|
let seqnum = ffi::gst_event_get_seqnum(self.as_mut_ptr());
|
||||||
assert_ne!(seqnum, 0);
|
debug_assert_ne!(seqnum, 0);
|
||||||
Seqnum(NonZeroU32::new_unchecked(seqnum))
|
Seqnum(NonZeroU32::new_unchecked(seqnum))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -770,7 +770,7 @@ impl StreamGroupDone {
|
||||||
ffi::gst_event_parse_stream_group_done(self.as_mut_ptr(), group_id.as_mut_ptr());
|
ffi::gst_event_parse_stream_group_done(self.as_mut_ptr(), group_id.as_mut_ptr());
|
||||||
|
|
||||||
let group_id = group_id.assume_init();
|
let group_id = group_id.assume_init();
|
||||||
assert_ne!(group_id, 0);
|
debug_assert_ne!(group_id, 0);
|
||||||
GroupId(NonZeroU32::new_unchecked(group_id))
|
GroupId(NonZeroU32::new_unchecked(group_id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1544,7 +1544,6 @@ macro_rules! event_builder_generic_impl {
|
||||||
|
|
||||||
#[must_use = "Building the event without using it has no effect"]
|
#[must_use = "Building the event without using it has no effect"]
|
||||||
pub fn build(mut self) -> Event {
|
pub fn build(mut self) -> Event {
|
||||||
assert_initialized_main_thread!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let event = $new_fn(&mut self);
|
let event = $new_fn(&mut self);
|
||||||
if let Some(seqnum) = self.builder.seqnum {
|
if let Some(seqnum) = self.builder.seqnum {
|
||||||
|
|
|
@ -16,7 +16,7 @@ pub fn parse_bin_from_description_with_name(
|
||||||
ghost_unlinked_pads: bool,
|
ghost_unlinked_pads: bool,
|
||||||
bin_name: &str,
|
bin_name: &str,
|
||||||
) -> Result<Bin, glib::Error> {
|
) -> Result<Bin, glib::Error> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let bin = parse_bin_from_description(bin_description, ghost_unlinked_pads)?;
|
let bin = parse_bin_from_description(bin_description, ghost_unlinked_pads)?;
|
||||||
if !bin_name.is_empty() {
|
if !bin_name.is_empty() {
|
||||||
let obj = bin.clone().upcast::<Object>();
|
let obj = bin.clone().upcast::<Object>();
|
||||||
|
@ -34,7 +34,7 @@ pub fn parse_bin_from_description_full(
|
||||||
mut context: Option<&mut ParseContext>,
|
mut context: Option<&mut ParseContext>,
|
||||||
flags: ParseFlags,
|
flags: ParseFlags,
|
||||||
) -> Result<Element, glib::Error> {
|
) -> Result<Element, glib::Error> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut error = ptr::null_mut();
|
let mut error = ptr::null_mut();
|
||||||
let ret = ffi::gst_parse_bin_from_description_full(
|
let ret = ffi::gst_parse_bin_from_description_full(
|
||||||
|
@ -59,7 +59,7 @@ pub fn parse_bin_from_description_with_name_full(
|
||||||
context: Option<&mut ParseContext>,
|
context: Option<&mut ParseContext>,
|
||||||
flags: ParseFlags,
|
flags: ParseFlags,
|
||||||
) -> Result<Element, glib::Error> {
|
) -> Result<Element, glib::Error> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let bin =
|
let bin =
|
||||||
parse_bin_from_description_full(bin_description, ghost_unlinked_pads, context, flags)?;
|
parse_bin_from_description_full(bin_description, ghost_unlinked_pads, context, flags)?;
|
||||||
if !bin_name.is_empty() {
|
if !bin_name.is_empty() {
|
||||||
|
|
|
@ -590,7 +590,7 @@ impl<'a, T: 'static> glib::translate::ToGlibPtrMut<'a, *mut ffi::GstIterator> fo
|
||||||
impl<T: StaticType> glib::translate::FromGlibPtrNone<*const ffi::GstIterator> for Iterator<T> {
|
impl<T: StaticType> glib::translate::FromGlibPtrNone<*const ffi::GstIterator> for Iterator<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *const ffi::GstIterator) -> Self {
|
unsafe fn from_glib_none(ptr: *const ffi::GstIterator) -> Self {
|
||||||
assert_ne!(
|
debug_assert_ne!(
|
||||||
glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()),
|
glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()),
|
||||||
glib::ffi::GFALSE
|
glib::ffi::GFALSE
|
||||||
);
|
);
|
||||||
|
@ -602,7 +602,7 @@ impl<T: StaticType> glib::translate::FromGlibPtrNone<*const ffi::GstIterator> fo
|
||||||
impl<T: StaticType> glib::translate::FromGlibPtrNone<*mut ffi::GstIterator> for Iterator<T> {
|
impl<T: StaticType> glib::translate::FromGlibPtrNone<*mut ffi::GstIterator> for Iterator<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *mut ffi::GstIterator) -> Self {
|
unsafe fn from_glib_none(ptr: *mut ffi::GstIterator) -> Self {
|
||||||
assert_ne!(
|
debug_assert_ne!(
|
||||||
glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()),
|
glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()),
|
||||||
glib::ffi::GFALSE
|
glib::ffi::GFALSE
|
||||||
);
|
);
|
||||||
|
@ -614,8 +614,8 @@ impl<T: StaticType> glib::translate::FromGlibPtrNone<*mut ffi::GstIterator> for
|
||||||
impl<T: StaticType> glib::translate::FromGlibPtrBorrow<*mut ffi::GstIterator> for Iterator<T> {
|
impl<T: StaticType> glib::translate::FromGlibPtrBorrow<*mut ffi::GstIterator> for Iterator<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_borrow(ptr: *mut ffi::GstIterator) -> Borrowed<Self> {
|
unsafe fn from_glib_borrow(ptr: *mut ffi::GstIterator) -> Borrowed<Self> {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
assert_ne!(
|
debug_assert_ne!(
|
||||||
glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()),
|
glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()),
|
||||||
glib::ffi::GFALSE
|
glib::ffi::GFALSE
|
||||||
);
|
);
|
||||||
|
@ -630,8 +630,8 @@ impl<T: StaticType> glib::translate::FromGlibPtrBorrow<*mut ffi::GstIterator> fo
|
||||||
impl<T: StaticType> glib::translate::FromGlibPtrFull<*mut ffi::GstIterator> for Iterator<T> {
|
impl<T: StaticType> glib::translate::FromGlibPtrFull<*mut ffi::GstIterator> for Iterator<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_full(ptr: *mut ffi::GstIterator) -> Self {
|
unsafe fn from_glib_full(ptr: *mut ffi::GstIterator) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
assert_ne!(
|
debug_assert_ne!(
|
||||||
glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()),
|
glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()),
|
||||||
glib::ffi::GFALSE
|
glib::ffi::GFALSE
|
||||||
);
|
);
|
||||||
|
|
|
@ -525,7 +525,7 @@ unsafe impl TransparentPtrType for DebugCategory {}
|
||||||
impl FromGlibPtrNone<*mut ffi::GstDebugCategory> for DebugCategory {
|
impl FromGlibPtrNone<*mut ffi::GstDebugCategory> for DebugCategory {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *mut ffi::GstDebugCategory) -> Self {
|
unsafe fn from_glib_none(ptr: *mut ffi::GstDebugCategory) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
DebugCategory(Some(ptr::NonNull::new_unchecked(ptr)))
|
DebugCategory(Some(ptr::NonNull::new_unchecked(ptr)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -533,7 +533,7 @@ impl FromGlibPtrNone<*mut ffi::GstDebugCategory> for DebugCategory {
|
||||||
impl FromGlibPtrFull<*mut ffi::GstDebugCategory> for DebugCategory {
|
impl FromGlibPtrFull<*mut ffi::GstDebugCategory> for DebugCategory {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_full(ptr: *mut ffi::GstDebugCategory) -> Self {
|
unsafe fn from_glib_full(ptr: *mut ffi::GstDebugCategory) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
DebugCategory(Some(ptr::NonNull::new_unchecked(ptr)))
|
DebugCategory(Some(ptr::NonNull::new_unchecked(ptr)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -836,7 +836,7 @@ macro_rules! memory_object_wrapper {
|
||||||
let value = &*(value as *const $crate::glib::Value as *const $crate::glib::gobject_ffi::GValue);
|
let value = &*(value as *const $crate::glib::Value as *const $crate::glib::gobject_ffi::GValue);
|
||||||
let ptr = &value.data[0].v_pointer as *const $crate::glib::ffi::gpointer
|
let ptr = &value.data[0].v_pointer as *const $crate::glib::ffi::gpointer
|
||||||
as *const *const $ffi_name;
|
as *const *const $ffi_name;
|
||||||
assert!(!(*ptr).is_null());
|
debug_assert!(!(*ptr).is_null());
|
||||||
&*(ptr as *const $name)
|
&*(ptr as *const $name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1853,7 +1853,6 @@ macro_rules! message_builder_generic_impl {
|
||||||
|
|
||||||
#[must_use = "Building the message without using it has no effect"]
|
#[must_use = "Building the message without using it has no effect"]
|
||||||
pub fn build(mut self) -> Message {
|
pub fn build(mut self) -> Message {
|
||||||
assert_initialized_main_thread!();
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let src = self.builder.src.to_glib_none().0;
|
let src = self.builder.src.to_glib_none().0;
|
||||||
let msg = $new_fn(&mut self, src);
|
let msg = $new_fn(&mut self, src);
|
||||||
|
|
|
@ -17,11 +17,11 @@ pub unsafe trait MetaAPI: Sync + Send + Sized {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_ptr(buffer: &BufferRef, ptr: *const Self::GstType) -> MetaRef<Self> {
|
unsafe fn from_ptr(buffer: &BufferRef, ptr: *const Self::GstType) -> MetaRef<Self> {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
let meta_api = Self::meta_api();
|
let meta_api = Self::meta_api();
|
||||||
if meta_api != glib::Type::INVALID {
|
if meta_api != glib::Type::INVALID {
|
||||||
assert_eq!(
|
debug_assert_eq!(
|
||||||
meta_api,
|
meta_api,
|
||||||
from_glib((*(*(ptr as *const ffi::GstMeta)).info).api)
|
from_glib((*(*(ptr as *const ffi::GstMeta)).info).api)
|
||||||
)
|
)
|
||||||
|
@ -38,11 +38,11 @@ pub unsafe trait MetaAPI: Sync + Send + Sized {
|
||||||
buffer: &mut BufferRef,
|
buffer: &mut BufferRef,
|
||||||
ptr: *mut Self::GstType,
|
ptr: *mut Self::GstType,
|
||||||
) -> MetaRefMut<Self, T> {
|
) -> MetaRefMut<Self, T> {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
let meta_api = Self::meta_api();
|
let meta_api = Self::meta_api();
|
||||||
if meta_api != glib::Type::INVALID {
|
if meta_api != glib::Type::INVALID {
|
||||||
assert_eq!(
|
debug_assert_eq!(
|
||||||
meta_api,
|
meta_api,
|
||||||
from_glib((*(*(ptr as *const ffi::GstMeta)).info).api)
|
from_glib((*(*(ptr as *const ffi::GstMeta)).info).api)
|
||||||
)
|
)
|
||||||
|
@ -278,7 +278,7 @@ impl<'a, T> MetaRefMut<'a, T, Standalone> {
|
||||||
self.buffer.as_mut_ptr(),
|
self.buffer.as_mut_ptr(),
|
||||||
self.meta as *mut T as *mut ffi::GstMeta,
|
self.meta as *mut T as *mut ffi::GstMeta,
|
||||||
);
|
);
|
||||||
assert_ne!(res, glib::ffi::GFALSE);
|
debug_assert_ne!(res, glib::ffi::GFALSE);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ macro_rules! mini_object_wrapper (
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_none(ptr: *const $ffi_name) -> Self {
|
pub unsafe fn from_glib_none(ptr: *const $ffi_name) -> Self {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
$crate::ffi::gst_mini_object_ref(ptr as *mut $crate::ffi::GstMiniObject);
|
$crate::ffi::gst_mini_object_ref(ptr as *mut $crate::ffi::GstMiniObject);
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ macro_rules! mini_object_wrapper (
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_full(ptr: *const $ffi_name) -> Self {
|
pub unsafe fn from_glib_full(ptr: *const $ffi_name) -> Self {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
$name {
|
$name {
|
||||||
obj: std::ptr::NonNull::new_unchecked(ptr as *mut $ffi_name),
|
obj: std::ptr::NonNull::new_unchecked(ptr as *mut $ffi_name),
|
||||||
|
@ -53,7 +53,7 @@ macro_rules! mini_object_wrapper (
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_borrow(ptr: *const $ffi_name) -> $crate::glib::translate::Borrowed<Self> {
|
pub unsafe fn from_glib_borrow(ptr: *const $ffi_name) -> $crate::glib::translate::Borrowed<Self> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
$crate::glib::translate::Borrowed::new($name {
|
$crate::glib::translate::Borrowed::new($name {
|
||||||
obj: std::ptr::NonNull::new_unchecked(ptr as *mut $ffi_name),
|
obj: std::ptr::NonNull::new_unchecked(ptr as *mut $ffi_name),
|
||||||
|
@ -62,7 +62,7 @@ macro_rules! mini_object_wrapper (
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn replace_ptr(&mut self, ptr: *mut $ffi_name) {
|
pub unsafe fn replace_ptr(&mut self, ptr: *mut $ffi_name) {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
self.obj = std::ptr::NonNull::new_unchecked(ptr);
|
self.obj = std::ptr::NonNull::new_unchecked(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ macro_rules! mini_object_wrapper (
|
||||||
self.as_mut_ptr() as *mut $crate::ffi::GstMiniObject
|
self.as_mut_ptr() as *mut $crate::ffi::GstMiniObject
|
||||||
);
|
);
|
||||||
self.replace_ptr(ptr as *mut $ffi_name);
|
self.replace_ptr(ptr as *mut $ffi_name);
|
||||||
assert!(self.is_writable());
|
debug_assert!(self.is_writable());
|
||||||
|
|
||||||
&mut *(self.obj.as_mut() as *mut $ffi_name as *mut $ref_name)
|
&mut *(self.obj.as_mut() as *mut $ffi_name as *mut $ref_name)
|
||||||
}
|
}
|
||||||
|
@ -435,14 +435,14 @@ macro_rules! mini_object_wrapper (
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_ptr<'a>(ptr: *const $ffi_name) -> &'a Self {
|
pub unsafe fn from_ptr<'a>(ptr: *const $ffi_name) -> &'a Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
&*(ptr as *const Self)
|
&*(ptr as *const Self)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_mut_ptr<'a>(ptr: *mut $ffi_name) -> &'a mut Self {
|
pub unsafe fn from_mut_ptr<'a>(ptr: *mut $ffi_name) -> &'a mut Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
assert_ne!(
|
debug_assert_ne!(
|
||||||
$crate::ffi::gst_mini_object_is_writable(ptr as *mut $crate::ffi::GstMiniObject),
|
$crate::ffi::gst_mini_object_is_writable(ptr as *mut $crate::ffi::GstMiniObject),
|
||||||
$crate::glib::ffi::GFALSE
|
$crate::glib::ffi::GFALSE
|
||||||
);
|
);
|
||||||
|
@ -542,7 +542,7 @@ macro_rules! mini_object_wrapper (
|
||||||
assert_eq!(std::mem::size_of::<$name>(), std::mem::size_of::<$crate::glib::ffi::gpointer>());
|
assert_eq!(std::mem::size_of::<$name>(), std::mem::size_of::<$crate::glib::ffi::gpointer>());
|
||||||
let value = &*(value as *const $crate::glib::Value as *const $crate::glib::gobject_ffi::GValue);
|
let value = &*(value as *const $crate::glib::Value as *const $crate::glib::gobject_ffi::GValue);
|
||||||
let ptr = &value.data[0].v_pointer as *const $crate::glib::ffi::gpointer as *const *const $ffi_name;
|
let ptr = &value.data[0].v_pointer as *const $crate::glib::ffi::gpointer as *const *const $ffi_name;
|
||||||
assert!(!(*ptr).is_null());
|
debug_assert!(!(*ptr).is_null());
|
||||||
&*(ptr as *const $name)
|
&*(ptr as *const $name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl FromGlib<libc::c_ulong> for PadProbeId {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib(val: libc::c_ulong) -> PadProbeId {
|
unsafe fn from_glib(val: libc::c_ulong) -> PadProbeId {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
assert_ne!(val, 0);
|
debug_assert_ne!(val, 0);
|
||||||
PadProbeId(NonZeroU64::new_unchecked(val as _))
|
PadProbeId(NonZeroU64::new_unchecked(val as _))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1364,7 +1364,7 @@ where
|
||||||
{
|
{
|
||||||
let func: &F = &*((*pad).getrangedata as *const F);
|
let func: &F = &*((*pad).getrangedata as *const F);
|
||||||
|
|
||||||
assert!(!buffer.is_null());
|
debug_assert!(!buffer.is_null());
|
||||||
|
|
||||||
let pad = Pad::from_glib_borrow(pad);
|
let pad = Pad::from_glib_borrow(pad);
|
||||||
let pad = pad.unsafe_cast_ref();
|
let pad = pad.unsafe_cast_ref();
|
||||||
|
@ -1639,7 +1639,7 @@ impl<T: IsA<Pad> + IsA<glib::Object> + glib::object::IsClass> PadBuilder<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let res = ffi::gst_ghost_pad_construct(pad.to_glib_none().0);
|
let res = ffi::gst_ghost_pad_construct(pad.to_glib_none().0);
|
||||||
// This can't really fail...
|
// This can't really fail...
|
||||||
assert_ne!(res, glib::ffi::GFALSE, "Failed to construct ghost pad");
|
debug_assert_ne!(res, glib::ffi::GFALSE, "Failed to construct ghost pad");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1647,7 +1647,7 @@ impl<T: IsA<Pad> + IsA<glib::Object> + glib::object::IsClass> PadBuilder<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_static_template(templ: &StaticPadTemplate, name: Option<&str>) -> Self {
|
pub fn from_static_template(templ: &StaticPadTemplate, name: Option<&str>) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let templ = templ.get();
|
let templ = templ.get();
|
||||||
Self::from_template(&templ, name)
|
Self::from_template(&templ, name)
|
||||||
|
@ -1691,7 +1691,7 @@ impl<T: IsA<Pad> + IsA<glib::Object> + glib::object::IsClass> PadBuilder<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let res = ffi::gst_ghost_pad_construct(pad.to_glib_none().0);
|
let res = ffi::gst_ghost_pad_construct(pad.to_glib_none().0);
|
||||||
// This can't really fail...
|
// This can't really fail...
|
||||||
assert_ne!(res, glib::ffi::GFALSE, "Failed to construct ghost pad");
|
debug_assert_ne!(res, glib::ffi::GFALSE, "Failed to construct ghost pad");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ impl PadTemplate {
|
||||||
pad_template: &StaticPadTemplate,
|
pad_template: &StaticPadTemplate,
|
||||||
pad_type: glib::types::Type,
|
pad_type: glib::types::Type,
|
||||||
) -> Result<PadTemplate, glib::BoolError> {
|
) -> Result<PadTemplate, glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
Option::<_>::from_glib_none(
|
Option::<_>::from_glib_none(
|
||||||
ffi::gst_pad_template_new_from_static_pad_template_with_gtype(
|
ffi::gst_pad_template_new_from_static_pad_template_with_gtype(
|
||||||
|
@ -83,7 +83,7 @@ impl PadTemplate {
|
||||||
presence: PadPresence,
|
presence: PadPresence,
|
||||||
caps: &'a Caps,
|
caps: &'a Caps,
|
||||||
) -> PadTemplateBuilder<'a> {
|
) -> PadTemplateBuilder<'a> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
PadTemplateBuilder {
|
PadTemplateBuilder {
|
||||||
name_template,
|
name_template,
|
||||||
|
|
|
@ -127,7 +127,7 @@ pub struct ParamSpecFractionBuilder<'a> {
|
||||||
|
|
||||||
impl<'a> ParamSpecFractionBuilder<'a> {
|
impl<'a> ParamSpecFractionBuilder<'a> {
|
||||||
fn new(name: &'a str) -> Self {
|
fn new(name: &'a str) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
name,
|
name,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -292,7 +292,7 @@ pub struct ParamSpecArrayBuilder<'a> {
|
||||||
|
|
||||||
impl<'a> ParamSpecArrayBuilder<'a> {
|
impl<'a> ParamSpecArrayBuilder<'a> {
|
||||||
fn new(name: &'a str) -> Self {
|
fn new(name: &'a str) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
name,
|
name,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -274,7 +274,7 @@ macro_rules! declare_concrete_query(
|
||||||
impl DerefMut for $name<Query> {
|
impl DerefMut for $name<Query> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||||
assert!(self.0.is_writable());
|
debug_assert!(self.0.is_writable());
|
||||||
unsafe { &mut *(self.0.as_mut_ptr() as *mut Self::Target) }
|
unsafe { &mut *(self.0.as_mut_ptr() as *mut Self::Target) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -931,7 +931,7 @@ declare_concrete_query!(Custom, T);
|
||||||
impl Custom<Query> {
|
impl Custom<Query> {
|
||||||
#[doc(alias = "gst_query_new_custom")]
|
#[doc(alias = "gst_query_new_custom")]
|
||||||
pub fn new(structure: crate::Structure) -> Self {
|
pub fn new(structure: crate::Structure) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
Self(from_glib_full(ffi::gst_query_new_custom(
|
Self(from_glib_full(ffi::gst_query_new_custom(
|
||||||
ffi::GST_QUERY_CUSTOM,
|
ffi::GST_QUERY_CUSTOM,
|
||||||
|
@ -1020,7 +1020,7 @@ declare_concrete_query!(Allocation, T);
|
||||||
impl Allocation<Query> {
|
impl Allocation<Query> {
|
||||||
#[doc(alias = "gst_query_new_allocation")]
|
#[doc(alias = "gst_query_new_allocation")]
|
||||||
pub fn new(caps: &crate::Caps, need_pool: bool) -> Self {
|
pub fn new(caps: &crate::Caps, need_pool: bool) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
Self(from_glib_full(ffi::gst_query_new_allocation(
|
Self(from_glib_full(ffi::gst_query_new_allocation(
|
||||||
caps.as_mut_ptr(),
|
caps.as_mut_ptr(),
|
||||||
|
@ -1386,7 +1386,7 @@ declare_concrete_query!(AcceptCaps, T);
|
||||||
impl AcceptCaps<Query> {
|
impl AcceptCaps<Query> {
|
||||||
#[doc(alias = "gst_query_new_accept_caps")]
|
#[doc(alias = "gst_query_new_accept_caps")]
|
||||||
pub fn new(caps: &crate::Caps) -> Self {
|
pub fn new(caps: &crate::Caps) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
Self(from_glib_full(ffi::gst_query_new_accept_caps(
|
Self(from_glib_full(ffi::gst_query_new_accept_caps(
|
||||||
caps.as_mut_ptr(),
|
caps.as_mut_ptr(),
|
||||||
|
@ -1434,7 +1434,7 @@ declare_concrete_query!(Caps, T);
|
||||||
impl Caps<Query> {
|
impl Caps<Query> {
|
||||||
#[doc(alias = "gst_query_new_caps")]
|
#[doc(alias = "gst_query_new_caps")]
|
||||||
pub fn new(filter: Option<&crate::Caps>) -> Self {
|
pub fn new(filter: Option<&crate::Caps>) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
Self(from_glib_full(ffi::gst_query_new_caps(
|
Self(from_glib_full(ffi::gst_query_new_caps(
|
||||||
filter.to_glib_none().0,
|
filter.to_glib_none().0,
|
||||||
|
|
|
@ -63,8 +63,6 @@ impl<'a> SampleBuilder<'a> {
|
||||||
|
|
||||||
#[must_use = "Building the sample without using it has no effect"]
|
#[must_use = "Building the sample without using it has no effect"]
|
||||||
pub fn build(self) -> Sample {
|
pub fn build(self) -> Sample {
|
||||||
assert_initialized_main_thread!();
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let info = self
|
let info = self
|
||||||
.info
|
.info
|
||||||
|
@ -92,6 +90,8 @@ impl<'a> SampleBuilder<'a> {
|
||||||
|
|
||||||
impl Sample {
|
impl Sample {
|
||||||
pub fn builder<'a>() -> SampleBuilder<'a> {
|
pub fn builder<'a>() -> SampleBuilder<'a> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
SampleBuilder {
|
SampleBuilder {
|
||||||
buffer: None,
|
buffer: None,
|
||||||
buffer_list: None,
|
buffer_list: None,
|
||||||
|
|
|
@ -156,7 +156,6 @@ impl<T: FormattedValueIntrinsic> FormattedSegment<T> {
|
||||||
stop_type: SeekType,
|
stop_type: SeekType,
|
||||||
stop: impl CompatibleFormattedValue<T>,
|
stop: impl CompatibleFormattedValue<T>,
|
||||||
) -> Option<bool> {
|
) -> Option<bool> {
|
||||||
skip_assert_initialized!();
|
|
||||||
let start = start.try_into_checked_explicit(self.format()).unwrap();
|
let start = start.try_into_checked_explicit(self.format()).unwrap();
|
||||||
let stop = stop.try_into_checked_explicit(self.format()).unwrap();
|
let stop = stop.try_into_checked_explicit(self.format()).unwrap();
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstStaticCaps> for StaticCap
|
||||||
impl glib::translate::FromGlibPtrNone<*const ffi::GstStaticCaps> for StaticCaps {
|
impl glib::translate::FromGlibPtrNone<*const ffi::GstStaticCaps> for StaticCaps {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *const ffi::GstStaticCaps) -> Self {
|
unsafe fn from_glib_none(ptr: *const ffi::GstStaticCaps) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
StaticCaps(ptr::NonNull::new_unchecked(ptr as *mut _))
|
StaticCaps(ptr::NonNull::new_unchecked(ptr as *mut _))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ impl glib::translate::FromGlibPtrNone<*const ffi::GstStaticCaps> for StaticCaps
|
||||||
impl glib::translate::FromGlibPtrNone<*mut ffi::GstStaticCaps> for StaticCaps {
|
impl glib::translate::FromGlibPtrNone<*mut ffi::GstStaticCaps> for StaticCaps {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *mut ffi::GstStaticCaps) -> Self {
|
unsafe fn from_glib_none(ptr: *mut ffi::GstStaticCaps) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
StaticCaps(ptr::NonNull::new_unchecked(ptr))
|
StaticCaps(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ impl glib::translate::FromGlibPtrNone<*mut ffi::GstStaticCaps> for StaticCaps {
|
||||||
impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstStaticCaps> for StaticCaps {
|
impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstStaticCaps> for StaticCaps {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_borrow(ptr: *mut ffi::GstStaticCaps) -> Borrowed<Self> {
|
unsafe fn from_glib_borrow(ptr: *mut ffi::GstStaticCaps) -> Borrowed<Self> {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
Borrowed::new(StaticCaps(ptr::NonNull::new_unchecked(ptr)))
|
Borrowed::new(StaticCaps(ptr::NonNull::new_unchecked(ptr)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstStaticPadTemplate> for St
|
||||||
impl glib::translate::FromGlibPtrNone<*const ffi::GstStaticPadTemplate> for StaticPadTemplate {
|
impl glib::translate::FromGlibPtrNone<*const ffi::GstStaticPadTemplate> for StaticPadTemplate {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *const ffi::GstStaticPadTemplate) -> Self {
|
unsafe fn from_glib_none(ptr: *const ffi::GstStaticPadTemplate) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
StaticPadTemplate(ptr::NonNull::new_unchecked(ptr as *mut _))
|
StaticPadTemplate(ptr::NonNull::new_unchecked(ptr as *mut _))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ impl glib::translate::FromGlibPtrNone<*const ffi::GstStaticPadTemplate> for Stat
|
||||||
impl glib::translate::FromGlibPtrNone<*mut ffi::GstStaticPadTemplate> for StaticPadTemplate {
|
impl glib::translate::FromGlibPtrNone<*mut ffi::GstStaticPadTemplate> for StaticPadTemplate {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *mut ffi::GstStaticPadTemplate) -> Self {
|
unsafe fn from_glib_none(ptr: *mut ffi::GstStaticPadTemplate) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
StaticPadTemplate(ptr::NonNull::new_unchecked(ptr))
|
StaticPadTemplate(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ impl glib::translate::FromGlibPtrNone<*mut ffi::GstStaticPadTemplate> for Static
|
||||||
impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstStaticPadTemplate> for StaticPadTemplate {
|
impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstStaticPadTemplate> for StaticPadTemplate {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_borrow(ptr: *mut ffi::GstStaticPadTemplate) -> Borrowed<Self> {
|
unsafe fn from_glib_borrow(ptr: *mut ffi::GstStaticPadTemplate) -> Borrowed<Self> {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
Borrowed::new(StaticPadTemplate(ptr::NonNull::new_unchecked(ptr)))
|
Borrowed::new(StaticPadTemplate(ptr::NonNull::new_unchecked(ptr)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ unsafe impl Sync for Structure {}
|
||||||
impl Structure {
|
impl Structure {
|
||||||
#[doc(alias = "gst_structure_new")]
|
#[doc(alias = "gst_structure_new")]
|
||||||
pub fn builder(name: &str) -> Builder {
|
pub fn builder(name: &str) -> Builder {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Builder::new(name)
|
Builder::new(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,14 +60,14 @@ impl Structure {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_structure_new_empty(name.to_glib_none().0);
|
let ptr = ffi::gst_structure_new_empty(name.to_glib_none().0);
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
Structure(ptr::NonNull::new_unchecked(ptr))
|
Structure(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "gst_structure_new")]
|
#[doc(alias = "gst_structure_new")]
|
||||||
pub fn new(name: &str, values: &[(&str, &(dyn ToSendValue + Sync))]) -> Structure {
|
pub fn new(name: &str, values: &[(&str, &(dyn ToSendValue + Sync))]) -> Structure {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let mut structure = Structure::new_empty(name);
|
let mut structure = Structure::new_empty(name);
|
||||||
|
|
||||||
for &(f, v) in values {
|
for &(f, v) in values {
|
||||||
|
@ -82,7 +82,7 @@ impl Structure {
|
||||||
name: &str,
|
name: &str,
|
||||||
iter: impl IntoIterator<Item = (&'a str, SendValue)>,
|
iter: impl IntoIterator<Item = (&'a str, SendValue)>,
|
||||||
) -> Structure {
|
) -> Structure {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
let mut structure = Structure::new_empty(name);
|
let mut structure = Structure::new_empty(name);
|
||||||
|
|
||||||
iter.into_iter()
|
iter.into_iter()
|
||||||
|
@ -135,7 +135,7 @@ impl Clone for Structure {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_structure_copy(self.0.as_ref());
|
let ptr = ffi::gst_structure_copy(self.0.as_ref());
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
Structure(ptr::NonNull::new_unchecked(ptr))
|
Structure(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ impl ToOwned for StructureRef {
|
||||||
fn to_owned(&self) -> Structure {
|
fn to_owned(&self) -> Structure {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = ffi::gst_structure_copy(&self.0);
|
let ptr = ffi::gst_structure_copy(&self.0);
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
Structure(ptr::NonNull::new_unchecked(ptr))
|
Structure(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,9 +277,9 @@ impl<'a> ToGlibPtrMut<'a, *mut ffi::GstStructure> for Structure {
|
||||||
impl FromGlibPtrNone<*const ffi::GstStructure> for Structure {
|
impl FromGlibPtrNone<*const ffi::GstStructure> for Structure {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *const ffi::GstStructure) -> Self {
|
unsafe fn from_glib_none(ptr: *const ffi::GstStructure) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
let ptr = ffi::gst_structure_copy(ptr);
|
let ptr = ffi::gst_structure_copy(ptr);
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
Structure(ptr::NonNull::new_unchecked(ptr))
|
Structure(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,9 +287,9 @@ impl FromGlibPtrNone<*const ffi::GstStructure> for Structure {
|
||||||
impl FromGlibPtrNone<*mut ffi::GstStructure> for Structure {
|
impl FromGlibPtrNone<*mut ffi::GstStructure> for Structure {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_none(ptr: *mut ffi::GstStructure) -> Self {
|
unsafe fn from_glib_none(ptr: *mut ffi::GstStructure) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
let ptr = ffi::gst_structure_copy(ptr);
|
let ptr = ffi::gst_structure_copy(ptr);
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
Structure(ptr::NonNull::new_unchecked(ptr))
|
Structure(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ impl FromGlibPtrNone<*mut ffi::GstStructure> for Structure {
|
||||||
impl FromGlibPtrFull<*const ffi::GstStructure> for Structure {
|
impl FromGlibPtrFull<*const ffi::GstStructure> for Structure {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_full(ptr: *const ffi::GstStructure) -> Self {
|
unsafe fn from_glib_full(ptr: *const ffi::GstStructure) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
Structure(ptr::NonNull::new_unchecked(ptr as *mut ffi::GstStructure))
|
Structure(ptr::NonNull::new_unchecked(ptr as *mut ffi::GstStructure))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ impl FromGlibPtrFull<*const ffi::GstStructure> for Structure {
|
||||||
impl FromGlibPtrFull<*mut ffi::GstStructure> for Structure {
|
impl FromGlibPtrFull<*mut ffi::GstStructure> for Structure {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib_full(ptr: *mut ffi::GstStructure) -> Self {
|
unsafe fn from_glib_full(ptr: *mut ffi::GstStructure) -> Self {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
Structure(ptr::NonNull::new_unchecked(ptr))
|
Structure(ptr::NonNull::new_unchecked(ptr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,14 +404,14 @@ unsafe impl Sync for StructureRef {}
|
||||||
impl StructureRef {
|
impl StructureRef {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_borrow<'a>(ptr: *const ffi::GstStructure) -> &'a StructureRef {
|
pub unsafe fn from_glib_borrow<'a>(ptr: *const ffi::GstStructure) -> &'a StructureRef {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
&*(ptr as *mut StructureRef)
|
&*(ptr as *mut StructureRef)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_glib_borrow_mut<'a>(ptr: *mut ffi::GstStructure) -> &'a mut StructureRef {
|
pub unsafe fn from_glib_borrow_mut<'a>(ptr: *mut ffi::GstStructure) -> &'a mut StructureRef {
|
||||||
assert!(!ptr.is_null());
|
debug_assert!(!ptr.is_null());
|
||||||
|
|
||||||
&mut *(ptr as *mut StructureRef)
|
&mut *(ptr as *mut StructureRef)
|
||||||
}
|
}
|
||||||
|
@ -631,7 +631,7 @@ impl StructureRef {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let field_name = ffi::gst_structure_nth_field_name(&self.0, idx);
|
let field_name = ffi::gst_structure_nth_field_name(&self.0, idx);
|
||||||
assert!(!field_name.is_null());
|
debug_assert!(!field_name.is_null());
|
||||||
|
|
||||||
Some(CStr::from_ptr(field_name).to_str().unwrap())
|
Some(CStr::from_ptr(field_name).to_str().unwrap())
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,7 +465,7 @@ impl TagListRef {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let name = ffi::gst_tag_list_nth_tag_name(self.as_ptr(), idx);
|
let name = ffi::gst_tag_list_nth_tag_name(self.as_ptr(), idx);
|
||||||
assert!(!name.is_null());
|
debug_assert!(!name.is_null());
|
||||||
Some(CStr::from_ptr(name).to_str().unwrap())
|
Some(CStr::from_ptr(name).to_str().unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl<O: IsA<TaskPool>> TaskPoolExtManual for O {
|
||||||
);
|
);
|
||||||
|
|
||||||
if !error.is_null() {
|
if !error.is_null() {
|
||||||
assert!(handle.is_null());
|
debug_assert!(handle.is_null());
|
||||||
|
|
||||||
// Assume that task_pool_trampoline was
|
// Assume that task_pool_trampoline was
|
||||||
// not called and will not be called
|
// not called and will not be called
|
||||||
|
|
|
@ -11,7 +11,7 @@ impl Tracer {
|
||||||
name: &str,
|
name: &str,
|
||||||
type_: glib::types::Type,
|
type_: glib::types::Type,
|
||||||
) -> Result<(), glib::error::BoolError> {
|
) -> Result<(), glib::error::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::result_from_gboolean!(
|
glib::result_from_gboolean!(
|
||||||
ffi::gst_tracer_register(
|
ffi::gst_tracer_register(
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl TypeFind {
|
||||||
where
|
where
|
||||||
F: Fn(&mut TypeFind) + Send + Sync + 'static,
|
F: Fn(&mut TypeFind) + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let func: Box<F> = Box::new(func);
|
let func: Box<F> = Box::new(func);
|
||||||
let func = Box::into_raw(func);
|
let func = Box::into_raw(func);
|
||||||
|
|
|
@ -11,17 +11,17 @@ pub struct Fraction(pub Rational32);
|
||||||
impl Fraction {
|
impl Fraction {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(num: i32, den: i32) -> Self {
|
pub fn new(num: i32, den: i32) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
(num, den).into()
|
(num, den).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn approximate_f32(x: f32) -> Option<Self> {
|
pub fn approximate_f32(x: f32) -> Option<Self> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Rational32::approximate_float(x).map(|r| r.into())
|
Rational32::approximate_float(x).map(|r| r.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn approximate_f64(x: f64) -> Option<Self> {
|
pub fn approximate_f64(x: f64) -> Option<Self> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Rational32::approximate_float(x).map(|r| r.into())
|
Rational32::approximate_float(x).map(|r| r.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ impl ops::Neg for &Fraction {
|
||||||
impl From<i32> for Fraction {
|
impl From<i32> for Fraction {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(x: i32) -> Self {
|
fn from(x: i32) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Fraction(x.into())
|
Fraction(x.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ impl From<i32> for Fraction {
|
||||||
impl From<(i32, i32)> for Fraction {
|
impl From<(i32, i32)> for Fraction {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(x: (i32, i32)) -> Self {
|
fn from(x: (i32, i32)) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Fraction(x.into())
|
Fraction(x.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ impl From<Fraction> for (i32, i32) {
|
||||||
impl From<Rational32> for Fraction {
|
impl From<Rational32> for Fraction {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(x: Rational32) -> Self {
|
fn from(x: Rational32) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Fraction(x)
|
Fraction(x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ impl IntRangeType for i32 {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn with_step(min: i32, max: i32, step: i32) -> IntRange<Self> {
|
fn with_step(min: i32, max: i32, step: i32) -> IntRange<Self> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
assert!(min <= max);
|
assert!(min <= max);
|
||||||
assert!(step > 0);
|
assert!(step > 0);
|
||||||
|
@ -375,7 +375,7 @@ impl IntRangeType for i64 {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn with_step(min: i64, max: i64, step: i64) -> IntRange<Self> {
|
fn with_step(min: i64, max: i64, step: i64) -> IntRange<Self> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
assert!(min <= max);
|
assert!(min <= max);
|
||||||
assert!(step > 0);
|
assert!(step > 0);
|
||||||
|
@ -387,13 +387,13 @@ impl IntRangeType for i64 {
|
||||||
impl<T: IntRangeType> IntRange<T> {
|
impl<T: IntRangeType> IntRange<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(min: T, max: T) -> IntRange<T> {
|
pub fn new(min: T, max: T) -> IntRange<T> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
T::with_min_max(min, max)
|
T::with_min_max(min, max)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn with_step(min: T, max: T, step: T) -> IntRange<T> {
|
pub fn with_step(min: T, max: T, step: T) -> IntRange<T> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
T::with_step(min, max, step)
|
T::with_step(min, max, step)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -548,7 +548,7 @@ pub struct FractionRange {
|
||||||
impl FractionRange {
|
impl FractionRange {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new<T: Into<Fraction>, U: Into<Fraction>>(min: T, max: U) -> Self {
|
pub fn new<T: Into<Fraction>, U: Into<Fraction>>(min: T, max: U) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let min = min.into();
|
let min = min.into();
|
||||||
let max = max.into();
|
let max = max.into();
|
||||||
|
@ -644,7 +644,7 @@ pub struct Bitmask(pub u64);
|
||||||
impl Bitmask {
|
impl Bitmask {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(v: u64) -> Self {
|
pub fn new(v: u64) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Bitmask(v)
|
Bitmask(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -783,7 +783,7 @@ impl Array {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_values(values: impl IntoIterator<Item = glib::SendValue>) -> Self {
|
pub fn from_values(values: impl IntoIterator<Item = glib::SendValue>) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
Self::new(values)
|
Self::new(values)
|
||||||
}
|
}
|
||||||
|
@ -817,7 +817,7 @@ impl Array {
|
||||||
|
|
||||||
impl Default for Array {
|
impl Default for Array {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let value = glib::Value::for_value_type::<Array>();
|
let value = glib::Value::for_value_type::<Array>();
|
||||||
|
@ -845,7 +845,7 @@ impl AsRef<[glib::SendValue]> for Array {
|
||||||
|
|
||||||
impl std::iter::FromIterator<glib::SendValue> for Array {
|
impl std::iter::FromIterator<glib::SendValue> for Array {
|
||||||
fn from_iter<T: IntoIterator<Item = glib::SendValue>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = glib::SendValue>>(iter: T) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Self::from_values(iter)
|
Self::from_values(iter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -903,7 +903,7 @@ unsafe impl<'a> Sync for ArrayRef<'a> {}
|
||||||
|
|
||||||
impl<'a> ArrayRef<'a> {
|
impl<'a> ArrayRef<'a> {
|
||||||
pub fn new(values: &'a [glib::SendValue]) -> Self {
|
pub fn new(values: &'a [glib::SendValue]) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
Self(values)
|
Self(values)
|
||||||
}
|
}
|
||||||
|
@ -1010,7 +1010,7 @@ impl List {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_values(values: impl IntoIterator<Item = glib::SendValue>) -> Self {
|
pub fn from_values(values: impl IntoIterator<Item = glib::SendValue>) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
Self::new(values)
|
Self::new(values)
|
||||||
}
|
}
|
||||||
|
@ -1044,7 +1044,7 @@ impl List {
|
||||||
|
|
||||||
impl Default for List {
|
impl Default for List {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let value = glib::Value::for_value_type::<List>();
|
let value = glib::Value::for_value_type::<List>();
|
||||||
|
@ -1072,7 +1072,7 @@ impl AsRef<[glib::SendValue]> for List {
|
||||||
|
|
||||||
impl std::iter::FromIterator<glib::SendValue> for List {
|
impl std::iter::FromIterator<glib::SendValue> for List {
|
||||||
fn from_iter<T: IntoIterator<Item = glib::SendValue>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = glib::SendValue>>(iter: T) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
Self::from_values(iter)
|
Self::from_values(iter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1130,7 +1130,7 @@ unsafe impl<'a> Sync for ListRef<'a> {}
|
||||||
|
|
||||||
impl<'a> ListRef<'a> {
|
impl<'a> ListRef<'a> {
|
||||||
pub fn new(values: &'a [glib::SendValue]) -> Self {
|
pub fn new(values: &'a [glib::SendValue]) -> Self {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
Self(values)
|
Self(values)
|
||||||
}
|
}
|
||||||
|
@ -1384,7 +1384,7 @@ impl GstValueExt for glib::Value {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deserialize(s: &str, type_: glib::Type) -> Result<glib::Value, glib::BoolError> {
|
fn deserialize(s: &str, type_: glib::Type) -> Result<glib::Value, glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut value = glib::Value::from_type(type_);
|
let mut value = glib::Value::from_type(type_);
|
||||||
|
@ -1406,7 +1406,7 @@ impl GstValueExt for glib::Value {
|
||||||
s: &str,
|
s: &str,
|
||||||
pspec: &glib::ParamSpec,
|
pspec: &glib::ParamSpec,
|
||||||
) -> Result<glib::Value, glib::BoolError> {
|
) -> Result<glib::Value, glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut value = glib::Value::from_type_unchecked(pspec.value_type());
|
let mut value = glib::Value::from_type_unchecked(pspec.value_type());
|
||||||
|
|
Loading…
Reference in a new issue