gstreamer/auto/functions.rs
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
6use crate::{Bin, ClockTime, DebugGraphDetails, DebugLevel, Element, StackTraceFlags, ffi};
7use glib::{prelude::*, translate::*};
8#[cfg(feature = "v1_28")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
10use std::boxed::Box as Box_;
11
12/// Calls `func` from another thread and passes `user_data` to it.
13/// ## `func`
14/// function to call asynchronously from another thread
15#[cfg(feature = "v1_28")]
16#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
17#[doc(alias = "gst_call_async")]
18pub fn call_async<P: FnOnce() + Send + Sync + 'static>(func: P) {
19 assert_initialized_main_thread!();
20 let func_data: Box_<P> = Box_::new(func);
21 unsafe extern "C" fn func_func<P: FnOnce() + Send + Sync + 'static>(
22 user_data: glib::ffi::gpointer,
23 ) {
24 unsafe {
25 let callback = Box_::from_raw(user_data as *mut P);
26 (*callback)()
27 }
28 }
29 let func = Some(func_func::<P> as _);
30 let super_callback0: Box_<P> = func_data;
31 unsafe {
32 ffi::gst_call_async(func, Box_::into_raw(super_callback0) as *mut _);
33 }
34}
35
36/// Applications might want to check if the runtime GStreamer version is greater
37/// or equal to the version specified using `major`, `minor` and `micro`.
38/// ## `major`
39/// Major version number
40/// ## `minor`
41/// Minor version number
42/// ## `micro`
43/// Micro version number
44///
45/// # Returns
46///
47/// [`true`] if the GStreamer version is greater or equal to
48/// `major`\.`minor`\.`micro`, [`false`] otherwise. Also this function returns [`false`]
49/// when checking for a different `major` version to the current one, as major
50/// version bumps are ABI breaks anyway.
51#[cfg(feature = "v1_28")]
52#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
53#[doc(alias = "gst_check_version")]
54pub fn check_version(major: u32, minor: u32, micro: u32) -> bool {
55 assert_initialized_main_thread!();
56 unsafe { from_glib(ffi::gst_check_version(major, minor, micro)) }
57}
58
59///
60/// # Returns
61///
62/// [`true`] if NEON (32-bit) is supported by the CPU, [`false`] otherwise.
63#[cfg(feature = "v1_28")]
64#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
65#[doc(alias = "gst_cpuid_supports_arm_neon")]
66pub fn cpuid_supports_arm_neon() -> bool {
67 assert_initialized_main_thread!();
68 unsafe { from_glib(ffi::gst_cpuid_supports_arm_neon()) }
69}
70
71///
72/// # Returns
73///
74/// [`true`] if NEON (64-bit) is supported by the CPU, [`false`] otherwise.
75#[cfg(feature = "v1_28")]
76#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
77#[doc(alias = "gst_cpuid_supports_arm_neon64")]
78pub fn cpuid_supports_arm_neon64() -> bool {
79 assert_initialized_main_thread!();
80 unsafe { from_glib(ffi::gst_cpuid_supports_arm_neon64()) }
81}
82
83///
84/// # Returns
85///
86/// [`true`] if RISC-V Vector extension is supported by the CPU, [`false`] otherwise.
87#[cfg(feature = "v1_30")]
88#[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
89#[doc(alias = "gst_cpuid_supports_riscv_v")]
90pub fn cpuid_supports_riscv_v() -> bool {
91 assert_initialized_main_thread!();
92 unsafe { from_glib(ffi::gst_cpuid_supports_riscv_v()) }
93}
94
95///
96/// # Returns
97///
98/// [`true`] if 3DNow! is supported by the CPU, [`false`] otherwise.
99#[cfg(feature = "v1_28")]
100#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
101#[doc(alias = "gst_cpuid_supports_x86_3dnow")]
102pub fn cpuid_supports_x86_3dnow() -> bool {
103 assert_initialized_main_thread!();
104 unsafe { from_glib(ffi::gst_cpuid_supports_x86_3dnow()) }
105}
106
107///
108/// # Returns
109///
110/// [`true`] if AVX is supported by the CPU, [`false`] otherwise.
111#[cfg(feature = "v1_28")]
112#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
113#[doc(alias = "gst_cpuid_supports_x86_avx")]
114pub fn cpuid_supports_x86_avx() -> bool {
115 assert_initialized_main_thread!();
116 unsafe { from_glib(ffi::gst_cpuid_supports_x86_avx()) }
117}
118
119///
120/// # Returns
121///
122/// [`true`] if avx2 is supported by the CPU, [`false`] otherwise.
123#[cfg(feature = "v1_28")]
124#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
125#[doc(alias = "gst_cpuid_supports_x86_avx2")]
126pub fn cpuid_supports_x86_avx2() -> bool {
127 assert_initialized_main_thread!();
128 unsafe { from_glib(ffi::gst_cpuid_supports_x86_avx2()) }
129}
130
131///
132/// # Returns
133///
134/// [`true`] if MMX is supported by the CPU, [`false`] otherwise.
135#[cfg(feature = "v1_28")]
136#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
137#[doc(alias = "gst_cpuid_supports_x86_mmx")]
138pub fn cpuid_supports_x86_mmx() -> bool {
139 assert_initialized_main_thread!();
140 unsafe { from_glib(ffi::gst_cpuid_supports_x86_mmx()) }
141}
142
143///
144/// # Returns
145///
146/// [`true`] if extended MMX is supported by the CPU, [`false`] otherwise.
147#[cfg(feature = "v1_28")]
148#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
149#[doc(alias = "gst_cpuid_supports_x86_mmxext")]
150pub fn cpuid_supports_x86_mmxext() -> bool {
151 assert_initialized_main_thread!();
152 unsafe { from_glib(ffi::gst_cpuid_supports_x86_mmxext()) }
153}
154
155///
156/// # Returns
157///
158/// [`true`] if SSE2 is supported by the CPU, [`false`] otherwise.
159#[cfg(feature = "v1_28")]
160#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
161#[doc(alias = "gst_cpuid_supports_x86_sse2")]
162pub fn cpuid_supports_x86_sse2() -> bool {
163 assert_initialized_main_thread!();
164 unsafe { from_glib(ffi::gst_cpuid_supports_x86_sse2()) }
165}
166
167///
168/// # Returns
169///
170/// [`true`] if SSE3 is supported by the CPU, [`false`] otherwise.
171#[cfg(feature = "v1_28")]
172#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
173#[doc(alias = "gst_cpuid_supports_x86_sse3")]
174pub fn cpuid_supports_x86_sse3() -> bool {
175 assert_initialized_main_thread!();
176 unsafe { from_glib(ffi::gst_cpuid_supports_x86_sse3()) }
177}
178
179///
180/// # Returns
181///
182/// [`true`] if SSE4.1 is supported by the CPU, [`false`] otherwise.
183#[cfg(feature = "v1_28")]
184#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
185#[doc(alias = "gst_cpuid_supports_x86_sse4_1")]
186pub fn cpuid_supports_x86_sse4_1() -> bool {
187 assert_initialized_main_thread!();
188 unsafe { from_glib(ffi::gst_cpuid_supports_x86_sse4_1()) }
189}
190
191///
192/// # Returns
193///
194/// [`true`] if SSSE3 is supported by the CPU, [`false`] otherwise.
195#[cfg(feature = "v1_28")]
196#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
197#[doc(alias = "gst_cpuid_supports_x86_sse4_2")]
198pub fn cpuid_supports_x86_sse4_2() -> bool {
199 assert_initialized_main_thread!();
200 unsafe { from_glib(ffi::gst_cpuid_supports_x86_sse4_2()) }
201}
202
203///
204/// # Returns
205///
206/// [`true`] if SSSE3 is supported by the CPU, [`false`] otherwise.
207#[cfg(feature = "v1_28")]
208#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
209#[doc(alias = "gst_cpuid_supports_x86_ssse3")]
210pub fn cpuid_supports_x86_ssse3() -> bool {
211 assert_initialized_main_thread!();
212 unsafe { from_glib(ffi::gst_cpuid_supports_x86_ssse3()) }
213}
214
215/// Adds a memory ringbuffer based debug logger that stores up to
216/// `max_size_per_thread` bytes of logs per thread and times out threads after
217/// `thread_timeout` seconds of inactivity.
218///
219/// Logs can be fetched with [`debug_ring_buffer_logger_get_logs()`][crate::debug_ring_buffer_logger_get_logs()] and the
220/// logger can be removed again with [`debug_remove_ring_buffer_logger()`][crate::debug_remove_ring_buffer_logger()].
221/// Only one logger at a time is possible.
222/// ## `max_size_per_thread`
223/// Maximum size of log per thread in bytes
224/// ## `thread_timeout`
225/// Timeout for threads in seconds
226#[doc(alias = "gst_debug_add_ring_buffer_logger")]
227pub fn debug_add_ring_buffer_logger(max_size_per_thread: u32, thread_timeout: u32) {
228 skip_assert_initialized!();
229 unsafe {
230 ffi::gst_debug_add_ring_buffer_logger(max_size_per_thread, thread_timeout);
231 }
232}
233
234/// To aid debugging applications one can use this method to obtain the whole
235/// network of gstreamer elements that form the pipeline into a dot file.
236///
237/// See [`debug_bin_to_dot_file()`][crate::debug_bin_to_dot_file()] for more details.
238/// ## `bin`
239/// the top-level pipeline that should be analyzed
240/// ## `details`
241/// type of [`DebugGraphDetails`][crate::DebugGraphDetails] to use
242///
243/// # Returns
244///
245/// a string containing the pipeline in graphviz
246/// dot format.
247#[doc(alias = "gst_debug_bin_to_dot_data")]
248pub fn debug_bin_to_dot_data(bin: &impl IsA<Bin>, details: DebugGraphDetails) -> glib::GString {
249 skip_assert_initialized!();
250 unsafe {
251 from_glib_full(ffi::gst_debug_bin_to_dot_data(
252 bin.as_ref().to_glib_none().0,
253 details.into_glib(),
254 ))
255 }
256}
257
258/// To aid debugging applications one can use this method to write out the whole
259/// network of gstreamer elements that form the pipeline into a dot file.
260/// This file can be processed with graphviz to get an image, like this:
261///
262/// **⚠️ The following code is in shell ⚠️**
263///
264/// ``` shell
265/// dot -Tpng -oimage.png graph_lowlevel.dot
266/// ```
267///
268/// There is also the interactive [gst-dots-viewer](https://gstreamer.freedesktop.org/documentation/coretracers/dots.html)
269/// tool, and [xdot](https://pypi.org/project/xdot/) which allows you to view the
270/// dot file directly without converting it first.
271///
272/// If `file_name` is NULL, the output filename will be based on the application
273/// name as returned by `g_get_application_name()`, or "unnamed" if the application
274/// name cannot be determined.
275///
276/// The file will be written to the directory specified by the
277/// `GST_DEBUG_DUMP_DOT_DIR` environment variable, and the `.dot` extension will be
278/// added. If `GST_DEBUG_DUMP_DOT_DIR` was not defined at the time
279/// `gst_init()` was called, the file will not be generated. Note that the
280/// directory must already exist, it will not be created by this function.
281///
282/// [`debug_bin_to_dot_data()`][crate::debug_bin_to_dot_data()] can be used if it is desired to generate the
283/// file even when `GST_DEBUG_DUMP_DOT_DIR` is not set.
284/// ## `bin`
285/// the top-level pipeline that should be analyzed
286/// ## `details`
287/// type of [`DebugGraphDetails`][crate::DebugGraphDetails] to use
288/// ## `file_name`
289/// output base filename (e.g. "myplayer")
290#[doc(alias = "gst_debug_bin_to_dot_file")]
291pub fn debug_bin_to_dot_file(
292 bin: &impl IsA<Bin>,
293 details: DebugGraphDetails,
294 file_name: Option<impl AsRef<std::path::Path>>,
295) {
296 skip_assert_initialized!();
297 unsafe {
298 ffi::gst_debug_bin_to_dot_file(
299 bin.as_ref().to_glib_none().0,
300 details.into_glib(),
301 file_name.as_ref().map(|p| p.as_ref()).to_glib_none().0,
302 );
303 }
304}
305
306/// This works like [`debug_bin_to_dot_file()`][crate::debug_bin_to_dot_file()], but adds the current timestamp
307/// to the filename, so that it can be used to take multiple snapshots.
308/// ## `bin`
309/// the top-level pipeline that should be analyzed
310/// ## `details`
311/// type of [`DebugGraphDetails`][crate::DebugGraphDetails] to use
312/// ## `file_name`
313/// output base filename (e.g. "myplayer")
314#[doc(alias = "gst_debug_bin_to_dot_file_with_ts")]
315pub fn debug_bin_to_dot_file_with_ts(
316 bin: &impl IsA<Bin>,
317 details: DebugGraphDetails,
318 file_name: Option<impl AsRef<std::path::Path>>,
319) {
320 skip_assert_initialized!();
321 unsafe {
322 ffi::gst_debug_bin_to_dot_file_with_ts(
323 bin.as_ref().to_glib_none().0,
324 details.into_glib(),
325 file_name.as_ref().map(|p| p.as_ref()).to_glib_none().0,
326 );
327 }
328}
329
330/// Returns the default threshold that is used for new categories.
331///
332/// # Returns
333///
334/// the default threshold level
335#[doc(alias = "gst_debug_get_default_threshold")]
336pub fn debug_get_default_threshold() -> DebugLevel {
337 skip_assert_initialized!();
338 unsafe { from_glib(ffi::gst_debug_get_default_threshold()) }
339}
340
341/// ## `flags`
342/// A set of [`StackTraceFlags`][crate::StackTraceFlags] to determine how the stack trace should
343/// look like. Pass `GST_STACK_TRACE_SHOW_NONE` to retrieve a minimal backtrace.
344///
345/// # Returns
346///
347/// a stack trace, if libunwind or glibc backtrace are
348/// present, else [`None`].
349#[doc(alias = "gst_debug_get_stack_trace")]
350pub fn debug_get_stack_trace(flags: StackTraceFlags) -> Result<glib::GString, glib::BoolError> {
351 skip_assert_initialized!();
352 unsafe {
353 Option::<_>::from_glib_full(ffi::gst_debug_get_stack_trace(flags.into_glib()))
354 .ok_or_else(|| glib::bool_error!("Failed to get stack trace"))
355 }
356}
357
358/// Checks if debugging output is activated.
359///
360/// # Returns
361///
362/// [`true`], if debugging is activated
363#[doc(alias = "gst_debug_is_active")]
364pub fn debug_is_active() -> bool {
365 skip_assert_initialized!();
366 unsafe { from_glib(ffi::gst_debug_is_active()) }
367}
368
369/// Checks if the debugging output should be colored.
370///
371/// # Returns
372///
373/// [`true`], if the debug output should be colored.
374#[doc(alias = "gst_debug_is_colored")]
375pub fn debug_is_colored() -> bool {
376 skip_assert_initialized!();
377 unsafe { from_glib(ffi::gst_debug_is_colored()) }
378}
379
380/// If libunwind, glibc backtrace or DbgHelp are present
381/// a stack trace is printed.
382#[doc(alias = "gst_debug_print_stack_trace")]
383pub fn debug_print_stack_trace() {
384 skip_assert_initialized!();
385 unsafe {
386 ffi::gst_debug_print_stack_trace();
387 }
388}
389
390/// Removes any previously added ring buffer logger with
391/// [`debug_add_ring_buffer_logger()`][crate::debug_add_ring_buffer_logger()].
392#[doc(alias = "gst_debug_remove_ring_buffer_logger")]
393pub fn debug_remove_ring_buffer_logger() {
394 skip_assert_initialized!();
395 unsafe {
396 ffi::gst_debug_remove_ring_buffer_logger();
397 }
398}
399
400/// Fetches the current logs per thread from the ring buffer logger. See
401/// [`debug_add_ring_buffer_logger()`][crate::debug_add_ring_buffer_logger()] for details.
402///
403/// # Returns
404///
405/// NULL-terminated array of
406/// strings with the debug output per thread
407#[doc(alias = "gst_debug_ring_buffer_logger_get_logs")]
408pub fn debug_ring_buffer_logger_get_logs() -> Vec<glib::GString> {
409 skip_assert_initialized!();
410 unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_debug_ring_buffer_logger_get_logs()) }
411}
412
413/// This function is not threadsafe. It makes sense to only call it
414/// during initialization.
415/// ## `active`
416/// Whether to use debugging output or not
417#[doc(alias = "gst_debug_set_active")]
418pub fn debug_set_active(active: bool) {
419 skip_assert_initialized!();
420 unsafe {
421 ffi::gst_debug_set_active(active.into_glib());
422 }
423}
424
425/// Sets or unsets the use of coloured debugging output.
426/// Same as gst_debug_set_color_mode () with the argument being
427/// being GST_DEBUG_COLOR_MODE_ON or GST_DEBUG_COLOR_MODE_OFF.
428///
429/// This function may be called before `gst_init()`.
430/// ## `colored`
431/// Whether to use colored output or not
432#[doc(alias = "gst_debug_set_colored")]
433pub fn debug_set_colored(colored: bool) {
434 skip_assert_initialized!();
435 unsafe {
436 ffi::gst_debug_set_colored(colored.into_glib());
437 }
438}
439
440/// Sets the default threshold to the given level and updates all categories to
441/// use this threshold.
442///
443/// This function may be called before `gst_init()`.
444/// ## `level`
445/// level to set
446#[doc(alias = "gst_debug_set_default_threshold")]
447pub fn debug_set_default_threshold(level: DebugLevel) {
448 skip_assert_initialized!();
449 unsafe {
450 ffi::gst_debug_set_default_threshold(level.into_glib());
451 }
452}
453
454/// Sets all categories which match the given glob style pattern to the given
455/// level.
456/// ## `name`
457/// name of the categories to set
458/// ## `level`
459/// level to set them to
460#[doc(alias = "gst_debug_set_threshold_for_name")]
461pub fn debug_set_threshold_for_name(name: &str, level: DebugLevel) {
462 skip_assert_initialized!();
463 unsafe {
464 ffi::gst_debug_set_threshold_for_name(name.to_glib_none().0, level.into_glib());
465 }
466}
467
468/// Sets the debug logging wanted in the same form as with the GST_DEBUG
469/// environment variable. You can use wildcards such as `*`, but note that
470/// the order matters when you use wild cards, e.g. `foosrc:6,*src:3,*:2` sets
471/// everything to log level 2.
472/// ## `list`
473/// comma-separated list of "category:level" pairs to be used
474/// as debug logging levels
475/// ## `reset`
476/// [`true`] to clear all previously-set debug levels before setting
477/// new thresholds
478/// [`false`] if adding the threshold described by `list` to the one already set.
479#[doc(alias = "gst_debug_set_threshold_from_string")]
480pub fn debug_set_threshold_from_string(list: &str, reset: bool) {
481 skip_assert_initialized!();
482 unsafe {
483 ffi::gst_debug_set_threshold_from_string(list.to_glib_none().0, reset.into_glib());
484 }
485}
486
487/// Resets all categories with the given name back to the default level.
488/// ## `name`
489/// name of the categories to set
490#[doc(alias = "gst_debug_unset_threshold_for_name")]
491pub fn debug_unset_threshold_for_name(name: &str) {
492 skip_assert_initialized!();
493 unsafe {
494 ffi::gst_debug_unset_threshold_for_name(name.to_glib_none().0);
495 }
496}
497
498/// This helper is mostly helpful for plugins that need to
499/// inspect the folder of the main executable to determine
500/// their set of features.
501///
502/// When a plugin is initialized from the gst-plugin-scanner
503/// external process, the returned path will be the same as from the
504/// parent process.
505///
506/// # Returns
507///
508/// The path of the executable that
509/// initialized GStreamer, or [`None`] if it could not be determined.
510#[doc(alias = "gst_get_main_executable_path")]
511#[doc(alias = "get_main_executable_path")]
512pub fn main_executable_path() -> Result<glib::GString, glib::BoolError> {
513 assert_initialized_main_thread!();
514 unsafe {
515 Option::<_>::from_glib_none(ffi::gst_get_main_executable_path())
516 .ok_or_else(|| glib::bool_error!("Failed to get main executable path"))
517 }
518}
519
520/// This is a convenience wrapper around [`parse_launch()`][crate::parse_launch()] to create a
521/// [`Bin`][crate::Bin] from a gst-launch-style pipeline description. See
522/// [`parse_launch()`][crate::parse_launch()] and the gst-launch man page for details about the
523/// syntax. Ghost pads on the bin for unlinked source or sink pads
524/// within the bin can automatically be created (but only a maximum of
525/// one ghost pad for each direction will be created; if you expect
526/// multiple unlinked source pads or multiple unlinked sink pads
527/// and want them all ghosted, you will have to create the ghost pads
528/// yourself).
529/// ## `bin_description`
530/// command line describing the bin
531/// ## `ghost_unlinked_pads`
532/// whether to automatically create ghost pads
533/// for unlinked source or sink pads within the bin
534///
535/// # Returns
536///
537/// a
538/// newly-created bin, or [`None`] if an error occurred.
539#[doc(alias = "gst_parse_bin_from_description")]
540pub fn parse_bin_from_description(
541 bin_description: &str,
542 ghost_unlinked_pads: bool,
543) -> Result<Bin, glib::Error> {
544 assert_initialized_main_thread!();
545 unsafe {
546 let mut error = std::ptr::null_mut();
547 let ret = ffi::gst_parse_bin_from_description(
548 bin_description.to_glib_none().0,
549 ghost_unlinked_pads.into_glib(),
550 &mut error,
551 );
552 if error.is_null() {
553 Ok(from_glib_none(ret))
554 } else {
555 Err(from_glib_full(error))
556 }
557 }
558}
559
560/// Create a new pipeline based on command line syntax.
561/// Please note that you might get a return value that is not [`None`] even though
562/// the `error` is set. In this case there was a recoverable parsing error and you
563/// can try to play the pipeline.
564///
565/// To create a sub-pipeline (bin) for embedding into an existing pipeline
566/// use [`parse_bin_from_description()`][crate::parse_bin_from_description()].
567/// ## `pipeline_description`
568/// the command line describing the pipeline
569///
570/// # Returns
571///
572/// a new element on success, [`None`] on
573/// failure. If more than one toplevel element is specified by the
574/// `pipeline_description`, all elements are put into a [`Pipeline`][crate::Pipeline], which
575/// than is returned.
576#[doc(alias = "gst_parse_launch")]
577pub fn parse_launch(pipeline_description: &str) -> Result<Element, glib::Error> {
578 assert_initialized_main_thread!();
579 unsafe {
580 let mut error = std::ptr::null_mut();
581 let ret = ffi::gst_parse_launch(pipeline_description.to_glib_none().0, &mut error);
582 if error.is_null() {
583 Ok(from_glib_none(ret))
584 } else {
585 Err(from_glib_full(error))
586 }
587 }
588}
589
590/// Create a new element based on command line syntax.
591/// `error` will contain an error message if an erroneous pipeline is specified.
592/// An error does not mean that the pipeline could not be constructed.
593/// ## `argv`
594/// null-terminated array of arguments
595///
596/// # Returns
597///
598/// a new element on success and [`None`]
599/// on failure.
600#[doc(alias = "gst_parse_launchv")]
601pub fn parse_launchv(argv: &[&str]) -> Result<Element, glib::Error> {
602 assert_initialized_main_thread!();
603 unsafe {
604 let mut error = std::ptr::null_mut();
605 let ret = ffi::gst_parse_launchv(argv.to_glib_none().0, &mut error);
606 if error.is_null() {
607 Ok(from_glib_none(ret))
608 } else {
609 Err(from_glib_full(error))
610 }
611 }
612}
613
614//#[cfg(feature = "v1_30")]
615//#[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
616//#[doc(alias = "gst_trace_event")]
617//pub fn trace_event(format: /*Ignored*/&mut TraceFormat, values: /*Ignored*/&[&TraceValue]) {
618// unsafe { TODO: call ffi:gst_trace_event() }
619//}
620
621//#[cfg(feature = "v1_30")]
622//#[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
623//#[doc(alias = "gst_trace_span_begin")]
624//pub fn trace_span_begin(format: /*Ignored*/&mut TraceFormat, values: /*Ignored*/&[&TraceValue]) -> TraceSpanId {
625// unsafe { TODO: call ffi:gst_trace_span_begin() }
626//}
627
628/// Forces GStreamer to re-scan its plugin paths and update the default
629/// plugin registry.
630///
631/// Applications will almost never need to call this function, it is only
632/// useful if the application knows new plugins have been installed (or old
633/// ones removed) since the start of the application (or, to be precise, the
634/// first call to `gst_init()`) and the application wants to make use of any
635/// newly-installed plugins without restarting the application.
636///
637/// Applications should assume that the registry update is neither atomic nor
638/// thread-safe and should therefore not have any dynamic pipelines running
639/// (including the playbin and decodebin elements) and should also not create
640/// any elements or access the GStreamer registry while the update is in
641/// progress.
642///
643/// Note that this function may block for a significant amount of time.
644///
645/// # Returns
646///
647/// [`true`] if the registry has been updated successfully (does not
648/// imply that there were changes), otherwise [`false`].
649#[doc(alias = "gst_update_registry")]
650pub fn update_registry() -> Result<(), glib::error::BoolError> {
651 assert_initialized_main_thread!();
652 unsafe {
653 glib::result_from_gboolean!(ffi::gst_update_registry(), "Failed to update the registry")
654 }
655}
656
657/// Get a timestamp as GstClockTime to be used for interval measurements.
658/// The timestamp should not be interpreted in any other way.
659///
660/// # Returns
661///
662/// the timestamp
663#[doc(alias = "gst_util_get_timestamp")]
664pub fn util_get_timestamp() -> ClockTime {
665 skip_assert_initialized!();
666 unsafe { try_from_glib(ffi::gst_util_get_timestamp()).expect("mandatory glib value is None") }
667}
668
669/// Gets the version number of the GStreamer library.
670///
671/// # Returns
672///
673///
674/// ## `major`
675/// pointer to a guint to store the major version number
676///
677/// ## `minor`
678/// pointer to a guint to store the minor version number
679///
680/// ## `micro`
681/// pointer to a guint to store the micro version number
682///
683/// ## `nano`
684/// pointer to a guint to store the nano version number
685#[doc(alias = "gst_version")]
686pub fn version() -> (u32, u32, u32, u32) {
687 skip_assert_initialized!();
688 unsafe {
689 let mut major = std::mem::MaybeUninit::uninit();
690 let mut minor = std::mem::MaybeUninit::uninit();
691 let mut micro = std::mem::MaybeUninit::uninit();
692 let mut nano = std::mem::MaybeUninit::uninit();
693 ffi::gst_version(
694 major.as_mut_ptr(),
695 minor.as_mut_ptr(),
696 micro.as_mut_ptr(),
697 nano.as_mut_ptr(),
698 );
699 (
700 major.assume_init(),
701 minor.assume_init(),
702 micro.assume_init(),
703 nano.assume_init(),
704 )
705 }
706}
707
708/// This function returns a string that is useful for describing this version
709/// of GStreamer to the outside world: user agent strings, logging, ...
710///
711/// # Returns
712///
713/// a newly allocated string describing this version
714/// of GStreamer.
715#[doc(alias = "gst_version_string")]
716pub fn version_string() -> glib::GString {
717 skip_assert_initialized!();
718 unsafe { from_glib_full(ffi::gst_version_string()) }
719}