diff --git a/gstreamer-audio/src/audio_format.rs b/gstreamer-audio/src/audio_format.rs index 0030e8730..2cdd6647c 100644 --- a/gstreamer-audio/src/audio_format.rs +++ b/gstreamer-audio/src/audio_format.rs @@ -141,17 +141,15 @@ impl str::FromStr for crate::AudioFormat { type Err = glib::BoolError; fn from_str(s: &str) -> Result { - assert_initialized_main_thread!(); + skip_assert_initialized!(); - unsafe { - let fmt = Self::from_glib(ffi::gst_audio_format_from_string(s.to_glib_none().0)); - if fmt == Self::Unknown { - Err(glib::glib_bool_error!( - "Failed to parse audio format from string" - )) - } else { - Ok(fmt) - } + let fmt = Self::from_string(s); + if fmt == Self::Unknown { + Err(glib::glib_bool_error!( + "Failed to parse audio format from string" + )) + } else { + Ok(fmt) } } } diff --git a/gstreamer-video/src/video_format.rs b/gstreamer-video/src/video_format.rs index fb70d6dac..7dbc190b1 100644 --- a/gstreamer-video/src/video_format.rs +++ b/gstreamer-video/src/video_format.rs @@ -336,18 +336,15 @@ impl str::FromStr for crate::VideoFormat { type Err = glib::BoolError; fn from_str(s: &str) -> Result { - assert_initialized_main_thread!(); + skip_assert_initialized!(); - unsafe { - let fmt = Self::from_glib(ffi::gst_video_format_from_string(s.to_glib_none().0)); - - if fmt == Self::Unknown { - Err(glib::glib_bool_error!( - "Failed to parse video format from string" - )) - } else { - Ok(fmt) - } + let fmt = Self::from_string(s); + if fmt == Self::Unknown { + Err(glib::glib_bool_error!( + "Failed to parse video format from string" + )) + } else { + Ok(fmt) } } } diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index 02a3e66c1..689b222cb 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -956,12 +956,15 @@ impl str::FromStr for crate::VideoFieldOrder { type Err = glib::error::BoolError; fn from_str(s: &str) -> Result { - assert_initialized_main_thread!(); + skip_assert_initialized!(); - unsafe { - Ok(from_glib(ffi::gst_video_field_order_from_string( - s.to_glib_none().0, - ))) + let fmt = Self::from_string(s); + if fmt == Self::Unknown { + Err(glib::glib_bool_error!( + "Failed to parse video field order from string" + )) + } else { + Ok(fmt) } } } @@ -970,13 +973,10 @@ impl str::FromStr for crate::VideoInterlaceMode { type Err = glib::error::BoolError; fn from_str(s: &str) -> Result { - assert_initialized_main_thread!(); + skip_assert_initialized!(); - unsafe { - Ok(from_glib(ffi::gst_video_interlace_mode_from_string( - s.to_glib_none().0, - ))) - } + let fmt = Self::from_string(s); + Ok(fmt) } }