diff --git a/Gir_Gst.toml b/Gir_Gst.toml index f6fe63d39..1025ab869 100644 --- a/Gir_Gst.toml +++ b/Gir_Gst.toml @@ -16,7 +16,6 @@ external_libraries = [ generate = [ "Gst.ClockTimeDiff", - "Gst.Pipeline", "Gst.State", "Gst.StateChange", "Gst.SeekFlags", @@ -275,6 +274,11 @@ name = "Gst.TocEntry" status = "manual" ref_mode = "ref" +[[object]] +name = "Gst.Pipeline" +subclassing = true +status = "generate" + [[object]] name = "Gst.Promise" status = "manual" diff --git a/gstreamer/src/auto/pipeline.rs b/gstreamer/src/auto/pipeline.rs index cbcb64b5e..3acb6e238 100644 --- a/gstreamer/src/auto/pipeline.rs +++ b/gstreamer/src/auto/pipeline.rs @@ -7,6 +7,7 @@ use ChildProxy; use Clock; use ClockTime; use Element; +use PipelineClass; use Object; use ffi; use glib; @@ -23,7 +24,7 @@ use std::mem::transmute; use std::ptr; glib_wrapper! { - pub struct Pipeline(Object): Bin, Element, Object, ChildProxy; + pub struct Pipeline(Object): Bin, Element, Object, ChildProxy; match fn { get_type => || ffi::gst_pipeline_get_type(), diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index b1d085a5e..7958d5c50 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -152,6 +152,9 @@ pub use element::ElementClass; mod bin; pub use bin::BinClass; +mod pipeline; +pub use pipeline::PipelineClass; + // OS dependent Bus extensions (also import the other plateform mod for doc) #[cfg(any(feature = "v1_14", feature = "dox"))] cfg_if! { diff --git a/gstreamer/src/pipeline.rs b/gstreamer/src/pipeline.rs new file mode 100644 index 000000000..bda835bb0 --- /dev/null +++ b/gstreamer/src/pipeline.rs @@ -0,0 +1,37 @@ +// Copyright (C) 2018 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 ffi; + +use std::ops; + +use glib::IsClassFor; + +#[repr(C)] +pub struct PipelineClass(ffi::GstPipelineClass); + +unsafe impl IsClassFor for PipelineClass { + type Instance = ::Pipeline; +} + +unsafe impl Send for PipelineClass {} +unsafe impl Sync for PipelineClass {} + +impl ops::Deref for PipelineClass { + type Target = ::BinClass; + + fn deref(&self) -> &Self::Target { + self.upcast_ref() + } +} + +impl ops::DerefMut for PipelineClass { + fn deref_mut(&mut self) -> &mut Self::Target { + self.upcast_ref_mut() + } +} diff --git a/gstreamer/src/subclass/mod.rs b/gstreamer/src/subclass/mod.rs index 4af3c0b67..87cbc2749 100644 --- a/gstreamer/src/subclass/mod.rs +++ b/gstreamer/src/subclass/mod.rs @@ -16,12 +16,14 @@ pub mod plugin; pub mod bin; pub mod child_proxy; pub mod element; +pub mod pipeline; pub mod uri_handler; pub mod prelude { pub use super::bin::BinImpl; pub use super::child_proxy::ChildProxyImpl; pub use super::element::{ElementClassSubclassExt, ElementImpl, ElementImplExt}; + pub use super::pipeline::PipelineImpl; pub use super::uri_handler::URIHandlerImpl; pub use super::PanicPoison; pub use glib::subclass::prelude::*; diff --git a/gstreamer/src/subclass/pipeline.rs b/gstreamer/src/subclass/pipeline.rs new file mode 100644 index 000000000..b46edcbe5 --- /dev/null +++ b/gstreamer/src/subclass/pipeline.rs @@ -0,0 +1,29 @@ +// Copyright (C) 2017,2018 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 ffi; + +use super::prelude::*; +use glib::subclass::prelude::*; + +use PipelineClass; + +pub trait PipelineImpl: BinImpl + Send + Sync + 'static {} + +unsafe impl IsSubclassable for PipelineClass +where + ::Instance: PanicPoison, +{ + fn override_vfuncs(&mut self) { + <::BinClass as IsSubclassable>::override_vfuncs(self); + unsafe { + let _klass = &mut *(self as *const Self as *mut ffi::GstPipelineClass); + // Nothing to do here + } + } +}