gstreamer: Implement glib::HasParamSpec for our custom pspecs

This allows using `gst::Fraction` / `gst::Array` properties via the new
properties macro.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1213>
This commit is contained in:
Sebastian Dröge 2023-02-06 15:21:02 +02:00
parent 91eec7a33f
commit 172e22c4b3

View file

@ -28,6 +28,17 @@ impl std::ops::Deref for ParamSpecFraction {
unsafe impl glib::ParamSpecType for ParamSpecFraction {} unsafe impl glib::ParamSpecType for ParamSpecFraction {}
impl glib::HasParamSpec for crate::Fraction {
type ParamSpec = ParamSpecFraction;
type SetValue = crate::Fraction;
type BuilderFn = for<'a> fn(&'a str) -> ParamSpecFractionBuilder;
fn param_spec_builder() -> Self::BuilderFn {
ParamSpecFraction::builder
}
}
#[doc(hidden)] #[doc(hidden)]
impl FromGlibPtrFull<*mut gobject_ffi::GParamSpec> for ParamSpecFraction { impl FromGlibPtrFull<*mut gobject_ffi::GParamSpec> for ParamSpecFraction {
#[inline] #[inline]
@ -228,6 +239,17 @@ impl std::ops::Deref for ParamSpecArray {
unsafe impl glib::ParamSpecType for ParamSpecArray {} unsafe impl glib::ParamSpecType for ParamSpecArray {}
impl glib::HasParamSpec for crate::Array {
type ParamSpec = ParamSpecArray;
type SetValue = crate::Array;
type BuilderFn = for<'a> fn(&'a str) -> ParamSpecArrayBuilder;
fn param_spec_builder() -> Self::BuilderFn {
ParamSpecArray::builder
}
}
#[doc(hidden)] #[doc(hidden)]
impl FromGlibPtrFull<*mut gobject_ffi::GParamSpec> for ParamSpecArray { impl FromGlibPtrFull<*mut gobject_ffi::GParamSpec> for ParamSpecArray {
#[inline] #[inline]