Commit d2b911a6 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Port GhostPad subclassing

parent ec2a0635
......@@ -735,6 +735,7 @@ trait = false
[[object]]
name = "Gst.GhostPad"
subclassing = true
status = "generate"
[[object.function]]
name = "set_target"
......
......@@ -2,6 +2,7 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use GhostPadClass;
use Object;
use Pad;
use PadDirection;
......@@ -18,7 +19,7 @@ use std::mem;
use std::ptr;
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 {
get_type => || ffi::gst_ghost_pad_get_type(),
......
......@@ -8,7 +8,7 @@
use ffi;
use glib::object::Downcast;
use glib::object::IsA;
use glib::object::{IsA, IsClassFor};
use glib::translate::*;
use GhostPad;
use Object;
......@@ -16,6 +16,8 @@ use Pad;
use PadMode;
use PadTemplate;
use std::ops;
impl GhostPad {
pub fn new<'a, P: Into<Option<&'a str>>, Q: IsA<Pad>>(name: P, target: &Q) -> Option<GhostPad> {
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 enums;
mod ghost_pad;
pub use ghost_pad::GhostPadClass;
mod gobject;
mod iterator;
mod object;
......
// 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 child_proxy;
pub mod element;
pub mod ghost_pad;
pub mod pad;
pub mod pipeline;
pub mod uri_handler;
......@@ -24,6 +25,7 @@ pub mod prelude {
pub use super::bin::BinImpl;
pub use super::child_proxy::ChildProxyImpl;
pub use super::element::{ElementClassSubclassExt, ElementImpl, ElementImplExt};
pub use super::ghost_pad::GhostPadImpl;
pub use super::pad::PadImpl;
pub use super::pipeline::PipelineImpl;
pub use super::uri_handler::URIHandlerImpl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment