diff --git a/Gir_GstPbutils.toml b/Gir_GstPbutils.toml index 70c756842..1a047c22a 100644 --- a/Gir_GstPbutils.toml +++ b/Gir_GstPbutils.toml @@ -170,6 +170,10 @@ status = "generate" pattern = "set_.*" ignore = true + [[object.function]] + pattern = "get_restriction" + ignore = true + [[object.function]] name = "copy" [object.function.return] diff --git a/gstreamer-pbutils/src/auto/encoding_profile.rs b/gstreamer-pbutils/src/auto/encoding_profile.rs index 2d8d9e40c..55ea5b111 100644 --- a/gstreamer-pbutils/src/auto/encoding_profile.rs +++ b/gstreamer-pbutils/src/auto/encoding_profile.rs @@ -72,8 +72,6 @@ pub trait EncodingProfileExt: 'static { fn get_preset_name(&self) -> Option; - fn get_restriction(&self) -> Option; - fn get_type_nick(&self) -> Option; fn is_enabled(&self) -> bool; @@ -163,14 +161,6 @@ impl> EncodingProfileExt for O { } } - fn get_restriction(&self) -> Option { - unsafe { - from_glib_full(gst_pbutils_sys::gst_encoding_profile_get_restriction( - self.as_ref().to_glib_none().0, - )) - } - } - fn get_type_nick(&self) -> Option { unsafe { from_glib_none(gst_pbutils_sys::gst_encoding_profile_get_type_nick( diff --git a/gstreamer-pbutils/src/encoding_profile.rs b/gstreamer-pbutils/src/encoding_profile.rs index 6385ea1e6..8ddb6e27e 100644 --- a/gstreamer-pbutils/src/encoding_profile.rs +++ b/gstreamer-pbutils/src/encoding_profile.rs @@ -121,6 +121,10 @@ trait EncodingProfileHasRestrictionSetter { fn set_restriction(&self, restriction: Option<&gst::Caps>); } +pub trait EncodingProfileHasRestrictionGetter { + fn get_restriction(&self) -> Option; +} + macro_rules! declare_encoding_profile_has_restriction( ($name:ident) => { impl EncodingProfileHasRestrictionSetter for $name { @@ -140,6 +144,18 @@ macro_rules! declare_encoding_profile_has_restriction( } } } + + impl EncodingProfileHasRestrictionGetter for $name { + fn get_restriction(&self) -> Option { + let profile: &EncodingProfile = glib::object::Cast::upcast_ref(self); + + unsafe { + from_glib_full(gst_pbutils_sys::gst_encoding_profile_get_restriction( + profile.to_glib_none().0, + )) + } + } + } } ); @@ -660,7 +676,6 @@ mod tests { assert_eq!(profile.get_format(), container_caps); assert_eq!(profile.get_preset().unwrap(), PRESET); assert_eq!(profile.get_preset_name().unwrap(), PRESET_NAME); - assert_eq!(profile.get_restriction(), None); assert_eq!(profile.get_presence(), PRESENCE); assert_eq!(profile.get_allow_dynamic_output(), ALLOW_DYNAMIC_OUTPUT); assert_eq!(profile.is_enabled(), ENABLED); diff --git a/gstreamer-pbutils/src/lib.rs b/gstreamer-pbutils/src/lib.rs index 9a24090b5..7fe45e5e1 100644 --- a/gstreamer-pbutils/src/lib.rs +++ b/gstreamer-pbutils/src/lib.rs @@ -66,7 +66,7 @@ pub mod prelude { pub use gst::prelude::*; pub use auto::traits::*; - pub use encoding_profile::EncodingProfileBuilder; + pub use encoding_profile::{EncodingProfileBuilder, EncodingProfileHasRestrictionGetter}; pub use functions::CodecTag; }