mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-04-27 15:34:51 +00:00
gstreamer/ghost_pad: Move GhostPad specific code into the ghost_pad module
This commit is contained in:
parent
f95ca85a27
commit
af15dafc14
2 changed files with 294 additions and 287 deletions
|
@ -6,12 +6,21 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::object::IsA;
|
use glib::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst_sys;
|
use gst_sys;
|
||||||
|
use FlowError;
|
||||||
|
use FlowSuccess;
|
||||||
use GhostPad;
|
use GhostPad;
|
||||||
|
use LoggableError;
|
||||||
use Object;
|
use Object;
|
||||||
|
use Pad;
|
||||||
|
use PadBuilder;
|
||||||
|
use PadExtManual;
|
||||||
|
use PadFlags;
|
||||||
|
use PadGetRangeSuccess;
|
||||||
use PadMode;
|
use PadMode;
|
||||||
|
use StaticPadTemplate;
|
||||||
|
|
||||||
impl GhostPad {
|
impl GhostPad {
|
||||||
pub fn activate_mode_default<P: IsA<GhostPad>, Q: IsA<Object>>(
|
pub fn activate_mode_default<P: IsA<GhostPad>, Q: IsA<Object>>(
|
||||||
|
@ -56,4 +65,287 @@ impl GhostPad {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new(name: Option<&str>, direction: ::PadDirection) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
Self::builder(name, direction).build()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn builder(name: Option<&str>, direction: ::PadDirection) -> PadBuilder<Self> {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
PadBuilder::new(name, direction)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn from_static_template(templ: &StaticPadTemplate, name: Option<&str>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
Self::builder_with_static_template(templ, name).build()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn builder_with_static_template(
|
||||||
|
templ: &StaticPadTemplate,
|
||||||
|
name: Option<&str>,
|
||||||
|
) -> PadBuilder<Self> {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
PadBuilder::from_static_template(templ, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn from_template(templ: &::PadTemplate, name: Option<&str>) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
Self::builder_with_template(templ, name).build()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn builder_with_template(templ: &::PadTemplate, name: Option<&str>) -> PadBuilder<Self> {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
PadBuilder::from_template(templ, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: IsA<GhostPad> + IsA<Pad>> PadBuilder<T> {
|
||||||
|
pub fn proxy_pad_activate_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(&::ProxyPad, Option<&::Object>) -> Result<(), LoggableError> + Send + Sync + 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_activate_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_activatemode_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(&::ProxyPad, Option<&::Object>, ::PadMode, bool) -> Result<(), LoggableError>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_activatemode_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_chain_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(&::ProxyPad, Option<&::Object>, ::Buffer) -> Result<FlowSuccess, FlowError>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_chain_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_chain_list_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(&::ProxyPad, Option<&::Object>, ::BufferList) -> Result<FlowSuccess, FlowError>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_chain_list_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_event_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(&::ProxyPad, Option<&::Object>, ::Event) -> bool + Send + Sync + 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_event_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_event_full_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(&::ProxyPad, Option<&::Object>, ::Event) -> Result<FlowSuccess, FlowError>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_event_full_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_getrange_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(
|
||||||
|
&::ProxyPad,
|
||||||
|
Option<&::Object>,
|
||||||
|
u64,
|
||||||
|
Option<&mut ::BufferRef>,
|
||||||
|
u32,
|
||||||
|
) -> Result<PadGetRangeSuccess, ::FlowError>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_getrange_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_iterate_internal_links_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(&::ProxyPad, Option<&::Object>) -> ::Iterator<Pad> + Send + Sync + 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_iterate_internal_links_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_link_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(&::ProxyPad, Option<&::Object>, &Pad) -> Result<::PadLinkSuccess, ::PadLinkError>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_link_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_query_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(&::ProxyPad, Option<&::Object>, &mut ::QueryRef) -> bool + Send + Sync + 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_query_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_unlink_function<F>(self, func: F) -> Self
|
||||||
|
where
|
||||||
|
F: Fn(&::ProxyPad, Option<&::Object>) + Send + Sync + 'static,
|
||||||
|
{
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_unlink_function(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn proxy_pad_flags(self, flags: PadFlags) -> Self {
|
||||||
|
use ProxyPadExt;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
let proxy = self
|
||||||
|
.0
|
||||||
|
.unsafe_cast_ref::<::ProxyPad>()
|
||||||
|
.get_internal()
|
||||||
|
.unwrap();
|
||||||
|
proxy.set_pad_flags(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn build_with_target<P: IsA<Pad>>(self, target: &P) -> Result<T, glib::BoolError> {
|
||||||
|
use GhostPadExt;
|
||||||
|
use PadExt;
|
||||||
|
|
||||||
|
assert_eq!(self.0.get_direction(), target.get_direction());
|
||||||
|
|
||||||
|
self.0.set_target(Some(target))?;
|
||||||
|
|
||||||
|
Ok(self.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1578,42 +1578,7 @@ impl Pad {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::GhostPad {
|
pub struct PadBuilder<T>(pub(crate) T);
|
||||||
pub fn new(name: Option<&str>, direction: ::PadDirection) -> Self {
|
|
||||||
skip_assert_initialized!();
|
|
||||||
Self::builder(name, direction).build()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn builder(name: Option<&str>, direction: ::PadDirection) -> PadBuilder<Self> {
|
|
||||||
skip_assert_initialized!();
|
|
||||||
PadBuilder::new(name, direction)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from_static_template(templ: &StaticPadTemplate, name: Option<&str>) -> Self {
|
|
||||||
skip_assert_initialized!();
|
|
||||||
Self::builder_with_static_template(templ, name).build()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn builder_with_static_template(
|
|
||||||
templ: &StaticPadTemplate,
|
|
||||||
name: Option<&str>,
|
|
||||||
) -> PadBuilder<Self> {
|
|
||||||
skip_assert_initialized!();
|
|
||||||
PadBuilder::from_static_template(templ, name)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from_template(templ: &::PadTemplate, name: Option<&str>) -> Self {
|
|
||||||
skip_assert_initialized!();
|
|
||||||
Self::builder_with_template(templ, name).build()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn builder_with_template(templ: &::PadTemplate, name: Option<&str>) -> PadBuilder<Self> {
|
|
||||||
skip_assert_initialized!();
|
|
||||||
PadBuilder::from_template(templ, name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct PadBuilder<T>(T);
|
|
||||||
|
|
||||||
impl<T: IsA<Pad> + IsA<glib::Object>> PadBuilder<T> {
|
impl<T: IsA<Pad> + IsA<glib::Object>> PadBuilder<T> {
|
||||||
pub fn new(name: Option<&str>, direction: ::PadDirection) -> Self {
|
pub fn new(name: Option<&str>, direction: ::PadDirection) -> Self {
|
||||||
|
@ -1854,256 +1819,6 @@ impl<T: IsA<Pad> + IsA<glib::Object>> PadBuilder<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: IsA<::GhostPad> + IsA<Pad>> PadBuilder<T> {
|
|
||||||
pub fn proxy_pad_activate_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(&::ProxyPad, Option<&::Object>) -> Result<(), LoggableError> + Send + Sync + 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_activate_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_activatemode_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(&::ProxyPad, Option<&::Object>, ::PadMode, bool) -> Result<(), LoggableError>
|
|
||||||
+ Send
|
|
||||||
+ Sync
|
|
||||||
+ 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_activatemode_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_chain_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(&::ProxyPad, Option<&::Object>, ::Buffer) -> Result<FlowSuccess, FlowError>
|
|
||||||
+ Send
|
|
||||||
+ Sync
|
|
||||||
+ 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_chain_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_chain_list_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(&::ProxyPad, Option<&::Object>, ::BufferList) -> Result<FlowSuccess, FlowError>
|
|
||||||
+ Send
|
|
||||||
+ Sync
|
|
||||||
+ 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_chain_list_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_event_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(&::ProxyPad, Option<&::Object>, ::Event) -> bool + Send + Sync + 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_event_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_event_full_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(&::ProxyPad, Option<&::Object>, ::Event) -> Result<FlowSuccess, FlowError>
|
|
||||||
+ Send
|
|
||||||
+ Sync
|
|
||||||
+ 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_event_full_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_getrange_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(
|
|
||||||
&::ProxyPad,
|
|
||||||
Option<&::Object>,
|
|
||||||
u64,
|
|
||||||
Option<&mut ::BufferRef>,
|
|
||||||
u32,
|
|
||||||
) -> Result<PadGetRangeSuccess, ::FlowError>
|
|
||||||
+ Send
|
|
||||||
+ Sync
|
|
||||||
+ 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_getrange_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_iterate_internal_links_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(&::ProxyPad, Option<&::Object>) -> ::Iterator<Pad> + Send + Sync + 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_iterate_internal_links_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_link_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(&::ProxyPad, Option<&::Object>, &Pad) -> Result<::PadLinkSuccess, ::PadLinkError>
|
|
||||||
+ Send
|
|
||||||
+ Sync
|
|
||||||
+ 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_link_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_query_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(&::ProxyPad, Option<&::Object>, &mut ::QueryRef) -> bool + Send + Sync + 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_query_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_unlink_function<F>(self, func: F) -> Self
|
|
||||||
where
|
|
||||||
F: Fn(&::ProxyPad, Option<&::Object>) + Send + Sync + 'static,
|
|
||||||
{
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_unlink_function(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn proxy_pad_flags(self, flags: PadFlags) -> Self {
|
|
||||||
use ProxyPadExt;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let proxy = self
|
|
||||||
.0
|
|
||||||
.unsafe_cast_ref::<::ProxyPad>()
|
|
||||||
.get_internal()
|
|
||||||
.unwrap();
|
|
||||||
proxy.set_pad_flags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn build_with_target<P: IsA<Pad>>(self, target: &P) -> Result<T, glib::BoolError> {
|
|
||||||
use GhostPadExt;
|
|
||||||
use PadExt;
|
|
||||||
|
|
||||||
assert_eq!(self.0.get_direction(), target.get_direction());
|
|
||||||
|
|
||||||
self.0.set_target(Some(target))?;
|
|
||||||
|
|
||||||
Ok(self.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Reference in a new issue