mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 03:21:03 +00:00
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.
This commit is contained in:
parent
298cb754c9
commit
dbe8eb9bd9
3 changed files with 56 additions and 43 deletions
|
@ -78,6 +78,8 @@ trait = false
|
||||||
[[object.signal]]
|
[[object.signal]]
|
||||||
name = "duration-changed"
|
name = "duration-changed"
|
||||||
concurrency = "send"
|
concurrency = "send"
|
||||||
|
# Pass ClockTime instead of u64
|
||||||
|
ignore = true
|
||||||
|
|
||||||
[[object.signal]]
|
[[object.signal]]
|
||||||
name = "end-of-stream"
|
name = "end-of-stream"
|
||||||
|
@ -96,12 +98,16 @@ trait = false
|
||||||
concurrency = "send"
|
concurrency = "send"
|
||||||
|
|
||||||
[[object.signal]]
|
[[object.signal]]
|
||||||
name = "position-changed"
|
name = "position-updated"
|
||||||
concurrency = "send"
|
concurrency = "send"
|
||||||
|
# Pass ClockTime instead of u64
|
||||||
|
ignore = true
|
||||||
|
|
||||||
[[object.signal]]
|
[[object.signal]]
|
||||||
name = "seek-done"
|
name = "seek-done"
|
||||||
concurrency = "send"
|
concurrency = "send"
|
||||||
|
# Pass ClockTime instead of u64
|
||||||
|
ignore = true
|
||||||
|
|
||||||
[[object.signal]]
|
[[object.signal]]
|
||||||
name = "state-changed"
|
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 {
|
pub fn connect_end_of_stream<F: Fn(&Player) + Send + 'static>(&self, f: F) -> SignalHandlerId {
|
||||||
unsafe {
|
unsafe {
|
||||||
let f: Box_<Box_<Fn(&Player) + Send + 'static>> = Box_::new(Box_::new(f));
|
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 {
|
pub fn connect_state_changed<F: Fn(&Player, PlayerState) + Send + 'static>(&self, f: F) -> SignalHandlerId {
|
||||||
unsafe {
|
unsafe {
|
||||||
let f: Box_<Box_<Fn(&Player, PlayerState) + Send + 'static>> = Box_::new(Box_::new(f));
|
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)
|
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) {
|
unsafe extern "C" fn end_of_stream_trampoline(this: *mut ffi::GstPlayer, f: glib_ffi::gpointer) {
|
||||||
callback_guard!();
|
callback_guard!();
|
||||||
let f: &&(Fn(&Player) + Send + 'static) = transmute(f);
|
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))
|
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) {
|
unsafe extern "C" fn state_changed_trampoline(this: *mut ffi::GstPlayer, object: ffi::GstPlayerState, f: glib_ffi::gpointer) {
|
||||||
callback_guard!();
|
callback_guard!();
|
||||||
let f: &&(Fn(&Player, PlayerState) + Send + 'static) = transmute(f);
|
let f: &&(Fn(&Player, PlayerState) + Send + 'static) = transmute(f);
|
||||||
|
|
|
@ -10,8 +10,13 @@ use Player;
|
||||||
use PlayerSignalDispatcher;
|
use PlayerSignalDispatcher;
|
||||||
use PlayerVideoRenderer;
|
use PlayerVideoRenderer;
|
||||||
use ffi;
|
use ffi;
|
||||||
|
use glib_ffi;
|
||||||
|
use glib::signal::SignalHandlerId;
|
||||||
|
use glib::signal::connect;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
use gst;
|
||||||
|
use std::boxed::Box as Box_;
|
||||||
|
use std::mem::transmute;
|
||||||
|
|
||||||
impl Player {
|
impl Player {
|
||||||
pub fn new(
|
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)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue