gstreamer_gl/auto/gl_buffer_pool.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
6#[cfg(feature = "v1_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
8use crate::GLAllocationParams;
9use crate::{ffi, GLContext};
10use glib::{prelude::*, translate::*};
11
12glib::wrapper! {
13 /// a [`GLBufferPool`][crate::GLBufferPool] is an object that allocates buffers with [`GLBaseMemory`][crate::GLBaseMemory]
14 ///
15 /// A [`GLBufferPool`][crate::GLBufferPool] is created with [`new()`][Self::new()]
16 ///
17 /// [`GLBufferPool`][crate::GLBufferPool] implements the VideoMeta buffer pool option
18 /// `GST_BUFFER_POOL_OPTION_VIDEO_META`, the VideoAligment buffer pool option
19 /// `GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT` as well as the OpenGL specific
20 /// [`BUFFER_POOL_OPTION_GL_SYNC_META`][crate::BUFFER_POOL_OPTION_GL_SYNC_META] buffer pool option.
21 ///
22 /// # Implements
23 ///
24 /// [`GLBufferPoolExt`][trait@crate::prelude::GLBufferPoolExt], [`trait@gst::prelude::BufferPoolExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
25 #[doc(alias = "GstGLBufferPool")]
26 pub struct GLBufferPool(Object<ffi::GstGLBufferPool, ffi::GstGLBufferPoolClass>) @extends gst::BufferPool, gst::Object;
27
28 match fn {
29 type_ => || ffi::gst_gl_buffer_pool_get_type(),
30 }
31}
32
33impl GLBufferPool {
34 pub const NONE: Option<&'static GLBufferPool> = None;
35
36 /// ## `context`
37 /// the [`GLContext`][crate::GLContext] to use
38 ///
39 /// # Returns
40 ///
41 /// a [`gst::BufferPool`][crate::gst::BufferPool] that allocates buffers with [`GLMemory`][crate::GLMemory]
42 #[doc(alias = "gst_gl_buffer_pool_new")]
43 pub fn new(context: &impl IsA<GLContext>) -> GLBufferPool {
44 skip_assert_initialized!();
45 unsafe {
46 gst::BufferPool::from_glib_none(ffi::gst_gl_buffer_pool_new(
47 context.as_ref().to_glib_none().0,
48 ))
49 .unsafe_cast()
50 }
51 }
52}
53
54unsafe impl Send for GLBufferPool {}
55unsafe impl Sync for GLBufferPool {}
56
57/// Trait containing all [`struct@GLBufferPool`] methods.
58///
59/// # Implementors
60///
61/// [`GLBufferPool`][struct@crate::GLBufferPool]
62pub trait GLBufferPoolExt: IsA<GLBufferPool> + 'static {
63 /// The returned [`GLAllocationParams`][crate::GLAllocationParams] will by [`None`] before the first successful
64 /// call to [`BufferPoolExtManual::set_config()`][crate::gst::prelude::BufferPoolExtManual::set_config()]. Subsequent successful calls to
65 /// [`BufferPoolExtManual::set_config()`][crate::gst::prelude::BufferPoolExtManual::set_config()] will cause this function to return a new
66 /// [`GLAllocationParams`][crate::GLAllocationParams] which may or may not contain the same information.
67 ///
68 /// # Returns
69 ///
70 /// a copy of the [`GLAllocationParams`][crate::GLAllocationParams] being used by the `self`
71 #[cfg(feature = "v1_20")]
72 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
73 #[doc(alias = "gst_gl_buffer_pool_get_gl_allocation_params")]
74 #[doc(alias = "get_gl_allocation_params")]
75 fn gl_allocation_params(&self) -> Option<GLAllocationParams> {
76 unsafe {
77 from_glib_full(ffi::gst_gl_buffer_pool_get_gl_allocation_params(
78 self.as_ref().to_glib_none().0,
79 ))
80 }
81 }
82}
83
84impl<O: IsA<GLBufferPool>> GLBufferPoolExt for O {}