Skip to main content

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/// If activated, debugging messages are sent to the debugging
414/// handlers.
415/// It makes sense to deactivate it for speed issues.
416/// > This function is not threadsafe. It makes sense to only call it
417/// during initialization.
418/// ## `active`
419/// Whether to use debugging output or not
420#[doc(alias = "gst_debug_set_active")]
421pub fn debug_set_active(active: bool) {
422    skip_assert_initialized!();
423    unsafe {
424        ffi::gst_debug_set_active(active.into_glib());
425    }
426}
427
428/// Sets or unsets the use of coloured debugging output.
429/// Same as gst_debug_set_color_mode () with the argument being
430/// being GST_DEBUG_COLOR_MODE_ON or GST_DEBUG_COLOR_MODE_OFF.
431///
432/// This function may be called before `gst_init()`.
433/// ## `colored`
434/// Whether to use colored output or not
435#[doc(alias = "gst_debug_set_colored")]
436pub fn debug_set_colored(colored: bool) {
437    skip_assert_initialized!();
438    unsafe {
439        ffi::gst_debug_set_colored(colored.into_glib());
440    }
441}
442
443/// Sets the default threshold to the given level and updates all categories to
444/// use this threshold.
445///
446/// This function may be called before `gst_init()`.
447/// ## `level`
448/// level to set
449#[doc(alias = "gst_debug_set_default_threshold")]
450pub fn debug_set_default_threshold(level: DebugLevel) {
451    skip_assert_initialized!();
452    unsafe {
453        ffi::gst_debug_set_default_threshold(level.into_glib());
454    }
455}
456
457/// Sets all categories which match the given glob style pattern to the given
458/// level.
459/// ## `name`
460/// name of the categories to set
461/// ## `level`
462/// level to set them to
463#[doc(alias = "gst_debug_set_threshold_for_name")]
464pub fn debug_set_threshold_for_name(name: &str, level: DebugLevel) {
465    skip_assert_initialized!();
466    unsafe {
467        ffi::gst_debug_set_threshold_for_name(name.to_glib_none().0, level.into_glib());
468    }
469}
470
471/// Sets the debug logging wanted in the same form as with the GST_DEBUG
472/// environment variable. You can use wildcards such as `*`, but note that
473/// the order matters when you use wild cards, e.g. `foosrc:6,*src:3,*:2` sets
474/// everything to log level 2.
475/// ## `list`
476/// comma-separated list of "category:level" pairs to be used
477///  as debug logging levels
478/// ## `reset`
479/// [`true`] to clear all previously-set debug levels before setting
480///  new thresholds
481/// [`false`] if adding the threshold described by `list` to the one already set.
482#[doc(alias = "gst_debug_set_threshold_from_string")]
483pub fn debug_set_threshold_from_string(list: &str, reset: bool) {
484    skip_assert_initialized!();
485    unsafe {
486        ffi::gst_debug_set_threshold_from_string(list.to_glib_none().0, reset.into_glib());
487    }
488}
489
490/// Resets all categories with the given name back to the default level.
491/// ## `name`
492/// name of the categories to set
493#[doc(alias = "gst_debug_unset_threshold_for_name")]
494pub fn debug_unset_threshold_for_name(name: &str) {
495    skip_assert_initialized!();
496    unsafe {
497        ffi::gst_debug_unset_threshold_for_name(name.to_glib_none().0);
498    }
499}
500
501/// This helper is mostly helpful for plugins that need to
502/// inspect the folder of the main executable to determine
503/// their set of features.
504///
505/// When a plugin is initialized from the gst-plugin-scanner
506/// external process, the returned path will be the same as from the
507/// parent process.
508///
509/// # Returns
510///
511/// The path of the executable that
512///  initialized GStreamer, or [`None`] if it could not be determined.
513#[doc(alias = "gst_get_main_executable_path")]
514#[doc(alias = "get_main_executable_path")]
515pub fn main_executable_path() -> Result<glib::GString, glib::BoolError> {
516    assert_initialized_main_thread!();
517    unsafe {
518        Option::<_>::from_glib_none(ffi::gst_get_main_executable_path())
519            .ok_or_else(|| glib::bool_error!("Failed to get main executable path"))
520    }
521}
522
523/// This is a convenience wrapper around [`parse_launch()`][crate::parse_launch()] to create a
524/// [`Bin`][crate::Bin] from a gst-launch-style pipeline description. See
525/// [`parse_launch()`][crate::parse_launch()] and the gst-launch man page for details about the
526/// syntax. Ghost pads on the bin for unlinked source or sink pads
527/// within the bin can automatically be created (but only a maximum of
528/// one ghost pad for each direction will be created; if you expect
529/// multiple unlinked source pads or multiple unlinked sink pads
530/// and want them all ghosted, you will have to create the ghost pads
531/// yourself).
532/// ## `bin_description`
533/// command line describing the bin
534/// ## `ghost_unlinked_pads`
535/// whether to automatically create ghost pads
536///  for unlinked source or sink pads within the bin
537///
538/// # Returns
539///
540/// a
541///  newly-created bin, or [`None`] if an error occurred.
542#[doc(alias = "gst_parse_bin_from_description")]
543pub fn parse_bin_from_description(
544    bin_description: &str,
545    ghost_unlinked_pads: bool,
546) -> Result<Bin, glib::Error> {
547    assert_initialized_main_thread!();
548    unsafe {
549        let mut error = std::ptr::null_mut();
550        let ret = ffi::gst_parse_bin_from_description(
551            bin_description.to_glib_none().0,
552            ghost_unlinked_pads.into_glib(),
553            &mut error,
554        );
555        if error.is_null() {
556            Ok(from_glib_none(ret))
557        } else {
558            Err(from_glib_full(error))
559        }
560    }
561}
562
563/// Create a new pipeline based on command line syntax.
564/// Please note that you might get a return value that is not [`None`] even though
565/// the `error` is set. In this case there was a recoverable parsing error and you
566/// can try to play the pipeline.
567///
568/// To create a sub-pipeline (bin) for embedding into an existing pipeline
569/// use [`parse_bin_from_description()`][crate::parse_bin_from_description()].
570/// ## `pipeline_description`
571/// the command line describing the pipeline
572///
573/// # Returns
574///
575/// a new element on success, [`None`] on
576///  failure. If more than one toplevel element is specified by the
577///  `pipeline_description`, all elements are put into a [`Pipeline`][crate::Pipeline], which
578///  than is returned.
579#[doc(alias = "gst_parse_launch")]
580pub fn parse_launch(pipeline_description: &str) -> Result<Element, glib::Error> {
581    assert_initialized_main_thread!();
582    unsafe {
583        let mut error = std::ptr::null_mut();
584        let ret = ffi::gst_parse_launch(pipeline_description.to_glib_none().0, &mut error);
585        if error.is_null() {
586            Ok(from_glib_none(ret))
587        } else {
588            Err(from_glib_full(error))
589        }
590    }
591}
592
593/// Create a new element based on command line syntax.
594/// `error` will contain an error message if an erroneous pipeline is specified.
595/// An error does not mean that the pipeline could not be constructed.
596/// ## `argv`
597/// null-terminated array of arguments
598///
599/// # Returns
600///
601/// a new element on success and [`None`]
602/// on failure.
603#[doc(alias = "gst_parse_launchv")]
604pub fn parse_launchv(argv: &[&str]) -> Result<Element, glib::Error> {
605    assert_initialized_main_thread!();
606    unsafe {
607        let mut error = std::ptr::null_mut();
608        let ret = ffi::gst_parse_launchv(argv.to_glib_none().0, &mut error);
609        if error.is_null() {
610            Ok(from_glib_none(ret))
611        } else {
612            Err(from_glib_full(error))
613        }
614    }
615}
616
617//#[cfg(feature = "v1_30")]
618//#[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
619//#[doc(alias = "gst_trace_event")]
620//pub fn trace_event(format: /*Ignored*/&mut TraceFormat, values: /*Ignored*/&[&TraceValue]) {
621//    unsafe { TODO: call ffi:gst_trace_event() }
622//}
623
624//#[cfg(feature = "v1_30")]
625//#[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
626//#[doc(alias = "gst_trace_span_begin")]
627//pub fn trace_span_begin(format: /*Ignored*/&mut TraceFormat, values: /*Ignored*/&[&TraceValue]) -> TraceSpanId {
628//    unsafe { TODO: call ffi:gst_trace_span_begin() }
629//}
630
631/// Forces GStreamer to re-scan its plugin paths and update the default
632/// plugin registry.
633///
634/// Applications will almost never need to call this function, it is only
635/// useful if the application knows new plugins have been installed (or old
636/// ones removed) since the start of the application (or, to be precise, the
637/// first call to `gst_init()`) and the application wants to make use of any
638/// newly-installed plugins without restarting the application.
639///
640/// Applications should assume that the registry update is neither atomic nor
641/// thread-safe and should therefore not have any dynamic pipelines running
642/// (including the playbin and decodebin elements) and should also not create
643/// any elements or access the GStreamer registry while the update is in
644/// progress.
645///
646/// Note that this function may block for a significant amount of time.
647///
648/// # Returns
649///
650/// [`true`] if the registry has been updated successfully (does not
651///  imply that there were changes), otherwise [`false`].
652#[doc(alias = "gst_update_registry")]
653pub fn update_registry() -> Result<(), glib::error::BoolError> {
654    assert_initialized_main_thread!();
655    unsafe {
656        glib::result_from_gboolean!(ffi::gst_update_registry(), "Failed to update the registry")
657    }
658}
659
660/// Get a timestamp as GstClockTime to be used for interval measurements.
661/// The timestamp should not be interpreted in any other way.
662///
663/// # Returns
664///
665/// the timestamp
666#[doc(alias = "gst_util_get_timestamp")]
667pub fn util_get_timestamp() -> ClockTime {
668    skip_assert_initialized!();
669    unsafe { try_from_glib(ffi::gst_util_get_timestamp()).expect("mandatory glib value is None") }
670}
671
672/// Gets the version number of the GStreamer library.
673///
674/// # Returns
675///
676///
677/// ## `major`
678/// pointer to a guint to store the major version number
679///
680/// ## `minor`
681/// pointer to a guint to store the minor version number
682///
683/// ## `micro`
684/// pointer to a guint to store the micro version number
685///
686/// ## `nano`
687/// pointer to a guint to store the nano version number
688#[doc(alias = "gst_version")]
689pub fn version() -> (u32, u32, u32, u32) {
690    skip_assert_initialized!();
691    unsafe {
692        let mut major = std::mem::MaybeUninit::uninit();
693        let mut minor = std::mem::MaybeUninit::uninit();
694        let mut micro = std::mem::MaybeUninit::uninit();
695        let mut nano = std::mem::MaybeUninit::uninit();
696        ffi::gst_version(
697            major.as_mut_ptr(),
698            minor.as_mut_ptr(),
699            micro.as_mut_ptr(),
700            nano.as_mut_ptr(),
701        );
702        (
703            major.assume_init(),
704            minor.assume_init(),
705            micro.assume_init(),
706            nano.assume_init(),
707        )
708    }
709}
710
711/// This function returns a string that is useful for describing this version
712/// of GStreamer to the outside world: user agent strings, logging, ...
713///
714/// # Returns
715///
716/// a newly allocated string describing this version
717///  of GStreamer.
718#[doc(alias = "gst_version_string")]
719pub fn version_string() -> glib::GString {
720    skip_assert_initialized!();
721    unsafe { from_glib_full(ffi::gst_version_string()) }
722}