// Copyright (C) 2017 Sebastian Dröge // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. 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 anyimpl::*; use bin::*; use element::*; use object::*; pub trait PipelineImpl: AnyImpl + ObjectImpl + ElementImpl + BinImpl + Send + Sync + 'static where T::InstanceStructType: PanicPoison { } any_impl!(PipelineBase, PipelineImpl, PanicPoison); pub unsafe trait PipelineBase: IsA + IsA + IsA + ObjectType { } pub unsafe trait PipelineClassExt where T::ImplType: PipelineImpl, T::InstanceStructType: PanicPoison { fn override_vfuncs(&mut self, _: &ClassInitToken) {} } glib_wrapper! { pub struct Pipeline(Object>): [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::(), } } unsafe impl + IsA + IsA + ObjectType> PipelineBase for T { } pub type PipelineClass = ClassStruct; // FIXME: Boilerplate unsafe impl PipelineClassExt for PipelineClass {} unsafe impl BinClassExt for PipelineClass {} unsafe impl ElementClassExt 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 PipelineImpl for Box<$name> where T::InstanceStructType: PanicPoison { } }; ); box_pipeline_impl!(PipelineImpl); impl ObjectType for Pipeline { const NAME: &'static str = "RsPipeline"; type GlibType = gst_ffi::GstPipeline; type GlibClassType = gst_ffi::GstPipelineClass; type ImplType = Box>; type InstanceStructType = ElementInstanceStruct; fn glib_type() -> glib::Type { unsafe { from_glib(gst_ffi::gst_pipeline_get_type()) } } fn class_init(token: &ClassInitToken, klass: &mut PipelineClass) { ElementClassExt::override_vfuncs(klass, token); BinClassExt::override_vfuncs(klass, token); PipelineClassExt::override_vfuncs(klass, token); } object_type_fns!(); }