forked from mirrors/gstreamer-rs
gstreamer: Add getters for ElementFactory/DeviceProviderFactory metadata
This commit is contained in:
parent
31b78f483e
commit
abd2d4dfd7
5 changed files with 129 additions and 22 deletions
|
@ -1113,6 +1113,11 @@ final_type = true
|
||||||
# Use glib::List as return type
|
# Use glib::List as return type
|
||||||
manual = true
|
manual = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "get_metadata"
|
||||||
|
# Use str as return type
|
||||||
|
manual = true
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "Gst.TypeFindFactory"
|
name = "Gst.TypeFindFactory"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
@ -1139,6 +1144,11 @@ final_type = true
|
||||||
# Use glib::List as return type
|
# Use glib::List as return type
|
||||||
manual = true
|
manual = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "get_metadata"
|
||||||
|
# Use str as return type
|
||||||
|
manual = true
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "Gst.DeviceProvider"
|
name = "Gst.DeviceProvider"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
|
|
@ -33,17 +33,6 @@ impl DeviceProviderFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "gst_device_provider_factory_get_metadata")]
|
|
||||||
#[doc(alias = "get_metadata")]
|
|
||||||
pub fn metadata(&self, key: &str) -> Option<glib::GString> {
|
|
||||||
unsafe {
|
|
||||||
from_glib_none(ffi::gst_device_provider_factory_get_metadata(
|
|
||||||
self.to_glib_none().0,
|
|
||||||
key.to_glib_none().0,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[doc(alias = "gst_device_provider_factory_get_metadata_keys")]
|
#[doc(alias = "gst_device_provider_factory_get_metadata_keys")]
|
||||||
#[doc(alias = "get_metadata_keys")]
|
#[doc(alias = "get_metadata_keys")]
|
||||||
pub fn metadata_keys(&self) -> Vec<glib::GString> {
|
pub fn metadata_keys(&self) -> Vec<glib::GString> {
|
||||||
|
|
|
@ -81,17 +81,6 @@ impl ElementFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "gst_element_factory_get_metadata")]
|
|
||||||
#[doc(alias = "get_metadata")]
|
|
||||||
pub fn metadata(&self, key: &str) -> Option<glib::GString> {
|
|
||||||
unsafe {
|
|
||||||
from_glib_none(ffi::gst_element_factory_get_metadata(
|
|
||||||
self.to_glib_none().0,
|
|
||||||
key.to_glib_none().0,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[doc(alias = "gst_element_factory_get_metadata_keys")]
|
#[doc(alias = "gst_element_factory_get_metadata_keys")]
|
||||||
#[doc(alias = "get_metadata_keys")]
|
#[doc(alias = "get_metadata_keys")]
|
||||||
pub fn metadata_keys(&self) -> Vec<glib::GString> {
|
pub fn metadata_keys(&self) -> Vec<glib::GString> {
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
// Take a look at the license at the top of the repository in the LICENSE file.
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||||
|
|
||||||
use crate::DeviceProviderFactory;
|
use crate::DeviceProviderFactory;
|
||||||
|
use crate::ELEMENT_METADATA_AUTHOR;
|
||||||
|
use crate::ELEMENT_METADATA_DESCRIPTION;
|
||||||
|
use crate::ELEMENT_METADATA_DOC_URI;
|
||||||
|
use crate::ELEMENT_METADATA_ICON_NAME;
|
||||||
|
use crate::ELEMENT_METADATA_KLASS;
|
||||||
|
use crate::ELEMENT_METADATA_LONGNAME;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
use std::ffi::CStr;
|
||||||
|
|
||||||
impl DeviceProviderFactory {
|
impl DeviceProviderFactory {
|
||||||
#[doc(alias = "gst_device_provider_factory_list_get_device_providers")]
|
#[doc(alias = "gst_device_provider_factory_list_get_device_providers")]
|
||||||
|
@ -13,4 +20,57 @@ impl DeviceProviderFactory {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "gst_device_provider_factory_get_metadata")]
|
||||||
|
#[doc(alias = "get_metadata")]
|
||||||
|
pub fn metadata(&self, key: &str) -> Option<&str> {
|
||||||
|
unsafe {
|
||||||
|
let ptr = ffi::gst_device_provider_factory_get_metadata(
|
||||||
|
self.to_glib_none().0,
|
||||||
|
key.to_glib_none().0,
|
||||||
|
);
|
||||||
|
|
||||||
|
if ptr.is_null() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(CStr::from_ptr(ptr).to_str().unwrap())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_longname")]
|
||||||
|
#[doc(alias = "gst_device_provider_factory_get_longname")]
|
||||||
|
pub fn longname(&self) -> &str {
|
||||||
|
self.metadata(&ELEMENT_METADATA_LONGNAME).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_klass")]
|
||||||
|
#[doc(alias = "gst_device_provider_factory_get_klass")]
|
||||||
|
pub fn klass(&self) -> &str {
|
||||||
|
self.metadata(&ELEMENT_METADATA_KLASS).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_description")]
|
||||||
|
#[doc(alias = "gst_device_provider_factory_get_description")]
|
||||||
|
pub fn description(&self) -> &str {
|
||||||
|
self.metadata(&ELEMENT_METADATA_DESCRIPTION).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_author")]
|
||||||
|
#[doc(alias = "gst_device_provider_factory_get_author")]
|
||||||
|
pub fn author(&self) -> &str {
|
||||||
|
self.metadata(&ELEMENT_METADATA_AUTHOR).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_documentation_uri")]
|
||||||
|
#[doc(alias = "gst_device_provider_factory_get_documentation_uri")]
|
||||||
|
pub fn documentation_uri(&self) -> Option<&str> {
|
||||||
|
self.metadata(&ELEMENT_METADATA_DOC_URI)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_icon_name")]
|
||||||
|
#[doc(alias = "gst_device_provider_factory_get_icon_name")]
|
||||||
|
pub fn icon_name(&self) -> Option<&str> {
|
||||||
|
self.metadata(&ELEMENT_METADATA_ICON_NAME)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
// Take a look at the license at the top of the repository in the LICENSE file.
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||||
|
|
||||||
|
use crate::ELEMENT_METADATA_AUTHOR;
|
||||||
|
use crate::ELEMENT_METADATA_DESCRIPTION;
|
||||||
|
use crate::ELEMENT_METADATA_DOC_URI;
|
||||||
|
use crate::ELEMENT_METADATA_ICON_NAME;
|
||||||
|
use crate::ELEMENT_METADATA_KLASS;
|
||||||
|
use crate::ELEMENT_METADATA_LONGNAME;
|
||||||
|
use std::ffi::CStr;
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
use crate::Element;
|
use crate::Element;
|
||||||
use crate::ElementFactory;
|
use crate::ElementFactory;
|
||||||
|
@ -97,4 +105,55 @@ impl ElementFactory {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "gst_element_factory_get_metadata")]
|
||||||
|
#[doc(alias = "get_metadata")]
|
||||||
|
pub fn metadata(&self, key: &str) -> Option<&str> {
|
||||||
|
unsafe {
|
||||||
|
let ptr =
|
||||||
|
ffi::gst_element_factory_get_metadata(self.to_glib_none().0, key.to_glib_none().0);
|
||||||
|
|
||||||
|
if ptr.is_null() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(CStr::from_ptr(ptr).to_str().unwrap())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_longname")]
|
||||||
|
#[doc(alias = "gst_element_factory_get_longname")]
|
||||||
|
pub fn longname(&self) -> &str {
|
||||||
|
self.metadata(&ELEMENT_METADATA_LONGNAME).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_klass")]
|
||||||
|
#[doc(alias = "gst_element_factory_get_klass")]
|
||||||
|
pub fn klass(&self) -> &str {
|
||||||
|
self.metadata(&ELEMENT_METADATA_KLASS).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_description")]
|
||||||
|
#[doc(alias = "gst_element_factory_get_description")]
|
||||||
|
pub fn description(&self) -> &str {
|
||||||
|
self.metadata(&ELEMENT_METADATA_DESCRIPTION).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_author")]
|
||||||
|
#[doc(alias = "gst_element_factory_get_author")]
|
||||||
|
pub fn author(&self) -> &str {
|
||||||
|
self.metadata(&ELEMENT_METADATA_AUTHOR).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_documentation_uri")]
|
||||||
|
#[doc(alias = "gst_element_factory_get_documentation_uri")]
|
||||||
|
pub fn documentation_uri(&self) -> Option<&str> {
|
||||||
|
self.metadata(&ELEMENT_METADATA_DOC_URI)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "get_icon_name")]
|
||||||
|
#[doc(alias = "gst_element_factory_get_icon_name")]
|
||||||
|
pub fn icon_name(&self) -> Option<&str> {
|
||||||
|
self.metadata(&ELEMENT_METADATA_ICON_NAME)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue