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