From 50505d19b8caed7e5a1cbe7b22db76fce14ee1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 15 Mar 2018 10:12:01 +0200 Subject: [PATCH] Update gstreamer-net --- Gir_GstNet.toml | 15 ++++---- gstreamer-net/Cargo.toml | 1 + gstreamer-net/src/auto/enums.rs | 2 +- gstreamer-net/src/auto/flags.rs | 2 +- gstreamer-net/src/auto/mod.rs | 2 +- gstreamer-net/src/auto/net_client_clock.rs | 40 +++++++++++++++------ gstreamer-net/src/auto/net_time_provider.rs | 32 +++++++++++++++-- gstreamer-net/src/auto/ntp_clock.rs | 14 ++------ gstreamer-net/src/auto/ptp_clock.rs | 12 +------ gstreamer-net/src/lib.rs | 3 ++ gstreamer-net/src/net_client_clock.rs | 32 +++++++++++++++++ gstreamer-net/src/ntp_clock.rs | 32 +++++++++++++++++ gstreamer-net/src/ptp_clock.rs | 32 +++++++++++++++++ 13 files changed, 171 insertions(+), 48 deletions(-) create mode 100644 gstreamer-net/src/net_client_clock.rs create mode 100644 gstreamer-net/src/ntp_clock.rs create mode 100644 gstreamer-net/src/ptp_clock.rs diff --git a/Gir_GstNet.toml b/Gir_GstNet.toml index 5798ffdce..fdf149ff1 100644 --- a/Gir_GstNet.toml +++ b/Gir_GstNet.toml @@ -37,9 +37,8 @@ trait = false [[object.function]] name = "new" - [[object.function.parameter]] - name = "name" - nullable = true + # Floating reference handling + ignore = true [[object]] name = "GstNet.PtpClock" @@ -48,9 +47,8 @@ trait = false [[object.function]] name = "new" - [[object.function.parameter]] - name = "name" - nullable = true + # Floating reference handling + ignore = true [[object]] name = "GstNet.NetClientClock" @@ -59,9 +57,8 @@ trait = false [[object.function]] name = "new" - [[object.function.parameter]] - name = "name" - nullable = true + # Floating reference handling + ignore = true [[object]] name = "GstNet.NetTimeProvider" diff --git a/gstreamer-net/Cargo.toml b/gstreamer-net/Cargo.toml index 81835bb95..8048efb39 100644 --- a/gstreamer-net/Cargo.toml +++ b/gstreamer-net/Cargo.toml @@ -27,6 +27,7 @@ optional = true [features] v1_10 = ["gstreamer-sys/v1_10", "gstreamer-net-sys/v1_10"] v1_12 = ["gstreamer-sys/v1_12", "gstreamer-net-sys/v1_12", "v1_10"] +v1_14 = ["gstreamer-sys/v1_14", "gstreamer-net-sys/v1_14", "v1_12"] embed-lgpl-docs = ["rustdoc-stripper"] purge-lgpl-docs = ["rustdoc-stripper"] dox = ["gstreamer-net-sys/dox", "glib/dox", "gstreamer/dox"] diff --git a/gstreamer-net/src/auto/enums.rs b/gstreamer-net/src/auto/enums.rs index 82b595c32..3cf2359d8 100644 --- a/gstreamer-net/src/auto/enums.rs +++ b/gstreamer-net/src/auto/enums.rs @@ -1,4 +1,4 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) +// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e0127) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT diff --git a/gstreamer-net/src/auto/flags.rs b/gstreamer-net/src/auto/flags.rs index 82b595c32..3cf2359d8 100644 --- a/gstreamer-net/src/auto/flags.rs +++ b/gstreamer-net/src/auto/flags.rs @@ -1,4 +1,4 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) +// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e0127) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT diff --git a/gstreamer-net/src/auto/mod.rs b/gstreamer-net/src/auto/mod.rs index f35292682..4f17f9112 100644 --- a/gstreamer-net/src/auto/mod.rs +++ b/gstreamer-net/src/auto/mod.rs @@ -1,4 +1,4 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) +// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e0127) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT diff --git a/gstreamer-net/src/auto/net_client_clock.rs b/gstreamer-net/src/auto/net_client_clock.rs index 3a6e9d57a..3f9067827 100644 --- a/gstreamer-net/src/auto/net_client_clock.rs +++ b/gstreamer-net/src/auto/net_client_clock.rs @@ -1,11 +1,10 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) +// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e0127) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; use glib::signal::SignalHandlerId; use glib::signal::connect; use glib::translate::*; @@ -30,15 +29,6 @@ glib_wrapper! { } impl NetClientClock { - pub fn new<'a, P: Into>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> NetClientClock { - assert_initialized_main_thread!(); - let name = name.into(); - let name = name.to_glib_none(); - unsafe { - gst::Clock::from_glib_none(ffi::gst_net_client_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked() - } - } - pub fn get_property_address(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); @@ -111,6 +101,20 @@ impl NetClientClock { } } + pub fn get_property_qos_dscp(&self) -> i32 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "qos-dscp".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + pub fn set_property_qos_dscp(&self, qos_dscp: i32) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "qos-dscp".to_glib_none().0, Value::from(&qos_dscp).to_glib_none().0); + } + } + pub fn get_property_round_trip_limit(&self) -> u64 { unsafe { let mut value = Value::from_type(::static_type()); @@ -173,6 +177,14 @@ impl NetClientClock { } } + pub fn connect_property_qos_dscp_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::qos-dscp", + transmute(notify_qos_dscp_trampoline as usize), Box_::into_raw(f) as *mut _) + } + } + pub fn connect_property_round_trip_limit_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); @@ -221,6 +233,12 @@ unsafe extern "C" fn notify_port_trampoline(this: *mut ffi::GstNetClientClock, _ f(&from_glib_borrow(this)) } +unsafe extern "C" fn notify_qos_dscp_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { + callback_guard!(); + let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f); + f(&from_glib_borrow(this)) +} + unsafe extern "C" fn notify_round_trip_limit_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { callback_guard!(); let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f); diff --git a/gstreamer-net/src/auto/net_time_provider.rs b/gstreamer-net/src/auto/net_time_provider.rs index aeab9802b..641d7dc34 100644 --- a/gstreamer-net/src/auto/net_time_provider.rs +++ b/gstreamer-net/src/auto/net_time_provider.rs @@ -1,4 +1,4 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) +// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e0127) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT @@ -34,7 +34,7 @@ impl NetTimeProvider { let address = address.into(); let address = address.to_glib_none(); unsafe { - from_glib_none(ffi::gst_net_time_provider_new(clock.to_glib_none().0, address.0, port)) + from_glib_full(ffi::gst_net_time_provider_new(clock.to_glib_none().0, address.0, port)) } } @@ -76,6 +76,20 @@ impl NetTimeProvider { } } + pub fn get_property_qos_dscp(&self) -> i32 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "qos-dscp".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + pub fn set_property_qos_dscp(&self, qos_dscp: i32) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "qos-dscp".to_glib_none().0, Value::from(&qos_dscp).to_glib_none().0); + } + } + pub fn connect_property_active_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); @@ -107,6 +121,14 @@ impl NetTimeProvider { transmute(notify_port_trampoline as usize), Box_::into_raw(f) as *mut _) } } + + pub fn connect_property_qos_dscp_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::qos-dscp", + transmute(notify_qos_dscp_trampoline as usize), Box_::into_raw(f) as *mut _) + } + } } unsafe impl Send for NetTimeProvider {} @@ -135,3 +157,9 @@ unsafe extern "C" fn notify_port_trampoline(this: *mut ffi::GstNetTimeProvider, let f: &&(Fn(&NetTimeProvider) + Send + Sync + 'static) = transmute(f); f(&from_glib_borrow(this)) } + +unsafe extern "C" fn notify_qos_dscp_trampoline(this: *mut ffi::GstNetTimeProvider, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { + callback_guard!(); + let f: &&(Fn(&NetTimeProvider) + Send + Sync + 'static) = transmute(f); + f(&from_glib_borrow(this)) +} diff --git a/gstreamer-net/src/auto/ntp_clock.rs b/gstreamer-net/src/auto/ntp_clock.rs index f1916960d..2278e5d1d 100644 --- a/gstreamer-net/src/auto/ntp_clock.rs +++ b/gstreamer-net/src/auto/ntp_clock.rs @@ -1,10 +1,9 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) +// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e0127) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT use NetClientClock; use ffi; -use glib::object::Downcast; use glib::translate::*; use glib_ffi; use gobject_ffi; @@ -25,16 +24,7 @@ glib_wrapper! { } } -impl NtpClock { - pub fn new<'a, P: Into>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> NtpClock { - assert_initialized_main_thread!(); - let name = name.into(); - let name = name.to_glib_none(); - unsafe { - gst::Clock::from_glib_none(ffi::gst_ntp_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked() - } - } -} +impl NtpClock {} unsafe impl Send for NtpClock {} unsafe impl Sync for NtpClock {} diff --git a/gstreamer-net/src/auto/ptp_clock.rs b/gstreamer-net/src/auto/ptp_clock.rs index bddef107c..bfad4836f 100644 --- a/gstreamer-net/src/auto/ptp_clock.rs +++ b/gstreamer-net/src/auto/ptp_clock.rs @@ -1,11 +1,10 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) +// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e0127) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT use ffi; use glib::StaticType; use glib::Value; -use glib::object::Downcast; use glib::signal::SignalHandlerId; use glib::signal::connect; use glib::translate::*; @@ -30,15 +29,6 @@ glib_wrapper! { } impl PtpClock { - pub fn new<'a, P: Into>>(name: P, domain: u32) -> PtpClock { - assert_initialized_main_thread!(); - let name = name.into(); - let name = name.to_glib_none(); - unsafe { - gst::Clock::from_glib_none(ffi::gst_ptp_clock_new(name.0, domain)).downcast_unchecked() - } - } - pub fn get_property_domain(&self) -> u32 { unsafe { let mut value = Value::from_type(::static_type()); diff --git a/gstreamer-net/src/lib.rs b/gstreamer-net/src/lib.rs index c7361e730..fd6d360ca 100644 --- a/gstreamer-net/src/lib.rs +++ b/gstreamer-net/src/lib.rs @@ -37,6 +37,9 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))] mod auto; pub use auto::*; +mod net_client_clock; +mod ntp_clock; +mod ptp_clock; // Re-export all the traits in a prelude module, so that applications // can always "use gst::prelude::*" without getting conflicts diff --git a/gstreamer-net/src/net_client_clock.rs b/gstreamer-net/src/net_client_clock.rs new file mode 100644 index 000000000..2423311ed --- /dev/null +++ b/gstreamer-net/src/net_client_clock.rs @@ -0,0 +1,32 @@ +// 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 NetClientClock; + +use gst; +use glib::translate::*; + +impl NetClientClock { + pub fn new<'a, P: Into>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> NetClientClock { + assert_initialized_main_thread!(); + let name = name.into(); + let name = name.to_glib_none(); + let (major, minor, _, _) = gst::version(); + if (major, minor) > (1, 12) { + unsafe { + gst::Clock::from_glib_full(ffi::gst_net_client_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked() + } + } else { + // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 + unsafe { + gst::Clock::from_glib_none(ffi::gst_net_client_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked() + } + } + } +} diff --git a/gstreamer-net/src/ntp_clock.rs b/gstreamer-net/src/ntp_clock.rs new file mode 100644 index 000000000..1bc0b78d9 --- /dev/null +++ b/gstreamer-net/src/ntp_clock.rs @@ -0,0 +1,32 @@ +// 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 NtpClock; + +use gst; +use glib::translate::*; + +impl NtpClock { + pub fn new<'a, P: Into>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> NtpClock { + assert_initialized_main_thread!(); + let name = name.into(); + let name = name.to_glib_none(); + let (major, minor, _, _) = gst::version(); + if (major, minor) > (1, 12) { + unsafe { + gst::Clock::from_glib_full(ffi::gst_ntp_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked() + } + } else { + // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 + unsafe { + gst::Clock::from_glib_none(ffi::gst_ntp_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked() + } + } + } +} diff --git a/gstreamer-net/src/ptp_clock.rs b/gstreamer-net/src/ptp_clock.rs new file mode 100644 index 000000000..804636c88 --- /dev/null +++ b/gstreamer-net/src/ptp_clock.rs @@ -0,0 +1,32 @@ +// 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 PtpClock; + +use gst; +use glib::translate::*; + +impl PtpClock { + pub fn new<'a, P: Into>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> PtpClock { + assert_initialized_main_thread!(); + let name = name.into(); + let name = name.to_glib_none(); + let (major, minor, _, _) = gst::version(); + if (major, minor) > (1, 12) { + unsafe { + gst::Clock::from_glib_full(ffi::gst_ntp_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked() + } + } else { + // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 + unsafe { + gst::Clock::from_glib_none(ffi::gst_ntp_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked() + } + } + } +}