From e55c7d408801be098de9cb61800ab24640fbbdcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 1 Aug 2017 14:04:42 +0100 Subject: [PATCH] Rename ObjectExt trait to GstObjectExt This works around a bug in the compiler with multiple traits having the same name, but being re-exported with a different one. https://github.com/gtk-rs/glib/issues/211 --- Gir_Gst.toml | 3 ++- examples/src/bin/decodebin.rs | 2 +- examples/src/bin/gtksink.rs | 1 - examples/src/bin/playbin.rs | 2 +- gstreamer/src/auto/mod.rs | 5 ----- gstreamer/src/auto/plugin.rs | 6 ++++++ gstreamer/src/lib.rs | 3 ++- gstreamer/src/{auto => }/object.rs | 4 ++-- 8 files changed, 14 insertions(+), 12 deletions(-) rename gstreamer/src/{auto => }/object.rs (99%) diff --git a/Gir_Gst.toml b/Gir_Gst.toml index 653b4d694..46b9fb623 100644 --- a/Gir_Gst.toml +++ b/Gir_Gst.toml @@ -271,7 +271,8 @@ status = "generate" [[object]] name = "Gst.Object" -status = "generate" +# For renaming the trait... +status = "manual" [[object.function]] name = "set_name" [object.function.return] diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index fc8c61ce7..1f7a87ce2 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -2,7 +2,7 @@ extern crate gstreamer as gst; use gst::*; extern crate glib; -use glib::ObjectExt; +use glib::*; use std::env; use std::u64; diff --git a/examples/src/bin/gtksink.rs b/examples/src/bin/gtksink.rs index 39a217402..258c41975 100644 --- a/examples/src/bin/gtksink.rs +++ b/examples/src/bin/gtksink.rs @@ -3,7 +3,6 @@ use gst::*; extern crate glib; use glib::*; -use glib::ObjectExt; extern crate gtk; use gtk::prelude::*; diff --git a/examples/src/bin/playbin.rs b/examples/src/bin/playbin.rs index 62e7381e9..b0c0b4770 100644 --- a/examples/src/bin/playbin.rs +++ b/examples/src/bin/playbin.rs @@ -2,7 +2,7 @@ extern crate gstreamer as gst; use gst::*; extern crate glib; -use glib::ObjectExt; +use glib::*; use std::env; use std::u64; diff --git a/gstreamer/src/auto/mod.rs b/gstreamer/src/auto/mod.rs index efa00ca22..8ff9f5fd6 100644 --- a/gstreamer/src/auto/mod.rs +++ b/gstreamer/src/auto/mod.rs @@ -43,10 +43,6 @@ mod ghost_pad; pub use self::ghost_pad::GhostPad; pub use self::ghost_pad::GhostPadExt; -mod object; -pub use self::object::Object; -pub use self::object::ObjectExt; - mod pad; pub use self::pad::Pad; pub use self::pad::PadExt; @@ -218,7 +214,6 @@ pub mod traits { pub use super::DeviceProviderFactoryExt; pub use super::ElementExt; pub use super::GhostPadExt; - pub use super::ObjectExt; pub use super::PadExt; pub use super::PadTemplateExt; pub use super::PipelineExt; diff --git a/gstreamer/src/auto/plugin.rs b/gstreamer/src/auto/plugin.rs index 6e56f9dcb..23b3a70b8 100644 --- a/gstreamer/src/auto/plugin.rs +++ b/gstreamer/src/auto/plugin.rs @@ -52,6 +52,12 @@ impl Plugin { } } + pub fn get_name(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_plugin_get_name(self.to_glib_none().0)) + } + } + pub fn get_origin(&self) -> Option { unsafe { from_glib_none(ffi::gst_plugin_get_origin(self.to_glib_none().0)) diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index e632f554b..65f88b78e 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -47,7 +47,6 @@ mod auto; pub use auto::*; pub use auto::traits::*; pub use auto::functions::{parse_bin_from_description, parse_launch}; -pub use auto::traits::ObjectExt as GstObjectExt; pub mod miniobject; pub use miniobject::GstRc; @@ -71,6 +70,7 @@ pub use query::{Query, QueryRef, QueryView}; pub mod event; pub use event::{Event, EventRef, EventView}; +mod object; mod element; mod bin; mod bus; @@ -81,6 +81,7 @@ mod ghost_pad; mod child_proxy; mod tag_setter; mod iterator; +pub use object::{Object, GstObjectExt}; pub use element::ElementExtManual; pub use bin::BinExtManual; pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo, PAD_PROBE_ID_INVALID}; diff --git a/gstreamer/src/auto/object.rs b/gstreamer/src/object.rs similarity index 99% rename from gstreamer/src/auto/object.rs rename to gstreamer/src/object.rs index d4f68f5f4..af8e4146c 100644 --- a/gstreamer/src/auto/object.rs +++ b/gstreamer/src/object.rs @@ -44,7 +44,7 @@ impl Object { unsafe impl Send for Object {} unsafe impl Sync for Object {} -pub trait ObjectExt { +pub trait GstObjectExt { //fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool; fn default_error<'a, P: Into>>(&self, error: &Error, debug: P); @@ -94,7 +94,7 @@ pub trait ObjectExt { //fn connect_deep_notify(&self, f: F) -> u64; } -impl> ObjectExt for O { +impl> GstObjectExt for O { //fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool { // unsafe { TODO: call ffi::gst_object_add_control_binding() } //}