2020-12-15 10:53:31 +00:00
|
|
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
2018-11-29 19:18:06 +00:00
|
|
|
|
2023-01-03 18:58:25 +00:00
|
|
|
use glib::{gobject_ffi, translate::*, ParamSpec};
|
2018-11-29 19:18:06 +00:00
|
|
|
|
2021-11-20 10:17:58 +00:00
|
|
|
glib::wrapper! {
|
|
|
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
|
|
#[doc(alias = "GstParamSpecFraction")]
|
|
|
|
pub struct ParamSpecFraction(Shared<ffi::GstParamSpecFraction>);
|
2018-12-11 10:37:15 +00:00
|
|
|
|
2021-11-20 10:17:58 +00:00
|
|
|
match fn {
|
|
|
|
ref => |ptr| gobject_ffi::g_param_spec_ref_sink(ptr as *mut gobject_ffi::GParamSpec),
|
|
|
|
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
|
|
|
|
type_ => || ffi::gst_param_spec_fraction_get_type(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for ParamSpecFraction {}
|
|
|
|
unsafe impl Sync for ParamSpecFraction {}
|
|
|
|
|
|
|
|
impl std::ops::Deref for ParamSpecFraction {
|
|
|
|
type Target = ParamSpec;
|
|
|
|
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
unsafe { &*(self as *const ParamSpecFraction as *const ParamSpec) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl glib::ParamSpecType for ParamSpecFraction {}
|
|
|
|
|
2023-02-06 13:21:02 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-20 10:17:58 +00:00
|
|
|
#[doc(hidden)]
|
|
|
|
impl FromGlibPtrFull<*mut gobject_ffi::GParamSpec> for ParamSpecFraction {
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
unsafe fn from_glib_full(ptr: *mut gobject_ffi::GParamSpec) -> Self {
|
|
|
|
from_glib_full(ptr as *mut ffi::GstParamSpecFraction)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ParamSpecFraction {
|
2022-02-21 16:14:37 +00:00
|
|
|
pub fn builder(name: &str) -> ParamSpecFractionBuilder {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
ParamSpecFractionBuilder::new(name)
|
|
|
|
}
|
|
|
|
|
2023-01-21 17:44:12 +00:00
|
|
|
#[deprecated = "Use builder() instead"]
|
2021-11-20 10:17:58 +00:00
|
|
|
#[allow(clippy::new_ret_no_self)]
|
|
|
|
#[doc(alias = "gst_param_spec_fraction")]
|
2022-09-04 07:34:05 +00:00
|
|
|
pub fn new<'a>(
|
2018-12-11 10:37:15 +00:00
|
|
|
name: &str,
|
2022-09-04 07:34:05 +00:00
|
|
|
nick: impl Into<Option<&'a str>>,
|
|
|
|
blurb: impl Into<Option<&'a str>>,
|
2020-11-21 13:46:48 +00:00
|
|
|
min: crate::Fraction,
|
|
|
|
max: crate::Fraction,
|
|
|
|
default: crate::Fraction,
|
2018-12-11 10:37:15 +00:00
|
|
|
flags: glib::ParamFlags,
|
2018-11-29 19:18:06 +00:00
|
|
|
) -> glib::ParamSpec {
|
2020-03-22 14:18:47 +00:00
|
|
|
assert_initialized_main_thread!();
|
2023-01-21 17:44:12 +00:00
|
|
|
unsafe { Self::new_unchecked(name, nick, blurb, min, max, default, flags) }
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe fn new_unchecked<'a>(
|
|
|
|
name: &str,
|
|
|
|
nick: impl Into<Option<&'a str>>,
|
|
|
|
blurb: impl Into<Option<&'a str>>,
|
|
|
|
min: crate::Fraction,
|
|
|
|
max: crate::Fraction,
|
|
|
|
default: crate::Fraction,
|
|
|
|
flags: glib::ParamFlags,
|
|
|
|
) -> glib::ParamSpec {
|
2018-11-29 19:18:06 +00:00
|
|
|
unsafe {
|
2021-11-20 10:17:58 +00:00
|
|
|
from_glib_none(ffi::gst_param_spec_fraction(
|
2018-11-29 19:18:06 +00:00
|
|
|
name.to_glib_none().0,
|
2022-09-04 07:34:05 +00:00
|
|
|
nick.into().to_glib_none().0,
|
|
|
|
blurb.into().to_glib_none().0,
|
2021-11-20 10:17:58 +00:00
|
|
|
min.numer(),
|
|
|
|
min.denom(),
|
|
|
|
max.numer(),
|
|
|
|
max.denom(),
|
|
|
|
default.numer(),
|
|
|
|
default.denom(),
|
2021-04-27 15:15:46 +00:00
|
|
|
flags.into_glib(),
|
2018-11-29 19:18:06 +00:00
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
pub fn minimum(&self) -> crate::Fraction {
|
|
|
|
unsafe {
|
2022-10-08 12:35:37 +00:00
|
|
|
let ptr = self.as_ptr();
|
2021-11-20 10:17:58 +00:00
|
|
|
|
|
|
|
crate::Fraction::new((*ptr).min_num, (*ptr).min_den)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
pub fn maximum(&self) -> crate::Fraction {
|
|
|
|
unsafe {
|
2022-10-08 12:35:37 +00:00
|
|
|
let ptr = self.as_ptr();
|
2021-11-20 10:17:58 +00:00
|
|
|
|
|
|
|
crate::Fraction::new((*ptr).max_num, (*ptr).max_den)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
pub fn default_value(&self) -> crate::Fraction {
|
|
|
|
unsafe {
|
2022-10-08 12:35:37 +00:00
|
|
|
let ptr = self.as_ptr();
|
2021-11-20 10:17:58 +00:00
|
|
|
|
|
|
|
crate::Fraction::new((*ptr).def_num, (*ptr).def_den)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
pub fn upcast(self) -> ParamSpec {
|
2022-10-08 12:35:37 +00:00
|
|
|
unsafe {
|
|
|
|
from_glib_full(
|
|
|
|
IntoGlibPtr::<*mut ffi::GstParamSpecFraction>::into_glib_ptr(self)
|
|
|
|
as *mut gobject_ffi::GParamSpec,
|
|
|
|
)
|
|
|
|
}
|
2021-11-20 10:17:58 +00:00
|
|
|
}
|
|
|
|
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
pub fn upcast_ref(&self) -> &ParamSpec {
|
2022-06-30 12:22:30 +00:00
|
|
|
self
|
2021-11-20 10:17:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-21 16:14:37 +00:00
|
|
|
#[derive(Default)]
|
|
|
|
#[must_use]
|
|
|
|
pub struct ParamSpecFractionBuilder<'a> {
|
|
|
|
name: &'a str,
|
|
|
|
nick: Option<&'a str>,
|
|
|
|
blurb: Option<&'a str>,
|
|
|
|
flags: glib::ParamFlags,
|
|
|
|
minimum: Option<crate::Fraction>,
|
|
|
|
maximum: Option<crate::Fraction>,
|
|
|
|
default_value: Option<crate::Fraction>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> ParamSpecFractionBuilder<'a> {
|
|
|
|
fn new(name: &'a str) -> Self {
|
2023-01-21 17:44:12 +00:00
|
|
|
assert_initialized_main_thread!();
|
2022-02-21 16:14:37 +00:00
|
|
|
Self {
|
|
|
|
name,
|
|
|
|
..Default::default()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// rustdoc-stripper-ignore-next
|
|
|
|
/// Default: `-i32::MAX/1`
|
|
|
|
pub fn minimum(mut self, minimum: crate::Fraction) -> Self {
|
|
|
|
self.minimum = Some(minimum);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
// rustdoc-stripper-ignore-next
|
|
|
|
/// Default: `i32::MAX/1`
|
|
|
|
pub fn maximum(mut self, maximum: crate::Fraction) -> Self {
|
|
|
|
self.maximum = Some(maximum);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
// rustdoc-stripper-ignore-next
|
|
|
|
/// Default: `0/1`
|
|
|
|
pub fn default_value(mut self, default_value: crate::Fraction) -> Self {
|
|
|
|
self.default_value = Some(default_value);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
#[must_use]
|
|
|
|
pub fn build(self) -> ParamSpec {
|
2023-01-21 17:44:12 +00:00
|
|
|
unsafe {
|
|
|
|
ParamSpecFraction::new_unchecked(
|
|
|
|
self.name,
|
|
|
|
self.nick.unwrap_or(self.name),
|
|
|
|
self.blurb.unwrap_or(self.name),
|
|
|
|
self.minimum
|
|
|
|
.unwrap_or_else(|| crate::Fraction::new(-i32::MAX, 1)),
|
|
|
|
self.maximum
|
|
|
|
.unwrap_or_else(|| crate::Fraction::new(i32::MAX, 1)),
|
|
|
|
self.default_value
|
|
|
|
.unwrap_or_else(|| crate::Fraction::new(0, 1)),
|
|
|
|
self.flags,
|
|
|
|
)
|
|
|
|
}
|
2022-02-21 16:14:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-10 09:03:51 +00:00
|
|
|
impl<'a> glib::prelude::ParamSpecBuilderExt<'a> for ParamSpecFractionBuilder<'a> {
|
|
|
|
fn set_nick(&mut self, nick: Option<&'a str>) {
|
|
|
|
self.nick = nick;
|
|
|
|
}
|
|
|
|
fn set_blurb(&mut self, blurb: Option<&'a str>) {
|
|
|
|
self.blurb = blurb;
|
|
|
|
}
|
|
|
|
fn set_flags(&mut self, flags: glib::ParamFlags) {
|
|
|
|
self.flags = flags;
|
|
|
|
}
|
|
|
|
fn current_flags(&self) -> glib::ParamFlags {
|
|
|
|
self.flags
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-20 10:17:58 +00:00
|
|
|
glib::wrapper! {
|
|
|
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
|
|
#[doc(alias = "GstParamSpecArray")]
|
|
|
|
pub struct ParamSpecArray(Shared<ffi::GstParamSpecArray>);
|
|
|
|
|
|
|
|
match fn {
|
|
|
|
ref => |ptr| gobject_ffi::g_param_spec_ref_sink(ptr as *mut gobject_ffi::GParamSpec),
|
|
|
|
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
|
2023-03-09 09:13:07 +00:00
|
|
|
type_ => || ffi::gst_param_spec_array_get_type(),
|
2021-11-20 10:17:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for ParamSpecArray {}
|
|
|
|
unsafe impl Sync for ParamSpecArray {}
|
|
|
|
|
|
|
|
impl std::ops::Deref for ParamSpecArray {
|
|
|
|
type Target = ParamSpec;
|
|
|
|
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
unsafe { &*(self as *const ParamSpecArray as *const ParamSpec) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl glib::ParamSpecType for ParamSpecArray {}
|
|
|
|
|
2023-02-06 13:21:02 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-20 10:17:58 +00:00
|
|
|
#[doc(hidden)]
|
|
|
|
impl FromGlibPtrFull<*mut gobject_ffi::GParamSpec> for ParamSpecArray {
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
unsafe fn from_glib_full(ptr: *mut gobject_ffi::GParamSpec) -> Self {
|
|
|
|
from_glib_full(ptr as *mut ffi::GstParamSpecArray)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ParamSpecArray {
|
2022-02-21 16:14:37 +00:00
|
|
|
pub fn builder(name: &str) -> ParamSpecArrayBuilder {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
ParamSpecArrayBuilder::new(name)
|
|
|
|
}
|
|
|
|
|
2021-11-20 10:17:58 +00:00
|
|
|
#[allow(clippy::new_ret_no_self)]
|
|
|
|
#[doc(alias = "gst_param_spec_array")]
|
2023-01-21 17:44:12 +00:00
|
|
|
#[deprecated = "Use builder() instead"]
|
2022-09-04 07:34:05 +00:00
|
|
|
pub fn new<'a>(
|
2018-11-29 19:18:06 +00:00
|
|
|
name: &str,
|
2022-09-04 07:34:05 +00:00
|
|
|
nick: impl Into<Option<&'a str>>,
|
|
|
|
blurb: impl Into<Option<&'a str>>,
|
2021-11-20 10:17:58 +00:00
|
|
|
element_spec: Option<&glib::ParamSpec>,
|
2018-11-29 19:18:06 +00:00
|
|
|
flags: glib::ParamFlags,
|
|
|
|
) -> glib::ParamSpec {
|
2020-03-22 14:18:47 +00:00
|
|
|
assert_initialized_main_thread!();
|
2023-01-21 17:44:12 +00:00
|
|
|
|
|
|
|
unsafe { Self::new_unchecked(name, nick, blurb, element_spec, flags) }
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe fn new_unchecked<'a>(
|
|
|
|
name: &str,
|
|
|
|
nick: impl Into<Option<&'a str>>,
|
|
|
|
blurb: impl Into<Option<&'a str>>,
|
|
|
|
element_spec: Option<&glib::ParamSpec>,
|
|
|
|
flags: glib::ParamFlags,
|
|
|
|
) -> glib::ParamSpec {
|
2018-11-29 19:18:06 +00:00
|
|
|
unsafe {
|
2021-11-20 10:17:58 +00:00
|
|
|
from_glib_none(ffi::gst_param_spec_array(
|
2018-11-29 19:18:06 +00:00
|
|
|
name.to_glib_none().0,
|
2022-09-04 07:34:05 +00:00
|
|
|
nick.into().to_glib_none().0,
|
|
|
|
blurb.into().to_glib_none().0,
|
2021-11-20 10:17:58 +00:00
|
|
|
element_spec.to_glib_none().0,
|
2021-04-27 15:15:46 +00:00
|
|
|
flags.into_glib(),
|
2018-11-29 19:18:06 +00:00
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
2021-11-20 10:17:58 +00:00
|
|
|
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2023-01-04 17:48:41 +00:00
|
|
|
pub fn element_spec(&self) -> Option<&ParamSpec> {
|
2021-11-20 10:17:58 +00:00
|
|
|
unsafe {
|
2022-10-08 12:35:37 +00:00
|
|
|
let ptr = self.as_ptr();
|
2021-11-20 10:17:58 +00:00
|
|
|
|
2023-01-04 17:48:41 +00:00
|
|
|
if (*ptr).element_spec.is_null() {
|
|
|
|
None
|
|
|
|
} else {
|
|
|
|
Some(
|
|
|
|
&*(&(*ptr).element_spec as *const *mut glib::gobject_ffi::GParamSpec
|
|
|
|
as *const glib::ParamSpec),
|
|
|
|
)
|
|
|
|
}
|
2021-11-20 10:17:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
pub fn upcast(self) -> ParamSpec {
|
2022-10-08 12:35:37 +00:00
|
|
|
unsafe {
|
|
|
|
from_glib_full(
|
|
|
|
IntoGlibPtr::<*mut ffi::GstParamSpecArray>::into_glib_ptr(self)
|
|
|
|
as *mut gobject_ffi::GParamSpec,
|
|
|
|
)
|
|
|
|
}
|
2021-11-20 10:17:58 +00:00
|
|
|
}
|
|
|
|
|
2022-12-18 08:18:31 +00:00
|
|
|
#[inline]
|
2021-11-20 10:17:58 +00:00
|
|
|
pub fn upcast_ref(&self) -> &ParamSpec {
|
2022-06-30 12:22:30 +00:00
|
|
|
self
|
2021-11-20 10:17:58 +00:00
|
|
|
}
|
2018-11-29 19:18:06 +00:00
|
|
|
}
|
2018-12-11 10:37:15 +00:00
|
|
|
|
2022-02-21 16:14:37 +00:00
|
|
|
#[derive(Default)]
|
|
|
|
#[must_use]
|
|
|
|
pub struct ParamSpecArrayBuilder<'a> {
|
|
|
|
name: &'a str,
|
|
|
|
nick: Option<&'a str>,
|
|
|
|
blurb: Option<&'a str>,
|
|
|
|
flags: glib::ParamFlags,
|
|
|
|
element_spec: Option<&'a glib::ParamSpec>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> ParamSpecArrayBuilder<'a> {
|
|
|
|
fn new(name: &'a str) -> Self {
|
2023-01-21 17:44:12 +00:00
|
|
|
assert_initialized_main_thread!();
|
2022-02-21 16:14:37 +00:00
|
|
|
Self {
|
|
|
|
name,
|
|
|
|
..Default::default()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// rustdoc-stripper-ignore-next
|
|
|
|
/// Default: `None`
|
2022-09-04 07:34:05 +00:00
|
|
|
pub fn element_spec(mut self, element_spec: impl Into<Option<&'a glib::ParamSpec>>) -> Self {
|
|
|
|
self.element_spec = element_spec.into();
|
2022-02-21 16:14:37 +00:00
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
#[must_use]
|
|
|
|
pub fn build(self) -> ParamSpec {
|
2023-01-21 17:44:12 +00:00
|
|
|
unsafe {
|
|
|
|
ParamSpecArray::new_unchecked(
|
|
|
|
self.name,
|
|
|
|
self.nick.unwrap_or(self.name),
|
|
|
|
self.blurb.unwrap_or(self.name),
|
|
|
|
self.element_spec,
|
|
|
|
self.flags,
|
|
|
|
)
|
|
|
|
}
|
2022-02-21 16:14:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-10 09:03:51 +00:00
|
|
|
impl<'a> glib::prelude::ParamSpecBuilderExt<'a> for ParamSpecArrayBuilder<'a> {
|
|
|
|
fn set_nick(&mut self, nick: Option<&'a str>) {
|
|
|
|
self.nick = nick;
|
|
|
|
}
|
|
|
|
fn set_blurb(&mut self, blurb: Option<&'a str>) {
|
|
|
|
self.blurb = blurb;
|
|
|
|
}
|
|
|
|
fn set_flags(&mut self, flags: glib::ParamFlags) {
|
|
|
|
self.flags = flags;
|
|
|
|
}
|
|
|
|
fn current_flags(&self) -> glib::ParamFlags {
|
|
|
|
self.flags
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-10 09:10:43 +00:00
|
|
|
pub trait GstParamSpecBuilderExt<'a>: glib::prelude::ParamSpecBuilderExt<'a> {
|
|
|
|
// rustdoc-stripper-ignore-next
|
|
|
|
/// Mark the property as controllable
|
|
|
|
fn controllable(self) -> Self {
|
|
|
|
let flags = self.current_flags() | crate::PARAM_FLAG_CONTROLLABLE;
|
|
|
|
self.flags(flags)
|
|
|
|
}
|
|
|
|
|
|
|
|
// rustdoc-stripper-ignore-next
|
|
|
|
/// Mark the property as mutable in ready state
|
|
|
|
fn mutable_ready(self) -> Self {
|
|
|
|
let flags = self.current_flags() | crate::PARAM_FLAG_MUTABLE_READY;
|
|
|
|
self.flags(flags)
|
|
|
|
}
|
|
|
|
|
|
|
|
// rustdoc-stripper-ignore-next
|
|
|
|
/// Mark the property as mutable in paused state
|
|
|
|
fn mutable_paused(self) -> Self {
|
|
|
|
let flags = self.current_flags() | crate::PARAM_FLAG_MUTABLE_PAUSED;
|
|
|
|
self.flags(flags)
|
|
|
|
}
|
|
|
|
|
|
|
|
// rustdoc-stripper-ignore-next
|
|
|
|
/// Mark the property as mutable in playing state
|
|
|
|
fn mutable_playing(self) -> Self {
|
|
|
|
let flags = self.current_flags() | crate::PARAM_FLAG_MUTABLE_PLAYING;
|
|
|
|
self.flags(flags)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
|
|
// rustdoc-stripper-ignore-next
|
|
|
|
/// Mark the property for showing the default value in the docs
|
|
|
|
fn doc_show_default(self) -> Self {
|
|
|
|
let flags = self.current_flags() | crate::PARAM_FLAG_DOC_SHOW_DEFAULT;
|
|
|
|
self.flags(flags)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
|
|
// rustdoc-stripper-ignore-next
|
|
|
|
/// Mark the property for being only conditionally available
|
|
|
|
fn conditionally_available(self) -> Self {
|
|
|
|
let flags = self.current_flags() | crate::PARAM_FLAG_CONDITIONALLY_AVAILABLE;
|
|
|
|
self.flags(flags)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a, T: glib::prelude::ParamSpecBuilderExt<'a>> GstParamSpecBuilderExt<'a> for T {}
|
|
|
|
|
2018-12-11 10:37:15 +00:00
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
2022-08-10 09:03:51 +00:00
|
|
|
use glib::prelude::*;
|
2018-12-11 10:37:15 +00:00
|
|
|
|
2023-01-03 18:58:25 +00:00
|
|
|
use super::*;
|
|
|
|
|
2018-12-11 10:37:15 +00:00
|
|
|
#[test]
|
2023-01-21 17:44:12 +00:00
|
|
|
#[allow(deprecated)]
|
2018-12-11 10:37:15 +00:00
|
|
|
fn test_trait() {
|
2020-11-21 13:46:48 +00:00
|
|
|
crate::init().unwrap();
|
2018-12-11 10:37:15 +00:00
|
|
|
|
2021-11-20 10:17:58 +00:00
|
|
|
let _pspec = ParamSpecFraction::new(
|
2018-12-11 10:37:15 +00:00
|
|
|
"foo",
|
|
|
|
"Foo",
|
|
|
|
"Foo Bar",
|
|
|
|
(0, 1).into(),
|
|
|
|
(100, 1).into(),
|
|
|
|
(1, 1).into(),
|
|
|
|
glib::ParamFlags::READWRITE,
|
|
|
|
);
|
2022-08-10 09:03:51 +00:00
|
|
|
|
|
|
|
let _pspec = ParamSpecFraction::builder("foo")
|
|
|
|
.nick("Foo")
|
|
|
|
.blurb("Foo Bar")
|
|
|
|
.minimum((0, 1).into())
|
|
|
|
.maximum((100, 1).into())
|
|
|
|
.default_value((1, 1).into())
|
|
|
|
.readwrite()
|
2022-08-10 09:10:43 +00:00
|
|
|
.mutable_playing()
|
2022-08-10 09:03:51 +00:00
|
|
|
.build();
|
2018-12-11 10:37:15 +00:00
|
|
|
}
|
|
|
|
}
|