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
use crate::Caps;
use glib::translate::*;
use glib::StaticType;
use std::ffi::CStr;
use std::fmt;
use std::ptr;
#[doc(alias = "GstStaticCaps")]
pub struct StaticCaps(ptr::NonNull<ffi::GstStaticCaps>);
impl StaticCaps {
#[doc(alias = "gst_static_caps_get")]
pub fn get(&self) -> Caps {
unsafe { from_glib_full(ffi::gst_static_caps_get(self.0.as_ptr())) }
}
}
unsafe impl Send for StaticCaps {}
unsafe impl Sync for StaticCaps {}
impl fmt::Debug for StaticCaps {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("StaticCaps")
.field("str", &unsafe {
CStr::from_ptr(self.0.as_ref().string).to_str()
})
.finish()
}
}
impl glib::types::StaticType for StaticCaps {
fn static_type() -> glib::types::Type {
unsafe { glib::translate::from_glib(ffi::gst_static_caps_get_type()) }
}
}
impl glib::value::ValueType for StaticCaps {
type Type = Self;
}
#[doc(hidden)]
unsafe impl<'a> glib::value::FromValue<'a> for StaticCaps {
type Checker = glib::value::GenericValueTypeOrNoneChecker<Self>;
unsafe fn from_value(value: &'a glib::Value) -> Self {
skip_assert_initialized!();
from_glib_none(
glib::gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstStaticCaps
)
}
}
#[doc(hidden)]
impl glib::value::ToValue for StaticCaps {
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
self.to_glib_none().0 as *mut _,
)
}
value
}
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
#[doc(hidden)]
impl glib::value::ToValueOptional for StaticCaps {
fn to_value_optional(s: Option<&Self>) -> glib::Value {
skip_assert_initialized!();
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
s.to_glib_none().0 as *mut _,
)
}
value
}
}
#[doc(hidden)]
impl glib::translate::GlibPtrDefault for StaticCaps {
type GlibType = *mut ffi::GstStaticCaps;
}
#[doc(hidden)]
impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstStaticCaps> for StaticCaps {
type Storage = &'a StaticCaps;
fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstStaticCaps, Self> {
glib::translate::Stash(self.0.as_ptr(), self)
}
fn to_glib_full(&self) -> *const ffi::GstStaticCaps {
unimplemented!()
}
}
#[doc(hidden)]
impl glib::translate::FromGlibPtrNone<*const ffi::GstStaticCaps> for StaticCaps {
#[inline]
unsafe fn from_glib_none(ptr: *const ffi::GstStaticCaps) -> Self {
assert!(!ptr.is_null());
StaticCaps(ptr::NonNull::new_unchecked(ptr as *mut _))
}
}
#[doc(hidden)]
impl glib::translate::FromGlibPtrNone<*mut ffi::GstStaticCaps> for StaticCaps {
#[inline]
unsafe fn from_glib_none(ptr: *mut ffi::GstStaticCaps) -> Self {
assert!(!ptr.is_null());
StaticCaps(ptr::NonNull::new_unchecked(ptr))
}
}
#[doc(hidden)]
impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstStaticCaps> for StaticCaps {
#[inline]
unsafe fn from_glib_borrow(ptr: *mut ffi::GstStaticCaps) -> Borrowed<Self> {
assert!(!ptr.is_null());
Borrowed::new(StaticCaps(ptr::NonNull::new_unchecked(ptr)))
}
}
#[doc(hidden)]
impl glib::translate::FromGlibPtrFull<*mut ffi::GstStaticCaps> for StaticCaps {
#[inline]
unsafe fn from_glib_full(_ptr: *mut ffi::GstStaticCaps) -> Self {
unimplemented!();
}
}