gstreamer-rs/gstreamer/src/auto/buffer_pool.rs

97 lines
2.6 KiB
Rust
Raw Normal View History

2018-04-23 17:34:22 +00:00
// 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)
2018-03-07 09:07:30 +00:00
// DO NOT EDIT
2020-11-21 13:46:33 +00:00
use crate::Object;
2018-03-07 09:07:30 +00:00
use glib::object::IsA;
use glib::translate::*;
2020-12-17 22:34:53 +00:00
glib::wrapper! {
#[doc(alias = "GstBufferPool")]
2020-11-21 13:46:33 +00:00
pub struct BufferPool(Object<ffi::GstBufferPool, ffi::GstBufferPoolClass>) @extends Object;
2018-03-07 09:07:30 +00:00
match fn {
type_ => || ffi::gst_buffer_pool_get_type(),
2018-03-07 09:07:30 +00:00
}
}
2021-11-03 17:28:46 +00:00
impl BufferPool {
pub const NONE: Option<&'static BufferPool> = None;
#[doc(alias = "gst_buffer_pool_new")]
pub fn new() -> BufferPool {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_buffer_pool_new()) }
}
}
impl Default for BufferPool {
fn default() -> Self {
Self::new()
}
2021-11-03 17:28:46 +00:00
}
2019-01-16 11:32:39 +00:00
2021-11-16 14:02:58 +00:00
unsafe impl Send for BufferPool {}
unsafe impl Sync for BufferPool {}
pub trait BufferPoolExt: 'static {
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_buffer_pool_get_options")]
#[doc(alias = "get_options")]
2021-04-11 19:38:18 +00:00
fn options(&self) -> Vec<glib::GString>;
2018-03-07 09:07:30 +00:00
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_buffer_pool_has_option")]
2018-03-07 09:07:30 +00:00
fn has_option(&self, option: &str) -> bool;
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_buffer_pool_is_active")]
2018-03-07 09:07:30 +00:00
fn is_active(&self) -> bool;
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_buffer_pool_set_active")]
2018-03-07 09:07:30 +00:00
fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError>;
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_buffer_pool_set_flushing")]
2018-03-07 09:07:30 +00:00
fn set_flushing(&self, flushing: bool);
}
impl<O: IsA<BufferPool>> BufferPoolExt for O {
2021-04-11 19:38:18 +00:00
fn options(&self) -> Vec<glib::GString> {
2018-03-07 09:07:30 +00:00
unsafe {
2020-11-21 13:46:33 +00:00
FromGlibPtrContainer::from_glib_none(ffi::gst_buffer_pool_get_options(
self.as_ref().to_glib_none().0,
))
2018-03-07 09:07:30 +00:00
}
}
fn has_option(&self, option: &str) -> bool {
unsafe {
2020-11-21 13:46:33 +00:00
from_glib(ffi::gst_buffer_pool_has_option(
self.as_ref().to_glib_none().0,
option.to_glib_none().0,
))
2018-03-07 09:07:30 +00:00
}
}
fn is_active(&self) -> bool {
unsafe {
2020-11-21 13:46:33 +00:00
from_glib(ffi::gst_buffer_pool_is_active(
self.as_ref().to_glib_none().0,
))
2018-03-07 09:07:30 +00:00
}
}
fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> {
unsafe {
2020-12-17 22:34:53 +00:00
glib::result_from_gboolean!(
ffi::gst_buffer_pool_set_active(self.as_ref().to_glib_none().0, active.into_glib()),
"Failed to activate buffer pool"
)
2018-03-07 09:07:30 +00:00
}
}
fn set_flushing(&self, flushing: bool) {
unsafe {
ffi::gst_buffer_pool_set_flushing(self.as_ref().to_glib_none().0, flushing.into_glib());
2018-03-07 09:07:30 +00:00
}
}
}