gstreamer-rs/gstreamer/src/proxy_pad.rs

109 lines
3.1 KiB
Rust
Raw Normal View History

2020-12-15 10:53:31 +00:00
// Take a look at the license at the top of the repository in the LICENSE file.
2017-07-29 13:19:15 +00:00
use crate::Buffer;
use crate::BufferList;
use crate::FlowError;
use crate::FlowSuccess;
use crate::Object;
use crate::Pad;
use crate::ProxyPad;
2018-04-25 08:10:06 +00:00
use std::ptr;
2017-07-29 13:19:15 +00:00
2021-04-26 12:15:53 +00:00
use glib::prelude::*;
2021-04-28 12:34:56 +00:00
use glib::translate::*;
2017-07-29 13:19:15 +00:00
pub trait ProxyPadExtManual: 'static {
#[doc(alias = "gst_proxy_pad_chain_default")]
fn chain_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
buffer: Buffer,
) -> Result<FlowSuccess, FlowError>;
#[doc(alias = "gst_proxy_pad_chain_list_default")]
fn chain_list_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
list: BufferList,
) -> Result<FlowSuccess, FlowError>;
#[doc(alias = "gst_proxy_pad_getrange_default")]
fn getrange_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
offset: u64,
size: u32,
) -> Result<Buffer, FlowError>;
#[doc(alias = "gst_proxy_pad_iterate_internal_links_default")]
fn iterate_internal_links_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
) -> Option<crate::Iterator<Pad>>;
}
impl<O: IsA<ProxyPad>> ProxyPadExtManual for O {
fn chain_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
buffer: Buffer,
) -> Result<FlowSuccess, FlowError> {
2017-07-29 13:19:15 +00:00
skip_assert_initialized!();
2021-04-28 12:34:56 +00:00
unsafe {
FlowSuccess::try_from_glib(ffi::gst_proxy_pad_chain_default(
self.as_ptr() as *mut ffi::GstPad,
parent.map(|p| p.as_ref()).to_glib_none().0,
buffer.into_ptr(),
))
2021-04-28 12:34:56 +00:00
}
2017-07-29 13:19:15 +00:00
}
fn chain_list_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
list: BufferList,
) -> Result<FlowSuccess, FlowError> {
skip_assert_initialized!();
2021-04-28 12:34:56 +00:00
unsafe {
FlowSuccess::try_from_glib(ffi::gst_proxy_pad_chain_list_default(
self.as_ptr() as *mut ffi::GstPad,
parent.map(|p| p.as_ref()).to_glib_none().0,
list.into_ptr(),
))
2021-04-28 12:34:56 +00:00
}
}
fn getrange_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
offset: u64,
size: u32,
) -> Result<Buffer, FlowError> {
2017-07-29 13:19:15 +00:00
skip_assert_initialized!();
unsafe {
let mut buffer = ptr::null_mut();
2021-04-28 12:34:56 +00:00
FlowSuccess::try_from_glib(ffi::gst_proxy_pad_getrange_default(
self.as_ptr() as *mut ffi::GstPad,
parent.map(|p| p.as_ref()).to_glib_none().0,
offset,
size,
&mut buffer,
2021-04-28 12:34:56 +00:00
))
.map(|_| from_glib_full(buffer))
2017-07-29 13:19:15 +00:00
}
}
fn iterate_internal_links_default<P: IsA<Object>>(
&self,
parent: Option<&P>,
) -> Option<crate::Iterator<Pad>> {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default(
self.as_ptr() as *mut ffi::GstPad,
parent.map(|p| p.as_ref()).to_glib_none().0,
))
}
}
2017-07-29 13:19:15 +00:00
}