1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::GLDisplay;
use crate::GLSLProfile;
use crate::GLSLVersion;
use glib::object::IsA;
use glib::translate::*;
use std::mem;

/// ## `name`
/// the extension to search for
/// ## `ext`
/// the list of possible extensions
///
/// # Returns
///
/// whether `name` is in the space separated list of `ext`
#[doc(alias = "gst_gl_check_extension")]
pub fn gl_check_extension(name: &str, ext: &str) -> bool {
    assert_initialized_main_thread!();
    unsafe {
        from_glib(ffi::gst_gl_check_extension(
            name.to_glib_none().0,
            ext.to_glib_none().0,
        ))
    }
}

#[doc(alias = "gst_gl_element_propagate_display_context")]
pub fn gl_element_propagate_display_context(
    element: &impl IsA<gst::Element>,
    display: &impl IsA<GLDisplay>,
) {
    skip_assert_initialized!();
    unsafe {
        ffi::gst_gl_element_propagate_display_context(
            element.as_ref().to_glib_none().0,
            display.as_ref().to_glib_none().0,
        );
    }
}

/// Note: this function first searches the first 1 kilobytes for a ``version``
/// preprocessor directive and then executes [`GLSLVersion::profile_from_string()`][crate::GLSLVersion::profile_from_string()].
/// ## `s`
/// string to search for a valid ``version`` string
///
/// # Returns
///
/// TRUE if a valid ``version`` string was found, FALSE otherwise
///
/// ## `version`
/// resulting [`GLSLVersion`][crate::GLSLVersion]
///
/// ## `profile`
/// resulting [`GLSLProfile`][crate::GLSLProfile]
#[doc(alias = "gst_glsl_string_get_version_profile")]
pub fn glsl_string_get_version_profile(s: &str) -> Option<(GLSLVersion, GLSLProfile)> {
    assert_initialized_main_thread!();
    unsafe {
        let mut version = mem::MaybeUninit::uninit();
        let mut profile = mem::MaybeUninit::uninit();
        let ret = from_glib(ffi::gst_glsl_string_get_version_profile(
            s.to_glib_none().0,
            version.as_mut_ptr(),
            profile.as_mut_ptr(),
        ));
        let version = version.assume_init();
        let profile = profile.assume_init();
        if ret {
            Some((from_glib(version), from_glib(profile)))
        } else {
            None
        }
    }
}