2019-05-12 13:38:40 +00:00
|
|
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
|
|
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
|
|
|
// DO NOT EDIT
|
|
|
|
|
2020-11-21 13:46:33 +00:00
|
|
|
use crate::Object;
|
2019-05-12 13:38:40 +00:00
|
|
|
use glib::object::IsA;
|
|
|
|
use glib::translate::*;
|
|
|
|
|
2020-12-17 22:34:53 +00:00
|
|
|
glib::wrapper! {
|
2020-11-21 13:46:33 +00:00
|
|
|
pub struct Allocator(Object<ffi::GstAllocator, ffi::GstAllocatorClass>) @extends Object;
|
2019-05-12 13:38:40 +00:00
|
|
|
|
|
|
|
match fn {
|
2020-11-21 13:46:33 +00:00
|
|
|
get_type => || ffi::gst_allocator_get_type(),
|
2019-05-12 13:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Allocator {
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_allocator_find")]
|
2019-05-12 13:38:40 +00:00
|
|
|
pub fn find(name: Option<&str>) -> Option<Allocator> {
|
|
|
|
assert_initialized_main_thread!();
|
2020-11-21 13:46:33 +00:00
|
|
|
unsafe { from_glib_full(ffi::gst_allocator_find(name.to_glib_none().0)) }
|
2019-05-12 13:38:40 +00:00
|
|
|
}
|
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_allocator_register")]
|
2019-05-12 13:38:40 +00:00
|
|
|
pub fn register<P: IsA<Allocator>>(name: &str, allocator: &P) {
|
|
|
|
skip_assert_initialized!();
|
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
ffi::gst_allocator_register(name.to_glib_none().0, allocator.as_ref().to_glib_full());
|
2019-05-12 13:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for Allocator {}
|
|
|
|
unsafe impl Sync for Allocator {}
|
|
|
|
|
|
|
|
pub const NONE_ALLOCATOR: Option<&Allocator> = None;
|
|
|
|
|
|
|
|
pub trait AllocatorExt: 'static {
|
2020-12-08 13:00:17 +00:00
|
|
|
//#[doc(alias = "gst_allocator_alloc")]
|
2019-06-18 10:10:46 +00:00
|
|
|
//fn alloc(&self, size: usize, params: /*Ignored*/Option<&mut AllocationParams>) -> /*Ignored*/Option<Memory>;
|
2019-05-12 13:38:40 +00:00
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
//#[doc(alias = "gst_allocator_free")]
|
2021-01-29 08:42:23 +00:00
|
|
|
//fn free(&self, memory: /*Ignored*/&mut Memory);
|
2019-05-12 13:38:40 +00:00
|
|
|
|
2020-12-08 13:00:17 +00:00
|
|
|
#[doc(alias = "gst_allocator_set_default")]
|
2019-05-12 13:38:40 +00:00
|
|
|
fn set_default(&self);
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<O: IsA<Allocator>> AllocatorExt for O {
|
2019-06-18 10:10:46 +00:00
|
|
|
//fn alloc(&self, size: usize, params: /*Ignored*/Option<&mut AllocationParams>) -> /*Ignored*/Option<Memory> {
|
2020-11-21 13:46:33 +00:00
|
|
|
// unsafe { TODO: call ffi:gst_allocator_alloc() }
|
2019-05-12 13:38:40 +00:00
|
|
|
//}
|
|
|
|
|
2021-01-29 08:42:23 +00:00
|
|
|
//fn free(&self, memory: /*Ignored*/&mut Memory) {
|
2020-11-21 13:46:33 +00:00
|
|
|
// unsafe { TODO: call ffi:gst_allocator_free() }
|
2019-05-12 13:38:40 +00:00
|
|
|
//}
|
|
|
|
|
|
|
|
fn set_default(&self) {
|
|
|
|
unsafe {
|
2020-11-21 13:46:33 +00:00
|
|
|
ffi::gst_allocator_set_default(self.as_ref().to_glib_full());
|
2019-05-12 13:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|