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