1 | // This file was generated by gir (https://github.com/gtk-rs/gir) |
2 | // from gir-files (https://github.com/gtk-rs/gir-files) |
3 | // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) |
4 | // DO NOT EDIT |
5 | |
6 | use crate::{Bin, ClockTime, DebugGraphDetails, DebugLevel, Element, StackTraceFlags}; |
7 | use glib::{prelude::*, translate::*}; |
8 | use std::{mem, ptr}; |
9 | |
10 | #[doc (alias = "gst_debug_add_ring_buffer_logger" )] |
11 | pub fn debug_add_ring_buffer_logger(max_size_per_thread: u32, thread_timeout: u32) { |
12 | skip_assert_initialized!(); |
13 | unsafe { |
14 | ffi::gst_debug_add_ring_buffer_logger(max_size_per_thread, thread_timeout); |
15 | } |
16 | } |
17 | |
18 | #[doc (alias = "gst_debug_bin_to_dot_data" )] |
19 | pub fn debug_bin_to_dot_data(bin: &impl IsA<Bin>, details: DebugGraphDetails) -> glib::GString { |
20 | skip_assert_initialized!(); |
21 | unsafe { |
22 | from_glib_full(ptr:ffi::gst_debug_bin_to_dot_data( |
23 | bin:bin.as_ref().to_glib_none().0, |
24 | details:details.into_glib(), |
25 | )) |
26 | } |
27 | } |
28 | |
29 | #[doc (alias = "gst_debug_bin_to_dot_file" )] |
30 | pub fn debug_bin_to_dot_file( |
31 | bin: &impl IsA<Bin>, |
32 | details: DebugGraphDetails, |
33 | file_name: impl AsRef<std::path::Path>, |
34 | ) { |
35 | skip_assert_initialized!(); |
36 | unsafe { |
37 | ffi::gst_debug_bin_to_dot_file( |
38 | bin:bin.as_ref().to_glib_none().0, |
39 | details:details.into_glib(), |
40 | file_name:file_name.as_ref().to_glib_none().0, |
41 | ); |
42 | } |
43 | } |
44 | |
45 | #[doc (alias = "gst_debug_bin_to_dot_file_with_ts" )] |
46 | pub fn debug_bin_to_dot_file_with_ts( |
47 | bin: &impl IsA<Bin>, |
48 | details: DebugGraphDetails, |
49 | file_name: impl AsRef<std::path::Path>, |
50 | ) { |
51 | skip_assert_initialized!(); |
52 | unsafe { |
53 | ffi::gst_debug_bin_to_dot_file_with_ts( |
54 | bin:bin.as_ref().to_glib_none().0, |
55 | details:details.into_glib(), |
56 | file_name:file_name.as_ref().to_glib_none().0, |
57 | ); |
58 | } |
59 | } |
60 | |
61 | #[doc (alias = "gst_debug_get_default_threshold" )] |
62 | pub fn debug_get_default_threshold() -> DebugLevel { |
63 | skip_assert_initialized!(); |
64 | unsafe { from_glib(val:ffi::gst_debug_get_default_threshold()) } |
65 | } |
66 | |
67 | #[doc (alias = "gst_debug_get_stack_trace" )] |
68 | pub fn debug_get_stack_trace(flags: StackTraceFlags) -> Result<glib::GString, glib::BoolError> { |
69 | skip_assert_initialized!(); |
70 | unsafe { |
71 | Option::<_>::from_glib_full(ffi::gst_debug_get_stack_trace(flags.into_glib())) |
72 | .ok_or_else(|| glib::bool_error!("Failed to get stack trace" )) |
73 | } |
74 | } |
75 | |
76 | #[doc (alias = "gst_debug_is_active" )] |
77 | pub fn debug_is_active() -> bool { |
78 | skip_assert_initialized!(); |
79 | unsafe { from_glib(val:ffi::gst_debug_is_active()) } |
80 | } |
81 | |
82 | #[doc (alias = "gst_debug_is_colored" )] |
83 | pub fn debug_is_colored() -> bool { |
84 | skip_assert_initialized!(); |
85 | unsafe { from_glib(val:ffi::gst_debug_is_colored()) } |
86 | } |
87 | |
88 | #[doc (alias = "gst_debug_print_stack_trace" )] |
89 | pub fn debug_print_stack_trace() { |
90 | skip_assert_initialized!(); |
91 | unsafe { |
92 | ffi::gst_debug_print_stack_trace(); |
93 | } |
94 | } |
95 | |
96 | #[doc (alias = "gst_debug_remove_ring_buffer_logger" )] |
97 | pub fn debug_remove_ring_buffer_logger() { |
98 | skip_assert_initialized!(); |
99 | unsafe { |
100 | ffi::gst_debug_remove_ring_buffer_logger(); |
101 | } |
102 | } |
103 | |
104 | #[doc (alias = "gst_debug_ring_buffer_logger_get_logs" )] |
105 | pub fn debug_ring_buffer_logger_get_logs() -> Vec<glib::GString> { |
106 | skip_assert_initialized!(); |
107 | unsafe { FromGlibPtrContainer::from_glib_full(ptr:ffi::gst_debug_ring_buffer_logger_get_logs()) } |
108 | } |
109 | |
110 | #[doc (alias = "gst_debug_set_active" )] |
111 | pub fn debug_set_active(active: bool) { |
112 | skip_assert_initialized!(); |
113 | unsafe { |
114 | ffi::gst_debug_set_active(active.into_glib()); |
115 | } |
116 | } |
117 | |
118 | #[doc (alias = "gst_debug_set_colored" )] |
119 | pub fn debug_set_colored(colored: bool) { |
120 | skip_assert_initialized!(); |
121 | unsafe { |
122 | ffi::gst_debug_set_colored(colored.into_glib()); |
123 | } |
124 | } |
125 | |
126 | #[doc (alias = "gst_debug_set_default_threshold" )] |
127 | pub fn debug_set_default_threshold(level: DebugLevel) { |
128 | skip_assert_initialized!(); |
129 | unsafe { |
130 | ffi::gst_debug_set_default_threshold(level:level.into_glib()); |
131 | } |
132 | } |
133 | |
134 | #[doc (alias = "gst_debug_set_threshold_for_name" )] |
135 | pub fn debug_set_threshold_for_name(name: &str, level: DebugLevel) { |
136 | skip_assert_initialized!(); |
137 | unsafe { |
138 | ffi::gst_debug_set_threshold_for_name(name:name.to_glib_none().0, level:level.into_glib()); |
139 | } |
140 | } |
141 | |
142 | #[doc (alias = "gst_debug_set_threshold_from_string" )] |
143 | pub fn debug_set_threshold_from_string(list: &str, reset: bool) { |
144 | skip_assert_initialized!(); |
145 | unsafe { |
146 | ffi::gst_debug_set_threshold_from_string(list:list.to_glib_none().0, reset:reset.into_glib()); |
147 | } |
148 | } |
149 | |
150 | #[doc (alias = "gst_debug_unset_threshold_for_name" )] |
151 | pub fn debug_unset_threshold_for_name(name: &str) { |
152 | skip_assert_initialized!(); |
153 | unsafe { |
154 | ffi::gst_debug_unset_threshold_for_name(name.to_glib_none().0); |
155 | } |
156 | } |
157 | |
158 | #[doc (alias = "gst_get_main_executable_path" )] |
159 | #[doc (alias = "get_main_executable_path" )] |
160 | pub fn main_executable_path() -> Result<glib::GString, glib::BoolError> { |
161 | assert_initialized_main_thread!(); |
162 | unsafe { |
163 | Option::<_>::from_glib_none(ffi::gst_get_main_executable_path()) |
164 | .ok_or_else(|| glib::bool_error!("Failed to get main executable path" )) |
165 | } |
166 | } |
167 | |
168 | #[doc (alias = "gst_parse_bin_from_description" )] |
169 | pub fn parse_bin_from_description( |
170 | bin_description: &str, |
171 | ghost_unlinked_pads: bool, |
172 | ) -> Result<Bin, glib::Error> { |
173 | assert_initialized_main_thread!(); |
174 | unsafe { |
175 | let mut error: *mut GError = ptr::null_mut(); |
176 | let ret: *mut GstBin = ffi::gst_parse_bin_from_description( |
177 | bin_description:bin_description.to_glib_none().0, |
178 | ghost_unlinked_pads:ghost_unlinked_pads.into_glib(), |
179 | &mut error, |
180 | ); |
181 | if error.is_null() { |
182 | Ok(from_glib_none(ptr:ret)) |
183 | } else { |
184 | Err(from_glib_full(ptr:error)) |
185 | } |
186 | } |
187 | } |
188 | |
189 | #[doc (alias = "gst_parse_launch" )] |
190 | pub fn parse_launch(pipeline_description: &str) -> Result<Element, glib::Error> { |
191 | assert_initialized_main_thread!(); |
192 | unsafe { |
193 | let mut error: *mut GError = ptr::null_mut(); |
194 | let ret: *mut GstElement = ffi::gst_parse_launch(pipeline_description:pipeline_description.to_glib_none().0, &mut error); |
195 | if error.is_null() { |
196 | Ok(from_glib_none(ptr:ret)) |
197 | } else { |
198 | Err(from_glib_full(ptr:error)) |
199 | } |
200 | } |
201 | } |
202 | |
203 | #[doc (alias = "gst_parse_launchv" )] |
204 | pub fn parse_launchv(argv: &[&str]) -> Result<Element, glib::Error> { |
205 | assert_initialized_main_thread!(); |
206 | unsafe { |
207 | let mut error: *mut GError = ptr::null_mut(); |
208 | let ret: *mut GstElement = ffi::gst_parse_launchv(argv:argv.to_glib_none().0, &mut error); |
209 | if error.is_null() { |
210 | Ok(from_glib_none(ptr:ret)) |
211 | } else { |
212 | Err(from_glib_full(ptr:error)) |
213 | } |
214 | } |
215 | } |
216 | |
217 | #[doc (alias = "gst_update_registry" )] |
218 | pub fn update_registry() -> Result<(), glib::error::BoolError> { |
219 | assert_initialized_main_thread!(); |
220 | unsafe { |
221 | glib::result_from_gboolean!(ffi::gst_update_registry(), "Failed to update the registry" ) |
222 | } |
223 | } |
224 | |
225 | #[doc (alias = "gst_util_get_timestamp" )] |
226 | pub fn util_get_timestamp() -> ClockTime { |
227 | skip_assert_initialized!(); |
228 | unsafe { try_from_glib(ffi::gst_util_get_timestamp()).expect(msg:"mandatory glib value is None" ) } |
229 | } |
230 | |
231 | #[doc (alias = "gst_version" )] |
232 | pub fn version() -> (u32, u32, u32, u32) { |
233 | skip_assert_initialized!(); |
234 | unsafe { |
235 | let mut major: MaybeUninit = mem::MaybeUninit::uninit(); |
236 | let mut minor: MaybeUninit = mem::MaybeUninit::uninit(); |
237 | let mut micro: MaybeUninit = mem::MaybeUninit::uninit(); |
238 | let mut nano: MaybeUninit = mem::MaybeUninit::uninit(); |
239 | ffi::gst_version( |
240 | major:major.as_mut_ptr(), |
241 | minor:minor.as_mut_ptr(), |
242 | micro:micro.as_mut_ptr(), |
243 | nano:nano.as_mut_ptr(), |
244 | ); |
245 | ( |
246 | major.assume_init(), |
247 | minor.assume_init(), |
248 | micro.assume_init(), |
249 | nano.assume_init(), |
250 | ) |
251 | } |
252 | } |
253 | |
254 | #[doc (alias = "gst_version_string" )] |
255 | pub fn version_string() -> glib::GString { |
256 | skip_assert_initialized!(); |
257 | unsafe { from_glib_full(ptr:ffi::gst_version_string()) } |
258 | } |
259 | |