Update gstreamer-net

This commit is contained in:
Sebastian Dröge 2018-03-15 10:12:01 +02:00
parent 99d4fe0925
commit 50505d19b8
13 changed files with 171 additions and 48 deletions

View file

@ -37,9 +37,8 @@ trait = false
[[object.function]] [[object.function]]
name = "new" name = "new"
[[object.function.parameter]] # Floating reference handling
name = "name" ignore = true
nullable = true
[[object]] [[object]]
name = "GstNet.PtpClock" name = "GstNet.PtpClock"
@ -48,9 +47,8 @@ trait = false
[[object.function]] [[object.function]]
name = "new" name = "new"
[[object.function.parameter]] # Floating reference handling
name = "name" ignore = true
nullable = true
[[object]] [[object]]
name = "GstNet.NetClientClock" name = "GstNet.NetClientClock"
@ -59,9 +57,8 @@ trait = false
[[object.function]] [[object.function]]
name = "new" name = "new"
[[object.function.parameter]] # Floating reference handling
name = "name" ignore = true
nullable = true
[[object]] [[object]]
name = "GstNet.NetTimeProvider" name = "GstNet.NetTimeProvider"

View file

@ -27,6 +27,7 @@ optional = true
[features] [features]
v1_10 = ["gstreamer-sys/v1_10", "gstreamer-net-sys/v1_10"] 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_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"] embed-lgpl-docs = ["rustdoc-stripper"]
purge-lgpl-docs = ["rustdoc-stripper"] purge-lgpl-docs = ["rustdoc-stripper"]
dox = ["gstreamer-net-sys/dox", "glib/dox", "gstreamer/dox"] dox = ["gstreamer-net-sys/dox", "glib/dox", "gstreamer/dox"]

View file

@ -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 @ ???) // from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT // DO NOT EDIT

View file

@ -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 @ ???) // from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT // DO NOT EDIT

View file

@ -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 @ ???) // from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT // DO NOT EDIT

View file

@ -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 @ ???) // from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect; use glib::signal::connect;
use glib::translate::*; use glib::translate::*;
@ -30,15 +29,6 @@ glib_wrapper! {
} }
impl NetClientClock { impl NetClientClock {
pub fn new<'a, P: Into<Option<&'a str>>>(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<String> { pub fn get_property_address(&self) -> Option<String> {
unsafe { unsafe {
let mut value = Value::from_type(<String as StaticType>::static_type()); let mut value = Value::from_type(<String as StaticType>::static_type());
@ -111,6 +101,20 @@ impl NetClientClock {
} }
} }
pub fn get_property_qos_dscp(&self) -> i32 {
unsafe {
let mut value = Value::from_type(<i32 as StaticType>::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 { pub fn get_property_round_trip_limit(&self) -> u64 {
unsafe { unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type()); let mut value = Value::from_type(<u64 as StaticType>::static_type());
@ -173,6 +177,14 @@ impl NetClientClock {
} }
} }
pub fn connect_property_qos_dscp_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = 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<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_round_trip_limit_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = 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)) 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) { unsafe extern "C" fn notify_round_trip_limit_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!(); callback_guard!();
let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f);

View file

@ -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 @ ???) // from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT // DO NOT EDIT
@ -34,7 +34,7 @@ impl NetTimeProvider {
let address = address.into(); let address = address.into();
let address = address.to_glib_none(); let address = address.to_glib_none();
unsafe { 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(<i32 as StaticType>::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<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_active_notify<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
@ -107,6 +121,14 @@ impl NetTimeProvider {
transmute(notify_port_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_port_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
pub fn connect_property_qos_dscp_notify<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = 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 {} 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); let f: &&(Fn(&NetTimeProvider) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this)) 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))
}

View file

@ -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 @ ???) // from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT // DO NOT EDIT
use NetClientClock; use NetClientClock;
use ffi; use ffi;
use glib::object::Downcast;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
@ -25,16 +24,7 @@ glib_wrapper! {
} }
} }
impl NtpClock { impl NtpClock {}
pub fn new<'a, P: Into<Option<&'a str>>>(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()
}
}
}
unsafe impl Send for NtpClock {} unsafe impl Send for NtpClock {}
unsafe impl Sync for NtpClock {} unsafe impl Sync for NtpClock {}

View file

@ -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 @ ???) // from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect; use glib::signal::connect;
use glib::translate::*; use glib::translate::*;
@ -30,15 +29,6 @@ glib_wrapper! {
} }
impl PtpClock { impl PtpClock {
pub fn new<'a, P: Into<Option<&'a str>>>(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 { pub fn get_property_domain(&self) -> u32 {
unsafe { unsafe {
let mut value = Value::from_type(<u32 as StaticType>::static_type()); let mut value = Value::from_type(<u32 as StaticType>::static_type());

View file

@ -37,6 +37,9 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))] #[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
mod auto; mod auto;
pub use 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 // Re-export all the traits in a prelude module, so that applications
// can always "use gst::prelude::*" without getting conflicts // can always "use gst::prelude::*" without getting conflicts

View file

@ -0,0 +1,32 @@
// Copyright (C) 2018 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<Option<&'a str>>>(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()
}
}
}
}

View file

@ -0,0 +1,32 @@
// Copyright (C) 2018 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<Option<&'a str>>>(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()
}
}
}
}

View file

@ -0,0 +1,32 @@
// Copyright (C) 2018 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<Option<&'a str>>>(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()
}
}
}
}