mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-06-16 05:00:36 +00:00
gstreamer/device_provider: Add constructor for device provider metadata
This commit is contained in:
parent
3b40b8e2d5
commit
8deac14876
|
@ -17,6 +17,38 @@ pub struct DeviceProviderMetadata {
|
||||||
additional: Vec<(String, String)>,
|
additional: Vec<(String, String)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl DeviceProviderMetadata {
|
||||||
|
pub fn new(long_name: &str, classification: &str, description: &str, author: &str) -> Self {
|
||||||
|
Self {
|
||||||
|
long_name: long_name.into(),
|
||||||
|
classification: classification.into(),
|
||||||
|
description: description.into(),
|
||||||
|
author: author.into(),
|
||||||
|
additional: vec![],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_additional(
|
||||||
|
long_name: &str,
|
||||||
|
classification: &str,
|
||||||
|
description: &str,
|
||||||
|
author: &str,
|
||||||
|
additional: &[(&str, &str)],
|
||||||
|
) -> Self {
|
||||||
|
Self {
|
||||||
|
long_name: long_name.into(),
|
||||||
|
classification: classification.into(),
|
||||||
|
description: description.into(),
|
||||||
|
author: author.into(),
|
||||||
|
additional: additional
|
||||||
|
.iter()
|
||||||
|
.copied()
|
||||||
|
.map(|(key, value)| (key.into(), value.into()))
|
||||||
|
.collect(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait DeviceProviderImpl: DeviceProviderImplExt + ObjectImpl + Send + Sync {
|
pub trait DeviceProviderImpl: DeviceProviderImplExt + ObjectImpl + Send + Sync {
|
||||||
fn metadata() -> Option<&'static DeviceProviderMetadata> {
|
fn metadata() -> Option<&'static DeviceProviderMetadata> {
|
||||||
None
|
None
|
||||||
|
|
Loading…
Reference in a new issue