gstreamer: Switch from paste to pastey

The former is no longer maintained, the latter is a compatible fork.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/557

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1779>
This commit is contained in:
Sebastian Dröge 2025-08-25 11:04:46 +03:00
parent ccca1db3fb
commit af52800887
4 changed files with 38 additions and 4 deletions

8
Cargo.lock generated
View file

@ -894,7 +894,7 @@ dependencies = [
"num-integer",
"num-rational",
"option-operations",
"paste",
"pastey",
"pin-project-lite",
"ron",
"serde",
@ -2268,6 +2268,12 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pastey"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
[[package]]
name = "percent-encoding"
version = "2.3.1"

View file

@ -29,7 +29,7 @@ muldiv = "1"
opt-ops = { package = "option-operations", version = "0.5" }
serde = { version = "1.0", optional = true, features = ["derive"] }
serde_bytes = { version = "0.11", optional = true }
paste = "1.0"
pastey = "0.1"
thiserror = "2"
smallvec = { version = "1.0", features = ["write"] }
itertools = "0.14"

View file

@ -9,7 +9,9 @@
// Re-exported for the subclass gst_plugin_define! macro
pub use glib;
pub use gstreamer_sys as ffi;
pub use paste;
#[deprecated = "Use `gst::pastey` instead"]
pub use pastey as paste;
pub use pastey;
#[doc(hidden)]
pub static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);

View file

@ -42,10 +42,12 @@ macro_rules! plugin_define(
// NB: if this looks a lot like `Option`, it is not a coincidence. Alas,
// Option::or is not `const` and neither is `unwrap_or` so we have to roll our
// own oli-obk-ified enum instead.
#[allow(unused)]
enum OptionalPtr<T>{
Null,
Some(*const T),
}
#[allow(unused)]
impl<T: Sized> OptionalPtr<T> {
const fn with(self, value: *const T) -> Self {
Self::Some(value)
@ -84,7 +86,7 @@ macro_rules! plugin_define(
}
}
$crate::paste::item! {
$crate::pastey::item! {
#[no_mangle]
#[allow(clippy::missing_safety_doc)]
pub unsafe extern "C" fn [<gst_plugin_ $name _register>] () {
@ -129,3 +131,27 @@ macro_rules! plugin_define(
pub use self::plugin_desc::plugin_register_static;
};
);
#[cfg(test)]
mod tests {
fn plugin_init(_plugin: &crate::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
crate::plugin_define!(
gst_rs_plugin_test,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
env!("CARGO_PKG_VERSION"),
"MIT/X11",
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY")
);
#[test]
fn plugin_register() {
crate::init().unwrap();
plugin_register_static().unwrap();
}
}