gstreamer_analytics_sys/
manual.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use gstreamer_sys as gst_sys;
use libc::size_t;

use crate::{GstTensorDataType, GstTensorDim, GstTensorDimOrder, GstTensorLayout};

#[repr(C)]
pub struct GstTensor {
    pub id: glib_sys::GQuark,
    pub layout: GstTensorLayout,
    pub data_type: GstTensorDataType,
    pub batch_size: size_t,
    pub data: *mut gst_sys::GstBuffer,
    pub dims_order: GstTensorDimOrder,
    pub num_dims: size_t,
    pub dims: [GstTensorDim; 0],
}

impl ::std::fmt::Debug for GstTensor {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GstTensor @ {self:p}"))
            .field("id", &self.id)
            .field("layout", &self.layout)
            .field("data_type", &self.data_type)
            .field("batch_size", &self.batch_size)
            .field("data", &self.data)
            .field("dims_order", &self.dims_order)
            .field("num_dims", &self.num_dims)
            .field("dims", &unsafe {
                ::std::slice::from_raw_parts(self.dims.as_ptr(), self.num_dims)
            })
            .finish()
    }
}