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