mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
gstreamer: Move initialization panic into a separate function
This keeps the number of duplicated panics all over the codebase lower and reduces generated code size. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1184>
This commit is contained in:
parent
7b279b9d6c
commit
ba1d8c5ce6
24 changed files with 58 additions and 133 deletions
|
@ -12,12 +12,7 @@ pub use gst;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,14 @@ pub use glib;
|
||||||
pub use gst;
|
pub use gst;
|
||||||
pub use gst_base;
|
pub use gst_base;
|
||||||
|
|
||||||
|
macro_rules! assert_initialized_main_thread {
|
||||||
|
() => {
|
||||||
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
|
gst::assert_initialized();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! skip_assert_initialized {
|
macro_rules! skip_assert_initialized {
|
||||||
() => {};
|
() => {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,7 @@ pub use gst_base;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,7 @@ pub use gst;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,7 @@ pub use gst;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,7 @@ pub use gst;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,12 +39,7 @@ pub unsafe fn deinit() {
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
crate::GES_INIT.call_once(|| {
|
crate::GES_INIT.call_once(|| {
|
||||||
unsafe { ffi::ges_init() };
|
unsafe { ffi::ges_init() };
|
||||||
|
|
|
@ -15,8 +15,8 @@ pub use gst_gl;
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
gst::assert_initialized();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,7 @@ pub use gst_video;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ pub use gst_gl;
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
gst::assert_initialized();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ pub use gst_gl;
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
gst::assert_initialized();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,7 @@ static MPEGTS_INIT: Once = Once::new();
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
crate::MPEGTS_INIT.call_once(|| unsafe { ffi::gst_mpegts_initialize() });
|
crate::MPEGTS_INIT.call_once(|| unsafe { ffi::gst_mpegts_initialize() });
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,12 +12,7 @@ pub use gst;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,7 @@ static PBUTILS_INIT: Once = Once::new();
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
crate::PBUTILS_INIT.call_once(|| {
|
crate::PBUTILS_INIT.call_once(|| {
|
||||||
unsafe { ffi::gst_pb_utils_init() };
|
unsafe { ffi::gst_pb_utils_init() };
|
||||||
|
|
|
@ -16,12 +16,7 @@ macro_rules! skip_assert_initialized {
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,7 @@ macro_rules! skip_assert_initialized {
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,7 @@ pub use gst;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,7 @@ pub use gst_sdp;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,7 @@ pub use gst_sdp;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,7 @@ pub use gst;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,25 +8,25 @@
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
|
pub static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
|
||||||
|
|
||||||
|
#[cold]
|
||||||
|
#[inline(never)]
|
||||||
|
#[track_caller]
|
||||||
|
pub fn assert_initialized() {
|
||||||
|
if unsafe { ffi::gst_validate_is_initialized() } != glib::ffi::GTRUE {
|
||||||
|
panic!("GStreamer Validate has not been initialized. Call `gst_validate::init` first.");
|
||||||
|
} else {
|
||||||
|
crate::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !crate::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !crate::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
if unsafe { ffi::gst_validate_is_initialized() } != glib::ffi::GTRUE {
|
$crate::assert_initialized();
|
||||||
panic!(
|
|
||||||
"GStreamer Validate has not been initialized. Call `gst_validate::init` first."
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
crate::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,7 @@ pub use gst_base;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,7 @@ pub use gst_sdp;
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
gst::assert_initialized();
|
||||||
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,15 +15,22 @@ pub use paste;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
|
pub static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
|
||||||
|
|
||||||
|
#[cold]
|
||||||
|
#[inline(never)]
|
||||||
|
#[track_caller]
|
||||||
|
pub fn assert_initialized() {
|
||||||
|
#[allow(unused_unsafe)]
|
||||||
|
if unsafe { ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
||||||
|
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
||||||
|
} else {
|
||||||
|
crate::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if !crate::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
if !crate::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
#[allow(unused_unsafe)]
|
$crate::assert_initialized();
|
||||||
if unsafe { ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
|
||||||
} else {
|
|
||||||
crate::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue