Update for GLib signal accumulator API changes

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1954>
This commit is contained in:
Sebastian Dröge 2024-11-30 15:10:06 +02:00
parent 204c4101f2
commit 6ee745edee
7 changed files with 49 additions and 56 deletions

View file

@ -211,10 +211,9 @@ impl ObjectImpl for HlsBaseSink {
Some(imp.new_file_stream(&playlist_location).ok().to_value())
})
.accumulator(|_hint, ret, value| {
.accumulator(|_hint, _acc, value| {
// First signal handler wins
*ret = value.clone();
false
std::ops::ControlFlow::Break(value.clone())
})
.build(),
glib::subclass::Signal::builder(SIGNAL_GET_FRAGMENT_STREAM)
@ -227,10 +226,9 @@ impl ObjectImpl for HlsBaseSink {
Some(imp.new_file_stream(&fragment_location).ok().to_value())
})
.accumulator(|_hint, ret, value| {
.accumulator(|_hint, _acc, value| {
// First signal handler wins
*ret = value.clone();
false
std::ops::ControlFlow::Break(value.clone())
})
.build(),
glib::subclass::Signal::builder(SIGNAL_DELETE_FRAGMENT)
@ -244,10 +242,9 @@ impl ObjectImpl for HlsBaseSink {
imp.delete_fragment(&fragment_location);
Some(true.to_value())
})
.accumulator(|_hint, ret, value| {
.accumulator(|_hint, _acc, value| {
// First signal handler wins
*ret = value.clone();
false
std::ops::ControlFlow::Break(value.clone())
})
.build(),
]

View file

@ -232,10 +232,9 @@ impl ObjectImpl for HlsCmafSink {
Some(imp.new_file_stream(&init_location).ok().to_value())
})
.accumulator(|_hint, ret, value| {
.accumulator(|_hint, _acc, value| {
// First signal handler wins
*ret = value.clone();
false
std::ops::ControlFlow::Break(value.clone())
})
.build(),
glib::subclass::Signal::builder(SIGNAL_NEW_PLAYLIST)

View file

@ -1947,12 +1947,11 @@ impl ObjectImpl for RtpBaseDepay2 {
glib::subclass::Signal::builder("request-extension")
.param_types([u32::static_type(), String::static_type()])
.return_type::<gst_rtp::RTPHeaderExtension>()
.accumulator(|_hint, acc, val| {
if matches!(val.get::<Option<glib::Object>>(), Ok(Some(_))) {
*acc = val.clone();
false
.accumulator(|_hint, _acc, value| {
if matches!(value.get::<Option<glib::Object>>(), Ok(Some(_))) {
std::ops::ControlFlow::Break(value.clone())
} else {
true
std::ops::ControlFlow::Continue(value.clone())
}
})
.class_handler(|args| {

View file

@ -1985,12 +1985,11 @@ impl ObjectImpl for RtpBasePay2 {
glib::subclass::Signal::builder("request-extension")
.param_types([u32::static_type(), String::static_type()])
.return_type::<gst_rtp::RTPHeaderExtension>()
.accumulator(|_hint, acc, val| {
if matches!(val.get::<Option<glib::Object>>(), Ok(Some(_))) {
*acc = val.clone();
false
.accumulator(|_hint, _acc, value| {
if matches!(value.get::<Option<glib::Object>>(), Ok(Some(_))) {
std::ops::ControlFlow::Break(value.clone())
} else {
true
std::ops::ControlFlow::Continue(value.clone())
}
})
.class_handler(|args| {

View file

@ -167,9 +167,9 @@ impl prelude::ObjectInterface for Signallable {
});
Some(Signallable::request_meta(this).to_value())
})
.accumulator(move |_hint, output, input| {
*output = input.clone();
false
.accumulator(move |_hint, _acc, value| {
// First signal handler wins
std::ops::ControlFlow::Break(value.clone())
})
.build(),
/**
@ -227,9 +227,9 @@ impl prelude::ObjectInterface for Signallable {
Some(false.into())
})
.accumulator(move |_hint, output, input| {
*output = input.clone();
false
.accumulator(move |_hint, _acc, value| {
// First signal handler wins
std::ops::ControlFlow::Break(value.clone())
})
.build(),
/**
@ -253,9 +253,9 @@ impl prelude::ObjectInterface for Signallable {
Some(false.into())
})
.accumulator(move |_hint, output, input| {
*output = input.clone();
false
.accumulator(move |_hint, _acc, value| {
// First signal handler wins
std::ops::ControlFlow::Break(value.clone())
})
.build(),
/**
@ -291,9 +291,9 @@ impl prelude::ObjectInterface for Signallable {
Some(false.into())
})
.accumulator(move |_hint, output, input| {
*output = input.clone();
false
.accumulator(move |_hint, _acc, value| {
// First signal handler wins
std::ops::ControlFlow::Break(value.clone())
})
.build(),
/**
@ -358,9 +358,9 @@ impl prelude::ObjectInterface for Signallable {
Some(desc.clone().into())
})
.accumulator(move |_hint, output, input| {
*output = input.clone();
false
.accumulator(move |_hint, _acc, value| {
// First signal handler wins
std::ops::ControlFlow::Break(value.clone())
})
.build(),
/**
@ -398,9 +398,9 @@ impl prelude::ObjectInterface for Signallable {
Some(false.into())
})
.accumulator(move |_hint, output, input| {
*output = input.clone();
false
.accumulator(move |_hint, _acc, value| {
// First signal handler wins
std::ops::ControlFlow::Break(value.clone())
})
.build(),
/**
@ -445,9 +445,9 @@ impl prelude::ObjectInterface for Signallable {
Some(false.into())
})
.accumulator(move |_hint, output, input| {
*output = input.clone();
false
.accumulator(move |_hint, _acc, value| {
// First signal handler wins
std::ops::ControlFlow::Break(value.clone())
})
.build(),
/**

View file

@ -859,15 +859,15 @@ fn configure_payloader(pay: &gst::Element) {
fn setup_signal_accumulator(
_hint: &glib::subclass::SignalInvocationHint,
ret: &mut glib::Value,
_acc: glib::Value,
value: &glib::Value,
) -> bool {
) -> std::ops::ControlFlow<glib::Value, glib::Value> {
let is_configured = value.get::<bool>().unwrap();
let continue_emission = !is_configured;
*ret = value.clone();
continue_emission
if !is_configured {
std::ops::ControlFlow::Continue(value.clone())
} else {
std::ops::ControlFlow::Break(value.clone())
}
}
/// Set of elements used in an EncodingChain
@ -5047,9 +5047,9 @@ impl ObjectImpl for BaseWebRTCSink {
.class_handler(|args| {
Some(args[3usize].get::<gst::Structure>().expect("wrong argument").to_value())
})
.accumulator(move |_hint, output, input| {
*output = input.clone();
false
.accumulator(move |_hint, _acc, value| {
// First signal handler wins
std::ops::ControlFlow::Break(value.clone())
})
.build(),
]

View file

@ -666,10 +666,9 @@ impl ObjectImpl for FallbackSrc {
// Simply return the input by default
Some(args[1].clone())
})
.accumulator(|_hint, ret, value| {
.accumulator(|_hint, _acc, value| {
// First signal handler wins
*ret = value.clone();
false
std::ops::ControlFlow::Break(value.clone())
})
.build(),
glib::subclass::Signal::builder("unblock")