mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 01:21:05 +00:00
Update to new clone macro syntax
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1463>
This commit is contained in:
parent
0be8b364f8
commit
5ea912d702
5 changed files with 172 additions and 149 deletions
26
Cargo.lock
generated
26
Cargo.lock
generated
|
@ -169,7 +169,7 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
|||
[[package]]
|
||||
name = "cairo-rs"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"cairo-sys-rs",
|
||||
|
@ -181,7 +181,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cairo-sys-rs"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
|
@ -678,7 +678,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gio"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -695,7 +695,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gio-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -724,7 +724,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "glib"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"futures-channel",
|
||||
|
@ -745,7 +745,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "glib-macros"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-crate",
|
||||
|
@ -757,7 +757,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "glib-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"system-deps",
|
||||
|
@ -820,7 +820,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gobject-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
|
@ -1679,7 +1679,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-targets 0.52.5",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1898,7 +1898,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pango"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"gio",
|
||||
"glib",
|
||||
|
@ -1909,7 +1909,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pango-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -1920,7 +1920,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pangocairo"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"cairo-rs",
|
||||
"glib",
|
||||
|
@ -1932,7 +1932,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pangocairo-sys"
|
||||
version = "0.20.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#d88a7c473e2af36a4718a648406b7894d288ec1b"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#dc97710becdf432e5a97e0b7c22d4d1daa8cfec6"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"glib-sys",
|
||||
|
|
|
@ -132,8 +132,10 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
overlay.connect_closure(
|
||||
"draw",
|
||||
false,
|
||||
glib::closure!(@strong drawer => move |_overlay: &gst::Element,
|
||||
sample: &gst::Sample| {
|
||||
glib::closure!(
|
||||
#[strong]
|
||||
drawer,
|
||||
move |_overlay: &gst::Element, sample: &gst::Sample| {
|
||||
use std::f64::consts::PI;
|
||||
|
||||
let drawer = drawer.lock().unwrap();
|
||||
|
@ -146,7 +148,8 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
let bitmap = drawer.bitmap.as_ref().unwrap();
|
||||
let render_target = drawer.render_target.as_ref().unwrap();
|
||||
|
||||
let global_angle = 360. * (timestamp % (10 * gst::ClockTime::SECOND)).nseconds() as f64
|
||||
let global_angle = 360.
|
||||
* (timestamp % (10 * gst::ClockTime::SECOND)).nseconds() as f64
|
||||
/ (10.0 * gst::ClockTime::SECOND.nseconds() as f64);
|
||||
let center_x = (info.width() / 2) as f32;
|
||||
let center_y = (info.height() / 2) as f32;
|
||||
|
@ -184,7 +187,10 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
let matrix = Matrix3x2::rotation(angle, center_x, center_y);
|
||||
render_target.SetTransform(&matrix);
|
||||
render_target.DrawTextLayout(
|
||||
D2D_POINT_2F { x: 0f32, y: top_margin },
|
||||
D2D_POINT_2F {
|
||||
x: 0f32,
|
||||
y: top_margin,
|
||||
},
|
||||
text_layout,
|
||||
&text_brush,
|
||||
D2D1_DRAW_TEXT_OPTIONS_NONE,
|
||||
|
@ -200,7 +206,8 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
let _ = render_target.Flush(None::<*mut u64>, None::<*mut u64>);
|
||||
}
|
||||
|
||||
let mut buffer = gst::Buffer::with_size((info.width() * info.height() * 4) as usize).unwrap();
|
||||
let mut buffer =
|
||||
gst::Buffer::with_size((info.width() * info.height() * 4) as usize).unwrap();
|
||||
{
|
||||
let buffer_mut = buffer.get_mut().unwrap();
|
||||
let mut map = buffer_mut.map_writable().unwrap();
|
||||
|
@ -209,7 +216,9 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
unsafe {
|
||||
// Bitmap size is equal to the background image size.
|
||||
// Copy entire memory
|
||||
bitmap.CopyPixels(std::ptr::null(), info.width() * 4, dst).unwrap();
|
||||
bitmap
|
||||
.CopyPixels(std::ptr::null(), info.width() * 4, dst)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,9 +248,9 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
gst_video::VideoOverlayFormatFlags::PREMULTIPLIED_ALPHA,
|
||||
);
|
||||
|
||||
gst_video::VideoOverlayComposition::new(Some(&rect))
|
||||
.unwrap()
|
||||
}),
|
||||
gst_video::VideoOverlayComposition::new(Some(&rect)).unwrap()
|
||||
}
|
||||
),
|
||||
);
|
||||
|
||||
// Add a signal handler to the overlay's "caps-changed" signal. This could e.g.
|
||||
|
|
|
@ -119,8 +119,9 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
overlay.connect_closure(
|
||||
"draw",
|
||||
false,
|
||||
glib::closure!(@strong drawer => move |_overlay: &gst::Element,
|
||||
sample: &gst::Sample| {
|
||||
glib::closure!(
|
||||
#[strong] drawer,
|
||||
move |_overlay: &gst::Element, sample: &gst::Sample| {
|
||||
use std::f64::consts::PI;
|
||||
|
||||
let drawer = drawer.lock().unwrap();
|
||||
|
|
|
@ -195,7 +195,11 @@ impl StreamProducer {
|
|||
let fku_probe_id = srcpad
|
||||
.add_probe(
|
||||
gst::PadProbeType::EVENT_UPSTREAM,
|
||||
glib::clone!(@weak appsink, @weak consumer => @default-panic, move |_pad, info| {
|
||||
glib::clone!(
|
||||
#[weak]
|
||||
appsink,
|
||||
#[upgrade_or_panic]
|
||||
move |_pad, info| {
|
||||
let Some(event) = info.event() else {
|
||||
return gst::PadProbeReturn::Ok;
|
||||
};
|
||||
|
@ -208,7 +212,8 @@ impl StreamProducer {
|
|||
}
|
||||
|
||||
gst::PadProbeReturn::Ok
|
||||
}),
|
||||
}
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
@ -410,7 +415,7 @@ impl<'a> From<&'a gst_app::AppSink> for StreamProducer {
|
|||
|
||||
appsink.set_callbacks(
|
||||
gst_app::AppSinkCallbacks::builder()
|
||||
.new_sample(glib::clone!(@strong consumers => move |appsink| {
|
||||
.new_sample(glib::clone!(#[strong] consumers, move |appsink| {
|
||||
let mut consumers = consumers.lock().unwrap();
|
||||
|
||||
let sample = match appsink.pull_sample() {
|
||||
|
@ -429,7 +434,7 @@ impl<'a> From<&'a gst_app::AppSink> for StreamProducer {
|
|||
|
||||
StreamProducer::process_sample(sample, appsink, consumers)
|
||||
}))
|
||||
.new_preroll(glib::clone!(@strong consumers => move |appsink| {
|
||||
.new_preroll(glib::clone!(#[strong] consumers, move |appsink| {
|
||||
let mut consumers = consumers.lock().unwrap();
|
||||
|
||||
let sample = match appsink.pull_preroll() {
|
||||
|
@ -448,7 +453,7 @@ impl<'a> From<&'a gst_app::AppSink> for StreamProducer {
|
|||
Ok(gst::FlowSuccess::Ok)
|
||||
}
|
||||
}))
|
||||
.new_event(glib::clone!(@strong consumers => move |appsink| {
|
||||
.new_event(glib::clone!(#[strong] consumers, move |appsink| {
|
||||
match appsink.pull_object().map(|obj| obj.downcast::<gst::Event>()) {
|
||||
Ok(Ok(event)) => {
|
||||
let (events_to_forward, appsrcs) = {
|
||||
|
@ -472,7 +477,7 @@ impl<'a> From<&'a gst_app::AppSink> for StreamProducer {
|
|||
|
||||
false
|
||||
}))
|
||||
.eos(glib::clone!(@strong consumers => move |appsink| {
|
||||
.eos(glib::clone!(#[strong] consumers, move |appsink| {
|
||||
let stream_consumers = consumers
|
||||
.lock()
|
||||
.unwrap();
|
||||
|
@ -499,7 +504,10 @@ impl<'a> From<&'a gst_app::AppSink> for StreamProducer {
|
|||
let sinkpad = appsink.static_pad("sink").unwrap();
|
||||
sinkpad.add_probe(
|
||||
gst::PadProbeType::EVENT_UPSTREAM,
|
||||
glib::clone!(@strong consumers => move |_pad, info| {
|
||||
glib::clone!(
|
||||
#[strong]
|
||||
consumers,
|
||||
move |_pad, info| {
|
||||
let Some(event) = info.event() else {
|
||||
return gst::PadProbeReturn::Ok;
|
||||
};
|
||||
|
@ -513,7 +521,8 @@ impl<'a> From<&'a gst_app::AppSink> for StreamProducer {
|
|||
consumers.current_latency = Some(latency);
|
||||
|
||||
gst::PadProbeReturn::Ok
|
||||
}),
|
||||
}
|
||||
),
|
||||
);
|
||||
|
||||
StreamProducer {
|
||||
|
|
|
@ -387,11 +387,15 @@ mod tests {
|
|||
let called = Arc::new(Mutex::new(false));
|
||||
let succeeding_action_type = crate::ActionTypeBuilder::new(
|
||||
"succeeds",
|
||||
glib::clone!(@strong called => move |_, _action| {
|
||||
glib::clone!(
|
||||
#[strong]
|
||||
called,
|
||||
move |_, _action| {
|
||||
*called.lock().unwrap() = true;
|
||||
|
||||
Ok(crate::ActionSuccess::Ok)
|
||||
}),
|
||||
}
|
||||
),
|
||||
)
|
||||
.parameter(
|
||||
crate::ActionParameterBuilder::new("always", "Does the action always succeeds")
|
||||
|
|
Loading…
Reference in a new issue