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
80
81
82
83
84
85
86
87
88
89
90
// 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, GLSLProfile, GLSLVersion};
use glib::{prelude::*, translate::*};

/// ## `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,
        );
    }
}

//#[cfg(feature = "v1_24")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
//#[doc(alias = "gst_gl_swizzle_invert")]
//pub fn gl_swizzle_invert(swizzle: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 14 }; 4, inversion: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 14 }; 4) {
//    unsafe { TODO: call ffi:gst_gl_swizzle_invert() }
//}

//#[cfg(feature = "v1_24")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
//#[doc(alias = "gst_gl_video_format_swizzle")]
//pub fn gl_video_format_swizzle(video_format: /*Ignored*/gst_video::VideoFormat, swizzle: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 14 }; 4) -> bool {
//    unsafe { TODO: call ffi:gst_gl_video_format_swizzle() }
//}

/// 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 = std::mem::MaybeUninit::uninit();
        let mut profile = std::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(),
        ));
        if ret {
            Some((
                from_glib(version.assume_init()),
                from_glib(profile.assume_init()),
            ))
        } else {
            None
        }
    }
}