mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-02 23:38:45 +00:00
Update per glib::SignalBuilder changes
This commit is contained in:
parent
7d666ce517
commit
52973d975e
6 changed files with 139 additions and 160 deletions
|
@ -124,20 +124,18 @@ impl ObjectSubclass for EbuR128Level {
|
|||
impl ObjectImpl for EbuR128Level {
|
||||
fn signals() -> &'static [glib::subclass::Signal] {
|
||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||
vec![
|
||||
glib::subclass::Signal::builder("reset", &[], glib::Type::UNIT.into())
|
||||
.action()
|
||||
.class_handler(|_token, args| {
|
||||
let this = args[0].get::<super::EbuR128Level>().unwrap();
|
||||
let imp = this.imp();
|
||||
vec![glib::subclass::Signal::builder("reset")
|
||||
.action()
|
||||
.class_handler(|_token, args| {
|
||||
let this = args[0].get::<super::EbuR128Level>().unwrap();
|
||||
let imp = this.imp();
|
||||
|
||||
gst::info!(CAT, obj: &this, "Resetting measurements",);
|
||||
imp.reset.store(true, atomic::Ordering::SeqCst);
|
||||
gst::info!(CAT, obj: &this, "Resetting measurements",);
|
||||
imp.reset.store(true, atomic::Ordering::SeqCst);
|
||||
|
||||
None
|
||||
})
|
||||
.build(),
|
||||
]
|
||||
None
|
||||
})
|
||||
.build()]
|
||||
});
|
||||
|
||||
&*SIGNALS
|
||||
|
|
|
@ -511,21 +511,20 @@ impl ObjectImpl for AppSrc {
|
|||
fn signals() -> &'static [glib::subclass::Signal] {
|
||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||
vec![
|
||||
glib::subclass::Signal::builder(
|
||||
"push-buffer",
|
||||
&[gst::Buffer::static_type().into()],
|
||||
bool::static_type().into(),
|
||||
)
|
||||
.action()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::AppSrc>().expect("signal arg");
|
||||
let buffer = args[1].get::<gst::Buffer>().expect("signal arg");
|
||||
let appsrc = element.imp();
|
||||
glib::subclass::Signal::builder("push-buffer")
|
||||
.param_types(&[gst::Buffer::static_type()])
|
||||
.return_type::<bool>()
|
||||
.action()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::AppSrc>().expect("signal arg");
|
||||
let buffer = args[1].get::<gst::Buffer>().expect("signal arg");
|
||||
let appsrc = element.imp();
|
||||
|
||||
Some(appsrc.push_buffer(&element, buffer).to_value())
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder("end-of-stream", &[], bool::static_type().into())
|
||||
Some(appsrc.push_buffer(&element, buffer).to_value())
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder("end-of-stream")
|
||||
.return_type::<bool>()
|
||||
.action()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::AppSrc>().expect("signal arg");
|
||||
|
|
|
@ -1416,19 +1416,15 @@ impl ObjectImpl for JitterBuffer {
|
|||
|
||||
fn signals() -> &'static [glib::subclass::Signal] {
|
||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||
vec![glib::subclass::Signal::builder(
|
||||
"clear-pt-map",
|
||||
&[],
|
||||
glib::types::Type::UNIT.into(),
|
||||
)
|
||||
.action()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::JitterBuffer>().expect("signal arg");
|
||||
let jb = element.imp();
|
||||
jb.clear_pt_map(&element);
|
||||
None
|
||||
})
|
||||
.build()]
|
||||
vec![glib::subclass::Signal::builder("clear-pt-map")
|
||||
.action()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::JitterBuffer>().expect("signal arg");
|
||||
let jb = element.imp();
|
||||
jb.clear_pt_map(&element);
|
||||
None
|
||||
})
|
||||
.build()]
|
||||
});
|
||||
|
||||
SIGNALS.as_ref()
|
||||
|
|
|
@ -1045,47 +1045,41 @@ impl ObjectImpl for UdpSink {
|
|||
fn signals() -> &'static [glib::subclass::Signal] {
|
||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||
vec![
|
||||
glib::subclass::Signal::builder(
|
||||
"add",
|
||||
&[String::static_type().into(), i32::static_type().into()],
|
||||
glib::types::Type::UNIT.into(),
|
||||
)
|
||||
.action()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::UdpSink>().expect("signal arg");
|
||||
let host = args[1].get::<String>().expect("signal arg");
|
||||
let port = args[2].get::<i32>().expect("signal arg");
|
||||
glib::subclass::Signal::builder("add")
|
||||
.param_types(&[String::static_type(), i32::static_type()])
|
||||
.action()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::UdpSink>().expect("signal arg");
|
||||
let host = args[1].get::<String>().expect("signal arg");
|
||||
let port = args[2].get::<i32>().expect("signal arg");
|
||||
|
||||
if let Ok(addr) = try_into_socket_addr(&element, &host, port) {
|
||||
let udpsink = element.imp();
|
||||
let mut settings = udpsink.settings.lock().unwrap();
|
||||
udpsink.add_client(&mut settings, addr);
|
||||
}
|
||||
if let Ok(addr) = try_into_socket_addr(&element, &host, port) {
|
||||
let udpsink = element.imp();
|
||||
let mut settings = udpsink.settings.lock().unwrap();
|
||||
udpsink.add_client(&mut settings, addr);
|
||||
}
|
||||
|
||||
None
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder(
|
||||
"remove",
|
||||
&[String::static_type().into(), i32::static_type().into()],
|
||||
glib::types::Type::UNIT.into(),
|
||||
)
|
||||
.action()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::UdpSink>().expect("signal arg");
|
||||
let host = args[1].get::<String>().expect("signal arg");
|
||||
let port = args[2].get::<i32>().expect("signal arg");
|
||||
None
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder("remove")
|
||||
.param_types(&[String::static_type(), i32::static_type()])
|
||||
.action()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::UdpSink>().expect("signal arg");
|
||||
let host = args[1].get::<String>().expect("signal arg");
|
||||
let port = args[2].get::<i32>().expect("signal arg");
|
||||
|
||||
if let Ok(addr) = try_into_socket_addr(&element, &host, port) {
|
||||
let udpsink = element.imp();
|
||||
let mut settings = udpsink.settings.lock().unwrap();
|
||||
udpsink.remove_client(&mut settings, addr);
|
||||
}
|
||||
if let Ok(addr) = try_into_socket_addr(&element, &host, port) {
|
||||
let udpsink = element.imp();
|
||||
let mut settings = udpsink.settings.lock().unwrap();
|
||||
udpsink.remove_client(&mut settings, addr);
|
||||
}
|
||||
|
||||
None
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder("clear", &[], glib::types::Type::UNIT.into())
|
||||
None
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder("clear")
|
||||
.action()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::UdpSink>().expect("signal arg");
|
||||
|
|
|
@ -579,77 +579,71 @@ impl ObjectImpl for HlsSink3 {
|
|||
fn signals() -> &'static [glib::subclass::Signal] {
|
||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||
vec![
|
||||
glib::subclass::Signal::builder(
|
||||
SIGNAL_GET_PLAYLIST_STREAM,
|
||||
&[String::static_type().into()],
|
||||
gio::OutputStream::static_type().into(),
|
||||
)
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0]
|
||||
.get::<super::HlsSink3>()
|
||||
.expect("playlist-stream signal arg");
|
||||
let playlist_location =
|
||||
args[1].get::<String>().expect("playlist-stream signal arg");
|
||||
let hlssink3 = element.imp();
|
||||
glib::subclass::Signal::builder(SIGNAL_GET_PLAYLIST_STREAM)
|
||||
.param_types(&[String::static_type()])
|
||||
.return_type::<gio::OutputStream>()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0]
|
||||
.get::<super::HlsSink3>()
|
||||
.expect("playlist-stream signal arg");
|
||||
let playlist_location =
|
||||
args[1].get::<String>().expect("playlist-stream signal arg");
|
||||
let hlssink3 = element.imp();
|
||||
|
||||
Some(
|
||||
hlssink3
|
||||
.new_file_stream(&element, &playlist_location)
|
||||
.ok()?
|
||||
.to_value(),
|
||||
)
|
||||
})
|
||||
.accumulator(|_hint, ret, value| {
|
||||
// First signal handler wins
|
||||
*ret = value.clone();
|
||||
false
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder(
|
||||
SIGNAL_GET_FRAGMENT_STREAM,
|
||||
&[String::static_type().into()],
|
||||
gio::OutputStream::static_type().into(),
|
||||
)
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0]
|
||||
.get::<super::HlsSink3>()
|
||||
.expect("fragment-stream signal arg");
|
||||
let fragment_location =
|
||||
args[1].get::<String>().expect("fragment-stream signal arg");
|
||||
let hlssink3 = element.imp();
|
||||
Some(
|
||||
hlssink3
|
||||
.new_file_stream(&element, &playlist_location)
|
||||
.ok()?
|
||||
.to_value(),
|
||||
)
|
||||
})
|
||||
.accumulator(|_hint, ret, value| {
|
||||
// First signal handler wins
|
||||
*ret = value.clone();
|
||||
false
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder(SIGNAL_GET_FRAGMENT_STREAM)
|
||||
.param_types(&[String::static_type()])
|
||||
.return_type::<gio::OutputStream>()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0]
|
||||
.get::<super::HlsSink3>()
|
||||
.expect("fragment-stream signal arg");
|
||||
let fragment_location =
|
||||
args[1].get::<String>().expect("fragment-stream signal arg");
|
||||
let hlssink3 = element.imp();
|
||||
|
||||
Some(
|
||||
hlssink3
|
||||
.new_file_stream(&element, &fragment_location)
|
||||
.ok()?
|
||||
.to_value(),
|
||||
)
|
||||
})
|
||||
.accumulator(|_hint, ret, value| {
|
||||
// First signal handler wins
|
||||
*ret = value.clone();
|
||||
false
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder(
|
||||
SIGNAL_DELETE_FRAGMENT,
|
||||
&[String::static_type().into()],
|
||||
glib::types::Type::BOOL.into(),
|
||||
)
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::HlsSink3>().expect("signal arg");
|
||||
let fragment_location = args[1].get::<String>().expect("signal arg");
|
||||
let hlssink3 = element.imp();
|
||||
Some(
|
||||
hlssink3
|
||||
.new_file_stream(&element, &fragment_location)
|
||||
.ok()?
|
||||
.to_value(),
|
||||
)
|
||||
})
|
||||
.accumulator(|_hint, ret, value| {
|
||||
// First signal handler wins
|
||||
*ret = value.clone();
|
||||
false
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder(SIGNAL_DELETE_FRAGMENT)
|
||||
.param_types(&[String::static_type()])
|
||||
.return_type::<bool>()
|
||||
.class_handler(|_, args| {
|
||||
let element = args[0].get::<super::HlsSink3>().expect("signal arg");
|
||||
let fragment_location = args[1].get::<String>().expect("signal arg");
|
||||
let hlssink3 = element.imp();
|
||||
|
||||
hlssink3.delete_fragment(&element, &fragment_location);
|
||||
Some(true.to_value())
|
||||
})
|
||||
.accumulator(|_hint, ret, value| {
|
||||
// First signal handler wins
|
||||
*ret = value.clone();
|
||||
false
|
||||
})
|
||||
.build(),
|
||||
hlssink3.delete_fragment(&element, &fragment_location);
|
||||
Some(true.to_value())
|
||||
})
|
||||
.accumulator(|_hint, ret, value| {
|
||||
// First signal handler wins
|
||||
*ret = value.clone();
|
||||
false
|
||||
})
|
||||
.build(),
|
||||
]
|
||||
});
|
||||
|
||||
|
|
|
@ -653,22 +653,20 @@ impl ObjectImpl for FallbackSrc {
|
|||
fn signals() -> &'static [glib::subclass::Signal] {
|
||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||
vec![
|
||||
glib::subclass::Signal::builder(
|
||||
"update-uri",
|
||||
&[String::static_type().into()],
|
||||
String::static_type().into(),
|
||||
)
|
||||
.class_handler(|_token, args| {
|
||||
// Simply return the input by default
|
||||
Some(args[1].clone())
|
||||
})
|
||||
.accumulator(|_hint, ret, value| {
|
||||
// First signal handler wins
|
||||
*ret = value.clone();
|
||||
false
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder("unblock", &[], glib::types::Type::UNIT.into())
|
||||
glib::subclass::Signal::builder("update-uri")
|
||||
.param_types(&[String::static_type()])
|
||||
.return_type::<String>()
|
||||
.class_handler(|_token, args| {
|
||||
// Simply return the input by default
|
||||
Some(args[1].clone())
|
||||
})
|
||||
.accumulator(|_hint, ret, value| {
|
||||
// First signal handler wins
|
||||
*ret = value.clone();
|
||||
false
|
||||
})
|
||||
.build(),
|
||||
glib::subclass::Signal::builder("unblock")
|
||||
.action()
|
||||
.class_handler(|_token, args| {
|
||||
let element = args[0].get::<super::FallbackSrc>().expect("signal arg");
|
||||
|
|
Loading…
Reference in a new issue