gstreamer_gl/auto/
gl_upload.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::{ffi, GLContext};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    /// [`GLUpload`][crate::GLUpload] is an object that uploads data from system memory into GL textures.
11    ///
12    /// A [`GLUpload`][crate::GLUpload] can be created with [`new()`][Self::new()]
13    ///
14    /// # Implements
15    ///
16    /// [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
17    #[doc(alias = "GstGLUpload")]
18    pub struct GLUpload(Object<ffi::GstGLUpload, ffi::GstGLUploadClass>) @extends gst::Object;
19
20    match fn {
21        type_ => || ffi::gst_gl_upload_get_type(),
22    }
23}
24
25impl GLUpload {
26    /// ## `context`
27    /// a [`GLContext`][crate::GLContext]
28    ///
29    /// # Returns
30    ///
31    /// a new [`GLUpload`][crate::GLUpload] object
32    #[doc(alias = "gst_gl_upload_new")]
33    pub fn new(context: &impl IsA<GLContext>) -> GLUpload {
34        skip_assert_initialized!();
35        unsafe { from_glib_full(ffi::gst_gl_upload_new(context.as_ref().to_glib_none().0)) }
36    }
37
38    /// Fixate the `othercaps` based on the information of the `caps`.
39    /// ## `direction`
40    /// the pad [`gst::PadDirection`][crate::gst::PadDirection]
41    /// ## `caps`
42    /// a [`gst::Caps`][crate::gst::Caps] as the reference
43    /// ## `othercaps`
44    /// a [`gst::Caps`][crate::gst::Caps] to fixate
45    ///
46    /// # Returns
47    ///
48    /// the fixated caps
49    #[cfg(feature = "v1_24")]
50    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
51    #[doc(alias = "gst_gl_upload_fixate_caps")]
52    pub fn fixate_caps(
53        &self,
54        direction: gst::PadDirection,
55        caps: &gst::Caps,
56        othercaps: gst::Caps,
57    ) -> gst::Caps {
58        unsafe {
59            from_glib_full(ffi::gst_gl_upload_fixate_caps(
60                self.to_glib_none().0,
61                direction.into_glib(),
62                caps.to_glib_none().0,
63                othercaps.into_glib_ptr(),
64            ))
65        }
66    }
67
68    ///
69    /// # Returns
70    ///
71    ///
72    /// ## `in_caps`
73    /// the input [`gst::Caps`][crate::gst::Caps]
74    ///
75    /// ## `out_caps`
76    /// the output [`gst::Caps`][crate::gst::Caps]
77    #[doc(alias = "gst_gl_upload_get_caps")]
78    #[doc(alias = "get_caps")]
79    pub fn caps(&self) -> (gst::Caps, gst::Caps) {
80        unsafe {
81            let mut in_caps = std::ptr::null_mut();
82            let mut out_caps = std::ptr::null_mut();
83            ffi::gst_gl_upload_get_caps(self.to_glib_none().0, &mut in_caps, &mut out_caps);
84            (from_glib_full(in_caps), from_glib_full(out_caps))
85        }
86    }
87
88    /// Initializes `self` with the information required for upload.
89    /// ## `in_caps`
90    /// input [`gst::Caps`][crate::gst::Caps]
91    /// ## `out_caps`
92    /// output [`gst::Caps`][crate::gst::Caps]
93    ///
94    /// # Returns
95    ///
96    /// whether `in_caps` and `out_caps` could be set on `self`
97    #[doc(alias = "gst_gl_upload_set_caps")]
98    pub fn set_caps(
99        &self,
100        in_caps: &gst::Caps,
101        out_caps: &gst::Caps,
102    ) -> Result<(), glib::error::BoolError> {
103        unsafe {
104            glib::result_from_gboolean!(
105                ffi::gst_gl_upload_set_caps(
106                    self.to_glib_none().0,
107                    in_caps.to_glib_none().0,
108                    out_caps.to_glib_none().0
109                ),
110                "Failed to set caps"
111            )
112        }
113    }
114
115    #[doc(alias = "gst_gl_upload_set_context")]
116    pub fn set_context(&self, context: &impl IsA<GLContext>) {
117        unsafe {
118            ffi::gst_gl_upload_set_context(
119                self.to_glib_none().0,
120                context.as_ref().to_glib_none().0,
121            );
122        }
123    }
124
125    #[doc(alias = "gst_gl_upload_transform_caps")]
126    pub fn transform_caps(
127        &self,
128        context: &impl IsA<GLContext>,
129        direction: gst::PadDirection,
130        caps: &gst::Caps,
131        filter: &gst::Caps,
132    ) -> gst::Caps {
133        unsafe {
134            from_glib_full(ffi::gst_gl_upload_transform_caps(
135                self.to_glib_none().0,
136                context.as_ref().to_glib_none().0,
137                direction.into_glib(),
138                caps.to_glib_none().0,
139                filter.to_glib_none().0,
140            ))
141        }
142    }
143
144    #[doc(alias = "gst_gl_upload_get_input_template_caps")]
145    #[doc(alias = "get_input_template_caps")]
146    pub fn input_template_caps() -> gst::Caps {
147        assert_initialized_main_thread!();
148        unsafe { from_glib_full(ffi::gst_gl_upload_get_input_template_caps()) }
149    }
150}
151
152unsafe impl Send for GLUpload {}
153unsafe impl Sync for GLUpload {}