forked from mirrors/gstreamer-rs
Port GhostPad subclassing
This commit is contained in:
parent
ec2a0635ca
commit
d2b911a629
6 changed files with 59 additions and 2 deletions
|
@ -735,6 +735,7 @@ trait = false
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "Gst.GhostPad"
|
name = "Gst.GhostPad"
|
||||||
|
subclassing = true
|
||||||
status = "generate"
|
status = "generate"
|
||||||
[[object.function]]
|
[[object.function]]
|
||||||
name = "set_target"
|
name = "set_target"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
|
use GhostPadClass;
|
||||||
use Object;
|
use Object;
|
||||||
use Pad;
|
use Pad;
|
||||||
use PadDirection;
|
use PadDirection;
|
||||||
|
@ -18,7 +19,7 @@ use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
glib_wrapper! {
|
glib_wrapper! {
|
||||||
pub struct GhostPad(Object<ffi::GstGhostPad, ffi::GstGhostPadClass>): ProxyPad, Pad, Object;
|
pub struct GhostPad(Object<ffi::GstGhostPad, ffi::GstGhostPadClass, GhostPadClass>): ProxyPad, Pad, Object;
|
||||||
|
|
||||||
match fn {
|
match fn {
|
||||||
get_type => || ffi::gst_ghost_pad_get_type(),
|
get_type => || ffi::gst_ghost_pad_get_type(),
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
use ffi;
|
use ffi;
|
||||||
use glib::object::Downcast;
|
use glib::object::Downcast;
|
||||||
use glib::object::IsA;
|
use glib::object::{IsA, IsClassFor};
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use GhostPad;
|
use GhostPad;
|
||||||
use Object;
|
use Object;
|
||||||
|
@ -16,6 +16,8 @@ use Pad;
|
||||||
use PadMode;
|
use PadMode;
|
||||||
use PadTemplate;
|
use PadTemplate;
|
||||||
|
|
||||||
|
use std::ops;
|
||||||
|
|
||||||
impl GhostPad {
|
impl GhostPad {
|
||||||
pub fn new<'a, P: Into<Option<&'a str>>, Q: IsA<Pad>>(name: P, target: &Q) -> Option<GhostPad> {
|
pub fn new<'a, P: Into<Option<&'a str>>, Q: IsA<Pad>>(name: P, target: &Q) -> Option<GhostPad> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
@ -93,3 +95,27 @@ impl GhostPad {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct GhostPadClass(ffi::GstGhostPadClass);
|
||||||
|
|
||||||
|
unsafe impl IsClassFor for GhostPadClass {
|
||||||
|
type Instance = GhostPad;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for GhostPadClass {}
|
||||||
|
unsafe impl Sync for GhostPadClass {}
|
||||||
|
|
||||||
|
impl ops::Deref for GhostPadClass {
|
||||||
|
type Target = ::PadClass;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
self.upcast_ref()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ops::DerefMut for GhostPadClass {
|
||||||
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||||
|
self.upcast_ref_mut()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -180,6 +180,7 @@ mod device_monitor;
|
||||||
mod device_provider;
|
mod device_provider;
|
||||||
mod enums;
|
mod enums;
|
||||||
mod ghost_pad;
|
mod ghost_pad;
|
||||||
|
pub use ghost_pad::GhostPadClass;
|
||||||
mod gobject;
|
mod gobject;
|
||||||
mod iterator;
|
mod iterator;
|
||||||
mod object;
|
mod object;
|
||||||
|
|
26
gstreamer/src/subclass/ghost_pad.rs
Normal file
26
gstreamer/src/subclass/ghost_pad.rs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (C) 2018 Sebastian Dröge <sebastian@centricular.com>
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
use ffi;
|
||||||
|
|
||||||
|
use super::prelude::*;
|
||||||
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
|
use GhostPadClass;
|
||||||
|
|
||||||
|
pub trait GhostPadImpl: PadImpl + Send + Sync + 'static {}
|
||||||
|
|
||||||
|
unsafe impl<T: ObjectSubclass + GhostPadImpl> IsSubclassable<T> for GhostPadClass {
|
||||||
|
fn override_vfuncs(&mut self) {
|
||||||
|
<::PadClass as IsSubclassable<T>>::override_vfuncs(self);
|
||||||
|
unsafe {
|
||||||
|
let _klass = &mut *(self as *const Self as *mut ffi::GstGhostPadClass);
|
||||||
|
// Nothing to do here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ pub mod plugin;
|
||||||
pub mod bin;
|
pub mod bin;
|
||||||
pub mod child_proxy;
|
pub mod child_proxy;
|
||||||
pub mod element;
|
pub mod element;
|
||||||
|
pub mod ghost_pad;
|
||||||
pub mod pad;
|
pub mod pad;
|
||||||
pub mod pipeline;
|
pub mod pipeline;
|
||||||
pub mod uri_handler;
|
pub mod uri_handler;
|
||||||
|
@ -24,6 +25,7 @@ pub mod prelude {
|
||||||
pub use super::bin::BinImpl;
|
pub use super::bin::BinImpl;
|
||||||
pub use super::child_proxy::ChildProxyImpl;
|
pub use super::child_proxy::ChildProxyImpl;
|
||||||
pub use super::element::{ElementClassSubclassExt, ElementImpl, ElementImplExt};
|
pub use super::element::{ElementClassSubclassExt, ElementImpl, ElementImplExt};
|
||||||
|
pub use super::ghost_pad::GhostPadImpl;
|
||||||
pub use super::pad::PadImpl;
|
pub use super::pad::PadImpl;
|
||||||
pub use super::pipeline::PipelineImpl;
|
pub use super::pipeline::PipelineImpl;
|
||||||
pub use super::uri_handler::URIHandlerImpl;
|
pub use super::uri_handler::URIHandlerImpl;
|
||||||
|
|
Loading…
Reference in a new issue