use g2g_core::{Caps, CapsSet, PropError, PropValue};
pub(crate) const FORWARDED_BLURB: &str =
"any other property is forwarded to the hosted Python class, which declares \
the real set (model-name, engine-name, device, ...); a name it does not \
declare fails when the pipeline starts";
pub(crate) fn fixed_caps(desc: &str) -> Result<Caps, PropError> {
CapsSet::from_gst_string(desc)
.and_then(|set| set.fixate())
.ok_or(PropError::Value)
}
pub(crate) fn forward(params: &mut Vec<(String, PropValue)>, name: &str, value: PropValue) {
match params.iter_mut().find(|(key, _)| key == name) {
Some(slot) => slot.1 = value,
None => params.push((name.to_string(), value)),
}
}
macro_rules! hosted_element_props {
($($own:expr),+ $(,)?) => {
&[
$($own,)+
PropertySpec::undeclared(crate::props::FORWARDED_BLURB),
]
};
}
pub(crate) use hosted_element_props;