gstreamer_analytics/auto/
enums.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::ffi;
#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
use glib::translate::*;

/// Describe the type of data contain in the tensor.
#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstTensorDataType")]
pub enum TensorDataType {
    /// signed 4 bit integer tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_INT4")]
    Int4,
    /// signed 8 bit integer tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_INT8")]
    Int8,
    /// signed 16 bit integer tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_INT16")]
    Int16,
    /// signed 32 bit integer tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_INT32")]
    Int32,
    /// signed 64 bit integer tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_INT64")]
    Int64,
    /// unsigned 4 bit integer tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_UINT4")]
    Uint4,
    /// unsigned 8 bit integer tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_UINT8")]
    Uint8,
    /// unsigned 16 bit integer tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_UINT16")]
    Uint16,
    /// unsigned 32 bit integer tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_UINT32")]
    Uint32,
    /// unsigned 64 bit integer tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_UINT64")]
    Uint64,
    /// 16 bit floating point tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_FLOAT16")]
    Float16,
    /// 32 bit floating point tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_FLOAT32")]
    Float32,
    /// 64 bit floating point tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_FLOAT64")]
    Float64,
    /// "brain" 16 bit floating point tensor data
    #[doc(alias = "GST_TENSOR_DATA_TYPE_BFLOAT16")]
    Bfloat16,
    #[doc(hidden)]
    __Unknown(i32),
}

#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[doc(hidden)]
impl IntoGlib for TensorDataType {
    type GlibType = ffi::GstTensorDataType;

    fn into_glib(self) -> ffi::GstTensorDataType {
        match self {
            Self::Int4 => ffi::GST_TENSOR_DATA_TYPE_INT4,
            Self::Int8 => ffi::GST_TENSOR_DATA_TYPE_INT8,
            Self::Int16 => ffi::GST_TENSOR_DATA_TYPE_INT16,
            Self::Int32 => ffi::GST_TENSOR_DATA_TYPE_INT32,
            Self::Int64 => ffi::GST_TENSOR_DATA_TYPE_INT64,
            Self::Uint4 => ffi::GST_TENSOR_DATA_TYPE_UINT4,
            Self::Uint8 => ffi::GST_TENSOR_DATA_TYPE_UINT8,
            Self::Uint16 => ffi::GST_TENSOR_DATA_TYPE_UINT16,
            Self::Uint32 => ffi::GST_TENSOR_DATA_TYPE_UINT32,
            Self::Uint64 => ffi::GST_TENSOR_DATA_TYPE_UINT64,
            Self::Float16 => ffi::GST_TENSOR_DATA_TYPE_FLOAT16,
            Self::Float32 => ffi::GST_TENSOR_DATA_TYPE_FLOAT32,
            Self::Float64 => ffi::GST_TENSOR_DATA_TYPE_FLOAT64,
            Self::Bfloat16 => ffi::GST_TENSOR_DATA_TYPE_BFLOAT16,
            Self::__Unknown(value) => value,
        }
    }
}

#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[doc(hidden)]
impl FromGlib<ffi::GstTensorDataType> for TensorDataType {
    unsafe fn from_glib(value: ffi::GstTensorDataType) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::GST_TENSOR_DATA_TYPE_INT4 => Self::Int4,
            ffi::GST_TENSOR_DATA_TYPE_INT8 => Self::Int8,
            ffi::GST_TENSOR_DATA_TYPE_INT16 => Self::Int16,
            ffi::GST_TENSOR_DATA_TYPE_INT32 => Self::Int32,
            ffi::GST_TENSOR_DATA_TYPE_INT64 => Self::Int64,
            ffi::GST_TENSOR_DATA_TYPE_UINT4 => Self::Uint4,
            ffi::GST_TENSOR_DATA_TYPE_UINT8 => Self::Uint8,
            ffi::GST_TENSOR_DATA_TYPE_UINT16 => Self::Uint16,
            ffi::GST_TENSOR_DATA_TYPE_UINT32 => Self::Uint32,
            ffi::GST_TENSOR_DATA_TYPE_UINT64 => Self::Uint64,
            ffi::GST_TENSOR_DATA_TYPE_FLOAT16 => Self::Float16,
            ffi::GST_TENSOR_DATA_TYPE_FLOAT32 => Self::Float32,
            ffi::GST_TENSOR_DATA_TYPE_FLOAT64 => Self::Float64,
            ffi::GST_TENSOR_DATA_TYPE_BFLOAT16 => Self::Bfloat16,
            value => Self::__Unknown(value),
        }
    }
}

/// Indicate to read tensor from memory in row-major or column-major order.
#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstTensorDimOrder")]
pub enum TensorDimOrder {
    /// elements along a row are consecutive in memory
    #[doc(alias = "GST_TENSOR_DIM_ORDER_ROW_MAJOR")]
    RowMajor,
    /// elements along a column are consecutive in memory
    #[doc(alias = "GST_TENSOR_DIM_ORDER_COL_MAJOR")]
    ColMajor,
    /// elements storage follow the order defined by
    ///  `GstTensorDim.order_index` This mean that when iterating the tensor
    ///  the dimension with index 0 is the most nested in the loops and consecutive
    ///  in memory, followed by other dimensions in the order defined by
    ///  `GstTensorDim.order_index`.
    #[doc(alias = "GST_TENSOR_DIM_ORDER_INDEXED")]
    Indexed,
    #[doc(hidden)]
    __Unknown(i32),
}

#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[doc(hidden)]
impl IntoGlib for TensorDimOrder {
    type GlibType = ffi::GstTensorDimOrder;

    #[inline]
    fn into_glib(self) -> ffi::GstTensorDimOrder {
        match self {
            Self::RowMajor => ffi::GST_TENSOR_DIM_ORDER_ROW_MAJOR,
            Self::ColMajor => ffi::GST_TENSOR_DIM_ORDER_COL_MAJOR,
            Self::Indexed => ffi::GST_TENSOR_DIM_ORDER_INDEXED,
            Self::__Unknown(value) => value,
        }
    }
}

#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[doc(hidden)]
impl FromGlib<ffi::GstTensorDimOrder> for TensorDimOrder {
    #[inline]
    unsafe fn from_glib(value: ffi::GstTensorDimOrder) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::GST_TENSOR_DIM_ORDER_ROW_MAJOR => Self::RowMajor,
            ffi::GST_TENSOR_DIM_ORDER_COL_MAJOR => Self::ColMajor,
            ffi::GST_TENSOR_DIM_ORDER_INDEXED => Self::Indexed,
            value => Self::__Unknown(value),
        }
    }
}