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
91
92
93
94
95
96
97
98
99
// 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::{GLContext, GLFormat, GLTextureTarget};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct GLVideoAllocationParams(Boxed<ffi::GstGLVideoAllocationParams>);

    match fn {
        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_gl_video_allocation_params_get_type(), ptr as *mut _) as *mut ffi::GstGLVideoAllocationParams,
        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_gl_video_allocation_params_get_type(), ptr as *mut _),
        type_ => || ffi::gst_gl_video_allocation_params_get_type(),
    }
}

impl GLVideoAllocationParams {
    /// ## `context`
    /// a [`GLContext`][crate::GLContext]
    /// ## `alloc_params`
    /// the [`gst::AllocationParams`][crate::gst::AllocationParams] for sysmem mappings of the texture
    /// ## `v_info`
    /// the [`gst_video::VideoInfo`][crate::gst_video::VideoInfo] for the texture
    /// ## `plane`
    /// the video plane of `v_info` to allocate
    /// ## `valign`
    /// any [`gst_video::VideoAlignment`][crate::gst_video::VideoAlignment] applied to symem mappings of the texture
    /// ## `target`
    /// the [`GLTextureTarget`][crate::GLTextureTarget] for the created textures
    /// ## `tex_format`
    /// the [`GLFormat`][crate::GLFormat] for the created textures
    ///
    /// # Returns
    ///
    /// a new [`GLVideoAllocationParams`][crate::GLVideoAllocationParams] for allocating [`GLMemory`][crate::GLMemory]'s
    #[doc(alias = "gst_gl_video_allocation_params_new")]
    pub fn new(
        context: &impl IsA<GLContext>,
        alloc_params: Option<&gst::AllocationParams>,
        v_info: &gst_video::VideoInfo,
        plane: u32,
        valign: Option<&gst_video::VideoAlignment>,
        target: GLTextureTarget,
        tex_format: GLFormat,
    ) -> GLVideoAllocationParams {
        skip_assert_initialized!();
        unsafe {
            from_glib_full(ffi::gst_gl_video_allocation_params_new(
                context.as_ref().to_glib_none().0,
                alloc_params.to_glib_none().0,
                v_info.to_glib_none().0,
                plane,
                valign.to_glib_none().0,
                target.into_glib(),
                tex_format.into_glib(),
            ))
        }
    }

    //#[doc(alias = "gst_gl_video_allocation_params_new_wrapped_data")]
    //pub fn new_wrapped_data(context: &impl IsA<GLContext>, alloc_params: Option<&gst::AllocationParams>, v_info: &gst_video::VideoInfo, plane: u32, valign: Option<&gst_video::VideoAlignment>, target: GLTextureTarget, tex_format: GLFormat, wrapped_data: /*Unimplemented*/Option<Basic: Pointer>, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> GLVideoAllocationParams {
    //    unsafe { TODO: call ffi:gst_gl_video_allocation_params_new_wrapped_data() }
    //}

    //#[doc(alias = "gst_gl_video_allocation_params_new_wrapped_gl_handle")]
    //pub fn new_wrapped_gl_handle(context: &impl IsA<GLContext>, alloc_params: Option<&gst::AllocationParams>, v_info: &gst_video::VideoInfo, plane: u32, valign: Option<&gst_video::VideoAlignment>, target: GLTextureTarget, tex_format: GLFormat, gl_handle: /*Unimplemented*/Option<Basic: Pointer>, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> GLVideoAllocationParams {
    //    unsafe { TODO: call ffi:gst_gl_video_allocation_params_new_wrapped_gl_handle() }
    //}

    //#[doc(alias = "gst_gl_video_allocation_params_new_wrapped_texture")]
    //pub fn new_wrapped_texture(context: &impl IsA<GLContext>, alloc_params: Option<&gst::AllocationParams>, v_info: &gst_video::VideoInfo, plane: u32, valign: Option<&gst_video::VideoAlignment>, target: GLTextureTarget, tex_format: GLFormat, tex_id: u32, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> GLVideoAllocationParams {
    //    unsafe { TODO: call ffi:gst_gl_video_allocation_params_new_wrapped_texture() }
    //}

    /// Copy and set any dynamically allocated resources in `dest_vid`. Intended
    /// for subclass usage only to chain up at the end of a subclass copy function.
    /// ## `dest_vid`
    /// destination [`GLVideoAllocationParams`][crate::GLVideoAllocationParams] to copy into
    #[doc(alias = "gst_gl_video_allocation_params_copy_data")]
    pub fn copy_data(&self, dest_vid: &mut GLVideoAllocationParams) {
        unsafe {
            ffi::gst_gl_video_allocation_params_copy_data(
                mut_override(self.to_glib_none().0),
                dest_vid.to_glib_none_mut().0,
            );
        }
    }

    //#[doc(alias = "gst_gl_video_allocation_params_init_full")]
    //pub fn init_full<P: Fn(&GLAllocationParams) + Send + Sync + 'static, Q: Fn() + Send + Sync + 'static>(&mut self, struct_size: usize, alloc_flags: u32, copy: P, free: Q, context: &impl IsA<GLContext>, alloc_params: Option<&gst::AllocationParams>, v_info: &gst_video::VideoInfo, plane: u32, valign: Option<&gst_video::VideoAlignment>, target: GLTextureTarget, tex_format: GLFormat, wrapped_data: /*Unimplemented*/Option<Basic: Pointer>, gl_handle: /*Unimplemented*/Option<Basic: Pointer>) -> bool {
    //    unsafe { TODO: call ffi:gst_gl_video_allocation_params_init_full() }
    //}
}

unsafe impl Send for GLVideoAllocationParams {}
unsafe impl Sync for GLVideoAllocationParams {}