Commit dbe8eb9b authored by Philippe Normand's avatar Philippe Normand 🥑 Committed by Sebastian Dröge
Browse files

gstreamer-player: regen for overridden signals

In the previous generated player bindings the position-updated was Send+Sync but
only Send is actually needed. In addition to this change the position-updated,
duration-changed and seek-done signals now invoke their handler with a
gst::ClockTime value instead of u64.
parent 298cb754
......@@ -78,6 +78,8 @@ trait = false
[[object.signal]]
name = "duration-changed"
concurrency = "send"
# Pass ClockTime instead of u64
ignore = true
[[object.signal]]
name = "end-of-stream"
......@@ -96,12 +98,16 @@ trait = false
concurrency = "send"
[[object.signal]]
name = "position-changed"
name = "position-updated"
concurrency = "send"
# Pass ClockTime instead of u64
ignore = true
[[object.signal]]
name = "seek-done"
concurrency = "send"
# Pass ClockTime instead of u64
ignore = true
[[object.signal]]
name = "state-changed"
......
......@@ -396,14 +396,6 @@ impl Player {
}
}
pub fn connect_duration_changed<F: Fn(&Player, u64) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Player, u64) + Send + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "duration-changed",
transmute(duration_changed_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_end_of_stream<F: Fn(&Player) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Player) + Send + 'static>> = Box_::new(Box_::new(f));
......@@ -436,22 +428,6 @@ impl Player {
}
}
pub fn connect_position_updated<F: Fn(&Player, u64) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Player, u64) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "position-updated",
transmute(position_updated_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_seek_done<F: Fn(&Player, u64) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Player, u64) + Send + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "seek-done",
transmute(seek_done_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_state_changed<F: Fn(&Player, PlayerState) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Player, PlayerState) + Send + 'static>> = Box_::new(Box_::new(f));
......@@ -638,12 +614,6 @@ unsafe extern "C" fn buffering_trampoline(this: *mut ffi::GstPlayer, object: lib
f(&from_glib_borrow(this), object)
}
unsafe extern "C" fn duration_changed_trampoline(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&Player, u64) + Send + 'static) = transmute(f);
f(&from_glib_borrow(this), object)
}
unsafe extern "C" fn end_of_stream_trampoline(this: *mut ffi::GstPlayer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&Player) + Send + 'static) = transmute(f);
......@@ -668,18 +638,6 @@ unsafe extern "C" fn mute_changed_trampoline(this: *mut ffi::GstPlayer, f: glib_
f(&from_glib_borrow(this))
}
unsafe extern "C" fn position_updated_trampoline(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&Player, u64) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this), object)
}
unsafe extern "C" fn seek_done_trampoline(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&Player, u64) + Send + 'static) = transmute(f);
f(&from_glib_borrow(this), object)
}
unsafe extern "C" fn state_changed_trampoline(this: *mut ffi::GstPlayer, object: ffi::GstPlayerState, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&Player, PlayerState) + Send + 'static) = transmute(f);
......
......@@ -10,8 +10,13 @@ use Player;
use PlayerSignalDispatcher;
use PlayerVideoRenderer;
use ffi;
use glib_ffi;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use gst;
use std::boxed::Box as Box_;
use std::mem::transmute;
impl Player {
pub fn new(
......@@ -40,4 +45,48 @@ impl Player {
))
}
}
pub fn connect_duration_changed<F: Fn(&Player, gst::ClockTime) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Player, gst::ClockTime) + Send + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "duration-changed",
transmute(duration_changed_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_position_updated<F: Fn(&Player, gst::ClockTime) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Player, gst::ClockTime) + Send + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "position-updated",
transmute(position_updated_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_seek_done<F: Fn(&Player, gst::ClockTime) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Player, gst::ClockTime) + Send + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "seek-done",
transmute(seek_done_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn duration_changed_trampoline(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&Player, gst::ClockTime) + Send + 'static) = transmute(f);
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
}
unsafe extern "C" fn position_updated_trampoline(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&Player, gst::ClockTime) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
}
unsafe extern "C" fn seek_done_trampoline(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&Player, gst::ClockTime) + Send + 'static) = transmute(f);
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment