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::{Buffer, Object};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 #[doc(alias = "GstBufferPool")]
11 pub struct BufferPool(Object<ffi::GstBufferPool, ffi::GstBufferPoolClass>) @extends Object;
12
13 match fn {
14 type_ => || ffi::gst_buffer_pool_get_type(),
15 }
16}
17
18impl BufferPool {
19 pub const NONE: Option<&'static BufferPool> = None;
20
21 #[doc(alias = "gst_buffer_pool_new")]
22 pub fn new() -> BufferPool {
23 assert_initialized_main_thread!();
24 unsafe { from_glib_full(ptr:ffi::gst_buffer_pool_new()) }
25 }
26}
27
28impl Default for BufferPool {
29 fn default() -> Self {
30 Self::new()
31 }
32}
33
34unsafe impl Send for BufferPool {}
35unsafe impl Sync for BufferPool {}
36
37mod sealed {
38 pub trait Sealed {}
39 impl<T: super::IsA<super::BufferPool>> Sealed for T {}
40}
41
42pub trait BufferPoolExt: IsA<BufferPool> + sealed::Sealed + 'static {
43 #[doc(alias = "gst_buffer_pool_get_options")]
44 #[doc(alias = "get_options")]
45 fn options(&self) -> Vec<glib::GString> {
46 unsafe {
47 FromGlibPtrContainer::from_glib_none(ffi::gst_buffer_pool_get_options(
48 self.as_ref().to_glib_none().0,
49 ))
50 }
51 }
52
53 #[doc(alias = "gst_buffer_pool_has_option")]
54 fn has_option(&self, option: &str) -> bool {
55 unsafe {
56 from_glib(ffi::gst_buffer_pool_has_option(
57 self.as_ref().to_glib_none().0,
58 option.to_glib_none().0,
59 ))
60 }
61 }
62
63 #[doc(alias = "gst_buffer_pool_is_active")]
64 fn is_active(&self) -> bool {
65 unsafe {
66 from_glib(ffi::gst_buffer_pool_is_active(
67 self.as_ref().to_glib_none().0,
68 ))
69 }
70 }
71
72 #[doc(alias = "gst_buffer_pool_release_buffer")]
73 fn release_buffer(&self, buffer: Buffer) {
74 unsafe {
75 ffi::gst_buffer_pool_release_buffer(
76 self.as_ref().to_glib_none().0,
77 buffer.into_glib_ptr(),
78 );
79 }
80 }
81
82 #[doc(alias = "gst_buffer_pool_set_active")]
83 fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> {
84 unsafe {
85 glib::result_from_gboolean!(
86 ffi::gst_buffer_pool_set_active(self.as_ref().to_glib_none().0, active.into_glib()),
87 "Failed to activate buffer pool"
88 )
89 }
90 }
91
92 #[doc(alias = "gst_buffer_pool_set_flushing")]
93 fn set_flushing(&self, flushing: bool) {
94 unsafe {
95 ffi::gst_buffer_pool_set_flushing(self.as_ref().to_glib_none().0, flushing.into_glib());
96 }
97 }
98}
99
100impl<O: IsA<BufferPool>> BufferPoolExt for O {}
101