1use std::mem;
10use std::ptr;
11
12use glib_ffi;
13use gobject_ffi;
14use gst_ffi;
15
16use glib;
17use glib::translate::*;
18use gst;
19use gst::prelude::*;
20
21use gobject_subclass::anyimpl::*;
22use gobject_subclass::object::*;
23
24use pad::*;
25
26pub trait GhostPadImpl<T: GhostPadBase>:
27 AnyImpl + ObjectImpl<T> + PadImpl<T> + Send + Sync + 'static
28{
29}
30
31any_impl!(GhostPadBase, GhostPadImpl);
32
33pub unsafe trait GhostPadBase: IsA<gst::GhostPad> + IsA<gst::Pad> + ObjectType {}
34
35pub unsafe trait GhostPadClassExt<T: GhostPadBase>
36where
37 T::ImplType: GhostPadImpl<T>,
38{
39 fn override_vfuncs(&mut self, _: &ClassInitToken) {}
40}
41
42glib_wrapper! {
43 pub struct GhostPad(Object<InstanceStruct<GhostPad>>):
44 [gst::GhostPad => gst_ffi::GstGhostPad,
45 gst::ProxyPad => gst_ffi::GstProxyPad,
46 gst::Pad => gst_ffi::GstPad,
47 gst::Object => gst_ffi::GstObject];
48
49 match fn {
50 get_type => || get_type::<GhostPad>(),
51 }
52}
53
54unsafe impl<T: IsA<gst::GhostPad> + IsA<gst::Pad> + ObjectType> GhostPadBase for T {}
55pub type GhostPadClass = ClassStruct<GhostPad>;
56
57unsafe impl GhostPadClassExt<GhostPad> for GhostPadClass {}
59unsafe impl PadClassExt<GhostPad> for GhostPadClass {}
60unsafe impl ObjectClassExt<GhostPad> for GhostPadClass {}
61
62unsafe impl Send for GhostPad {}
63unsafe impl Sync for GhostPad {}
64
65#[macro_export]
66macro_rules! box_ghost_pad_impl(
67 ($name:ident) => {
68 box_pad_impl!($name);
69
70 impl<T: GhostPadBase> GhostPadImpl<T> for Box<$name<T>>
71 {
72 }
73 };
74);
75box_ghost_pad_impl!(GhostPadImpl);
76
77impl ObjectType for GhostPad {
78 const NAME: &'static str = "RsGhostPad";
79 type ParentType = gst::GhostPad;
80 type ImplType = Box<GhostPadImpl<Self>>;
81 type InstanceStructType = InstanceStruct<Self>;
82
83 fn class_init(token: &ClassInitToken, klass: &mut GhostPadClass) {
84 ObjectClassExt::override_vfuncs(klass, token);
85 PadClassExt::override_vfuncs(klass, token);
86 GhostPadClassExt::override_vfuncs(klass, token);
87 }
88
89 object_type_fns!();
90}