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 {
|
impl ObjectImpl for EbuR128Level {
|
||||||
fn signals() -> &'static [glib::subclass::Signal] {
|
fn signals() -> &'static [glib::subclass::Signal] {
|
||||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||||
vec![
|
vec![glib::subclass::Signal::builder("reset")
|
||||||
glib::subclass::Signal::builder("reset", &[], glib::Type::UNIT.into())
|
.action()
|
||||||
.action()
|
.class_handler(|_token, args| {
|
||||||
.class_handler(|_token, args| {
|
let this = args[0].get::<super::EbuR128Level>().unwrap();
|
||||||
let this = args[0].get::<super::EbuR128Level>().unwrap();
|
let imp = this.imp();
|
||||||
let imp = this.imp();
|
|
||||||
|
|
||||||
gst::info!(CAT, obj: &this, "Resetting measurements",);
|
gst::info!(CAT, obj: &this, "Resetting measurements",);
|
||||||
imp.reset.store(true, atomic::Ordering::SeqCst);
|
imp.reset.store(true, atomic::Ordering::SeqCst);
|
||||||
|
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
.build(),
|
.build()]
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
&*SIGNALS
|
&*SIGNALS
|
||||||
|
|
|
@ -511,21 +511,20 @@ impl ObjectImpl for AppSrc {
|
||||||
fn signals() -> &'static [glib::subclass::Signal] {
|
fn signals() -> &'static [glib::subclass::Signal] {
|
||||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||||
vec![
|
vec![
|
||||||
glib::subclass::Signal::builder(
|
glib::subclass::Signal::builder("push-buffer")
|
||||||
"push-buffer",
|
.param_types(&[gst::Buffer::static_type()])
|
||||||
&[gst::Buffer::static_type().into()],
|
.return_type::<bool>()
|
||||||
bool::static_type().into(),
|
.action()
|
||||||
)
|
.class_handler(|_, args| {
|
||||||
.action()
|
let element = args[0].get::<super::AppSrc>().expect("signal arg");
|
||||||
.class_handler(|_, args| {
|
let buffer = args[1].get::<gst::Buffer>().expect("signal arg");
|
||||||
let element = args[0].get::<super::AppSrc>().expect("signal arg");
|
let appsrc = element.imp();
|
||||||
let buffer = args[1].get::<gst::Buffer>().expect("signal arg");
|
|
||||||
let appsrc = element.imp();
|
|
||||||
|
|
||||||
Some(appsrc.push_buffer(&element, buffer).to_value())
|
Some(appsrc.push_buffer(&element, buffer).to_value())
|
||||||
})
|
})
|
||||||
.build(),
|
.build(),
|
||||||
glib::subclass::Signal::builder("end-of-stream", &[], bool::static_type().into())
|
glib::subclass::Signal::builder("end-of-stream")
|
||||||
|
.return_type::<bool>()
|
||||||
.action()
|
.action()
|
||||||
.class_handler(|_, args| {
|
.class_handler(|_, args| {
|
||||||
let element = args[0].get::<super::AppSrc>().expect("signal arg");
|
let element = args[0].get::<super::AppSrc>().expect("signal arg");
|
||||||
|
|
|
@ -1416,19 +1416,15 @@ impl ObjectImpl for JitterBuffer {
|
||||||
|
|
||||||
fn signals() -> &'static [glib::subclass::Signal] {
|
fn signals() -> &'static [glib::subclass::Signal] {
|
||||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||||
vec![glib::subclass::Signal::builder(
|
vec![glib::subclass::Signal::builder("clear-pt-map")
|
||||||
"clear-pt-map",
|
.action()
|
||||||
&[],
|
.class_handler(|_, args| {
|
||||||
glib::types::Type::UNIT.into(),
|
let element = args[0].get::<super::JitterBuffer>().expect("signal arg");
|
||||||
)
|
let jb = element.imp();
|
||||||
.action()
|
jb.clear_pt_map(&element);
|
||||||
.class_handler(|_, args| {
|
None
|
||||||
let element = args[0].get::<super::JitterBuffer>().expect("signal arg");
|
})
|
||||||
let jb = element.imp();
|
.build()]
|
||||||
jb.clear_pt_map(&element);
|
|
||||||
None
|
|
||||||
})
|
|
||||||
.build()]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
SIGNALS.as_ref()
|
SIGNALS.as_ref()
|
||||||
|
|
|
@ -1045,47 +1045,41 @@ impl ObjectImpl for UdpSink {
|
||||||
fn signals() -> &'static [glib::subclass::Signal] {
|
fn signals() -> &'static [glib::subclass::Signal] {
|
||||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||||
vec![
|
vec![
|
||||||
glib::subclass::Signal::builder(
|
glib::subclass::Signal::builder("add")
|
||||||
"add",
|
.param_types(&[String::static_type(), i32::static_type()])
|
||||||
&[String::static_type().into(), i32::static_type().into()],
|
.action()
|
||||||
glib::types::Type::UNIT.into(),
|
.class_handler(|_, args| {
|
||||||
)
|
let element = args[0].get::<super::UdpSink>().expect("signal arg");
|
||||||
.action()
|
let host = args[1].get::<String>().expect("signal arg");
|
||||||
.class_handler(|_, args| {
|
let port = args[2].get::<i32>().expect("signal arg");
|
||||||
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) {
|
if let Ok(addr) = try_into_socket_addr(&element, &host, port) {
|
||||||
let udpsink = element.imp();
|
let udpsink = element.imp();
|
||||||
let mut settings = udpsink.settings.lock().unwrap();
|
let mut settings = udpsink.settings.lock().unwrap();
|
||||||
udpsink.add_client(&mut settings, addr);
|
udpsink.add_client(&mut settings, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
.build(),
|
.build(),
|
||||||
glib::subclass::Signal::builder(
|
glib::subclass::Signal::builder("remove")
|
||||||
"remove",
|
.param_types(&[String::static_type(), i32::static_type()])
|
||||||
&[String::static_type().into(), i32::static_type().into()],
|
.action()
|
||||||
glib::types::Type::UNIT.into(),
|
.class_handler(|_, args| {
|
||||||
)
|
let element = args[0].get::<super::UdpSink>().expect("signal arg");
|
||||||
.action()
|
let host = args[1].get::<String>().expect("signal arg");
|
||||||
.class_handler(|_, args| {
|
let port = args[2].get::<i32>().expect("signal arg");
|
||||||
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) {
|
if let Ok(addr) = try_into_socket_addr(&element, &host, port) {
|
||||||
let udpsink = element.imp();
|
let udpsink = element.imp();
|
||||||
let mut settings = udpsink.settings.lock().unwrap();
|
let mut settings = udpsink.settings.lock().unwrap();
|
||||||
udpsink.remove_client(&mut settings, addr);
|
udpsink.remove_client(&mut settings, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
.build(),
|
.build(),
|
||||||
glib::subclass::Signal::builder("clear", &[], glib::types::Type::UNIT.into())
|
glib::subclass::Signal::builder("clear")
|
||||||
.action()
|
.action()
|
||||||
.class_handler(|_, args| {
|
.class_handler(|_, args| {
|
||||||
let element = args[0].get::<super::UdpSink>().expect("signal arg");
|
let element = args[0].get::<super::UdpSink>().expect("signal arg");
|
||||||
|
|
|
@ -579,77 +579,71 @@ impl ObjectImpl for HlsSink3 {
|
||||||
fn signals() -> &'static [glib::subclass::Signal] {
|
fn signals() -> &'static [glib::subclass::Signal] {
|
||||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||||
vec![
|
vec![
|
||||||
glib::subclass::Signal::builder(
|
glib::subclass::Signal::builder(SIGNAL_GET_PLAYLIST_STREAM)
|
||||||
SIGNAL_GET_PLAYLIST_STREAM,
|
.param_types(&[String::static_type()])
|
||||||
&[String::static_type().into()],
|
.return_type::<gio::OutputStream>()
|
||||||
gio::OutputStream::static_type().into(),
|
.class_handler(|_, args| {
|
||||||
)
|
let element = args[0]
|
||||||
.class_handler(|_, args| {
|
.get::<super::HlsSink3>()
|
||||||
let element = args[0]
|
.expect("playlist-stream signal arg");
|
||||||
.get::<super::HlsSink3>()
|
let playlist_location =
|
||||||
.expect("playlist-stream signal arg");
|
args[1].get::<String>().expect("playlist-stream signal arg");
|
||||||
let playlist_location =
|
let hlssink3 = element.imp();
|
||||||
args[1].get::<String>().expect("playlist-stream signal arg");
|
|
||||||
let hlssink3 = element.imp();
|
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
hlssink3
|
hlssink3
|
||||||
.new_file_stream(&element, &playlist_location)
|
.new_file_stream(&element, &playlist_location)
|
||||||
.ok()?
|
.ok()?
|
||||||
.to_value(),
|
.to_value(),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.accumulator(|_hint, ret, value| {
|
.accumulator(|_hint, ret, value| {
|
||||||
// First signal handler wins
|
// First signal handler wins
|
||||||
*ret = value.clone();
|
*ret = value.clone();
|
||||||
false
|
false
|
||||||
})
|
})
|
||||||
.build(),
|
.build(),
|
||||||
glib::subclass::Signal::builder(
|
glib::subclass::Signal::builder(SIGNAL_GET_FRAGMENT_STREAM)
|
||||||
SIGNAL_GET_FRAGMENT_STREAM,
|
.param_types(&[String::static_type()])
|
||||||
&[String::static_type().into()],
|
.return_type::<gio::OutputStream>()
|
||||||
gio::OutputStream::static_type().into(),
|
.class_handler(|_, args| {
|
||||||
)
|
let element = args[0]
|
||||||
.class_handler(|_, args| {
|
.get::<super::HlsSink3>()
|
||||||
let element = args[0]
|
.expect("fragment-stream signal arg");
|
||||||
.get::<super::HlsSink3>()
|
let fragment_location =
|
||||||
.expect("fragment-stream signal arg");
|
args[1].get::<String>().expect("fragment-stream signal arg");
|
||||||
let fragment_location =
|
let hlssink3 = element.imp();
|
||||||
args[1].get::<String>().expect("fragment-stream signal arg");
|
|
||||||
let hlssink3 = element.imp();
|
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
hlssink3
|
hlssink3
|
||||||
.new_file_stream(&element, &fragment_location)
|
.new_file_stream(&element, &fragment_location)
|
||||||
.ok()?
|
.ok()?
|
||||||
.to_value(),
|
.to_value(),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.accumulator(|_hint, ret, value| {
|
.accumulator(|_hint, ret, value| {
|
||||||
// First signal handler wins
|
// First signal handler wins
|
||||||
*ret = value.clone();
|
*ret = value.clone();
|
||||||
false
|
false
|
||||||
})
|
})
|
||||||
.build(),
|
.build(),
|
||||||
glib::subclass::Signal::builder(
|
glib::subclass::Signal::builder(SIGNAL_DELETE_FRAGMENT)
|
||||||
SIGNAL_DELETE_FRAGMENT,
|
.param_types(&[String::static_type()])
|
||||||
&[String::static_type().into()],
|
.return_type::<bool>()
|
||||||
glib::types::Type::BOOL.into(),
|
.class_handler(|_, args| {
|
||||||
)
|
let element = args[0].get::<super::HlsSink3>().expect("signal arg");
|
||||||
.class_handler(|_, args| {
|
let fragment_location = args[1].get::<String>().expect("signal arg");
|
||||||
let element = args[0].get::<super::HlsSink3>().expect("signal arg");
|
let hlssink3 = element.imp();
|
||||||
let fragment_location = args[1].get::<String>().expect("signal arg");
|
|
||||||
let hlssink3 = element.imp();
|
|
||||||
|
|
||||||
hlssink3.delete_fragment(&element, &fragment_location);
|
hlssink3.delete_fragment(&element, &fragment_location);
|
||||||
Some(true.to_value())
|
Some(true.to_value())
|
||||||
})
|
})
|
||||||
.accumulator(|_hint, ret, value| {
|
.accumulator(|_hint, ret, value| {
|
||||||
// First signal handler wins
|
// First signal handler wins
|
||||||
*ret = value.clone();
|
*ret = value.clone();
|
||||||
false
|
false
|
||||||
})
|
})
|
||||||
.build(),
|
.build(),
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -653,22 +653,20 @@ impl ObjectImpl for FallbackSrc {
|
||||||
fn signals() -> &'static [glib::subclass::Signal] {
|
fn signals() -> &'static [glib::subclass::Signal] {
|
||||||
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
|
||||||
vec![
|
vec![
|
||||||
glib::subclass::Signal::builder(
|
glib::subclass::Signal::builder("update-uri")
|
||||||
"update-uri",
|
.param_types(&[String::static_type()])
|
||||||
&[String::static_type().into()],
|
.return_type::<String>()
|
||||||
String::static_type().into(),
|
.class_handler(|_token, args| {
|
||||||
)
|
// Simply return the input by default
|
||||||
.class_handler(|_token, args| {
|
Some(args[1].clone())
|
||||||
// Simply return the input by default
|
})
|
||||||
Some(args[1].clone())
|
.accumulator(|_hint, ret, value| {
|
||||||
})
|
// First signal handler wins
|
||||||
.accumulator(|_hint, ret, value| {
|
*ret = value.clone();
|
||||||
// First signal handler wins
|
false
|
||||||
*ret = value.clone();
|
})
|
||||||
false
|
.build(),
|
||||||
})
|
glib::subclass::Signal::builder("unblock")
|
||||||
.build(),
|
|
||||||
glib::subclass::Signal::builder("unblock", &[], glib::types::Type::UNIT.into())
|
|
||||||
.action()
|
.action()
|
||||||
.class_handler(|_token, args| {
|
.class_handler(|_token, args| {
|
||||||
let element = args[0].get::<super::FallbackSrc>().expect("signal arg");
|
let element = args[0].get::<super::FallbackSrc>().expect("signal arg");
|
||||||
|
|
Loading…
Reference in a new issue