mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-14 05:21:29 +00:00
gstreamer/device_provider: Add constructor for device provider metadata
This commit is contained in:
parent
3b40b8e2d5
commit
8deac14876
1 changed files with 32 additions and 0 deletions
|
@ -17,6 +17,38 @@ pub struct DeviceProviderMetadata {
|
|||
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 {
|
||||
fn metadata() -> Option<&'static DeviceProviderMetadata> {
|
||||
None
|
||||
|
|
Loading…
Reference in a new issue