subclass: clean up subclassing prelude/re-exports

Use re-export pattern from glib.

Fix #255
This commit is contained in:
Guillaume Desmottes 2020-06-09 11:24:30 +02:00
parent 1d886727d9
commit 6cd711cfdf
8 changed files with 47 additions and 40 deletions

View file

@ -249,7 +249,7 @@ mod media {
&self, &self,
media: &gst_rtsp_server::RTSPMedia, media: &gst_rtsp_server::RTSPMedia,
sdp: &mut gst_sdp::SDPMessageRef, sdp: &mut gst_sdp::SDPMessageRef,
info: &gst_rtsp_server::subclass::rtsp_media::SDPInfo, info: &gst_rtsp_server::subclass::SDPInfo,
) -> Result<(), gst::LoggableError> { ) -> Result<(), gst::LoggableError> {
self.parent_setup_sdp(media, sdp, info)?; self.parent_setup_sdp(media, sdp, info)?;

View file

@ -7,10 +7,10 @@
// except according to those terms. // except according to those terms.
#![allow(clippy::cast_ptr_alignment)] #![allow(clippy::cast_ptr_alignment)]
pub mod audio_decoder; mod audio_decoder;
pub mod audio_encoder; mod audio_encoder;
pub mod audio_sink; mod audio_sink;
pub mod audio_src; mod audio_src;
pub mod prelude { pub mod prelude {
pub use super::audio_decoder::{AudioDecoderImpl, AudioDecoderImplExt}; pub use super::audio_decoder::{AudioDecoderImpl, AudioDecoderImplExt};

View file

@ -8,18 +8,20 @@
// except according to those terms. // except according to those terms.
#![allow(clippy::cast_ptr_alignment)] #![allow(clippy::cast_ptr_alignment)]
pub mod base_parse; mod base_parse;
pub mod base_sink; mod base_sink;
// Public to namespace CreateSuccess
pub mod base_src; pub mod base_src;
// Public to namespace GenerateOutputSuccess and PrepareOutputBufferSuccess,
pub mod base_transform; pub mod base_transform;
pub mod push_src; mod push_src;
pub use self::base_transform::BaseTransformMode; pub use self::base_transform::BaseTransformMode;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
pub mod aggregator; mod aggregator;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
pub mod aggregator_pad; mod aggregator_pad;
pub mod prelude { pub mod prelude {
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]

View file

@ -7,10 +7,12 @@
// except according to those terms. // except according to those terms.
#![allow(clippy::cast_ptr_alignment)] #![allow(clippy::cast_ptr_alignment)]
pub mod rtsp_client; mod rtsp_client;
pub mod rtsp_media; mod rtsp_media;
pub mod rtsp_media_factory; mod rtsp_media_factory;
pub mod rtsp_server; mod rtsp_server;
pub use self::rtsp_media::SDPInfo;
pub mod prelude { pub mod prelude {
pub use super::rtsp_client::{RTSPClientImpl, RTSPClientImplExt}; pub use super::rtsp_client::{RTSPClientImpl, RTSPClientImplExt};

View file

@ -7,8 +7,8 @@
// except according to those terms. // except according to those terms.
#![allow(clippy::cast_ptr_alignment)] #![allow(clippy::cast_ptr_alignment)]
pub mod video_decoder; mod video_decoder;
pub mod video_encoder; mod video_encoder;
pub mod prelude { pub mod prelude {
pub use super::video_decoder::{VideoDecoderImpl, VideoDecoderImplExt}; pub use super::video_decoder::{VideoDecoderImpl, VideoDecoderImplExt};

View file

@ -9,34 +9,37 @@
#![allow(clippy::cast_ptr_alignment)] #![allow(clippy::cast_ptr_alignment)]
#[macro_use] #[macro_use]
pub mod error; mod error;
#[cfg(any(feature = "v1_14"))] #[cfg(any(feature = "v1_14"))]
#[macro_use] #[macro_use]
#[path = "plugin_1_14.rs"] #[path = "plugin_1_14.rs"]
pub mod plugin; mod plugin;
#[cfg(not(any(feature = "v1_14")))] #[cfg(not(any(feature = "v1_14")))]
#[macro_use] #[macro_use]
#[path = "plugin_1_12.rs"] #[path = "plugin_1_12.rs"]
pub mod plugin; mod plugin;
pub mod bin; mod bin;
pub mod child_proxy; mod child_proxy;
pub mod element; mod element;
pub mod ghost_pad; mod ghost_pad;
pub mod pad; mod pad;
pub mod pipeline; mod pipeline;
pub mod device; mod device;
pub mod device_provider; mod device_provider;
pub mod clock; mod clock;
pub mod system_clock; mod system_clock;
pub mod preset; mod preset;
pub mod tag_setter; mod tag_setter;
pub mod uri_handler; mod uri_handler;
pub use self::error::FlowError;
pub use self::plugin::{MAJOR_VERSION, MINOR_VERSION};
pub mod prelude { pub mod prelude {
pub use super::bin::{BinImpl, BinImplExt}; pub use super::bin::{BinImpl, BinImplExt};

View file

@ -31,8 +31,8 @@ macro_rules! gst_plugin_define(
#[no_mangle] #[no_mangle]
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
pub static gst_plugin_desc: GstPluginDesc = GstPluginDesc($crate::gst_sys::GstPluginDesc { pub static gst_plugin_desc: GstPluginDesc = GstPluginDesc($crate::gst_sys::GstPluginDesc {
major_version: $crate::subclass::plugin::MAJOR_VERSION, major_version: $crate::subclass::MAJOR_VERSION,
minor_version: $crate::subclass::plugin::MINOR_VERSION, minor_version: $crate::subclass::MINOR_VERSION,
name: concat!(stringify!($name), "\0") as *const str as *const _, name: concat!(stringify!($name), "\0") as *const str as *const _,
description: concat!($description, "\0") as *const str as *const _, description: concat!($description, "\0") as *const str as *const _,
plugin_init: Some(plugin_init_trampoline), plugin_init: Some(plugin_init_trampoline),
@ -49,8 +49,8 @@ macro_rules! gst_plugin_define(
unsafe { unsafe {
$crate::glib::glib_result_from_gboolean!( $crate::glib::glib_result_from_gboolean!(
$crate::gst_sys::gst_plugin_register_static( $crate::gst_sys::gst_plugin_register_static(
$crate::subclass::plugin::MAJOR_VERSION, $crate::subclass::MAJOR_VERSION,
$crate::subclass::plugin::MINOR_VERSION, $crate::subclass::MINOR_VERSION,
concat!(stringify!($name), "\0") as *const str as *const _, concat!(stringify!($name), "\0") as *const str as *const _,
concat!($description, "\0") as *const str as _, concat!($description, "\0") as *const str as _,
Some(plugin_init_trampoline), Some(plugin_init_trampoline),

View file

@ -29,8 +29,8 @@ macro_rules! gst_plugin_define(
unsafe impl Sync for GstPluginDesc {} unsafe impl Sync for GstPluginDesc {}
static GST_PLUGIN_DESC: GstPluginDesc = GstPluginDesc($crate::gst_sys::GstPluginDesc { static GST_PLUGIN_DESC: GstPluginDesc = GstPluginDesc($crate::gst_sys::GstPluginDesc {
major_version: $crate::subclass::plugin::MAJOR_VERSION, major_version: $crate::subclass::MAJOR_VERSION,
minor_version: $crate::subclass::plugin::MINOR_VERSION, minor_version: $crate::subclass::MINOR_VERSION,
name: concat!(stringify!($name), "\0") as *const str as *const _, name: concat!(stringify!($name), "\0") as *const str as *const _,
description: concat!($description, "\0") as *const str as *const _, description: concat!($description, "\0") as *const str as *const _,
plugin_init: Some(plugin_init_trampoline), plugin_init: Some(plugin_init_trampoline),
@ -47,8 +47,8 @@ macro_rules! gst_plugin_define(
unsafe { unsafe {
$crate::glib::glib_result_from_gboolean!( $crate::glib::glib_result_from_gboolean!(
$crate::gst_sys::gst_plugin_register_static( $crate::gst_sys::gst_plugin_register_static(
$crate::subclass::plugin::MAJOR_VERSION, $crate::subclass::MAJOR_VERSION,
$crate::subclass::plugin::MINOR_VERSION, $crate::subclass::MINOR_VERSION,
concat!(stringify!($name), "\0") as *const str as *const _, concat!(stringify!($name), "\0") as *const str as *const _,
concat!($description, "\0") as *const str as _, concat!($description, "\0") as *const str as _,
Some(plugin_init_trampoline), Some(plugin_init_trampoline),