forked from mirrors/gstreamer-rs
gstreamer*: Add missing init checks
This commit is contained in:
parent
2f72261360
commit
c07fe14191
63 changed files with 196 additions and 0 deletions
|
@ -146,6 +146,7 @@ impl AppSinkCallbacksBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn post_panic_error_message(element: &AppSink, err: &dyn std::any::Any) {
|
fn post_panic_error_message(element: &AppSink, err: &dyn std::any::Any) {
|
||||||
|
skip_assert_initialized!();
|
||||||
if let Some(cause) = err.downcast_ref::<&str>() {
|
if let Some(cause) = err.downcast_ref::<&str>() {
|
||||||
gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
|
gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
|
||||||
} else if let Some(cause) = err.downcast_ref::<String>() {
|
} else if let Some(cause) = err.downcast_ref::<String>() {
|
||||||
|
|
|
@ -118,6 +118,7 @@ impl AppSrcCallbacksBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn post_panic_error_message(element: &AppSrc, err: &dyn std::any::Any) {
|
fn post_panic_error_message(element: &AppSrc, err: &dyn std::any::Any) {
|
||||||
|
skip_assert_initialized!();
|
||||||
if let Some(cause) = err.downcast_ref::<&str>() {
|
if let Some(cause) = err.downcast_ref::<&str>() {
|
||||||
gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
|
gst_element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
|
||||||
} else if let Some(cause) = err.downcast_ref::<String>() {
|
} else if let Some(cause) = err.downcast_ref::<String>() {
|
||||||
|
|
|
@ -27,6 +27,7 @@ impl AudioClippingMeta {
|
||||||
start: V,
|
start: V,
|
||||||
end: V,
|
end: V,
|
||||||
) -> gst::MetaRefMut<Self, gst::meta::Standalone> {
|
) -> gst::MetaRefMut<Self, gst::meta::Standalone> {
|
||||||
|
skip_assert_initialized!();
|
||||||
let start = start.into();
|
let start = start.into();
|
||||||
let end = end.into();
|
let end = end.into();
|
||||||
assert_eq!(start.get_format(), end.get_format());
|
assert_eq!(start.get_format(), end.get_format());
|
||||||
|
|
|
@ -49,6 +49,7 @@ impl ToGlib for Overhead {
|
||||||
impl FromGlib<i32> for Overhead {
|
impl FromGlib<i32> for Overhead {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_glib(val: i32) -> Overhead {
|
fn from_glib(val: i32) -> Overhead {
|
||||||
|
skip_assert_initialized!();
|
||||||
match val {
|
match val {
|
||||||
0 => Overhead::None,
|
0 => Overhead::None,
|
||||||
1 => Overhead::Frame,
|
1 => Overhead::Frame,
|
||||||
|
@ -94,6 +95,7 @@ impl<'a> BaseParseFrame<'a> {
|
||||||
frame: *mut gst_base_sys::GstBaseParseFrame,
|
frame: *mut gst_base_sys::GstBaseParseFrame,
|
||||||
_parse: &'a BaseParse,
|
_parse: &'a BaseParse,
|
||||||
) -> BaseParseFrame<'a> {
|
) -> BaseParseFrame<'a> {
|
||||||
|
skip_assert_initialized!();
|
||||||
assert!(!frame.is_null());
|
assert!(!frame.is_null());
|
||||||
BaseParseFrame(ptr::NonNull::new_unchecked(frame), PhantomData)
|
BaseParseFrame(ptr::NonNull::new_unchecked(frame), PhantomData)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ pub struct MutexGuard<'a>(&'a glib_sys::GMutex);
|
||||||
impl<'a> MutexGuard<'a> {
|
impl<'a> MutexGuard<'a> {
|
||||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||||
pub fn lock(mutex: &'a glib_sys::GMutex) -> Self {
|
pub fn lock(mutex: &'a glib_sys::GMutex) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib_sys::g_mutex_lock(mut_override(mutex));
|
glib_sys::g_mutex_lock(mut_override(mutex));
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ pub use auto::*;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
|
|
||||||
|
mod asset;
|
||||||
mod timeline_element;
|
mod timeline_element;
|
||||||
pub use timeline_element::TimelineElementExtManual;
|
pub use timeline_element::TimelineElementExtManual;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ impl GLContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_current_gl_context(context_type: GLPlatform) -> uintptr_t {
|
pub fn get_current_gl_context(context_type: GLPlatform) -> uintptr_t {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_gl_sys::gst_gl_context_get_current_gl_context(context_type.to_glib()) as uintptr_t
|
gst_gl_sys::gst_gl_context_get_current_gl_context(context_type.to_glib()) as uintptr_t
|
||||||
}
|
}
|
||||||
|
@ -41,6 +42,7 @@ impl GLContext {
|
||||||
gl_api: GLAPI,
|
gl_api: GLAPI,
|
||||||
name: &str,
|
name: &str,
|
||||||
) -> uintptr_t {
|
) -> uintptr_t {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_gl_sys::gst_gl_context_get_proc_address_with_platform(
|
gst_gl_sys::gst_gl_context_get_proc_address_with_platform(
|
||||||
context_type.to_glib(),
|
context_type.to_glib(),
|
||||||
|
|
|
@ -19,6 +19,7 @@ impl GLSyncMeta {
|
||||||
buffer: &'a mut gst::BufferRef,
|
buffer: &'a mut gst::BufferRef,
|
||||||
context: &C,
|
context: &C,
|
||||||
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let meta = gst_gl_sys::gst_buffer_add_gl_sync_meta(
|
let meta = gst_gl_sys::gst_buffer_add_gl_sync_meta(
|
||||||
context.as_ref().to_glib_none().0,
|
context.as_ref().to_glib_none().0,
|
||||||
|
|
|
@ -39,6 +39,7 @@ impl VideoFrameGLExt for VideoFrame<Readable> {
|
||||||
buffer: gst::Buffer,
|
buffer: gst::Buffer,
|
||||||
info: &VideoInfo,
|
info: &VideoInfo,
|
||||||
) -> Result<VideoFrame<Readable>, gst::Buffer> {
|
) -> Result<VideoFrame<Readable>, gst::Buffer> {
|
||||||
|
skip_assert_initialized!();
|
||||||
VideoFrameRef::<&gst::BufferRef>::from_buffer_readable_gl(buffer, info)
|
VideoFrameRef::<&gst::BufferRef>::from_buffer_readable_gl(buffer, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ impl VideoFrameGLExt for VideoFrame<Readable> {
|
||||||
buffer: &'a gst::BufferRef,
|
buffer: &'a gst::BufferRef,
|
||||||
info: &'b VideoInfo,
|
info: &'b VideoInfo,
|
||||||
) -> Result<VideoFrameRef<&'a gst::BufferRef>, glib::error::BoolError> {
|
) -> Result<VideoFrameRef<&'a gst::BufferRef>, glib::error::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
VideoFrameRef::<&gst::BufferRef>::from_buffer_ref_readable_gl(buffer, info)
|
VideoFrameRef::<&gst::BufferRef>::from_buffer_ref_readable_gl(buffer, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,6 +155,7 @@ impl<'a> VideoFrameGLExt for VideoFrameRef<&'a gst::BufferRef> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn buffer_n_gl_memory(buffer: &gst::BufferRef) -> Option<u32> {
|
fn buffer_n_gl_memory(buffer: &gst::BufferRef) -> Option<u32> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let buf = buffer.as_mut_ptr();
|
let buf = buffer.as_mut_ptr();
|
||||||
let num = gst_sys::gst_buffer_n_memory(buf);
|
let num = gst_sys::gst_buffer_n_memory(buf);
|
||||||
|
|
|
@ -24,6 +24,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)]
|
||||||
|
|
|
@ -18,6 +18,7 @@ impl NetAddressMeta {
|
||||||
buffer: &'a mut gst::BufferRef,
|
buffer: &'a mut gst::BufferRef,
|
||||||
addr: &A,
|
addr: &A,
|
||||||
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let meta = gst_net_sys::gst_buffer_add_net_address_meta(
|
let meta = gst_net_sys::gst_buffer_add_net_address_meta(
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
|
|
|
@ -362,6 +362,7 @@ fn set_common_fields<T: EncodingProfileBuilderCommon>(
|
||||||
profile: &T,
|
profile: &T,
|
||||||
base_data: &EncodingProfileBuilderCommonData,
|
base_data: &EncodingProfileBuilderCommonData,
|
||||||
) {
|
) {
|
||||||
|
skip_assert_initialized!();
|
||||||
profile.set_name(base_data.name);
|
profile.set_name(base_data.name);
|
||||||
profile.set_description(base_data.description);
|
profile.set_description(base_data.description);
|
||||||
profile.set_preset(base_data.preset);
|
profile.set_preset(base_data.preset);
|
||||||
|
|
|
@ -32,6 +32,7 @@ impl<'a> RTPBuffer<'a, Readable> {
|
||||||
pub fn from_buffer_readable(
|
pub fn from_buffer_readable(
|
||||||
buffer: &gst::Buffer,
|
buffer: &gst::Buffer,
|
||||||
) -> Result<RTPBuffer<Readable>, glib::BoolError> {
|
) -> Result<RTPBuffer<Readable>, glib::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut rtp_buffer = mem::MaybeUninit::zeroed();
|
let mut rtp_buffer = mem::MaybeUninit::zeroed();
|
||||||
let res: bool = from_glib(gst_rtp_sys::gst_rtp_buffer_map(
|
let res: bool = from_glib(gst_rtp_sys::gst_rtp_buffer_map(
|
||||||
|
@ -57,6 +58,7 @@ impl<'a> RTPBuffer<'a, Writable> {
|
||||||
pub fn from_buffer_writable(
|
pub fn from_buffer_writable(
|
||||||
buffer: &mut gst::Buffer,
|
buffer: &mut gst::Buffer,
|
||||||
) -> Result<RTPBuffer<Writable>, glib::BoolError> {
|
) -> Result<RTPBuffer<Writable>, glib::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut rtp_buffer = mem::MaybeUninit::zeroed();
|
let mut rtp_buffer = mem::MaybeUninit::zeroed();
|
||||||
let res: bool = from_glib(gst_rtp_sys::gst_rtp_buffer_map(
|
let res: bool = from_glib(gst_rtp_sys::gst_rtp_buffer_map(
|
||||||
|
@ -132,6 +134,7 @@ impl RTPBufferExt for gst::Buffer {
|
||||||
pad_len: u8,
|
pad_len: u8,
|
||||||
csrc_count: u8,
|
csrc_count: u8,
|
||||||
) -> Result<gst::Buffer, glib::BoolError> {
|
) -> Result<gst::Buffer, glib::BoolError> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
Option::<_>::from_glib_full(gst_rtp_sys::gst_rtp_buffer_new_allocate(
|
Option::<_>::from_glib_full(gst_rtp_sys::gst_rtp_buffer_new_allocate(
|
||||||
payload_len,
|
payload_len,
|
||||||
|
@ -144,6 +147,7 @@ impl RTPBufferExt for gst::Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compare_seqnum(seqnum1: u16, seqnum2: u16) -> i32 {
|
pub fn compare_seqnum(seqnum1: u16, seqnum2: u16) -> i32 {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe { gst_rtp_sys::gst_rtp_buffer_compare_seqnum(seqnum1, seqnum2) }
|
unsafe { gst_rtp_sys::gst_rtp_buffer_compare_seqnum(seqnum1, seqnum2) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ gst_define_mini_object_wrapper!(
|
||||||
|
|
||||||
impl RTSPThread {
|
impl RTSPThread {
|
||||||
pub fn new(type_: ::RTSPThreadType) -> Option<Self> {
|
pub fn new(type_: ::RTSPThreadType) -> Option<Self> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_thread_new(type_.to_glib())) }
|
unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_thread_new(type_.to_glib())) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ impl RTSPToken {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(values: &[(&str, &dyn ToSendValue)]) -> Self {
|
pub fn new(values: &[(&str, &dyn ToSendValue)]) -> Self {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
let mut token = RTSPToken::new_empty();
|
let mut token = RTSPToken::new_empty();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@ pub fn convert_sample(
|
||||||
caps: &gst::Caps,
|
caps: &gst::Caps,
|
||||||
timeout: gst::ClockTime,
|
timeout: gst::ClockTime,
|
||||||
) -> Result<gst::Sample, glib::Error> {
|
) -> Result<gst::Sample, glib::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut error = ptr::null_mut();
|
let mut error = ptr::null_mut();
|
||||||
let ret = gst_video_sys::gst_video_convert_sample(
|
let ret = gst_video_sys::gst_video_convert_sample(
|
||||||
|
@ -47,6 +48,7 @@ pub fn convert_sample_async<F>(
|
||||||
) where
|
) where
|
||||||
F: FnOnce(Result<gst::Sample, glib::Error>) + Send + 'static,
|
F: FnOnce(Result<gst::Sample, glib::Error>) + Send + 'static,
|
||||||
{
|
{
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe { convert_sample_async_unsafe(sample, caps, timeout, func) }
|
unsafe { convert_sample_async_unsafe(sample, caps, timeout, func) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +60,7 @@ pub fn convert_sample_async_local<F>(
|
||||||
) where
|
) where
|
||||||
F: FnOnce(Result<gst::Sample, glib::Error>) + Send + 'static,
|
F: FnOnce(Result<gst::Sample, glib::Error>) + Send + 'static,
|
||||||
{
|
{
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
assert!(glib::MainContext::ref_thread_default().is_owner());
|
assert!(glib::MainContext::ref_thread_default().is_owner());
|
||||||
convert_sample_async_unsafe(sample, caps, timeout, func)
|
convert_sample_async_unsafe(sample, caps, timeout, func)
|
||||||
|
@ -113,6 +116,8 @@ pub fn convert_sample_future(
|
||||||
timeout: gst::ClockTime,
|
timeout: gst::ClockTime,
|
||||||
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<gst::Sample, glib::Error>> + 'static>>
|
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<gst::Sample, glib::Error>> + 'static>>
|
||||||
{
|
{
|
||||||
|
skip_assert_initialized!();
|
||||||
|
|
||||||
use futures_channel::oneshot;
|
use futures_channel::oneshot;
|
||||||
use futures_util::future::lazy;
|
use futures_util::future::lazy;
|
||||||
use futures_util::future::FutureExt;
|
use futures_util::future::FutureExt;
|
||||||
|
|
|
@ -69,6 +69,7 @@ impl<'a> VideoCodecFrame<'a> {
|
||||||
frame: *mut gst_video_sys::GstVideoCodecFrame,
|
frame: *mut gst_video_sys::GstVideoCodecFrame,
|
||||||
element: &'a T,
|
element: &'a T,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
let stream_lock = element.get_stream_lock();
|
let stream_lock = element.get_stream_lock();
|
||||||
glib_sys::g_rec_mutex_lock(stream_lock);
|
glib_sys::g_rec_mutex_lock(stream_lock);
|
||||||
Self { frame, element }
|
Self { frame, element }
|
||||||
|
|
|
@ -73,6 +73,7 @@ impl<'a, T: VideoCodecStateContext<'a>> fmt::Debug for VideoCodecState<'a, T> {
|
||||||
impl<'a> VideoCodecState<'a, Readable> {
|
impl<'a> VideoCodecState<'a, Readable> {
|
||||||
// Take ownership of @state
|
// Take ownership of @state
|
||||||
pub(crate) unsafe fn new(state: *mut gst_video_sys::GstVideoCodecState) -> Self {
|
pub(crate) unsafe fn new(state: *mut gst_video_sys::GstVideoCodecState) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
state,
|
state,
|
||||||
context: Readable {},
|
context: Readable {},
|
||||||
|
@ -87,6 +88,7 @@ impl<'a> VideoCodecState<'a, InNegotiation<'a>> {
|
||||||
state: *mut gst_video_sys::GstVideoCodecState,
|
state: *mut gst_video_sys::GstVideoCodecState,
|
||||||
element: &'a T,
|
element: &'a T,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
let stream_lock = element.get_stream_lock();
|
let stream_lock = element.get_stream_lock();
|
||||||
glib_sys::g_rec_mutex_lock(stream_lock);
|
glib_sys::g_rec_mutex_lock(stream_lock);
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -35,6 +35,7 @@ impl VideoConverter {
|
||||||
out_info: &::VideoInfo,
|
out_info: &::VideoInfo,
|
||||||
config: Option<VideoConverterConfig>,
|
config: Option<VideoConverterConfig>,
|
||||||
) -> Result<Self, glib::BoolError> {
|
) -> Result<Self, glib::BoolError> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
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"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ use gst::MiniObject;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
pub fn is_force_key_unit_event(event: &gst::EventRef) -> bool {
|
pub fn is_force_key_unit_event(event: &gst::EventRef) -> bool {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(gst_video_sys::gst_video_event_is_force_key_unit(
|
from_glib(gst_video_sys::gst_video_event_is_force_key_unit(
|
||||||
event.as_mut_ptr(),
|
event.as_mut_ptr(),
|
||||||
|
@ -159,6 +160,7 @@ pub struct DownstreamForceKeyUnitEvent {
|
||||||
pub fn parse_downstream_force_key_unit_event(
|
pub fn parse_downstream_force_key_unit_event(
|
||||||
event: &gst::EventRef,
|
event: &gst::EventRef,
|
||||||
) -> Result<DownstreamForceKeyUnitEvent, glib::error::BoolError> {
|
) -> Result<DownstreamForceKeyUnitEvent, glib::error::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut timestamp = mem::MaybeUninit::uninit();
|
let mut timestamp = mem::MaybeUninit::uninit();
|
||||||
let mut stream_time = mem::MaybeUninit::uninit();
|
let mut stream_time = mem::MaybeUninit::uninit();
|
||||||
|
@ -253,6 +255,7 @@ pub struct UpstreamForceKeyUnitEvent {
|
||||||
pub fn parse_upstream_force_key_unit_event(
|
pub fn parse_upstream_force_key_unit_event(
|
||||||
event: &gst::EventRef,
|
event: &gst::EventRef,
|
||||||
) -> Result<UpstreamForceKeyUnitEvent, glib::error::BoolError> {
|
) -> Result<UpstreamForceKeyUnitEvent, glib::error::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut running_time = mem::MaybeUninit::uninit();
|
let mut running_time = mem::MaybeUninit::uninit();
|
||||||
let mut all_headers = mem::MaybeUninit::uninit();
|
let mut all_headers = mem::MaybeUninit::uninit();
|
||||||
|
@ -287,6 +290,7 @@ pub enum ForceKeyUnitEvent {
|
||||||
pub fn parse_force_key_unit_event(
|
pub fn parse_force_key_unit_event(
|
||||||
event: &gst::EventRef,
|
event: &gst::EventRef,
|
||||||
) -> Result<ForceKeyUnitEvent, glib::error::BoolError> {
|
) -> Result<ForceKeyUnitEvent, glib::error::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
if event.is_upstream() {
|
if event.is_upstream() {
|
||||||
parse_upstream_force_key_unit_event(event).map(ForceKeyUnitEvent::Upstream)
|
parse_upstream_force_key_unit_event(event).map(ForceKeyUnitEvent::Upstream)
|
||||||
} else {
|
} else {
|
||||||
|
@ -295,6 +299,7 @@ pub fn parse_force_key_unit_event(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_still_frame_event<'a>(in_still: bool) -> StillFrameEventBuilder<'a> {
|
pub fn new_still_frame_event<'a>(in_still: bool) -> StillFrameEventBuilder<'a> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
StillFrameEventBuilder::new(in_still)
|
StillFrameEventBuilder::new(in_still)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,6 +334,7 @@ pub struct StillFrameEvent {
|
||||||
pub fn parse_still_frame_event(
|
pub fn parse_still_frame_event(
|
||||||
event: &gst::EventRef,
|
event: &gst::EventRef,
|
||||||
) -> Result<StillFrameEvent, glib::error::BoolError> {
|
) -> Result<StillFrameEvent, glib::error::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut in_still = mem::MaybeUninit::uninit();
|
let mut in_still = mem::MaybeUninit::uninit();
|
||||||
|
|
||||||
|
|
|
@ -189,6 +189,7 @@ impl fmt::Display for ::VideoColorimetry {
|
||||||
|
|
||||||
impl From<::VideoMultiviewFramePacking> for ::VideoMultiviewMode {
|
impl From<::VideoMultiviewFramePacking> for ::VideoMultiviewMode {
|
||||||
fn from(v: ::VideoMultiviewFramePacking) -> Self {
|
fn from(v: ::VideoMultiviewFramePacking) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
from_glib(v.to_glib())
|
from_glib(v.to_glib())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,6 +200,8 @@ impl std::convert::TryFrom<::VideoMultiviewMode> for ::VideoMultiviewFramePackin
|
||||||
fn try_from(
|
fn try_from(
|
||||||
v: ::VideoMultiviewMode,
|
v: ::VideoMultiviewMode,
|
||||||
) -> Result<::VideoMultiviewFramePacking, ::VideoMultiviewMode> {
|
) -> Result<::VideoMultiviewFramePacking, ::VideoMultiviewMode> {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let v2 = from_glib(v.to_glib());
|
let v2 = from_glib(v.to_glib());
|
||||||
|
|
||||||
if let ::VideoMultiviewFramePacking::__Unknown(_) = v2 {
|
if let ::VideoMultiviewFramePacking::__Unknown(_) = v2 {
|
||||||
|
|
|
@ -29,6 +29,8 @@ impl VideoMeta {
|
||||||
width: u32,
|
width: u32,
|
||||||
height: u32,
|
height: u32,
|
||||||
) -> gst::MetaRefMut<Self, gst::meta::Standalone> {
|
) -> gst::MetaRefMut<Self, gst::meta::Standalone> {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let info = ::VideoInfo::new(format, width, height).build().unwrap();
|
let info = ::VideoInfo::new(format, width, height).build().unwrap();
|
||||||
assert!(buffer.get_size() >= info.size());
|
assert!(buffer.get_size() >= info.size());
|
||||||
|
|
||||||
|
@ -54,6 +56,8 @@ impl VideoMeta {
|
||||||
offset: &[usize],
|
offset: &[usize],
|
||||||
stride: &[i32],
|
stride: &[i32],
|
||||||
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
|
||||||
let n_planes = offset.len() as u32;
|
let n_planes = offset.len() as u32;
|
||||||
let info = ::VideoInfo::new(format, width, height)
|
let info = ::VideoInfo::new(format, width, height)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
|
@ -145,6 +149,7 @@ impl VideoOverlayCompositionMeta {
|
||||||
buffer: &'a mut gst::BufferRef,
|
buffer: &'a mut gst::BufferRef,
|
||||||
overlay: &::VideoOverlayComposition,
|
overlay: &::VideoOverlayComposition,
|
||||||
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let meta = gst_video_sys::gst_buffer_add_video_overlay_composition_meta(
|
let meta = gst_video_sys::gst_buffer_add_video_overlay_composition_meta(
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
|
@ -204,6 +209,7 @@ impl VideoCaptionMeta {
|
||||||
caption_type: ::VideoCaptionType,
|
caption_type: ::VideoCaptionType,
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let meta = gst_video_sys::gst_buffer_add_video_caption_meta(
|
let meta = gst_video_sys::gst_buffer_add_video_caption_meta(
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
|
|
|
@ -31,6 +31,7 @@ impl<O: IsA<VideoOverlay>> VideoOverlayExtManual for O {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_video_overlay_prepare_window_handle_message(msg: &gst::MessageRef) -> bool {
|
pub fn is_video_overlay_prepare_window_handle_message(msg: &gst::MessageRef) -> bool {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(
|
from_glib(
|
||||||
gst_video_sys::gst_is_video_overlay_prepare_window_handle_message(msg.as_mut_ptr()),
|
gst_video_sys::gst_is_video_overlay_prepare_window_handle_message(msg.as_mut_ptr()),
|
||||||
|
|
|
@ -43,6 +43,7 @@ impl VideoOverlayRectangle {
|
||||||
render_height: u32,
|
render_height: u32,
|
||||||
flags: ::VideoOverlayFormatFlags,
|
flags: ::VideoOverlayFormatFlags,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
assert!(buffer.get_meta::<::VideoMeta>().is_some());
|
assert!(buffer.get_meta::<::VideoMeta>().is_some());
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(gst_video_sys::gst_video_overlay_rectangle_new_raw(
|
from_glib_full(gst_video_sys::gst_video_overlay_rectangle_new_raw(
|
||||||
|
@ -201,6 +202,7 @@ impl VideoOverlayComposition {
|
||||||
pub fn new<'a, T: IntoIterator<Item = &'a VideoOverlayRectangle>>(
|
pub fn new<'a, T: IntoIterator<Item = &'a VideoOverlayRectangle>>(
|
||||||
rects: T,
|
rects: T,
|
||||||
) -> Result<Self, glib::error::BoolError> {
|
) -> Result<Self, glib::error::BoolError> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut iter = rects.into_iter();
|
let mut iter = rects.into_iter();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ pub struct VideoRectangle {
|
||||||
|
|
||||||
impl VideoRectangle {
|
impl VideoRectangle {
|
||||||
pub fn new(x: i32, y: i32, w: i32, h: i32) -> Self {
|
pub fn new(x: i32, y: i32, w: i32, h: i32) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
VideoRectangle { x, y, w, h }
|
VideoRectangle { x, y, w, h }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +29,7 @@ pub fn center_video_rectangle(
|
||||||
dst: &VideoRectangle,
|
dst: &VideoRectangle,
|
||||||
scale: bool,
|
scale: bool,
|
||||||
) -> VideoRectangle {
|
) -> VideoRectangle {
|
||||||
|
skip_assert_initialized!();
|
||||||
let mut result = gst_video_sys::GstVideoRectangle {
|
let mut result = gst_video_sys::GstVideoRectangle {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
|
|
|
@ -144,6 +144,7 @@ impl TryFrom<VideoTimeCode> for ValidVideoTimeCode {
|
||||||
type Error = VideoTimeCode;
|
type Error = VideoTimeCode;
|
||||||
|
|
||||||
fn try_from(v: VideoTimeCode) -> Result<ValidVideoTimeCode, VideoTimeCode> {
|
fn try_from(v: VideoTimeCode) -> Result<ValidVideoTimeCode, VideoTimeCode> {
|
||||||
|
skip_assert_initialized!();
|
||||||
if v.is_valid() {
|
if v.is_valid() {
|
||||||
Ok(ValidVideoTimeCode(v.0))
|
Ok(ValidVideoTimeCode(v.0))
|
||||||
} else {
|
} else {
|
||||||
|
@ -164,6 +165,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!();
|
||||||
let tc = VideoTimeCode::new(
|
let tc = VideoTimeCode::new(
|
||||||
fps,
|
fps,
|
||||||
latest_daily_jam,
|
latest_daily_jam,
|
||||||
|
@ -192,6 +194,7 @@ impl ValidVideoTimeCode {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
pub fn add_frames(&mut self, frames: i64) {
|
pub fn add_frames(&mut self, frames: i64) {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_video_sys::gst_video_time_code_add_frames(self.to_glib_none_mut().0, frames);
|
gst_video_sys::gst_video_time_code_add_frames(self.to_glib_none_mut().0, frames);
|
||||||
}
|
}
|
||||||
|
@ -517,6 +520,7 @@ impl Ord for ValidVideoTimeCode {
|
||||||
|
|
||||||
impl From<ValidVideoTimeCode> for VideoTimeCode {
|
impl From<ValidVideoTimeCode> for VideoTimeCode {
|
||||||
fn from(v: ValidVideoTimeCode) -> VideoTimeCode {
|
fn from(v: ValidVideoTimeCode) -> VideoTimeCode {
|
||||||
|
skip_assert_initialized!();
|
||||||
VideoTimeCode(v.0)
|
VideoTimeCode(v.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,6 +536,7 @@ impl VideoTimeCodeMeta {
|
||||||
buffer: &'a mut gst::BufferRef,
|
buffer: &'a mut gst::BufferRef,
|
||||||
tc: &ValidVideoTimeCode,
|
tc: &ValidVideoTimeCode,
|
||||||
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let meta = gst_video_sys::gst_buffer_add_video_time_code_meta(
|
let meta = gst_video_sys::gst_buffer_add_video_time_code_meta(
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
|
|
|
@ -58,6 +58,7 @@ impl AllocationParams {
|
||||||
|
|
||||||
impl From<gst_sys::GstAllocationParams> for AllocationParams {
|
impl From<gst_sys::GstAllocationParams> for AllocationParams {
|
||||||
fn from(params: gst_sys::GstAllocationParams) -> Self {
|
fn from(params: gst_sys::GstAllocationParams) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
AllocationParams(params)
|
AllocationParams(params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,6 +286,7 @@ impl<T> BufferCursor<T> {
|
||||||
|
|
||||||
impl BufferCursor<Readable> {
|
impl BufferCursor<Readable> {
|
||||||
pub(crate) fn new_readable(buffer: Buffer) -> BufferCursor<Readable> {
|
pub(crate) fn new_readable(buffer: Buffer) -> BufferCursor<Readable> {
|
||||||
|
skip_assert_initialized!();
|
||||||
let size = buffer.get_size() as u64;
|
let size = buffer.get_size() as u64;
|
||||||
let num_mem = buffer.n_memory();
|
let num_mem = buffer.n_memory();
|
||||||
|
|
||||||
|
@ -304,6 +305,7 @@ impl BufferCursor<Readable> {
|
||||||
|
|
||||||
impl BufferCursor<Writable> {
|
impl BufferCursor<Writable> {
|
||||||
pub(crate) fn new_writable(buffer: Buffer) -> Result<BufferCursor<Writable>, glib::BoolError> {
|
pub(crate) fn new_writable(buffer: Buffer) -> Result<BufferCursor<Writable>, glib::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
if !buffer.is_writable() || !buffer.is_all_memory_writable() {
|
if !buffer.is_writable() || !buffer.is_all_memory_writable() {
|
||||||
return Err(glib_bool_error!("Not all memories are writable"));
|
return Err(glib_bool_error!("Not all memories are writable"));
|
||||||
}
|
}
|
||||||
|
@ -383,6 +385,7 @@ impl<'a> BufferRefCursor<&'a BufferRef> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn new_readable(buffer: &'a BufferRef) -> BufferRefCursor<&'a BufferRef> {
|
pub(crate) fn new_readable(buffer: &'a BufferRef) -> BufferRefCursor<&'a BufferRef> {
|
||||||
|
skip_assert_initialized!();
|
||||||
let size = buffer.get_size() as u64;
|
let size = buffer.get_size() as u64;
|
||||||
let num_mem = buffer.n_memory();
|
let num_mem = buffer.n_memory();
|
||||||
|
|
||||||
|
@ -406,6 +409,7 @@ impl<'a> BufferRefCursor<&'a mut BufferRef> {
|
||||||
pub(crate) fn new_writable(
|
pub(crate) fn new_writable(
|
||||||
buffer: &'a mut BufferRef,
|
buffer: &'a mut BufferRef,
|
||||||
) -> Result<BufferRefCursor<&'a mut BufferRef>, glib::BoolError> {
|
) -> Result<BufferRefCursor<&'a mut BufferRef>, glib::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
if !buffer.is_all_memory_writable() {
|
if !buffer.is_all_memory_writable() {
|
||||||
return Err(glib_bool_error!("Not all memories are writable"));
|
return Err(glib_bool_error!("Not all memories are writable"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,6 +192,7 @@ unsafe impl Sync for BufferPoolAcquireParams {}
|
||||||
|
|
||||||
impl BufferPoolAcquireParams {
|
impl BufferPoolAcquireParams {
|
||||||
pub fn with_flags(flags: ::BufferPoolAcquireFlags) -> Self {
|
pub fn with_flags(flags: ::BufferPoolAcquireFlags) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
BufferPoolAcquireParams(gst_sys::GstBufferPoolAcquireParams {
|
BufferPoolAcquireParams(gst_sys::GstBufferPoolAcquireParams {
|
||||||
format: gst_sys::GST_FORMAT_UNDEFINED,
|
format: gst_sys::GST_FORMAT_UNDEFINED,
|
||||||
start: -1,
|
start: -1,
|
||||||
|
@ -206,6 +207,7 @@ impl BufferPoolAcquireParams {
|
||||||
stop: T,
|
stop: T,
|
||||||
flags: ::BufferPoolAcquireFlags,
|
flags: ::BufferPoolAcquireFlags,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
BufferPoolAcquireParams(gst_sys::GstBufferPoolAcquireParams {
|
BufferPoolAcquireParams(gst_sys::GstBufferPoolAcquireParams {
|
||||||
format: start.get_format().to_glib(),
|
format: start.get_format().to_glib(),
|
||||||
|
|
|
@ -57,6 +57,7 @@ struct BufferDe {
|
||||||
|
|
||||||
impl From<BufferDe> for Buffer {
|
impl From<BufferDe> for Buffer {
|
||||||
fn from(buf_de: BufferDe) -> Self {
|
fn from(buf_de: BufferDe) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
let mut buffer = Buffer::from_mut_slice(buf_de.buffer.to_vec());
|
let mut buffer = Buffer::from_mut_slice(buf_de.buffer.to_vec());
|
||||||
{
|
{
|
||||||
let buffer = buffer.get_mut().unwrap();
|
let buffer = buffer.get_mut().unwrap();
|
||||||
|
@ -73,6 +74,7 @@ impl From<BufferDe> for Buffer {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Buffer {
|
impl<'de> Deserialize<'de> for Buffer {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
BufferDe::deserialize(deserializer).map(|buffer_de| buffer_de.into())
|
BufferDe::deserialize(deserializer).map(|buffer_de| buffer_de.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ impl<'de> Visitor<'de> for BufferListVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for BufferList {
|
impl<'de> Deserialize<'de> for BufferList {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_seq(BufferListVisitor)
|
deserializer.deserialize_seq(BufferListVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -570,6 +570,7 @@ impl<T> fmt::Debug for Builder<T> {
|
||||||
|
|
||||||
impl Builder<NoFeature> {
|
impl Builder<NoFeature> {
|
||||||
fn new(name: &str) -> Builder<NoFeature> {
|
fn new(name: &str) -> Builder<NoFeature> {
|
||||||
|
skip_assert_initialized!();
|
||||||
Builder {
|
Builder {
|
||||||
s: ::Structure::new_empty(name),
|
s: ::Structure::new_empty(name),
|
||||||
features: None,
|
features: None,
|
||||||
|
@ -639,6 +640,7 @@ impl BuilderFull<SomeFeatures> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_with_features(features: CapsFeatures) -> Self {
|
fn new_with_features(features: CapsFeatures) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
BuilderFull {
|
BuilderFull {
|
||||||
caps: Caps::new_empty(),
|
caps: Caps::new_empty(),
|
||||||
features: Some(features),
|
features: Some(features),
|
||||||
|
|
|
@ -32,6 +32,7 @@ unsafe impl Sync for CapsFeatures {}
|
||||||
|
|
||||||
impl CapsFeatures {
|
impl CapsFeatures {
|
||||||
pub fn new(features: &[&str]) -> Self {
|
pub fn new(features: &[&str]) -> Self {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
let mut f = Self::new_empty();
|
let mut f = Self::new_empty();
|
||||||
|
|
||||||
for feature in features {
|
for feature in features {
|
||||||
|
|
|
@ -94,6 +94,7 @@ impl<'de> Visitor<'de> for CapsFeaturesSomeVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for CapsFeaturesSome {
|
impl<'de> Deserialize<'de> for CapsFeaturesSome {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<CapsFeaturesSome, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<CapsFeaturesSome, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_seq(CapsFeaturesSomeVisitor)
|
deserializer.deserialize_seq(CapsFeaturesSomeVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,6 +132,7 @@ impl<'de> Visitor<'de> for CapsFeaturesVariantKindsVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for CapsFeaturesVariantKinds {
|
impl<'de> Deserialize<'de> for CapsFeaturesVariantKinds {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_identifier(CapsFeaturesVariantKindsVisitor)
|
deserializer.deserialize_identifier(CapsFeaturesVariantKindsVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,6 +159,7 @@ impl<'de> Visitor<'de> for CapsFeaturesVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for CapsFeatures {
|
impl<'de> Deserialize<'de> for CapsFeatures {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_enum(
|
deserializer.deserialize_enum(
|
||||||
stringify!(Caps),
|
stringify!(Caps),
|
||||||
CAPS_FEATURES_VARIANT_NAMES,
|
CAPS_FEATURES_VARIANT_NAMES,
|
||||||
|
|
|
@ -128,6 +128,7 @@ impl<'de> Visitor<'de> for CapsItemVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for CapsItemDe {
|
impl<'de> Deserialize<'de> for CapsItemDe {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<CapsItemDe, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<CapsItemDe, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_tuple(2, CapsItemVisitor)
|
deserializer.deserialize_tuple(2, CapsItemVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,6 +157,7 @@ impl<'de> Visitor<'de> for CapsSomeVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for CapsSome {
|
impl<'de> Deserialize<'de> for CapsSome {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<CapsSome, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<CapsSome, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_seq(CapsSomeVisitor)
|
deserializer.deserialize_seq(CapsSomeVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,6 +194,7 @@ impl<'de> Visitor<'de> for CapsVariantKindsVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for CapsVariantKinds {
|
impl<'de> Deserialize<'de> for CapsVariantKinds {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_identifier(CapsVariantKindsVisitor)
|
deserializer.deserialize_identifier(CapsVariantKindsVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,6 +222,7 @@ impl<'de> Visitor<'de> for CapsVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Caps {
|
impl<'de> Deserialize<'de> for Caps {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_enum(stringify!(Caps), CAPS_VARIANT_NAMES, CapsVisitor)
|
deserializer.deserialize_enum(stringify!(Caps), CAPS_VARIANT_NAMES, CapsVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,7 @@ impl Clock {
|
||||||
cnum: ClockTime,
|
cnum: ClockTime,
|
||||||
cdenom: ClockTime,
|
cdenom: ClockTime,
|
||||||
) -> ClockTime {
|
) -> ClockTime {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(gst_sys::gst_clock_adjust_with_calibration(
|
from_glib(gst_sys::gst_clock_adjust_with_calibration(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
|
@ -207,6 +208,7 @@ impl Clock {
|
||||||
cnum: ClockTime,
|
cnum: ClockTime,
|
||||||
cdenom: ClockTime,
|
cdenom: ClockTime,
|
||||||
) -> ClockTime {
|
) -> ClockTime {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(gst_sys::gst_clock_unadjust_with_calibration(
|
from_glib(gst_sys::gst_clock_unadjust_with_calibration(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
|
|
|
@ -44,18 +44,22 @@ impl ClockTime {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_seconds(seconds: u64) -> ClockTime {
|
pub fn from_seconds(seconds: u64) -> ClockTime {
|
||||||
|
skip_assert_initialized!();
|
||||||
seconds * ::SECOND
|
seconds * ::SECOND
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_mseconds(mseconds: u64) -> ClockTime {
|
pub fn from_mseconds(mseconds: u64) -> ClockTime {
|
||||||
|
skip_assert_initialized!();
|
||||||
mseconds * ::MSECOND
|
mseconds * ::MSECOND
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_useconds(useconds: u64) -> ClockTime {
|
pub fn from_useconds(useconds: u64) -> ClockTime {
|
||||||
|
skip_assert_initialized!();
|
||||||
useconds * ::USECOND
|
useconds * ::USECOND
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_nseconds(nseconds: u64) -> ClockTime {
|
pub fn from_nseconds(nseconds: u64) -> ClockTime {
|
||||||
|
skip_assert_initialized!();
|
||||||
nseconds * ::NSECOND
|
nseconds * ::NSECOND
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ impl<'de> Visitor<'de> for ClockTimeVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for ClockTime {
|
impl<'de> Deserialize<'de> for ClockTime {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_option(ClockTimeVisitor)
|
deserializer.deserialize_option(ClockTimeVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,7 @@ impl cmp::PartialOrd for DateTime {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_cmp(delta: i32) -> Option<cmp::Ordering> {
|
fn get_cmp(delta: i32) -> Option<cmp::Ordering> {
|
||||||
|
skip_assert_initialized!();
|
||||||
Some(delta.cmp(&0))
|
Some(delta.cmp(&0))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,6 +236,7 @@ impl<'a> convert::TryFrom<&'a glib::DateTime> for DateTime {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: &'a glib::DateTime) -> Result<DateTime, glib::BoolError> {
|
fn try_from(v: &'a glib::DateTime) -> Result<DateTime, glib::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
DateTime::new_from_g_date_time(v)
|
DateTime::new_from_g_date_time(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,6 +245,7 @@ impl convert::TryFrom<glib::DateTime> for DateTime {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: glib::DateTime) -> Result<DateTime, glib::BoolError> {
|
fn try_from(v: glib::DateTime) -> Result<DateTime, glib::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
DateTime::new_from_g_date_time(&v)
|
DateTime::new_from_g_date_time(&v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -251,6 +254,7 @@ impl<'a> convert::TryFrom<&'a DateTime> for glib::DateTime {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: &'a DateTime) -> Result<glib::DateTime, glib::BoolError> {
|
fn try_from(v: &'a DateTime) -> Result<glib::DateTime, glib::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
v.to_g_date_time()
|
v.to_g_date_time()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,6 +263,7 @@ impl convert::TryFrom<DateTime> for glib::DateTime {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: DateTime) -> Result<glib::DateTime, glib::BoolError> {
|
fn try_from(v: DateTime) -> Result<glib::DateTime, glib::BoolError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
v.to_g_date_time()
|
v.to_g_date_time()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ pub(crate) struct Date(glib::Date);
|
||||||
|
|
||||||
impl From<glib::Date> for Date {
|
impl From<glib::Date> for Date {
|
||||||
fn from(glib_date: glib::Date) -> Self {
|
fn from(glib_date: glib::Date) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
Date(glib_date)
|
Date(glib_date)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +110,7 @@ impl TryFrom<DateTimeVariants> for Date {
|
||||||
type Error = &'static str;
|
type Error = &'static str;
|
||||||
|
|
||||||
fn try_from(dt_variant: DateTimeVariants) -> Result<Self, Self::Error> {
|
fn try_from(dt_variant: DateTimeVariants) -> Result<Self, Self::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
match dt_variant {
|
match dt_variant {
|
||||||
DateTimeVariants::YMD(y, m, d) => {
|
DateTimeVariants::YMD(y, m, d) => {
|
||||||
let month = glib::DateMonth::from_glib(m);
|
let month = glib::DateMonth::from_glib(m);
|
||||||
|
@ -129,6 +131,7 @@ impl TryFrom<DateTimeVariants> for Date {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Date {
|
impl<'de> Deserialize<'de> for Date {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
DateTimeVariants::deserialize(deserializer)
|
DateTimeVariants::deserialize(deserializer)
|
||||||
.and_then(|dt_variant| dt_variant.try_into().map_err(D::Error::custom))
|
.and_then(|dt_variant| dt_variant.try_into().map_err(D::Error::custom))
|
||||||
}
|
}
|
||||||
|
@ -139,6 +142,7 @@ impl TryFrom<DateTimeVariants> for DateTime {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(dt_variant: DateTimeVariants) -> Result<Self, Self::Error> {
|
fn try_from(dt_variant: DateTimeVariants) -> Result<Self, Self::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
match dt_variant {
|
match dt_variant {
|
||||||
DateTimeVariants::Y(y) => DateTime::new_y(y),
|
DateTimeVariants::Y(y) => DateTime::new_y(y),
|
||||||
DateTimeVariants::YM(y, m) => DateTime::new_ym(y, m),
|
DateTimeVariants::YM(y, m) => DateTime::new_ym(y, m),
|
||||||
|
@ -155,6 +159,7 @@ impl TryFrom<DateTimeVariants> for DateTime {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for DateTime {
|
impl<'de> Deserialize<'de> for DateTime {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
DateTimeVariants::deserialize(deserializer)
|
DateTimeVariants::deserialize(deserializer)
|
||||||
.and_then(|dt_variant| dt_variant.try_into().map_err(D::Error::custom))
|
.and_then(|dt_variant| dt_variant.try_into().map_err(D::Error::custom))
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,12 @@ impl StateChangeReturn {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_error(_: StateChangeError) -> Self {
|
pub fn from_error(_: StateChangeError) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
StateChangeReturn::Failure
|
StateChangeReturn::Failure
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_ok(v: StateChangeSuccess) -> Self {
|
pub fn from_ok(v: StateChangeSuccess) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match v {
|
match v {
|
||||||
StateChangeSuccess::Success => StateChangeReturn::Success,
|
StateChangeSuccess::Success => StateChangeReturn::Success,
|
||||||
StateChangeSuccess::Async => StateChangeReturn::Async,
|
StateChangeSuccess::Async => StateChangeReturn::Async,
|
||||||
|
@ -54,6 +56,7 @@ pub enum StateChangeSuccess {
|
||||||
|
|
||||||
impl From<StateChangeSuccess> for StateChangeReturn {
|
impl From<StateChangeSuccess> for StateChangeReturn {
|
||||||
fn from(value: StateChangeSuccess) -> Self {
|
fn from(value: StateChangeSuccess) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
StateChangeReturn::from_ok(value)
|
StateChangeReturn::from_ok(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,12 +68,14 @@ pub struct StateChangeError;
|
||||||
|
|
||||||
impl From<StateChangeError> for StateChangeReturn {
|
impl From<StateChangeError> for StateChangeReturn {
|
||||||
fn from(value: StateChangeError) -> Self {
|
fn from(value: StateChangeError) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
StateChangeReturn::from_error(value)
|
StateChangeReturn::from_error(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Result<StateChangeSuccess, StateChangeError>> for StateChangeReturn {
|
impl From<Result<StateChangeSuccess, StateChangeError>> for StateChangeReturn {
|
||||||
fn from(res: Result<StateChangeSuccess, StateChangeError>) -> Self {
|
fn from(res: Result<StateChangeSuccess, StateChangeError>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match res {
|
match res {
|
||||||
Ok(success) => StateChangeReturn::from_ok(success),
|
Ok(success) => StateChangeReturn::from_ok(success),
|
||||||
Err(error) => StateChangeReturn::from_error(error),
|
Err(error) => StateChangeReturn::from_error(error),
|
||||||
|
@ -106,6 +111,7 @@ impl FlowReturn {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_error(v: FlowError) -> Self {
|
pub fn from_error(v: FlowError) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match v {
|
match v {
|
||||||
FlowError::NotLinked => FlowReturn::NotLinked,
|
FlowError::NotLinked => FlowReturn::NotLinked,
|
||||||
FlowError::Flushing => FlowReturn::Flushing,
|
FlowError::Flushing => FlowReturn::Flushing,
|
||||||
|
@ -120,6 +126,7 @@ impl FlowReturn {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_ok(v: FlowSuccess) -> Self {
|
pub fn from_ok(v: FlowSuccess) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match v {
|
match v {
|
||||||
FlowSuccess::CustomSuccess2 => FlowReturn::CustomSuccess2,
|
FlowSuccess::CustomSuccess2 => FlowReturn::CustomSuccess2,
|
||||||
FlowSuccess::CustomSuccess1 => FlowReturn::CustomSuccess1,
|
FlowSuccess::CustomSuccess1 => FlowReturn::CustomSuccess1,
|
||||||
|
@ -139,6 +146,7 @@ pub enum FlowSuccess {
|
||||||
|
|
||||||
impl From<FlowSuccess> for FlowReturn {
|
impl From<FlowSuccess> for FlowReturn {
|
||||||
fn from(value: FlowSuccess) -> Self {
|
fn from(value: FlowSuccess) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
FlowReturn::from_ok(value)
|
FlowReturn::from_ok(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,12 +176,14 @@ pub enum FlowError {
|
||||||
|
|
||||||
impl From<FlowError> for FlowReturn {
|
impl From<FlowError> for FlowReturn {
|
||||||
fn from(value: FlowError) -> Self {
|
fn from(value: FlowError) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
FlowReturn::from_error(value)
|
FlowReturn::from_error(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Result<FlowSuccess, FlowError>> for FlowReturn {
|
impl From<Result<FlowSuccess, FlowError>> for FlowReturn {
|
||||||
fn from(res: Result<FlowSuccess, FlowError>) -> Self {
|
fn from(res: Result<FlowSuccess, FlowError>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match res {
|
match res {
|
||||||
Ok(success) => FlowReturn::from_ok(success),
|
Ok(success) => FlowReturn::from_ok(success),
|
||||||
Err(error) => FlowReturn::from_error(error),
|
Err(error) => FlowReturn::from_error(error),
|
||||||
|
@ -196,6 +206,7 @@ impl PadLinkReturn {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_error(v: PadLinkError) -> Self {
|
pub fn from_error(v: PadLinkError) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match v {
|
match v {
|
||||||
PadLinkError::WrongHierarchy => PadLinkReturn::WrongHierarchy,
|
PadLinkError::WrongHierarchy => PadLinkReturn::WrongHierarchy,
|
||||||
PadLinkError::WasLinked => PadLinkReturn::WasLinked,
|
PadLinkError::WasLinked => PadLinkReturn::WasLinked,
|
||||||
|
@ -207,6 +218,7 @@ impl PadLinkReturn {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_ok(_: PadLinkSuccess) -> Self {
|
pub fn from_ok(_: PadLinkSuccess) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
PadLinkReturn::Ok
|
PadLinkReturn::Ok
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,6 +228,7 @@ pub struct PadLinkSuccess;
|
||||||
|
|
||||||
impl From<PadLinkSuccess> for PadLinkReturn {
|
impl From<PadLinkSuccess> for PadLinkReturn {
|
||||||
fn from(value: PadLinkSuccess) -> Self {
|
fn from(value: PadLinkSuccess) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
PadLinkReturn::from_ok(value)
|
PadLinkReturn::from_ok(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,12 +252,14 @@ pub enum PadLinkError {
|
||||||
|
|
||||||
impl From<PadLinkError> for PadLinkReturn {
|
impl From<PadLinkError> for PadLinkReturn {
|
||||||
fn from(value: PadLinkError) -> Self {
|
fn from(value: PadLinkError) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
PadLinkReturn::from_error(value)
|
PadLinkReturn::from_error(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Result<PadLinkSuccess, PadLinkError>> for PadLinkReturn {
|
impl From<Result<PadLinkSuccess, PadLinkError>> for PadLinkReturn {
|
||||||
fn from(res: Result<PadLinkSuccess, PadLinkError>) -> Self {
|
fn from(res: Result<PadLinkSuccess, PadLinkError>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match res {
|
match res {
|
||||||
Ok(success) => PadLinkReturn::from_ok(success),
|
Ok(success) => PadLinkReturn::from_ok(success),
|
||||||
Err(error) => PadLinkReturn::from_error(error),
|
Err(error) => PadLinkReturn::from_error(error),
|
||||||
|
@ -268,6 +283,7 @@ impl ClockReturn {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_error(v: ClockError) -> Self {
|
pub fn from_error(v: ClockError) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match v {
|
match v {
|
||||||
ClockError::Early => ClockReturn::Early,
|
ClockError::Early => ClockReturn::Early,
|
||||||
ClockError::Unscheduled => ClockReturn::Unscheduled,
|
ClockError::Unscheduled => ClockReturn::Unscheduled,
|
||||||
|
@ -279,6 +295,7 @@ impl ClockReturn {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_ok(v: ClockSuccess) -> Self {
|
pub fn from_ok(v: ClockSuccess) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match v {
|
match v {
|
||||||
ClockSuccess::Ok => ClockReturn::Ok,
|
ClockSuccess::Ok => ClockReturn::Ok,
|
||||||
ClockSuccess::Done => ClockReturn::Done,
|
ClockSuccess::Done => ClockReturn::Done,
|
||||||
|
@ -294,6 +311,7 @@ pub enum ClockSuccess {
|
||||||
|
|
||||||
impl From<ClockSuccess> for ClockReturn {
|
impl From<ClockSuccess> for ClockReturn {
|
||||||
fn from(value: ClockSuccess) -> Self {
|
fn from(value: ClockSuccess) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
ClockReturn::from_ok(value)
|
ClockReturn::from_ok(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,12 +335,14 @@ pub enum ClockError {
|
||||||
|
|
||||||
impl From<ClockError> for ClockReturn {
|
impl From<ClockError> for ClockReturn {
|
||||||
fn from(value: ClockError) -> Self {
|
fn from(value: ClockError) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
ClockReturn::from_error(value)
|
ClockReturn::from_error(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Result<ClockSuccess, ClockError>> for ClockReturn {
|
impl From<Result<ClockSuccess, ClockError>> for ClockReturn {
|
||||||
fn from(res: Result<ClockSuccess, ClockError>) -> Self {
|
fn from(res: Result<ClockSuccess, ClockError>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match res {
|
match res {
|
||||||
Ok(success) => ClockReturn::from_ok(success),
|
Ok(success) => ClockReturn::from_ok(success),
|
||||||
Err(error) => ClockReturn::from_error(error),
|
Err(error) => ClockReturn::from_error(error),
|
||||||
|
|
|
@ -70,6 +70,7 @@ impl ErrorMessage {
|
||||||
function: &'static str,
|
function: &'static str,
|
||||||
line: u32,
|
line: u32,
|
||||||
) -> ErrorMessage {
|
) -> ErrorMessage {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
let error_domain = T::domain();
|
let error_domain = T::domain();
|
||||||
let error_code = error.code();
|
let error_code = error.code();
|
||||||
|
|
||||||
|
@ -122,6 +123,7 @@ pub struct LoggableError {
|
||||||
|
|
||||||
impl LoggableError {
|
impl LoggableError {
|
||||||
pub fn new(category: ::DebugCategory, bool_error: glib::BoolError) -> LoggableError {
|
pub fn new(category: ::DebugCategory, bool_error: glib::BoolError) -> LoggableError {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
LoggableError {
|
LoggableError {
|
||||||
category,
|
category,
|
||||||
bool_error,
|
bool_error,
|
||||||
|
@ -157,6 +159,7 @@ impl LoggableError {
|
||||||
|
|
||||||
impl From<glib::BoolError> for LoggableError {
|
impl From<glib::BoolError> for LoggableError {
|
||||||
fn from(bool_error: glib::BoolError) -> Self {
|
fn from(bool_error: glib::BoolError) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
LoggableError {
|
LoggableError {
|
||||||
category: *::CAT_RUST,
|
category: *::CAT_RUST,
|
||||||
bool_error,
|
bool_error,
|
||||||
|
|
|
@ -77,6 +77,7 @@ impl FormattedValue for GenericFormattedValue {
|
||||||
|
|
||||||
impl GenericFormattedValue {
|
impl GenericFormattedValue {
|
||||||
pub fn new(format: Format, value: i64) -> Self {
|
pub fn new(format: Format, value: i64) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
match format {
|
match format {
|
||||||
Format::Undefined => GenericFormattedValue::Undefined(Undefined(value)),
|
Format::Undefined => GenericFormattedValue::Undefined(Undefined(value)),
|
||||||
Format::Default => GenericFormattedValue::Default(if value == -1 {
|
Format::Default => GenericFormattedValue::Default(if value == -1 {
|
||||||
|
@ -298,6 +299,7 @@ macro_rules! impl_format_value_traits(
|
||||||
|
|
||||||
impl From<$name> for GenericFormattedValue {
|
impl From<$name> for GenericFormattedValue {
|
||||||
fn from(v: $name) -> GenericFormattedValue {
|
fn from(v: $name) -> GenericFormattedValue {
|
||||||
|
skip_assert_initialized!();
|
||||||
GenericFormattedValue::$format_value(v)
|
GenericFormattedValue::$format_value(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,6 +308,7 @@ macro_rules! impl_format_value_traits(
|
||||||
type Error = TryFromGenericFormattedValueError;
|
type Error = TryFromGenericFormattedValueError;
|
||||||
|
|
||||||
fn try_from(v: GenericFormattedValue) -> Result<$name, TryFromGenericFormattedValueError> {
|
fn try_from(v: GenericFormattedValue) -> Result<$name, TryFromGenericFormattedValueError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
if let GenericFormattedValue::$format_value(v) = v {
|
if let GenericFormattedValue::$format_value(v) = v {
|
||||||
Ok(v)
|
Ok(v)
|
||||||
} else {
|
} else {
|
||||||
|
@ -318,12 +321,14 @@ macro_rules! impl_format_value_traits(
|
||||||
|
|
||||||
impl From<u64> for $name {
|
impl From<u64> for $name {
|
||||||
fn from(v: u64) -> $name {
|
fn from(v: u64) -> $name {
|
||||||
|
skip_assert_initialized!();
|
||||||
$name(Some(v))
|
$name(Some(v))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Option<u64>> for $name {
|
impl From<Option<u64>> for $name {
|
||||||
fn from(v: Option<u64>) -> $name {
|
fn from(v: Option<u64>) -> $name {
|
||||||
|
skip_assert_initialized!();
|
||||||
$name(v)
|
$name(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -535,6 +540,7 @@ impl FormattedValue for Undefined {
|
||||||
|
|
||||||
impl From<Undefined> for GenericFormattedValue {
|
impl From<Undefined> for GenericFormattedValue {
|
||||||
fn from(v: Undefined) -> GenericFormattedValue {
|
fn from(v: Undefined) -> GenericFormattedValue {
|
||||||
|
skip_assert_initialized!();
|
||||||
GenericFormattedValue::Undefined(v)
|
GenericFormattedValue::Undefined(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -543,6 +549,7 @@ impl TryFrom<GenericFormattedValue> for Undefined {
|
||||||
type Error = TryFromGenericFormattedValueError;
|
type Error = TryFromGenericFormattedValueError;
|
||||||
|
|
||||||
fn try_from(v: GenericFormattedValue) -> Result<Undefined, TryFromGenericFormattedValueError> {
|
fn try_from(v: GenericFormattedValue) -> Result<Undefined, TryFromGenericFormattedValueError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
if let GenericFormattedValue::Undefined(v) = v {
|
if let GenericFormattedValue::Undefined(v) = v {
|
||||||
Ok(v)
|
Ok(v)
|
||||||
} else {
|
} else {
|
||||||
|
@ -555,6 +562,7 @@ impl SpecificFormattedValue for Undefined {}
|
||||||
|
|
||||||
impl From<i64> for Undefined {
|
impl From<i64> for Undefined {
|
||||||
fn from(v: i64) -> Undefined {
|
fn from(v: i64) -> Undefined {
|
||||||
|
skip_assert_initialized!();
|
||||||
Undefined(v)
|
Undefined(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -616,6 +624,7 @@ impl FormattedValue for Percent {
|
||||||
|
|
||||||
impl From<Percent> for GenericFormattedValue {
|
impl From<Percent> for GenericFormattedValue {
|
||||||
fn from(v: Percent) -> GenericFormattedValue {
|
fn from(v: Percent) -> GenericFormattedValue {
|
||||||
|
skip_assert_initialized!();
|
||||||
GenericFormattedValue::Percent(v)
|
GenericFormattedValue::Percent(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,6 +633,7 @@ impl TryFrom<GenericFormattedValue> for Percent {
|
||||||
type Error = TryFromGenericFormattedValueError;
|
type Error = TryFromGenericFormattedValueError;
|
||||||
|
|
||||||
fn try_from(v: GenericFormattedValue) -> Result<Percent, TryFromGenericFormattedValueError> {
|
fn try_from(v: GenericFormattedValue) -> Result<Percent, TryFromGenericFormattedValueError> {
|
||||||
|
skip_assert_initialized!();
|
||||||
if let GenericFormattedValue::Percent(v) = v {
|
if let GenericFormattedValue::Percent(v) = v {
|
||||||
Ok(v)
|
Ok(v)
|
||||||
} else {
|
} else {
|
||||||
|
@ -675,6 +685,7 @@ impl TryFrom<f64> for Percent {
|
||||||
type Error = TryPercentFromFloatError;
|
type Error = TryPercentFromFloatError;
|
||||||
|
|
||||||
fn try_from(v: f64) -> Result<Self, Self::Error> {
|
fn try_from(v: f64) -> Result<Self, Self::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
if v < 0.0 || v > 1.0 {
|
if v < 0.0 || v > 1.0 {
|
||||||
Err(TryPercentFromFloatError(()))
|
Err(TryPercentFromFloatError(()))
|
||||||
} else {
|
} else {
|
||||||
|
@ -689,6 +700,7 @@ impl TryFrom<f32> for Percent {
|
||||||
type Error = TryPercentFromFloatError;
|
type Error = TryPercentFromFloatError;
|
||||||
|
|
||||||
fn try_from(v: f32) -> Result<Self, Self::Error> {
|
fn try_from(v: f32) -> Result<Self, Self::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
if v < 0.0 || v > 1.0 {
|
if v < 0.0 || v > 1.0 {
|
||||||
Err(TryPercentFromFloatError(()))
|
Err(TryPercentFromFloatError(()))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -24,6 +24,7 @@ macro_rules! impl_ser_de(
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for $t {
|
impl<'de> Deserialize<'de> for $t {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
Option::<u64>::deserialize(deserializer).map($t)
|
Option::<u64>::deserialize(deserializer).map($t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +43,7 @@ impl Serialize for Undefined {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Undefined {
|
impl<'de> Deserialize<'de> for Undefined {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
i64::deserialize(deserializer).map(Undefined)
|
i64::deserialize(deserializer).map(Undefined)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +56,7 @@ impl Serialize for Percent {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Percent {
|
impl<'de> Deserialize<'de> for Percent {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
Option::<u32>::deserialize(deserializer).map(Percent)
|
Option::<u32>::deserialize(deserializer).map(Percent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,7 @@ pub fn calculate_linear_regression(
|
||||||
xy: &[(u64, u64)],
|
xy: &[(u64, u64)],
|
||||||
temp: Option<&mut [(u64, u64)]>,
|
temp: Option<&mut [(u64, u64)]>,
|
||||||
) -> Option<(u64, u64, u64, u64, f64)> {
|
) -> Option<(u64, u64, u64, u64, f64)> {
|
||||||
|
skip_assert_initialized!();
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -178,6 +178,7 @@ where
|
||||||
for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static,
|
for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static,
|
||||||
{
|
{
|
||||||
pub fn new<I: IteratorImpl<T>>(imp: I) -> Self {
|
pub fn new<I: IteratorImpl<T>>(imp: I) -> Self {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
static DUMMY_COOKIE: u32 = 0;
|
static DUMMY_COOKIE: u32 = 0;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -208,6 +209,7 @@ where
|
||||||
for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Clone + Send + 'static,
|
for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Clone + Send + 'static,
|
||||||
{
|
{
|
||||||
pub fn from_vec(items: Vec<T>) -> Self {
|
pub fn from_vec(items: Vec<T>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
Self::new(VecIteratorImpl::new(items))
|
Self::new(VecIteratorImpl::new(items))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,6 +293,7 @@ where
|
||||||
for<'a> T: StaticType + ToValue + FromValueOptional<'a> + Clone + Send + 'static,
|
for<'a> T: StaticType + ToValue + FromValueOptional<'a> + Clone + Send + 'static,
|
||||||
{
|
{
|
||||||
fn new(items: Vec<T>) -> Self {
|
fn new(items: Vec<T>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
Self { pos: 0, items }
|
Self { pos: 0, items }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -616,6 +619,7 @@ pub struct StdIterator<T> {
|
||||||
|
|
||||||
impl<T> StdIterator<T> {
|
impl<T> StdIterator<T> {
|
||||||
fn new(inner: Iterator<T>) -> Self {
|
fn new(inner: Iterator<T>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
Self { inner, error: None }
|
Self { inner, error: None }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ pub struct DebugCategory(ptr::NonNull<gst_sys::GstDebugCategory>);
|
||||||
|
|
||||||
impl DebugCategory {
|
impl DebugCategory {
|
||||||
pub fn new(name: &str, color: ::DebugColorFlags, description: Option<&str>) -> DebugCategory {
|
pub fn new(name: &str, color: ::DebugColorFlags, description: Option<&str>) -> DebugCategory {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn _gst_debug_category_new(
|
fn _gst_debug_category_new(
|
||||||
name: *const c_char,
|
name: *const c_char,
|
||||||
|
@ -72,6 +73,7 @@ impl DebugCategory {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(name: &str) -> Option<DebugCategory> {
|
pub fn get(name: &str) -> Option<DebugCategory> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn _gst_debug_get_category(name: *const c_char) -> *mut gst_sys::GstDebugCategory;
|
fn _gst_debug_get_category(name: *const c_char) -> *mut gst_sys::GstDebugCategory;
|
||||||
|
@ -364,6 +366,7 @@ where
|
||||||
+ Sync
|
+ Sync
|
||||||
+ 'static,
|
+ 'static,
|
||||||
{
|
{
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let user_data = Box::new(function);
|
let user_data = Box::new(function);
|
||||||
let user_data_ptr = Box::into_raw(user_data) as gpointer;
|
let user_data_ptr = Box::into_raw(user_data) as gpointer;
|
||||||
|
@ -377,12 +380,14 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn debug_remove_default_log_function() {
|
pub fn debug_remove_default_log_function() {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_sys::gst_debug_remove_log_function(Some(gst_sys::gst_debug_log_default));
|
gst_sys::gst_debug_remove_log_function(Some(gst_sys::gst_debug_log_default));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn debug_remove_log_function(log_fn: DebugLogFunction) {
|
pub fn debug_remove_log_function(log_fn: DebugLogFunction) {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let removed = gst_sys::gst_debug_remove_log_function_by_data(log_fn.0.as_ptr());
|
let removed = gst_sys::gst_debug_remove_log_function_by_data(log_fn.0.as_ptr());
|
||||||
assert_eq!(removed, 1);
|
assert_eq!(removed, 1);
|
||||||
|
|
|
@ -65,6 +65,7 @@ impl Memory {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_size(size: usize) -> Self {
|
pub fn with_size(size: usize) -> Self {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(gst_sys::gst_allocator_alloc(
|
from_glib_full(gst_sys::gst_allocator_alloc(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
|
@ -75,6 +76,7 @@ impl Memory {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_size_and_params(size: usize, params: &AllocationParams) -> Self {
|
pub fn with_size_and_params(size: usize, params: &AllocationParams) -> Self {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(gst_sys::gst_allocator_alloc(
|
from_glib_full(gst_sys::gst_allocator_alloc(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
|
|
|
@ -264,6 +264,7 @@ unsafe impl Sync for ParentBufferMeta {}
|
||||||
|
|
||||||
impl ParentBufferMeta {
|
impl ParentBufferMeta {
|
||||||
pub fn add<'a>(buffer: &'a mut BufferRef, parent: &Buffer) -> MetaRefMut<'a, Self, Standalone> {
|
pub fn add<'a>(buffer: &'a mut BufferRef, parent: &Buffer) -> MetaRefMut<'a, Self, Standalone> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let meta = gst_sys::gst_buffer_add_parent_buffer_meta(
|
let meta = gst_sys::gst_buffer_add_parent_buffer_meta(
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
|
@ -316,6 +317,7 @@ impl ReferenceTimestampMeta {
|
||||||
timestamp: ClockTime,
|
timestamp: ClockTime,
|
||||||
duration: ClockTime,
|
duration: ClockTime,
|
||||||
) -> MetaRefMut<'a, Self, Standalone> {
|
) -> MetaRefMut<'a, Self, Standalone> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let meta = gst_sys::gst_buffer_add_reference_timestamp_meta(
|
let meta = gst_sys::gst_buffer_add_reference_timestamp_meta(
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
|
|
|
@ -25,6 +25,7 @@ pub struct GstRc<T: MiniObject> {
|
||||||
|
|
||||||
impl<T: MiniObject> GstRc<T> {
|
impl<T: MiniObject> GstRc<T> {
|
||||||
pub unsafe fn from_glib_none(ptr: *const T::GstType) -> Self {
|
pub unsafe fn from_glib_none(ptr: *const T::GstType) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
assert!(!ptr.is_null());
|
assert!(!ptr.is_null());
|
||||||
|
|
||||||
gst_sys::gst_mini_object_ref(ptr as *mut gst_sys::GstMiniObject);
|
gst_sys::gst_mini_object_ref(ptr as *mut gst_sys::GstMiniObject);
|
||||||
|
@ -538,6 +539,7 @@ macro_rules! gst_define_mini_object_wrapper(
|
||||||
|
|
||||||
impl From<$crate::GstRc<$ref_name>> for $name {
|
impl From<$crate::GstRc<$ref_name>> for $name {
|
||||||
fn from(rc: $crate::GstRc<$ref_name>) -> $name {
|
fn from(rc: $crate::GstRc<$ref_name>) -> $name {
|
||||||
|
skip_assert_initialized!();
|
||||||
$name(rc)
|
$name(rc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ impl GstParamSpecExt for glib::ParamSpec {
|
||||||
element_spec: &glib::ParamSpec,
|
element_spec: &glib::ParamSpec,
|
||||||
flags: glib::ParamFlags,
|
flags: glib::ParamFlags,
|
||||||
) -> glib::ParamSpec {
|
) -> glib::ParamSpec {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(gst_sys::gst_param_spec_array(
|
from_glib_full(gst_sys::gst_param_spec_array(
|
||||||
name.to_glib_none().0,
|
name.to_glib_none().0,
|
||||||
|
@ -60,6 +61,7 @@ impl GstParamSpecExt for glib::ParamSpec {
|
||||||
default: ::Fraction,
|
default: ::Fraction,
|
||||||
flags: glib::ParamFlags,
|
flags: glib::ParamFlags,
|
||||||
) -> glib::ParamSpec {
|
) -> glib::ParamSpec {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(gst_sys::gst_param_spec_fraction(
|
from_glib_full(gst_sys::gst_param_spec_fraction(
|
||||||
name.to_glib_none().0,
|
name.to_glib_none().0,
|
||||||
|
|
|
@ -44,6 +44,7 @@ impl Promise {
|
||||||
where
|
where
|
||||||
F: FnOnce(Result<&StructureRef, PromiseError>) + Send + 'static,
|
F: FnOnce(Result<&StructureRef, PromiseError>) + Send + 'static,
|
||||||
{
|
{
|
||||||
|
assert_initialized_main_thread!();
|
||||||
let user_data: Box<Option<F>> = Box::new(Some(func));
|
let user_data: Box<Option<F>> = Box::new(Some(func));
|
||||||
|
|
||||||
unsafe extern "C" fn trampoline<
|
unsafe extern "C" fn trampoline<
|
||||||
|
|
|
@ -355,6 +355,7 @@ macro_rules! declare_concrete_query(
|
||||||
|
|
||||||
impl From<$name<Query>> for Query {
|
impl From<$name<Query>> for Query {
|
||||||
fn from(concrete: $name<Query>) -> Self {
|
fn from(concrete: $name<Query>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe { from_glib_none(concrete.0.as_mut_ptr()) }
|
unsafe { from_glib_none(concrete.0.as_mut_ptr()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1319,6 +1320,7 @@ mod tests {
|
||||||
::init().unwrap();
|
::init().unwrap();
|
||||||
|
|
||||||
fn check_mut(query: &mut QueryRef) {
|
fn check_mut(query: &mut QueryRef) {
|
||||||
|
skip_assert_initialized!();
|
||||||
match query.view_mut() {
|
match query.view_mut() {
|
||||||
QueryView::Position(ref mut p) => {
|
QueryView::Position(ref mut p) => {
|
||||||
let pos = p.get_result();
|
let pos = p.get_result();
|
||||||
|
@ -1332,6 +1334,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_ref(query: &QueryRef) {
|
fn check_ref(query: &QueryRef) {
|
||||||
|
skip_assert_initialized!();
|
||||||
match query.view() {
|
match query.view() {
|
||||||
QueryView::Position(ref p) => {
|
QueryView::Position(ref p) => {
|
||||||
let pos = p.get_result();
|
let pos = p.get_result();
|
||||||
|
|
|
@ -46,6 +46,7 @@ struct SampleDe {
|
||||||
|
|
||||||
impl From<SampleDe> for Sample {
|
impl From<SampleDe> for Sample {
|
||||||
fn from(buf_de: SampleDe) -> Self {
|
fn from(buf_de: SampleDe) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
let mut builder = Sample::new();
|
let mut builder = Sample::new();
|
||||||
|
|
||||||
if let Some(buffer) = buf_de.buffer.as_ref() {
|
if let Some(buffer) = buf_de.buffer.as_ref() {
|
||||||
|
@ -74,6 +75,7 @@ impl From<SampleDe> for Sample {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Sample {
|
impl<'de> Deserialize<'de> for Sample {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
SampleDe::deserialize(deserializer).map(|sample_de| sample_de.into())
|
SampleDe::deserialize(deserializer).map(|sample_de| sample_de.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ impl<T: FormattedValue> Serialize for FormattedSegment<T> {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Segment {
|
impl<'de> Deserialize<'de> for Segment {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
FormattedSegmentSerde::deserialize(deserializer).map(|fmt_seg_de| {
|
FormattedSegmentSerde::deserialize(deserializer).map(|fmt_seg_de| {
|
||||||
let mut segment = Self::new();
|
let mut segment = Self::new();
|
||||||
segment.set_flags(fmt_seg_de.flags);
|
segment.set_flags(fmt_seg_de.flags);
|
||||||
|
@ -98,6 +99,7 @@ impl<'de> Deserialize<'de> for Segment {
|
||||||
|
|
||||||
impl<'de, T: FormattedValue + SpecificFormattedValue> Deserialize<'de> for FormattedSegment<T> {
|
impl<'de, T: FormattedValue + SpecificFormattedValue> Deserialize<'de> for FormattedSegment<T> {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
Segment::deserialize(deserializer).and_then(|segment| {
|
Segment::deserialize(deserializer).and_then(|segment| {
|
||||||
segment.downcast::<T>().map_err(|segment| {
|
segment.downcast::<T>().map_err(|segment| {
|
||||||
de::Error::custom(format!(
|
de::Error::custom(format!(
|
||||||
|
|
|
@ -44,10 +44,12 @@ pub enum GetError<'name> {
|
||||||
|
|
||||||
impl<'name> GetError<'name> {
|
impl<'name> GetError<'name> {
|
||||||
fn new_field_not_found(name: &'name str) -> GetError {
|
fn new_field_not_found(name: &'name str) -> GetError {
|
||||||
|
skip_assert_initialized!();
|
||||||
GetError::FieldNotFound { name }
|
GetError::FieldNotFound { name }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_value_get_error(name: &'name str, value_get_error: glib::value::GetError) -> GetError {
|
fn from_value_get_error(name: &'name str, value_get_error: glib::value::GetError) -> GetError {
|
||||||
|
skip_assert_initialized!();
|
||||||
GetError::ValueGetError {
|
GetError::ValueGetError {
|
||||||
name,
|
name,
|
||||||
value_get_error,
|
value_get_error,
|
||||||
|
@ -713,6 +715,7 @@ pub struct Builder {
|
||||||
|
|
||||||
impl Builder {
|
impl Builder {
|
||||||
fn new(name: &str) -> Self {
|
fn new(name: &str) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
Builder {
|
Builder {
|
||||||
s: Structure::new_empty(name),
|
s: Structure::new_empty(name),
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,7 @@ impl Serialize for Structure {
|
||||||
struct FieldDe(String, SendValue);
|
struct FieldDe(String, SendValue);
|
||||||
impl From<FieldDe> for (String, glib::SendValue) {
|
impl From<FieldDe> for (String, glib::SendValue) {
|
||||||
fn from(field_de: FieldDe) -> Self {
|
fn from(field_de: FieldDe) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
(field_de.0, field_de.1.into())
|
(field_de.0, field_de.1.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,6 +106,7 @@ impl<'de> Visitor<'de> for FieldVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for FieldDe {
|
impl<'de> Deserialize<'de> for FieldDe {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_tuple(3, FieldVisitor)
|
deserializer.deserialize_tuple(3, FieldVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,6 +135,7 @@ impl<'de, 'a> DeserializeSeed<'de> for FieldsDe<'a> {
|
||||||
type Value = ();
|
type Value = ();
|
||||||
|
|
||||||
fn deserialize<D: Deserializer<'de>>(self, deserializer: D) -> Result<(), D::Error> {
|
fn deserialize<D: Deserializer<'de>>(self, deserializer: D) -> Result<(), D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_seq(FieldsVisitor(self.0))
|
deserializer.deserialize_seq(FieldsVisitor(self.0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,6 +162,7 @@ impl<'de> Visitor<'de> for StructureVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Structure {
|
impl<'de> Deserialize<'de> for Structure {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_tuple(2, StructureVisitor)
|
deserializer.deserialize_tuple(2, StructureVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -789,14 +789,17 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
|
||||||
impl<'a> ExactSizeIterator for Iter<'a> {}
|
impl<'a> ExactSizeIterator for Iter<'a> {}
|
||||||
|
|
||||||
pub fn tag_exists(name: &str) -> bool {
|
pub fn tag_exists(name: &str) -> bool {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe { from_glib(gst_sys::gst_tag_exists(name.to_glib_none().0)) }
|
unsafe { from_glib(gst_sys::gst_tag_exists(name.to_glib_none().0)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tag_get_type(name: &str) -> glib::Type {
|
pub fn tag_get_type(name: &str) -> glib::Type {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe { from_glib(gst_sys::gst_tag_get_type(name.to_glib_none().0)) }
|
unsafe { from_glib(gst_sys::gst_tag_get_type(name.to_glib_none().0)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tag_get_nick(name: &str) -> Option<&'static str> {
|
pub fn tag_get_nick(name: &str) -> Option<&'static str> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = gst_sys::gst_tag_get_nick(name.to_glib_none().0);
|
let ptr = gst_sys::gst_tag_get_nick(name.to_glib_none().0);
|
||||||
|
|
||||||
|
@ -809,6 +812,7 @@ pub fn tag_get_nick(name: &str) -> Option<&'static str> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tag_get_description(name: &str) -> Option<&'static str> {
|
pub fn tag_get_description(name: &str) -> Option<&'static str> {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = gst_sys::gst_tag_get_description(name.to_glib_none().0);
|
let ptr = gst_sys::gst_tag_get_description(name.to_glib_none().0);
|
||||||
|
|
||||||
|
@ -821,6 +825,7 @@ pub fn tag_get_description(name: &str) -> Option<&'static str> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tag_get_flag(name: &str) -> ::TagFlag {
|
pub fn tag_get_flag(name: &str) -> ::TagFlag {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe { from_glib(gst_sys::gst_tag_get_flag(name.to_glib_none().0)) }
|
unsafe { from_glib(gst_sys::gst_tag_get_flag(name.to_glib_none().0)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,6 +835,7 @@ pub trait CustomTag<'a>: Tag<'a> {
|
||||||
const DESCRIPTION: &'static str;
|
const DESCRIPTION: &'static str;
|
||||||
|
|
||||||
fn merge_func(src: &Value) -> Value {
|
fn merge_func(src: &Value) -> Value {
|
||||||
|
skip_assert_initialized!();
|
||||||
merge_use_first(src)
|
merge_use_first(src)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -857,6 +863,7 @@ pub fn register<T: for<'a> CustomTag<'a>>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn merge_use_first(src: &Value) -> Value {
|
pub fn merge_use_first(src: &Value) -> Value {
|
||||||
|
skip_assert_initialized!();
|
||||||
assert_eq!(src.type_(), ::List::static_type());
|
assert_eq!(src.type_(), ::List::static_type());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -869,6 +876,7 @@ pub fn merge_use_first(src: &Value) -> Value {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn merge_strings_with_comma(src: &Value) -> Value {
|
pub fn merge_strings_with_comma(src: &Value) -> Value {
|
||||||
|
skip_assert_initialized!();
|
||||||
assert_eq!(src.type_(), ::List::static_type());
|
assert_eq!(src.type_(), ::List::static_type());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -1064,6 +1072,7 @@ mod tests {
|
||||||
const DESCRIPTION: &'static str = "My own custom tag type for testing";
|
const DESCRIPTION: &'static str = "My own custom tag type for testing";
|
||||||
|
|
||||||
fn merge_func(src: &Value) -> Value {
|
fn merge_func(src: &Value) -> Value {
|
||||||
|
skip_assert_initialized!();
|
||||||
merge_strings_with_comma(src)
|
merge_strings_with_comma(src)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ macro_rules! ser_opt_tag (
|
||||||
struct TagValuesSer<'a>(Rc<RefCell<GenericTagIter<'a>>>);
|
struct TagValuesSer<'a>(Rc<RefCell<GenericTagIter<'a>>>);
|
||||||
impl<'a> TagValuesSer<'a> {
|
impl<'a> TagValuesSer<'a> {
|
||||||
fn from(tags_ser: &TagsSer<'a>) -> Self {
|
fn from(tags_ser: &TagsSer<'a>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
TagValuesSer(Rc::clone(&tags_ser.1))
|
TagValuesSer(Rc::clone(&tags_ser.1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +108,7 @@ impl<'a> Serialize for TagValuesSer<'a> {
|
||||||
struct TagsSer<'a>(&'a str, Rc<RefCell<GenericTagIter<'a>>>);
|
struct TagsSer<'a>(&'a str, Rc<RefCell<GenericTagIter<'a>>>);
|
||||||
impl<'a> TagsSer<'a> {
|
impl<'a> TagsSer<'a> {
|
||||||
fn new(name: &'a str, tag_iter: GenericTagIter<'a>) -> Self {
|
fn new(name: &'a str, tag_iter: GenericTagIter<'a>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
TagsSer(name, Rc::new(RefCell::new(tag_iter)))
|
TagsSer(name, Rc::new(RefCell::new(tag_iter)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,6 +240,7 @@ impl<'de, 'a> DeserializeSeed<'de> for TagValues<'a> {
|
||||||
type Value = ();
|
type Value = ();
|
||||||
|
|
||||||
fn deserialize<D: Deserializer<'de>>(self, deserializer: D) -> Result<(), D::Error> {
|
fn deserialize<D: Deserializer<'de>>(self, deserializer: D) -> Result<(), D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_seq(TagValuesVisitor(self.0, self.1))
|
deserializer.deserialize_seq(TagValuesVisitor(self.0, self.1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,6 +270,7 @@ impl<'de, 'a> DeserializeSeed<'de> for TagValuesTuple<'a> {
|
||||||
type Value = ();
|
type Value = ();
|
||||||
|
|
||||||
fn deserialize<D: Deserializer<'de>>(self, deserializer: D) -> Result<(), D::Error> {
|
fn deserialize<D: Deserializer<'de>>(self, deserializer: D) -> Result<(), D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_tuple(2, TagValuesTupleVisitor(self.0))
|
deserializer.deserialize_tuple(2, TagValuesTupleVisitor(self.0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,6 +299,7 @@ impl<'de> Visitor<'de> for TagsVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for TagsDe {
|
impl<'de> Deserialize<'de> for TagsDe {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_seq(TagsVisitor)
|
deserializer.deserialize_seq(TagsVisitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -307,6 +312,7 @@ struct TagListDe {
|
||||||
|
|
||||||
impl From<TagListDe> for TagList {
|
impl From<TagListDe> for TagList {
|
||||||
fn from(tag_list_de: TagListDe) -> Self {
|
fn from(tag_list_de: TagListDe) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
let mut tag_list = tag_list_de.tags.0;
|
let mut tag_list = tag_list_de.tags.0;
|
||||||
tag_list.get_mut().unwrap().set_scope(tag_list_de.scope);
|
tag_list.get_mut().unwrap().set_scope(tag_list_de.scope);
|
||||||
|
|
||||||
|
@ -316,6 +322,7 @@ impl From<TagListDe> for TagList {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for TagList {
|
impl<'de> Deserialize<'de> for TagList {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
TagListDe::deserialize(deserializer).map(|tag_list_de| tag_list_de.into())
|
TagListDe::deserialize(deserializer).map(|tag_list_de| tag_list_de.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ struct TocDe {
|
||||||
|
|
||||||
impl From<TocDe> for Toc {
|
impl From<TocDe> for Toc {
|
||||||
fn from(mut toc_de: TocDe) -> Self {
|
fn from(mut toc_de: TocDe) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
let mut toc = Toc::new(toc_de.scope);
|
let mut toc = Toc::new(toc_de.scope);
|
||||||
{
|
{
|
||||||
let toc = toc.get_mut().unwrap();
|
let toc = toc.get_mut().unwrap();
|
||||||
|
@ -76,6 +77,7 @@ impl From<TocDe> for Toc {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Toc {
|
impl<'de> Deserialize<'de> for Toc {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
TocDe::deserialize(deserializer).map(|toc_de| toc_de.into())
|
TocDe::deserialize(deserializer).map(|toc_de| toc_de.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,6 +95,7 @@ struct TocEntryDe {
|
||||||
|
|
||||||
impl From<TocEntryDe> for TocEntry {
|
impl From<TocEntryDe> for TocEntry {
|
||||||
fn from(mut toc_entry_de: TocEntryDe) -> Self {
|
fn from(mut toc_entry_de: TocEntryDe) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
let mut toc_entry = TocEntry::new(toc_entry_de.entry_type, toc_entry_de.uid.as_str());
|
let mut toc_entry = TocEntry::new(toc_entry_de.entry_type, toc_entry_de.uid.as_str());
|
||||||
{
|
{
|
||||||
let toc_entry = toc_entry.get_mut().unwrap();
|
let toc_entry = toc_entry.get_mut().unwrap();
|
||||||
|
@ -117,6 +120,7 @@ impl From<TocEntryDe> for TocEntry {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for TocEntry {
|
impl<'de> Deserialize<'de> for TocEntry {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
TocEntryDe::deserialize(deserializer).map(|toc_entry_de| toc_entry_de.into())
|
TocEntryDe::deserialize(deserializer).map(|toc_entry_de| toc_entry_de.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ impl<'a> TypeFind<'a> {
|
||||||
where
|
where
|
||||||
F: Fn(&mut TypeFind) + Send + Sync + 'static,
|
F: Fn(&mut TypeFind) + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
|
assert_initialized_main_thread!();
|
||||||
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);
|
||||||
|
@ -160,6 +161,7 @@ pub struct SliceTypeFind<T: AsRef<[u8]>> {
|
||||||
|
|
||||||
impl<T: AsRef<[u8]>> SliceTypeFind<T> {
|
impl<T: AsRef<[u8]>> SliceTypeFind<T> {
|
||||||
pub fn new(data: T) -> SliceTypeFind<T> {
|
pub fn new(data: T) -> SliceTypeFind<T> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
SliceTypeFind {
|
SliceTypeFind {
|
||||||
probability: None,
|
probability: None,
|
||||||
caps: None,
|
caps: None,
|
||||||
|
@ -181,6 +183,7 @@ impl<T: AsRef<[u8]>> SliceTypeFind<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn type_find(data: T) -> (TypeFindProbability, Option<Caps>) {
|
pub fn type_find(data: T) -> (TypeFindProbability, Option<Caps>) {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
let mut t = SliceTypeFind {
|
let mut t = SliceTypeFind {
|
||||||
probability: None,
|
probability: None,
|
||||||
caps: None,
|
caps: None,
|
||||||
|
|
|
@ -15,6 +15,7 @@ pub struct MutexGuard<'a>(&'a glib_sys::GMutex);
|
||||||
impl<'a> MutexGuard<'a> {
|
impl<'a> MutexGuard<'a> {
|
||||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||||
pub fn lock(mutex: &'a glib_sys::GMutex) -> Self {
|
pub fn lock(mutex: &'a glib_sys::GMutex) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib_sys::g_mutex_lock(mut_override(mutex));
|
glib_sys::g_mutex_lock(mut_override(mutex));
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ impl<'a> Serialize for Fraction {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Fraction {
|
impl<'de> Deserialize<'de> for Fraction {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
Rational32::deserialize(deserializer)
|
Rational32::deserialize(deserializer)
|
||||||
.map(|rational| Fraction::new(*rational.numer(), *rational.denom()))
|
.map(|rational| Fraction::new(*rational.numer(), *rational.denom()))
|
||||||
}
|
}
|
||||||
|
@ -143,12 +144,14 @@ macro_rules! ser_value (
|
||||||
pub(crate) struct SendValue(glib::SendValue);
|
pub(crate) struct SendValue(glib::SendValue);
|
||||||
impl SendValue {
|
impl SendValue {
|
||||||
pub(crate) fn from(send_value: glib::SendValue) -> Self {
|
pub(crate) fn from(send_value: glib::SendValue) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
SendValue(send_value)
|
SendValue(send_value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<SendValue> for glib::SendValue {
|
impl From<SendValue> for glib::SendValue {
|
||||||
fn from(send_value: SendValue) -> Self {
|
fn from(send_value: SendValue) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
send_value.0
|
send_value.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,6 +282,7 @@ impl<'de> Visitor<'de> for SendValueVisitor {
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for SendValue {
|
impl<'de> Deserialize<'de> for SendValue {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
deserializer.deserialize_tuple(2, SendValueVisitor {})
|
deserializer.deserialize_tuple(2, SendValueVisitor {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,6 +291,7 @@ macro_rules! impl_de_send_value_collection (
|
||||||
($t:ident) => {
|
($t:ident) => {
|
||||||
impl<'a, 'de> Deserialize<'de> for $t<'a> {
|
impl<'a, 'de> Deserialize<'de> for $t<'a> {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
skip_assert_initialized!();
|
||||||
let send_value_vec = Vec::<SendValue>::deserialize(deserializer)?;
|
let send_value_vec = Vec::<SendValue>::deserialize(deserializer)?;
|
||||||
Ok($t::from_owned(unsafe{
|
Ok($t::from_owned(unsafe{
|
||||||
mem::transmute::<Vec<SendValue>, Vec<glib::SendValue>>(send_value_vec)
|
mem::transmute::<Vec<SendValue>, Vec<glib::SendValue>>(send_value_vec)
|
||||||
|
|
Loading…
Reference in a new issue