mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-09-02 01:43:49 +00:00
analytics: Add bindings for new TensorDataType::name()
and a Display
impl
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1743>
This commit is contained in:
parent
b180622ead
commit
6aa870ba6d
2 changed files with 35 additions and 0 deletions
33
gstreamer-analytics/src/enums.rs
Normal file
33
gstreamer-analytics/src/enums.rs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||||
|
|
||||||
|
#[cfg(feature = "v1_28")]
|
||||||
|
use crate::ffi;
|
||||||
|
#[cfg(feature = "v1_28")]
|
||||||
|
use crate::TensorDataType;
|
||||||
|
|
||||||
|
#[cfg(feature = "v1_28")]
|
||||||
|
use glib::translate::*;
|
||||||
|
|
||||||
|
#[cfg(feature = "v1_28")]
|
||||||
|
impl TensorDataType {
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
|
||||||
|
#[doc(alias = "gst_tensor_data_type_get_name")]
|
||||||
|
pub fn name<'a>(self) -> &'a glib::GStr {
|
||||||
|
unsafe {
|
||||||
|
glib::GStr::from_ptr(
|
||||||
|
ffi::gst_tensor_data_type_get_name(self.into_glib())
|
||||||
|
.as_ref()
|
||||||
|
.expect("gst_tensor_data_type_get_name returned NULL"),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "v1_28")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
|
||||||
|
impl std::fmt::Display for TensorDataType {
|
||||||
|
#[inline]
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
f.write_str(&self.name())
|
||||||
|
}
|
||||||
|
}
|
|
@ -43,6 +43,8 @@ pub use crate::tracking::*;
|
||||||
mod classification;
|
mod classification;
|
||||||
pub use crate::classification::*;
|
pub use crate::classification::*;
|
||||||
|
|
||||||
|
mod enums;
|
||||||
|
|
||||||
// Re-export all the traits in a prelude module, so that applications
|
// Re-export all the traits in a prelude module, so that applications
|
||||||
// can always "use gst_app::prelude::*" without getting conflicts
|
// can always "use gst_app::prelude::*" without getting conflicts
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
|
|
Loading…
Reference in a new issue