From d910e7ad96c8389e1bc3f2a2f0f3c13d2b43485f Mon Sep 17 00:00:00 2001 From: Sangha Lee Date: Wed, 21 Dec 2022 03:32:42 +0900 Subject: [PATCH] update gstreamer --- Cargo.lock | 275 ++++++++++------------------- libs/scrap/Cargo.toml | 6 +- libs/scrap/src/wayland/pipewire.rs | 32 ++-- 3 files changed, 109 insertions(+), 204 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b220c15d..336fc4b50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -295,7 +295,7 @@ dependencies = [ "glib-sys 0.15.10", "gobject-sys 0.15.10", "libc", - "system-deps 6.0.3", + "system-deps", ] [[package]] @@ -313,6 +313,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" +[[package]] +name = "atomic_refcell" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d" + [[package]] name = "atty" version = "0.2.14" @@ -519,7 +525,7 @@ checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8" dependencies = [ "glib-sys 0.15.10", "libc", - "system-deps 6.0.3", + "system-deps", ] [[package]] @@ -1996,7 +2002,7 @@ dependencies = [ "glib-sys 0.15.10", "gobject-sys 0.15.10", "libc", - "system-deps 6.0.3", + "system-deps", ] [[package]] @@ -2013,7 +2019,7 @@ dependencies = [ "libc", "pango-sys", "pkg-config", - "system-deps 6.0.3", + "system-deps", ] [[package]] @@ -2079,7 +2085,7 @@ dependencies = [ "glib-sys 0.15.10", "gobject-sys 0.15.10", "libc", - "system-deps 6.0.3", + "system-deps", "winapi 0.3.9", ] @@ -2092,29 +2098,10 @@ dependencies = [ "glib-sys 0.16.3", "gobject-sys 0.16.3", "libc", - "system-deps 6.0.3", + "system-deps", "winapi 0.3.9", ] -[[package]] -name = "glib" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c685013b7515e668f1b57a165b009d4d28cb139a8a989bbd699c10dad29d0c5" -dependencies = [ - "bitflags", - "futures-channel", - "futures-core", - "futures-executor", - "futures-task", - "futures-util", - "glib-macros 0.10.1", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", - "libc", - "once_cell", -] - [[package]] name = "glib" version = "0.15.12" @@ -2157,22 +2144,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "glib-macros" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41486a26d1366a8032b160b59065a59fb528530a46a49f627e7048fb8c064039" -dependencies = [ - "anyhow", - "heck 0.3.3", - "itertools", - "proc-macro-crate 0.1.5", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "glib-macros" version = "0.15.11" @@ -2181,7 +2152,7 @@ checksum = "25a68131a662b04931e71891fb14aaf65ee4b44d08e8abc10f49e77418c86c64" dependencies = [ "anyhow", "heck 0.4.0", - "proc-macro-crate 1.2.1", + "proc-macro-crate", "proc-macro-error", "proc-macro2", "quote", @@ -2196,23 +2167,13 @@ checksum = "e084807350b01348b6d9dbabb724d1a0bb987f47a2c85de200e98e12e30733bf" dependencies = [ "anyhow", "heck 0.4.0", - "proc-macro-crate 1.2.1", + "proc-macro-crate", "proc-macro-error", "proc-macro2", "quote", "syn", ] -[[package]] -name = "glib-sys" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e9b997a66e9a23d073f2b1abb4dbfc3925e0b8952f67efd8d9b6e168e4cdc1" -dependencies = [ - "libc", - "system-deps 1.3.2", -] - [[package]] name = "glib-sys" version = "0.15.10" @@ -2220,7 +2181,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4" dependencies = [ "libc", - "system-deps 6.0.3", + "system-deps", ] [[package]] @@ -2230,7 +2191,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61a4f46316d06bfa33a7ac22df6f0524c8be58e3db2d9ca99ccb1f357b62a65" dependencies = [ "libc", - "system-deps 6.0.3", + "system-deps", ] [[package]] @@ -2239,17 +2200,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -[[package]] -name = "gobject-sys" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c" -dependencies = [ - "glib-sys 0.10.1", - "libc", - "system-deps 1.3.2", -] - [[package]] name = "gobject-sys" version = "0.15.10" @@ -2258,7 +2208,7 @@ checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a" dependencies = [ "glib-sys 0.15.10", "libc", - "system-deps 6.0.3", + "system-deps", ] [[package]] @@ -2269,28 +2219,28 @@ checksum = "3520bb9c07ae2a12c7f2fbb24d4efc11231c8146a86956413fb1a79bb760a0f1" dependencies = [ "glib-sys 0.16.3", "libc", - "system-deps 6.0.3", + "system-deps", ] [[package]] name = "gstreamer" -version = "0.16.7" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff5d0f7ff308ae37e6eb47b6ded17785bdea06e438a708cd09e0288c1862f33" +checksum = "87a7570ad1d3c1cbf64561ada514fe0c03cf834f2076b85ffc616756c840b665" dependencies = [ "bitflags", "cfg-if 1.0.0", "futures-channel", "futures-core", "futures-util", - "glib 0.10.3", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", + "glib 0.16.5", "gstreamer-sys", "libc", "muldiv", - "num-rational", + "num-integer", + "num-rational 0.4.1", "once_cell", + "option-operations", "paste", "pretty-hex", "thiserror", @@ -2298,94 +2248,86 @@ dependencies = [ [[package]] name = "gstreamer-app" -version = "0.16.5" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc80888271338c3ede875d8cafc452eb207476ff5539dcbe0018a8f5b827af0e" +checksum = "c45202b4d565034d4fe5577c990d3a99eaf0c2bfd2cb3f73f70db14d58e0208c" dependencies = [ "bitflags", "futures-core", "futures-sink", - "glib 0.10.3", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", + "glib 0.16.5", "gstreamer", "gstreamer-app-sys", "gstreamer-base", - "gstreamer-sys", "libc", "once_cell", ] [[package]] name = "gstreamer-app-sys" -version = "0.9.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "813f64275c9e7b33b828b9efcf9dfa64b95996766d4de996e84363ac65b87e3d" +checksum = "29b0159da8dd0672c1a5507445c70c8dc483abfb63a0295cabaedd396f1d67d1" dependencies = [ - "glib-sys 0.10.1", + "glib-sys 0.16.3", "gstreamer-base-sys", "gstreamer-sys", "libc", - "system-deps 1.3.2", + "system-deps", ] [[package]] name = "gstreamer-base" -version = "0.16.5" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafd01c56f59cb10f4b5a10f97bb4bdf8c2b2784ae5b04da7e2d400cf6e6afcf" +checksum = "a61a299f9ea2ca892b43e2e428b86c679875e95ba23f8ae06fd730308df630f0" dependencies = [ + "atomic_refcell", "bitflags", - "glib 0.10.3", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", + "cfg-if 1.0.0", + "glib 0.16.5", "gstreamer", "gstreamer-base-sys", - "gstreamer-sys", "libc", ] [[package]] name = "gstreamer-base-sys" -version = "0.9.1" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b7b6dc2d6e160a1ae28612f602bd500b3fa474ce90bf6bb2f08072682beef5" +checksum = "dbc3c4476e1503ae245c89fbe20060c30ec6ade5f44620bcc402cbc70a3911a1" dependencies = [ - "glib-sys 0.10.1", - "gobject-sys 0.10.0", + "glib-sys 0.16.3", + "gobject-sys 0.16.3", "gstreamer-sys", "libc", - "system-deps 1.3.2", + "system-deps", ] [[package]] name = "gstreamer-sys" -version = "0.9.1" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1f154082d01af5718c5f8a8eb4f565a4ea5586ad8833a8fc2c2aa6844b601d" +checksum = "545f52ad8a480732cc4290fd65dfe42952c8ae374fe581831ba15981fedf18a4" dependencies = [ - "glib-sys 0.10.1", - "gobject-sys 0.10.0", + "glib-sys 0.16.3", + "gobject-sys 0.16.3", "libc", - "system-deps 1.3.2", + "system-deps", ] [[package]] name = "gstreamer-video" -version = "0.16.7" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7bbb1485d87469849ec45c08e03c2f280d3ea20ff3c439d03185be54e3ce98e" +checksum = "5e99623fb99436c4b2da66ae94b25881c94db5144afc1bd7c84cee5cabb72f18" dependencies = [ "bitflags", + "cfg-if 1.0.0", "futures-channel", - "futures-util", - "glib 0.10.3", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", + "glib 0.16.5", "gstreamer", "gstreamer-base", - "gstreamer-base-sys", - "gstreamer-sys", "gstreamer-video-sys", "libc", "once_cell", @@ -2393,16 +2335,16 @@ dependencies = [ [[package]] name = "gstreamer-video-sys" -version = "0.9.1" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92347e46438007d6a2386302125f62cb9df6769cdacb931af5c0f12c1ee21de4" +checksum = "9206e9df0ed84824bfe4cc13e3359154ad7624221c7d3d6242585db3f19a15d9" dependencies = [ - "glib-sys 0.10.1", - "gobject-sys 0.10.0", + "glib-sys 0.16.3", + "gobject-sys 0.16.3", "gstreamer-base-sys", "gstreamer-sys", "libc", - "system-deps 1.3.2", + "system-deps", ] [[package]] @@ -2443,7 +2385,7 @@ dependencies = [ "gobject-sys 0.15.10", "libc", "pango-sys", - "system-deps 6.0.3", + "system-deps", ] [[package]] @@ -2453,7 +2395,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24f518afe90c23fba585b2d7697856f9e6a7bbc62f65588035e66f6afb01a2e9" dependencies = [ "anyhow", - "proc-macro-crate 1.2.1", + "proc-macro-crate", "proc-macro-error", "proc-macro2", "quote", @@ -2700,7 +2642,7 @@ dependencies = [ "byteorder", "color_quant", "num-iter", - "num-rational", + "num-rational 0.3.2", "num-traits 0.2.15", "png", "tiff", @@ -2790,15 +2732,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec947b7a4ce12e3b87e353abae7ce124d025b6c7d6c5aea5cc0bcf92e9510ded" -[[package]] -name = "itertools" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "0.3.4" @@ -3252,9 +3185,9 @@ dependencies = [ [[package]] name = "muldiv" -version = "0.2.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0419348c027fa7be448d2ae7ea0e4e04c2334c31dc4e74ab29f00a2a7ca69204" +checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0" [[package]] name = "ndk" @@ -3339,7 +3272,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" dependencies = [ "darling", - "proc-macro-crate 1.2.1", + "proc-macro-crate", "proc-macro2", "quote", "syn", @@ -3526,6 +3459,17 @@ dependencies = [ "num-traits 0.2.15", ] +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits 0.2.15", +] + [[package]] name = "num-traits" version = "0.1.43" @@ -3569,7 +3513,7 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" dependencies = [ - "proc-macro-crate 1.2.1", + "proc-macro-crate", "proc-macro2", "quote", "syn", @@ -3657,6 +3601,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "option-operations" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c26d27bb1aeab65138e4bf7666045169d1717febcc9ff870166be8348b223d0" +dependencies = [ + "paste", +] + [[package]] name = "ordered-multimap" version = "0.4.3" @@ -3711,7 +3664,7 @@ dependencies = [ "glib-sys 0.15.10", "gobject-sys 0.15.10", "libc", - "system-deps 6.0.3", + "system-deps", ] [[package]] @@ -3927,9 +3880,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "pretty-hex" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5c99d529f0d30937f6f4b8a86d988047327bb88d04d2c4afc356de74722131" +checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" [[package]] name = "primal-check" @@ -3940,15 +3893,6 @@ dependencies = [ "num-integer", ] -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - [[package]] name = "proc-macro-crate" version = "1.2.1" @@ -4318,8 +4262,8 @@ dependencies = [ "libc", "log", "mio 0.8.5", - "strum 0.24.1", - "strum_macros 0.24.3", + "strum", + "strum_macros", "widestring 1.0.2", "winapi 0.3.9", "x11 2.20.1", @@ -5174,30 +5118,12 @@ dependencies = [ "syn", ] -[[package]] -name = "strum" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" - [[package]] name = "strum" version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" -[[package]] -name = "strum_macros" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "strum_macros" version = "0.24.3" @@ -5283,21 +5209,6 @@ dependencies = [ "libc", ] -[[package]] -name = "system-deps" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3ecc17269a19353b3558b313bba738b25d82993e30d62a18406a24aba4649b" -dependencies = [ - "heck 0.3.3", - "pkg-config", - "strum 0.18.0", - "strum_macros 0.18.0", - "thiserror", - "toml", - "version-compare 0.0.10", -] - [[package]] name = "system-deps" version = "6.0.3" @@ -5308,7 +5219,7 @@ dependencies = [ "heck 0.4.0", "pkg-config", "toml", - "version-compare 0.1.1", + "version-compare", ] [[package]] @@ -5739,12 +5650,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -[[package]] -name = "version-compare" -version = "0.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1" - [[package]] name = "version-compare" version = "0.1.1" @@ -6571,7 +6476,7 @@ version = "3.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45066039ebf3330820e495e854f8b312abb68f0a39e97972d092bd72e8bb3e8e" dependencies = [ - "proc-macro-crate 1.2.1", + "proc-macro-crate", "proc-macro2", "quote", "regex", @@ -6638,7 +6543,7 @@ version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "155247a5d1ab55e335421c104ccd95d64f17cebbd02f50cdbc1c33385f9c4d81" dependencies = [ - "proc-macro-crate 1.2.1", + "proc-macro-crate", "proc-macro2", "quote", "syn", diff --git a/libs/scrap/Cargo.toml b/libs/scrap/Cargo.toml index e2eb43177..de6a6f2bf 100644 --- a/libs/scrap/Cargo.toml +++ b/libs/scrap/Cargo.toml @@ -48,9 +48,9 @@ bindgen = "0.59" [target.'cfg(target_os = "linux")'.dependencies] dbus = { version = "0.9", optional = true } tracing = { version = "0.1", optional = true } -gstreamer = { version = "0.16", optional = true } -gstreamer-app = { version = "0.16", features = ["v1_10"], optional = true } -gstreamer-video = { version = "0.16", optional = true } +gstreamer = { version = "0.19", optional = true } +gstreamer-app = { version = "0.19", features = ["v1_16"], optional = true } +gstreamer-video = { version = "0.19", optional = true } [target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies] hwcodec = { git = "https://github.com/21pages/hwcodec", optional = true } diff --git a/libs/scrap/src/wayland/pipewire.rs b/libs/scrap/src/wayland/pipewire.rs index a7b4c1357..d43a1b278 100644 --- a/libs/scrap/src/wayland/pipewire.rs +++ b/libs/scrap/src/wayland/pipewire.rs @@ -129,18 +129,18 @@ impl PipeWireRecorder { pub fn new(capturable: PipeWireCapturable) -> Result> { let pipeline = gst::Pipeline::new(None); - let src = gst::ElementFactory::make("pipewiresrc", None)?; - src.set_property("fd", &capturable.fd.as_raw_fd())?; - src.set_property("path", &format!("{}", capturable.path))?; - src.set_property("keepalive_time", &1_000.as_raw_fd())?; + let src = gst::ElementFactory::make_with_name("pipewiresrc", None).unwrap(); + src.set_property("fd", &capturable.fd.as_raw_fd()); + src.set_property("path", &format!("{}", capturable.path)); + src.set_property("keepalive_time", &1_000.as_raw_fd()); // For some reason pipewire blocks on destruction of AppSink if this is not set to true, // see: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/982 - src.set_property("always-copy", &true)?; + src.set_property("always-copy", &true); - let sink = gst::ElementFactory::make("appsink", None)?; - sink.set_property("drop", &true)?; - sink.set_property("max-buffers", &1u32)?; + let sink = gst::ElementFactory::make_with_name("appsink", None).unwrap(); + sink.set_property("drop", &true); + sink.set_property("max-buffers", &1u32); pipeline.add_many(&[&src, &sink])?; src.link(&sink)?; @@ -173,20 +173,20 @@ impl Recorder for PipeWireRecorder { .try_pull_sample(gst::ClockTime::from_mseconds(timeout_ms)) { let cap = sample - .get_caps() + .caps() .ok_or("Failed get caps")? - .get_structure(0) + .structure(0) .ok_or("Failed to get structure")?; - let w: i32 = cap.get_value("width")?.get_some()?; - let h: i32 = cap.get_value("height")?.get_some()?; + let w: i32 = cap.value("width")?.get()?; + let h: i32 = cap.value("height")?.get()?; let w = w as usize; let h = h as usize; let buf = sample - .get_buffer_owned() + .buffer_owned() .ok_or_else(|| GStreamerError("Failed to get owned buffer.".into()))?; let mut crop = buf - .get_meta::() - .map(|m| m.get_rect()); + .meta::() + .map(|m| m.rect()); // only crop if necessary if Some((0, 0, w as u32, h as u32)) == crop { crop = None; @@ -197,7 +197,7 @@ impl Recorder for PipeWireRecorder { if let Err(..) = crate::would_block_if_equal(&mut self.saved_raw_data, buf.as_slice()) { return Ok(PixelProvider::NONE); } - let buf_size = buf.get_size(); + let buf_size = buf.size(); // BGRx is 4 bytes per pixel if buf_size != (w * h * 4) { // for some reason the width and height of the caps do not guarantee correct buffer