1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
use std::mem;
use std::ptr;
use glib_ffi;
use gobject_ffi;
use gst_ffi;
use glib;
use glib::translate::*;
use gst;
use gst::prelude::*;
use gobject_subclass::anyimpl::*;
use gobject_subclass::object::*;
use bin::*;
use element::*;
use object::*;
pub trait PipelineImpl<T: PipelineBase>:
AnyImpl + ObjectImpl<T> + ElementImpl<T> + BinImpl<T> + Send + Sync + 'static
where
T::InstanceStructType: PanicPoison,
{
}
any_impl!(PipelineBase, PipelineImpl, PanicPoison);
pub unsafe trait PipelineBase:
IsA<gst::Element> + IsA<gst::Bin> + IsA<gst::Pipeline> + ObjectType
{
}
pub unsafe trait PipelineClassExt<T: PipelineBase>
where
T::ImplType: PipelineImpl<T>,
T::InstanceStructType: PanicPoison,
{
fn override_vfuncs(&mut self, _: &ClassInitToken) {}
}
glib_wrapper! {
pub struct Pipeline(Object<ElementInstanceStruct<Pipeline>>):
[gst::Pipeline => gst_ffi::GstPipeline,
gst::Bin => gst_ffi::GstBin,
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
gst::ChildProxy => gst_ffi::GstChildProxy];
match fn {
get_type => || get_type::<Pipeline>(),
}
}
unsafe impl<T: IsA<gst::Element> + IsA<gst::Bin> + IsA<gst::Pipeline> + ObjectType> PipelineBase
for T
{
}
pub type PipelineClass = ClassStruct<Pipeline>;
unsafe impl PipelineClassExt<Pipeline> for PipelineClass {}
unsafe impl BinClassExt<Pipeline> for PipelineClass {}
unsafe impl ElementClassExt<Pipeline> for PipelineClass {}
unsafe impl ObjectClassExt<Pipeline> for PipelineClass {}
unsafe impl Send for Pipeline {}
unsafe impl Sync for Pipeline {}
#[macro_export]
macro_rules! box_pipeline_impl(
($name:ident) => {
box_bin_impl!($name);
impl<T: PipelineBase> PipelineImpl<T> for Box<$name<T>>
where
T::InstanceStructType: PanicPoison
{
}
};
);
box_pipeline_impl!(PipelineImpl);
impl ObjectType for Pipeline {
const NAME: &'static str = "RsPipeline";
type ParentType = gst::Pipeline;
type ImplType = Box<PipelineImpl<Self>>;
type InstanceStructType = ElementInstanceStruct<Self>;
fn class_init(token: &ClassInitToken, klass: &mut PipelineClass) {
ObjectClassExt::override_vfuncs(klass, token);
ElementClassExt::override_vfuncs(klass, token);
BinClassExt::override_vfuncs(klass, token);
PipelineClassExt::override_vfuncs(klass, token);
}
object_type_fns!();
}