Revert "Implement RGB0 pixel format "

This commit is contained in:
RustDesk 2022-12-22 12:22:26 +08:00 committed by GitHub
parent 7f006102b5
commit 9c24117b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 215 additions and 145 deletions

275
Cargo.lock generated
View File

@ -295,7 +295,7 @@ dependencies = [
"glib-sys 0.15.10", "glib-sys 0.15.10",
"gobject-sys 0.15.10", "gobject-sys 0.15.10",
"libc", "libc",
"system-deps", "system-deps 6.0.3",
] ]
[[package]] [[package]]
@ -313,12 +313,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
[[package]]
name = "atomic_refcell"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d"
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -525,7 +519,7 @@ checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8"
dependencies = [ dependencies = [
"glib-sys 0.15.10", "glib-sys 0.15.10",
"libc", "libc",
"system-deps", "system-deps 6.0.3",
] ]
[[package]] [[package]]
@ -2002,7 +1996,7 @@ dependencies = [
"glib-sys 0.15.10", "glib-sys 0.15.10",
"gobject-sys 0.15.10", "gobject-sys 0.15.10",
"libc", "libc",
"system-deps", "system-deps 6.0.3",
] ]
[[package]] [[package]]
@ -2019,7 +2013,7 @@ dependencies = [
"libc", "libc",
"pango-sys", "pango-sys",
"pkg-config", "pkg-config",
"system-deps", "system-deps 6.0.3",
] ]
[[package]] [[package]]
@ -2085,7 +2079,7 @@ dependencies = [
"glib-sys 0.15.10", "glib-sys 0.15.10",
"gobject-sys 0.15.10", "gobject-sys 0.15.10",
"libc", "libc",
"system-deps", "system-deps 6.0.3",
"winapi 0.3.9", "winapi 0.3.9",
] ]
@ -2098,10 +2092,29 @@ dependencies = [
"glib-sys 0.16.3", "glib-sys 0.16.3",
"gobject-sys 0.16.3", "gobject-sys 0.16.3",
"libc", "libc",
"system-deps", "system-deps 6.0.3",
"winapi 0.3.9", "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]] [[package]]
name = "glib" name = "glib"
version = "0.15.12" version = "0.15.12"
@ -2144,6 +2157,22 @@ dependencies = [
"thiserror", "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]] [[package]]
name = "glib-macros" name = "glib-macros"
version = "0.15.11" version = "0.15.11"
@ -2152,7 +2181,7 @@ checksum = "25a68131a662b04931e71891fb14aaf65ee4b44d08e8abc10f49e77418c86c64"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"heck 0.4.0", "heck 0.4.0",
"proc-macro-crate", "proc-macro-crate 1.2.1",
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2167,13 +2196,23 @@ checksum = "e084807350b01348b6d9dbabb724d1a0bb987f47a2c85de200e98e12e30733bf"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"heck 0.4.0", "heck 0.4.0",
"proc-macro-crate", "proc-macro-crate 1.2.1",
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "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]] [[package]]
name = "glib-sys" name = "glib-sys"
version = "0.15.10" version = "0.15.10"
@ -2181,7 +2220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4" checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4"
dependencies = [ dependencies = [
"libc", "libc",
"system-deps", "system-deps 6.0.3",
] ]
[[package]] [[package]]
@ -2191,7 +2230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61a4f46316d06bfa33a7ac22df6f0524c8be58e3db2d9ca99ccb1f357b62a65" checksum = "c61a4f46316d06bfa33a7ac22df6f0524c8be58e3db2d9ca99ccb1f357b62a65"
dependencies = [ dependencies = [
"libc", "libc",
"system-deps", "system-deps 6.0.3",
] ]
[[package]] [[package]]
@ -2200,6 +2239,17 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 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]] [[package]]
name = "gobject-sys" name = "gobject-sys"
version = "0.15.10" version = "0.15.10"
@ -2208,7 +2258,7 @@ checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a"
dependencies = [ dependencies = [
"glib-sys 0.15.10", "glib-sys 0.15.10",
"libc", "libc",
"system-deps", "system-deps 6.0.3",
] ]
[[package]] [[package]]
@ -2219,28 +2269,28 @@ checksum = "3520bb9c07ae2a12c7f2fbb24d4efc11231c8146a86956413fb1a79bb760a0f1"
dependencies = [ dependencies = [
"glib-sys 0.16.3", "glib-sys 0.16.3",
"libc", "libc",
"system-deps", "system-deps 6.0.3",
] ]
[[package]] [[package]]
name = "gstreamer" name = "gstreamer"
version = "0.19.4" version = "0.16.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87a7570ad1d3c1cbf64561ada514fe0c03cf834f2076b85ffc616756c840b665" checksum = "9ff5d0f7ff308ae37e6eb47b6ded17785bdea06e438a708cd09e0288c1862f33"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-util", "futures-util",
"glib 0.16.5", "glib 0.10.3",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"gstreamer-sys", "gstreamer-sys",
"libc", "libc",
"muldiv", "muldiv",
"num-integer", "num-rational",
"num-rational 0.4.1",
"once_cell", "once_cell",
"option-operations",
"paste", "paste",
"pretty-hex", "pretty-hex",
"thiserror", "thiserror",
@ -2248,86 +2298,94 @@ dependencies = [
[[package]] [[package]]
name = "gstreamer-app" name = "gstreamer-app"
version = "0.19.2" version = "0.16.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c45202b4d565034d4fe5577c990d3a99eaf0c2bfd2cb3f73f70db14d58e0208c" checksum = "cc80888271338c3ede875d8cafc452eb207476ff5539dcbe0018a8f5b827af0e"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"glib 0.16.5", "glib 0.10.3",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"gstreamer", "gstreamer",
"gstreamer-app-sys", "gstreamer-app-sys",
"gstreamer-base", "gstreamer-base",
"gstreamer-sys",
"libc", "libc",
"once_cell", "once_cell",
] ]
[[package]] [[package]]
name = "gstreamer-app-sys" name = "gstreamer-app-sys"
version = "0.19.2" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29b0159da8dd0672c1a5507445c70c8dc483abfb63a0295cabaedd396f1d67d1" checksum = "813f64275c9e7b33b828b9efcf9dfa64b95996766d4de996e84363ac65b87e3d"
dependencies = [ dependencies = [
"glib-sys 0.16.3", "glib-sys 0.10.1",
"gstreamer-base-sys", "gstreamer-base-sys",
"gstreamer-sys", "gstreamer-sys",
"libc", "libc",
"system-deps", "system-deps 1.3.2",
] ]
[[package]] [[package]]
name = "gstreamer-base" name = "gstreamer-base"
version = "0.19.3" version = "0.16.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a61a299f9ea2ca892b43e2e428b86c679875e95ba23f8ae06fd730308df630f0" checksum = "bafd01c56f59cb10f4b5a10f97bb4bdf8c2b2784ae5b04da7e2d400cf6e6afcf"
dependencies = [ dependencies = [
"atomic_refcell",
"bitflags", "bitflags",
"cfg-if 1.0.0", "glib 0.10.3",
"glib 0.16.5", "glib-sys 0.10.1",
"gobject-sys 0.10.0",
"gstreamer", "gstreamer",
"gstreamer-base-sys", "gstreamer-base-sys",
"gstreamer-sys",
"libc", "libc",
] ]
[[package]] [[package]]
name = "gstreamer-base-sys" name = "gstreamer-base-sys"
version = "0.19.3" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbc3c4476e1503ae245c89fbe20060c30ec6ade5f44620bcc402cbc70a3911a1" checksum = "a4b7b6dc2d6e160a1ae28612f602bd500b3fa474ce90bf6bb2f08072682beef5"
dependencies = [ dependencies = [
"glib-sys 0.16.3", "glib-sys 0.10.1",
"gobject-sys 0.16.3", "gobject-sys 0.10.0",
"gstreamer-sys", "gstreamer-sys",
"libc", "libc",
"system-deps", "system-deps 1.3.2",
] ]
[[package]] [[package]]
name = "gstreamer-sys" name = "gstreamer-sys"
version = "0.19.4" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "545f52ad8a480732cc4290fd65dfe42952c8ae374fe581831ba15981fedf18a4" checksum = "fc1f154082d01af5718c5f8a8eb4f565a4ea5586ad8833a8fc2c2aa6844b601d"
dependencies = [ dependencies = [
"glib-sys 0.16.3", "glib-sys 0.10.1",
"gobject-sys 0.16.3", "gobject-sys 0.10.0",
"libc", "libc",
"system-deps", "system-deps 1.3.2",
] ]
[[package]] [[package]]
name = "gstreamer-video" name = "gstreamer-video"
version = "0.19.4" version = "0.16.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e99623fb99436c4b2da66ae94b25881c94db5144afc1bd7c84cee5cabb72f18" checksum = "f7bbb1485d87469849ec45c08e03c2f280d3ea20ff3c439d03185be54e3ce98e"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if 1.0.0",
"futures-channel", "futures-channel",
"glib 0.16.5", "futures-util",
"glib 0.10.3",
"glib-sys 0.10.1",
"gobject-sys 0.10.0",
"gstreamer", "gstreamer",
"gstreamer-base", "gstreamer-base",
"gstreamer-base-sys",
"gstreamer-sys",
"gstreamer-video-sys", "gstreamer-video-sys",
"libc", "libc",
"once_cell", "once_cell",
@ -2335,16 +2393,16 @@ dependencies = [
[[package]] [[package]]
name = "gstreamer-video-sys" name = "gstreamer-video-sys"
version = "0.19.4" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9206e9df0ed84824bfe4cc13e3359154ad7624221c7d3d6242585db3f19a15d9" checksum = "92347e46438007d6a2386302125f62cb9df6769cdacb931af5c0f12c1ee21de4"
dependencies = [ dependencies = [
"glib-sys 0.16.3", "glib-sys 0.10.1",
"gobject-sys 0.16.3", "gobject-sys 0.10.0",
"gstreamer-base-sys", "gstreamer-base-sys",
"gstreamer-sys", "gstreamer-sys",
"libc", "libc",
"system-deps", "system-deps 1.3.2",
] ]
[[package]] [[package]]
@ -2385,7 +2443,7 @@ dependencies = [
"gobject-sys 0.15.10", "gobject-sys 0.15.10",
"libc", "libc",
"pango-sys", "pango-sys",
"system-deps", "system-deps 6.0.3",
] ]
[[package]] [[package]]
@ -2395,7 +2453,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24f518afe90c23fba585b2d7697856f9e6a7bbc62f65588035e66f6afb01a2e9" checksum = "24f518afe90c23fba585b2d7697856f9e6a7bbc62f65588035e66f6afb01a2e9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"proc-macro-crate", "proc-macro-crate 1.2.1",
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2642,7 +2700,7 @@ dependencies = [
"byteorder", "byteorder",
"color_quant", "color_quant",
"num-iter", "num-iter",
"num-rational 0.3.2", "num-rational",
"num-traits 0.2.15", "num-traits 0.2.15",
"png", "png",
"tiff", "tiff",
@ -2732,6 +2790,15 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec947b7a4ce12e3b87e353abae7ce124d025b6c7d6c5aea5cc0bcf92e9510ded" checksum = "ec947b7a4ce12e3b87e353abae7ce124d025b6c7d6c5aea5cc0bcf92e9510ded"
[[package]]
name = "itertools"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "0.3.4" version = "0.3.4"
@ -3185,9 +3252,9 @@ dependencies = [
[[package]] [[package]]
name = "muldiv" name = "muldiv"
version = "1.0.1" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0" checksum = "0419348c027fa7be448d2ae7ea0e4e04c2334c31dc4e74ab29f00a2a7ca69204"
[[package]] [[package]]
name = "ndk" name = "ndk"
@ -3272,7 +3339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c"
dependencies = [ dependencies = [
"darling", "darling",
"proc-macro-crate", "proc-macro-crate 1.2.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
@ -3459,17 +3526,6 @@ dependencies = [
"num-traits 0.2.15", "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]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.1.43" version = "0.1.43"
@ -3513,7 +3569,7 @@ version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate 1.2.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
@ -3601,15 +3657,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 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]] [[package]]
name = "ordered-multimap" name = "ordered-multimap"
version = "0.4.3" version = "0.4.3"
@ -3664,7 +3711,7 @@ dependencies = [
"glib-sys 0.15.10", "glib-sys 0.15.10",
"gobject-sys 0.15.10", "gobject-sys 0.15.10",
"libc", "libc",
"system-deps", "system-deps 6.0.3",
] ]
[[package]] [[package]]
@ -3880,9 +3927,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]] [[package]]
name = "pretty-hex" name = "pretty-hex"
version = "0.3.0" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" checksum = "bc5c99d529f0d30937f6f4b8a86d988047327bb88d04d2c4afc356de74722131"
[[package]] [[package]]
name = "primal-check" name = "primal-check"
@ -3893,6 +3940,15 @@ dependencies = [
"num-integer", "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]] [[package]]
name = "proc-macro-crate" name = "proc-macro-crate"
version = "1.2.1" version = "1.2.1"
@ -4262,8 +4318,8 @@ dependencies = [
"libc", "libc",
"log", "log",
"mio 0.8.5", "mio 0.8.5",
"strum", "strum 0.24.1",
"strum_macros", "strum_macros 0.24.3",
"widestring 1.0.2", "widestring 1.0.2",
"winapi 0.3.9", "winapi 0.3.9",
"x11 2.20.1", "x11 2.20.1",
@ -5118,12 +5174,30 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "strum"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b"
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.24.1" version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" 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]] [[package]]
name = "strum_macros" name = "strum_macros"
version = "0.24.3" version = "0.24.3"
@ -5209,6 +5283,21 @@ dependencies = [
"libc", "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]] [[package]]
name = "system-deps" name = "system-deps"
version = "6.0.3" version = "6.0.3"
@ -5219,7 +5308,7 @@ dependencies = [
"heck 0.4.0", "heck 0.4.0",
"pkg-config", "pkg-config",
"toml", "toml",
"version-compare", "version-compare 0.1.1",
] ]
[[package]] [[package]]
@ -5650,6 +5739,12 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version-compare"
version = "0.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1"
[[package]] [[package]]
name = "version-compare" name = "version-compare"
version = "0.1.1" version = "0.1.1"
@ -6476,7 +6571,7 @@ version = "3.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45066039ebf3330820e495e854f8b312abb68f0a39e97972d092bd72e8bb3e8e" checksum = "45066039ebf3330820e495e854f8b312abb68f0a39e97972d092bd72e8bb3e8e"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate 1.2.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"regex", "regex",
@ -6543,7 +6638,7 @@ version = "3.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "155247a5d1ab55e335421c104ccd95d64f17cebbd02f50cdbc1c33385f9c4d81" checksum = "155247a5d1ab55e335421c104ccd95d64f17cebbd02f50cdbc1c33385f9c4d81"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate 1.2.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",

View File

@ -48,9 +48,9 @@ bindgen = "0.59"
[target.'cfg(target_os = "linux")'.dependencies] [target.'cfg(target_os = "linux")'.dependencies]
dbus = { version = "0.9", optional = true } dbus = { version = "0.9", optional = true }
tracing = { version = "0.1", optional = true } tracing = { version = "0.1", optional = true }
gstreamer = { version = "0.19", optional = true } gstreamer = { version = "0.16", optional = true }
gstreamer-app = { version = "0.19", features = ["v1_16"], optional = true } gstreamer-app = { version = "0.16", features = ["v1_10"], optional = true }
gstreamer-video = { version = "0.19", optional = true } gstreamer-video = { version = "0.16", optional = true }
[target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies] [target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies]
hwcodec = { git = "https://github.com/21pages/hwcodec", optional = true } hwcodec = { git = "https://github.com/21pages/hwcodec", optional = true }

View File

@ -50,12 +50,6 @@ impl TraitCapturer for Capturer {
} else { } else {
x x
})), })),
PixelProvider::RGB0(w, h, x) => Ok(Frame(if self.2 {
crate::common::rgba_to_i420(w as _, h as _, &x, &mut self.3);
&self.3[..]
} else {
x
})),
PixelProvider::NONE => Err(std::io::ErrorKind::WouldBlock.into()), PixelProvider::NONE => Err(std::io::ErrorKind::WouldBlock.into()),
_ => Err(map_err("Invalid data")), _ => Err(map_err("Invalid data")),
} }

View File

@ -4,7 +4,6 @@ use std::error::Error;
pub enum PixelProvider<'a> { pub enum PixelProvider<'a> {
// 8 bits per color // 8 bits per color
RGB(usize, usize, &'a [u8]), RGB(usize, usize, &'a [u8]),
RGB0(usize, usize, &'a [u8]),
BGR0(usize, usize, &'a [u8]), BGR0(usize, usize, &'a [u8]),
// width, height, stride // width, height, stride
BGR0S(usize, usize, usize, &'a [u8]), BGR0S(usize, usize, usize, &'a [u8]),
@ -15,7 +14,6 @@ impl<'a> PixelProvider<'a> {
pub fn size(&self) -> (usize, usize) { pub fn size(&self) -> (usize, usize) {
match self { match self {
PixelProvider::RGB(w, h, _) => (*w, *h), PixelProvider::RGB(w, h, _) => (*w, *h),
PixelProvider::RGB0(w, h, _) => (*w, *h),
PixelProvider::BGR0(w, h, _) => (*w, *h), PixelProvider::BGR0(w, h, _) => (*w, *h),
PixelProvider::BGR0S(w, h, _, _) => (*w, *h), PixelProvider::BGR0S(w, h, _, _) => (*w, *h),
PixelProvider::NONE => (0, 0), PixelProvider::NONE => (0, 0),

View File

@ -117,7 +117,6 @@ impl Capturable for PipeWireCapturable {
pub struct PipeWireRecorder { pub struct PipeWireRecorder {
buffer: Option<gst::MappedBuffer<gst::buffer::Readable>>, buffer: Option<gst::MappedBuffer<gst::buffer::Readable>>,
buffer_cropped: Vec<u8>, buffer_cropped: Vec<u8>,
pix_fmt: String,
is_cropped: bool, is_cropped: bool,
pipeline: gst::Pipeline, pipeline: gst::Pipeline,
appsink: AppSink, appsink: AppSink,
@ -130,42 +129,34 @@ impl PipeWireRecorder {
pub fn new(capturable: PipeWireCapturable) -> Result<Self, Box<dyn Error>> { pub fn new(capturable: PipeWireCapturable) -> Result<Self, Box<dyn Error>> {
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::new(None);
let src = gst::ElementFactory::make_with_name("pipewiresrc", None)?; let src = gst::ElementFactory::make("pipewiresrc", None)?;
src.set_property("fd", &capturable.fd.as_raw_fd()); src.set_property("fd", &capturable.fd.as_raw_fd())?;
src.set_property("path", &format!("{}", capturable.path)); src.set_property("path", &format!("{}", capturable.path))?;
src.set_property("keepalive_time", &1_000.as_raw_fd()); 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, // 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 // 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_with_name("appsink", None)?; let sink = gst::ElementFactory::make("appsink", None)?;
sink.set_property("drop", &true); sink.set_property("drop", &true)?;
sink.set_property("max-buffers", &1u32); sink.set_property("max-buffers", &1u32)?;
pipeline.add_many(&[&src, &sink])?; pipeline.add_many(&[&src, &sink])?;
src.link(&sink)?; src.link(&sink)?;
let appsink = sink let appsink = sink
.dynamic_cast::<AppSink>() .dynamic_cast::<AppSink>()
.map_err(|_| GStreamerError("Sink element is expected to be an appsink!".into()))?; .map_err(|_| GStreamerError("Sink element is expected to be an appsink!".into()))?;
let mut caps = gst::Caps::new_empty(); appsink.set_caps(Some(&gst::Caps::new_simple(
caps.merge_structure(gst::structure::Structure::new(
"video/x-raw", "video/x-raw",
&[("format", &"BGRx")], &[("format", &"BGRx")],
)); )));
caps.merge_structure(gst::structure::Structure::new(
"video/x-raw",
&[("format", &"RGBx")],
));
appsink.set_caps(Some(&caps));
pipeline.set_state(gst::State::Playing)?; pipeline.set_state(gst::State::Playing)?;
Ok(Self { Ok(Self {
pipeline, pipeline,
appsink, appsink,
buffer: None, buffer: None,
pix_fmt: "".into(),
width: 0, width: 0,
height: 0, height: 0,
buffer_cropped: vec![], buffer_cropped: vec![],
@ -182,21 +173,20 @@ impl Recorder for PipeWireRecorder {
.try_pull_sample(gst::ClockTime::from_mseconds(timeout_ms)) .try_pull_sample(gst::ClockTime::from_mseconds(timeout_ms))
{ {
let cap = sample let cap = sample
.caps() .get_caps()
.ok_or("Failed get caps")? .ok_or("Failed get caps")?
.structure(0) .get_structure(0)
.ok_or("Failed to get structure")?; .ok_or("Failed to get structure")?;
let w: i32 = cap.value("width")?.get()?; let w: i32 = cap.get_value("width")?.get_some()?;
let h: i32 = cap.value("height")?.get()?; let h: i32 = cap.get_value("height")?.get_some()?;
self.pix_fmt = cap.value("format")?.get()?;
let w = w as usize; let w = w as usize;
let h = h as usize; let h = h as usize;
let buf = sample let buf = sample
.buffer_owned() .get_buffer_owned()
.ok_or_else(|| GStreamerError("Failed to get owned buffer.".into()))?; .ok_or_else(|| GStreamerError("Failed to get owned buffer.".into()))?;
let mut crop = buf let mut crop = buf
.meta::<gstreamer_video::VideoCropMeta>() .get_meta::<gstreamer_video::VideoCropMeta>()
.map(|m| m.rect()); .map(|m| m.get_rect());
// only crop if necessary // only crop if necessary
if Some((0, 0, w as u32, h as u32)) == crop { if Some((0, 0, w as u32, h as u32)) == crop {
crop = None; crop = None;
@ -207,7 +197,7 @@ impl Recorder for PipeWireRecorder {
if let Err(..) = crate::would_block_if_equal(&mut self.saved_raw_data, buf.as_slice()) { if let Err(..) = crate::would_block_if_equal(&mut self.saved_raw_data, buf.as_slice()) {
return Ok(PixelProvider::NONE); return Ok(PixelProvider::NONE);
} }
let buf_size = buf.size(); let buf_size = buf.get_size();
// BGRx is 4 bytes per pixel // BGRx is 4 bytes per pixel
if buf_size != (w * h * 4) { if buf_size != (w * h * 4) {
// for some reason the width and height of the caps do not guarantee correct buffer // for some reason the width and height of the caps do not guarantee correct buffer
@ -251,22 +241,15 @@ impl Recorder for PipeWireRecorder {
if self.buffer.is_none() { if self.buffer.is_none() {
return Err(Box::new(GStreamerError("No buffer available!".into()))); return Err(Box::new(GStreamerError("No buffer available!".into())));
} }
let buf = if self.is_cropped { Ok(PixelProvider::BGR0(
self.buffer_cropped.as_slice() self.width,
} else { self.height,
self.buffer if self.is_cropped {
.as_ref() self.buffer_cropped.as_slice()
.ok_or("Failed to get buffer as ref")? } else {
.as_slice() self.buffer.as_ref().unwrap().as_slice()
}; },
match self.pix_fmt.as_str() { ))
"BGRx" => Ok(PixelProvider::BGR0(self.width, self.height, buf)),
"RGBx" => Ok(PixelProvider::RGB0(self.width, self.height, buf)),
_ => Err(Box::new(GStreamerError(format!(
"Unreachable! Unknown pix_fmt, {}",
&self.pix_fmt
)))),
}
} }
} }