Compare commits
2 Commits
a2491695b3
...
a7ffa69326
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7ffa69326 | ||
|
|
4ed15c97f0 |
150
Cargo.lock
generated
150
Cargo.lock
generated
@@ -3049,12 +3049,15 @@ checksum = "12101ecc8225ea6d675bc70263074eab6169079621c2186fe0c66590b2df9681"
|
|||||||
name = "gst"
|
name = "gst"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bitflags 2.10.0",
|
||||||
"error-stack",
|
"error-stack",
|
||||||
"futures",
|
"futures",
|
||||||
"futures-lite 2.6.1",
|
"futures-lite 2.6.1",
|
||||||
"glib 0.21.5",
|
"glib 0.21.5",
|
||||||
|
"glib-sys 0.21.5",
|
||||||
"gstreamer 0.24.4",
|
"gstreamer 0.24.4",
|
||||||
"gstreamer-app 0.24.4",
|
"gstreamer-app 0.24.4",
|
||||||
|
"gstreamer-base 0.24.4",
|
||||||
"gstreamer-video 0.24.4",
|
"gstreamer-video 0.24.4",
|
||||||
"smol",
|
"smol",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
@@ -3388,7 +3391,7 @@ dependencies = [
|
|||||||
"gstreamer 0.24.4",
|
"gstreamer 0.24.4",
|
||||||
"gstreamer-app 0.24.4",
|
"gstreamer-app 0.24.4",
|
||||||
"gstreamer-base 0.24.4",
|
"gstreamer-base 0.24.4",
|
||||||
"gstreamer-video 0.23.6",
|
"gstreamer-video 0.24.4",
|
||||||
"pollster 0.4.0",
|
"pollster 0.4.0",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
@@ -3594,17 +3597,16 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "iced"
|
name = "iced"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
checksum = "000e01026c93ba643f8357a3db3ada0e6555265a377f6f9291c472f6dd701fb3"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced_core",
|
"iced_core",
|
||||||
"iced_debug",
|
"iced_debug 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"iced_devtools",
|
"iced_devtools",
|
||||||
"iced_futures",
|
"iced_futures 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"iced_renderer",
|
"iced_renderer",
|
||||||
"iced_runtime",
|
"iced_runtime 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"iced_widget",
|
"iced_widget",
|
||||||
"iced_winit",
|
"iced_winit 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"image",
|
"image",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
]
|
]
|
||||||
@@ -3617,7 +3619,7 @@ dependencies = [
|
|||||||
"gst",
|
"gst",
|
||||||
"iced",
|
"iced",
|
||||||
"iced_core",
|
"iced_core",
|
||||||
"iced_futures",
|
"iced_futures 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"iced_renderer",
|
"iced_renderer",
|
||||||
"iced_wgpu",
|
"iced_wgpu",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
@@ -3628,8 +3630,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_beacon"
|
name = "iced_beacon"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
checksum = "02a48f970444257a5e8b19def673f14f0d79c159fa851055e2a861683c3f8845"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"futures",
|
"futures",
|
||||||
@@ -3644,8 +3645,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_core"
|
name = "iced_core"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
checksum = "91ab1937d699403e7e69252ae743a902bcee9f4ab2052cc4c9a46fcf34729d85"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.10.0",
|
"bitflags 2.10.0",
|
||||||
"bytes",
|
"bytes",
|
||||||
@@ -3665,21 +3665,30 @@ name = "iced_debug"
|
|||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "25035ab0215a620e53f4103e36fc4e59a1fb2817e4bfc38a30ad27b4202ea0be"
|
checksum = "25035ab0215a620e53f4103e36fc4e59a1fb2817e4bfc38a30ad27b4202ea0be"
|
||||||
|
dependencies = [
|
||||||
|
"iced_core",
|
||||||
|
"iced_futures 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iced_debug"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced_beacon",
|
"iced_beacon",
|
||||||
"iced_core",
|
"iced_core",
|
||||||
"iced_futures",
|
"iced_futures 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_devtools"
|
name = "iced_devtools"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
checksum = "59b8e2a306ac5c583234b02f5404afdb7b7467c8f72a4a44ad3e7be30fc4b339"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced_debug",
|
"iced_debug 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"iced_program",
|
"iced_program 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"iced_widget",
|
"iced_widget",
|
||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
@@ -3689,6 +3698,19 @@ name = "iced_futures"
|
|||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8c0c85ccad42dfbec7293c36c018af0ea0dbcc52d137a4a9a0b0f6822a3fdf0a"
|
checksum = "8c0c85ccad42dfbec7293c36c018af0ea0dbcc52d137a4a9a0b0f6822a3fdf0a"
|
||||||
|
dependencies = [
|
||||||
|
"futures",
|
||||||
|
"iced_core",
|
||||||
|
"log",
|
||||||
|
"rustc-hash 2.1.1",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"wasmtimer",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iced_futures"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"iced_core",
|
"iced_core",
|
||||||
@@ -3710,7 +3732,25 @@ dependencies = [
|
|||||||
"cosmic-text 0.15.0",
|
"cosmic-text 0.15.0",
|
||||||
"half",
|
"half",
|
||||||
"iced_core",
|
"iced_core",
|
||||||
"iced_futures",
|
"iced_futures 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log",
|
||||||
|
"raw-window-handle",
|
||||||
|
"rustc-hash 2.1.1",
|
||||||
|
"thiserror 2.0.17",
|
||||||
|
"unicode-segmentation",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iced_graphics"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"bytemuck",
|
||||||
|
"cosmic-text 0.15.0",
|
||||||
|
"half",
|
||||||
|
"iced_core",
|
||||||
|
"iced_futures 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"image",
|
"image",
|
||||||
"kamadak-exif",
|
"kamadak-exif",
|
||||||
"log",
|
"log",
|
||||||
@@ -3727,17 +3767,25 @@ version = "0.14.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6dfafec2947cda688d8eb00dac337ba11aa60f9ef6335aed343e189d26e4a673"
|
checksum = "6dfafec2947cda688d8eb00dac337ba11aa60f9ef6335aed343e189d26e4a673"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced_graphics",
|
"iced_graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"iced_runtime",
|
"iced_runtime 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iced_program"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
|
dependencies = [
|
||||||
|
"iced_graphics 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
|
"iced_runtime 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_renderer"
|
name = "iced_renderer"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
checksum = "250cc0802408e8c077986ec56c7d07c65f423ee658a4b9fd795a1f2aae5dac05"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced_graphics",
|
"iced_graphics 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"iced_tiny_skia",
|
"iced_tiny_skia",
|
||||||
"iced_wgpu",
|
"iced_wgpu",
|
||||||
"log",
|
"log",
|
||||||
@@ -3752,7 +3800,19 @@ checksum = "d1889b819ce4c06674183242e336c8d49465665441396914dc07cc86f44fa8d4"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"iced_core",
|
"iced_core",
|
||||||
"iced_futures",
|
"iced_futures 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"raw-window-handle",
|
||||||
|
"thiserror 2.0.17",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iced_runtime"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"iced_core",
|
||||||
|
"iced_futures 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"sipper",
|
"sipper",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
@@ -3761,13 +3821,12 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_tiny_skia"
|
name = "iced_tiny_skia"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
checksum = "fe0acf8b75a3bc914aff5f2329fdffc1b36eeaea29dda0e4bd232f1c62e9cc3d"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cosmic-text 0.15.0",
|
"cosmic-text 0.15.0",
|
||||||
"iced_debug",
|
"iced_debug 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"iced_graphics",
|
"iced_graphics 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"kurbo 0.10.4",
|
"kurbo 0.10.4",
|
||||||
"log",
|
"log",
|
||||||
"rustc-hash 2.1.1",
|
"rustc-hash 2.1.1",
|
||||||
@@ -3796,8 +3855,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_wgpu"
|
name = "iced_wgpu"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
checksum = "ff144a999b0ca0f8a10257934500060240825c42e950ec0ebee9c8ae30561c13"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.10.0",
|
"bitflags 2.10.0",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
@@ -3805,8 +3863,8 @@ dependencies = [
|
|||||||
"futures",
|
"futures",
|
||||||
"glam",
|
"glam",
|
||||||
"guillotiere",
|
"guillotiere",
|
||||||
"iced_debug",
|
"iced_debug 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"iced_graphics",
|
"iced_graphics 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"log",
|
"log",
|
||||||
"lyon",
|
"lyon",
|
||||||
"rustc-hash 2.1.1",
|
"rustc-hash 2.1.1",
|
||||||
@@ -3816,9 +3874,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_widget"
|
name = "iced_widget"
|
||||||
version = "0.14.1"
|
version = "0.14.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
checksum = "f86f6948998a5e031849afae1bb852f3b100c71572befa0be70b19075dcb2163"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced_renderer",
|
"iced_renderer",
|
||||||
"log",
|
"log",
|
||||||
@@ -3834,8 +3891,25 @@ version = "0.14.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8b7dbedc47562d1de3b9707d939f678b88c382004b7ab5a18f7a7dd723162d75"
|
checksum = "8b7dbedc47562d1de3b9707d939f678b88c382004b7ab5a18f7a7dd723162d75"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced_debug",
|
"iced_debug 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"iced_program",
|
"iced_program 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log",
|
||||||
|
"rustc-hash 2.1.1",
|
||||||
|
"thiserror 2.0.17",
|
||||||
|
"tracing",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
"window_clipboard",
|
||||||
|
"winit",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iced_winit"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "git+https://github.com/uttarayan21/iced?branch=0.14#5846d52983d7e2eecc478130ba6373f0c1f82c94"
|
||||||
|
dependencies = [
|
||||||
|
"iced_debug 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
|
"iced_program 0.14.0 (git+https://github.com/uttarayan21/iced?branch=0.14)",
|
||||||
"log",
|
"log",
|
||||||
"mundy",
|
"mundy",
|
||||||
"rustc-hash 2.1.1",
|
"rustc-hash 2.1.1",
|
||||||
@@ -8091,7 +8165,7 @@ dependencies = [
|
|||||||
"iced",
|
"iced",
|
||||||
"iced_video_player",
|
"iced_video_player",
|
||||||
"iced_wgpu",
|
"iced_wgpu",
|
||||||
"iced_winit",
|
"iced_winit 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"tap",
|
"tap",
|
||||||
"toml 0.9.8",
|
"toml 0.9.8",
|
||||||
|
|||||||
@@ -15,8 +15,13 @@ members = [
|
|||||||
iced = { version = "0.14.0" }
|
iced = { version = "0.14.0" }
|
||||||
iced_video_player = "0.6"
|
iced_video_player = "0.6"
|
||||||
gst = { version = "0.1.0", path = "gst" }
|
gst = { version = "0.1.0", path = "gst" }
|
||||||
# iced_video_player = { git = "https://github.com/jazzfool/iced_video_player" }
|
iced_wgpu = { version = "0.14.0" }
|
||||||
# iced_video_player = { path = "crates/iced_video_player" }
|
|
||||||
|
[patch.crates-io]
|
||||||
|
iced_wgpu = { git = "https://github.com/uttarayan21/iced", branch = "0.14" }
|
||||||
|
iced_core = { git = "https://github.com/uttarayan21/iced", branch = "0.14" }
|
||||||
|
iced_renderer = { git = "https://github.com/uttarayan21/iced", branch = "0.14" }
|
||||||
|
iced = { git = "https://github.com/uttarayan21/iced", branch = "0.14" }
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "jello"
|
name = "jello"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ gst.workspace = true
|
|||||||
iced_core = "0.14.0"
|
iced_core = "0.14.0"
|
||||||
iced_futures = "0.14.0"
|
iced_futures = "0.14.0"
|
||||||
iced_renderer = { version = "0.14.0", features = ["iced_wgpu"] }
|
iced_renderer = { version = "0.14.0", features = ["iced_wgpu"] }
|
||||||
iced_wgpu = "0.14.0"
|
iced_wgpu = { version = "0.14.0" }
|
||||||
thiserror = "2.0.17"
|
thiserror = "2.0.17"
|
||||||
tracing = "0.1.43"
|
tracing = "0.1.43"
|
||||||
|
|
||||||
@@ -21,3 +21,6 @@ tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
|
|||||||
debug = true
|
debug = true
|
||||||
[profile.release]
|
[profile.release]
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
|
# [patch.crates-io]
|
||||||
|
# iced_wgpu = { git = "https://github.com/uttarayan21/iced", branch = "0.14" }
|
||||||
|
|||||||
@@ -10,7 +10,37 @@ pub fn main() -> iced::Result {
|
|||||||
)
|
)
|
||||||
.with(tracing_subscriber::EnvFilter::from_default_env())
|
.with(tracing_subscriber::EnvFilter::from_default_env())
|
||||||
.init();
|
.init();
|
||||||
iced::application(State::new, update, view).run()
|
iced::application(State::new, update, view)
|
||||||
|
.subscription(keyboard_event)
|
||||||
|
.run()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn keyboard_event(state: &State) -> iced::Subscription<Message> {
|
||||||
|
use iced::keyboard::{Key, key::Named};
|
||||||
|
iced::keyboard::listen().map(move |event| match event {
|
||||||
|
iced::keyboard::Event::KeyPressed { key, .. } => {
|
||||||
|
let key = key.as_ref();
|
||||||
|
match key {
|
||||||
|
Key::Named(Named::Escape) | Key::Character("q") => Message::Quit,
|
||||||
|
Key::Named(Named::Space) => Message::Toggle,
|
||||||
|
_ => Message::Load,
|
||||||
|
}
|
||||||
|
// if key == &space {
|
||||||
|
// // Toggle play/pause
|
||||||
|
// let is_playing = state
|
||||||
|
// .video
|
||||||
|
// .source()
|
||||||
|
// .is_playing()
|
||||||
|
// .expect("Failed to get playing state");
|
||||||
|
// if is_playing {
|
||||||
|
// Message::Pause
|
||||||
|
// } else {
|
||||||
|
// Message::Play
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
_ => Message::Load,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@@ -30,16 +60,16 @@ impl State {
|
|||||||
pub enum Message {
|
pub enum Message {
|
||||||
Play,
|
Play,
|
||||||
Pause,
|
Pause,
|
||||||
Loaded,
|
Toggle,
|
||||||
Load,
|
Load,
|
||||||
|
Quit,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(state: &mut State, message: Message) -> iced::Task<Message> {
|
pub fn update(state: &mut State, message: Message) -> iced::Task<Message> {
|
||||||
match message {
|
match message {
|
||||||
Message::Load => {
|
Message::Load => {
|
||||||
// does stuff
|
// does stuff
|
||||||
let src = state.video.source().clone();
|
iced::Task::none()
|
||||||
iced::Task::perform(src.wait(), |_| Message::Loaded)
|
|
||||||
}
|
}
|
||||||
Message::Play => {
|
Message::Play => {
|
||||||
state.video.source().play().expect("Failed to play video");
|
state.video.source().play().expect("Failed to play video");
|
||||||
@@ -49,10 +79,14 @@ pub fn update(state: &mut State, message: Message) -> iced::Task<Message> {
|
|||||||
state.video.source().pause().expect("Failed to pause video");
|
state.video.source().pause().expect("Failed to pause video");
|
||||||
iced::Task::none()
|
iced::Task::none()
|
||||||
}
|
}
|
||||||
Message::Loaded => {
|
Message::Toggle => {
|
||||||
// Video loaded
|
state.video.source().toggle().expect("Failed to stop video");
|
||||||
iced::Task::none()
|
iced::Task::none()
|
||||||
}
|
}
|
||||||
|
Message::Quit => {
|
||||||
|
state.video.source().stop().expect("Failed to stop video");
|
||||||
|
std::process::exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ pub struct VideoFrame {
|
|||||||
pub id: id::Id,
|
pub id: id::Id,
|
||||||
pub size: wgpu::Extent3d,
|
pub size: wgpu::Extent3d,
|
||||||
pub ready: Arc<AtomicBool>,
|
pub ready: Arc<AtomicBool>,
|
||||||
pub frame: Arc<Mutex<gst::app::Sample>>,
|
pub frame: Arc<Mutex<gst::Sample>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl iced_wgpu::Primitive for VideoFrame {
|
impl iced_wgpu::Primitive for VideoFrame {
|
||||||
@@ -97,7 +97,6 @@ impl iced_wgpu::Primitive for VideoFrame {
|
|||||||
video.bind_group = new_bind_group;
|
video.bind_group = new_bind_group;
|
||||||
}
|
}
|
||||||
if video.ready.load(std::sync::atomic::Ordering::SeqCst) {
|
if video.ready.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
let now = std::time::Instant::now();
|
|
||||||
let frame = self.frame.lock().expect("BUG: Mutex poisoned");
|
let frame = self.frame.lock().expect("BUG: Mutex poisoned");
|
||||||
let buffer = frame
|
let buffer = frame
|
||||||
.buffer()
|
.buffer()
|
||||||
@@ -107,10 +106,10 @@ impl iced_wgpu::Primitive for VideoFrame {
|
|||||||
.map_readable()
|
.map_readable()
|
||||||
.expect("BUG: Failed to map gst::Buffer readable");
|
.expect("BUG: Failed to map gst::Buffer readable");
|
||||||
queue.write_buffer(&video.buffer, 0, &data);
|
queue.write_buffer(&video.buffer, 0, &data);
|
||||||
|
drop(data);
|
||||||
video
|
video
|
||||||
.ready
|
.ready
|
||||||
.store(false, std::sync::atomic::Ordering::SeqCst);
|
.store(false, std::sync::atomic::Ordering::SeqCst);
|
||||||
tracing::info!("{:?} Taken to write to surface texture", now.elapsed());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,12 +147,7 @@ impl iced_wgpu::Primitive for VideoFrame {
|
|||||||
view: target,
|
view: target,
|
||||||
resolve_target: None,
|
resolve_target: None,
|
||||||
ops: wgpu::Operations {
|
ops: wgpu::Operations {
|
||||||
load: wgpu::LoadOp::Clear(wgpu::Color {
|
load: wgpu::LoadOp::Load,
|
||||||
r: 0.1,
|
|
||||||
g: 0.2,
|
|
||||||
b: 0.3,
|
|
||||||
a: 1.0,
|
|
||||||
}),
|
|
||||||
store: wgpu::StoreOp::Store,
|
store: wgpu::StoreOp::Store,
|
||||||
},
|
},
|
||||||
depth_slice: None,
|
depth_slice: None,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use gst::{
|
|||||||
caps::{Caps, CapsType},
|
caps::{Caps, CapsType},
|
||||||
element::ElementExt,
|
element::ElementExt,
|
||||||
pipeline::PipelineExt,
|
pipeline::PipelineExt,
|
||||||
playback::Playbin3,
|
playback::{PlayFlags, Playbin, Playbin3},
|
||||||
videoconvertscale::VideoConvert,
|
videoconvertscale::VideoConvert,
|
||||||
};
|
};
|
||||||
use std::sync::{Arc, Mutex, atomic::AtomicBool};
|
use std::sync::{Arc, Mutex, atomic::AtomicBool};
|
||||||
@@ -13,11 +13,11 @@ use std::sync::{Arc, Mutex, atomic::AtomicBool};
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct VideoSource {
|
pub struct VideoSource {
|
||||||
pub(crate) playbin: Playbin3,
|
pub(crate) playbin: Playbin3,
|
||||||
// pub(crate) videoconvert: VideoConvert,
|
pub(crate) videoconvert: VideoConvert,
|
||||||
pub(crate) appsink: AppSink,
|
pub(crate) appsink: AppSink,
|
||||||
pub(crate) bus: Bus,
|
pub(crate) bus: Bus,
|
||||||
pub(crate) ready: Arc<AtomicBool>,
|
pub(crate) ready: Arc<AtomicBool>,
|
||||||
pub(crate) frame: Arc<Mutex<gst::app::Sample>>,
|
pub(crate) frame: Arc<Mutex<gst::Sample>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VideoSource {
|
impl VideoSource {
|
||||||
@@ -26,31 +26,36 @@ impl VideoSource {
|
|||||||
/// now.
|
/// now.
|
||||||
pub fn new(url: impl AsRef<str>) -> Result<Self> {
|
pub fn new(url: impl AsRef<str>) -> Result<Self> {
|
||||||
Gst::new();
|
Gst::new();
|
||||||
// let videoconvert = VideoConvert::new("iced-video-convert")
|
let videoconvert = VideoConvert::new("iced-video-convert")
|
||||||
// // .change_context(Error)?
|
// .change_context(Error)?
|
||||||
// // .with_output_format(gst::plugins::videoconvertscale::VideoFormat::Rgba)
|
// .with_output_format(gst::plugins::videoconvertscale::VideoFormat::Rgba)
|
||||||
// .change_context(Error)?;
|
.change_context(Error)?;
|
||||||
let appsink = AppSink::new("iced-video-sink")
|
let mut appsink = AppSink::new("iced-video-sink").change_context(Error)?;
|
||||||
.change_context(Error)?
|
appsink
|
||||||
.with_drop(true);
|
.drop(true)
|
||||||
// .with_caps(
|
.sync(true)
|
||||||
// Caps::builder(CapsType::Video)
|
// .async_(true)
|
||||||
// .field("format", "RGBA")
|
.emit_signals(true)
|
||||||
// .build(),
|
.caps(
|
||||||
// );
|
Caps::builder(CapsType::Video)
|
||||||
// let video_sink = videoconvert.link(&appsink).change_context(Error)?;
|
.field("format", "RGB10A2_LE") // Forced for now
|
||||||
let playbin = gst::plugins::playback::Playbin3::new("iced-video")
|
.build(),
|
||||||
|
);
|
||||||
|
let video_sink = videoconvert.link(&appsink).change_context(Error)?;
|
||||||
|
let playbin = Playbin3::new("iced-video")
|
||||||
.change_context(Error)?
|
.change_context(Error)?
|
||||||
.with_uri(url.as_ref())
|
.with_uri(url.as_ref())
|
||||||
.with_buffer_duration(core::time::Duration::from_secs(2))
|
.with_buffer_duration(core::time::Duration::from_secs(2))
|
||||||
.with_buffer_size(2000000)
|
.with_buffer_size(4096 * 4096 * 4 * 3)
|
||||||
.with_video_sink(&appsink);
|
.with_ring_buffer_max_size(4096 * 4096 * 4 * 3)
|
||||||
|
.with_flags(PlayFlags::default() | PlayFlags::DOWNLOAD)
|
||||||
|
.with_video_sink(&video_sink);
|
||||||
let bus = playbin.bus().change_context(Error)?;
|
let bus = playbin.bus().change_context(Error)?;
|
||||||
playbin.pause().change_context(Error)?;
|
playbin.pause().change_context(Error)?;
|
||||||
let ready = Arc::new(AtomicBool::new(false));
|
let ready = Arc::new(AtomicBool::new(false));
|
||||||
let frame = Arc::new(Mutex::new(gst::app::Sample::new()));
|
let frame = Arc::new(Mutex::new(gst::Sample::new()));
|
||||||
|
|
||||||
let appsink = appsink.on_new_frame({
|
appsink.on_new_frame({
|
||||||
let ready = Arc::clone(&ready);
|
let ready = Arc::clone(&ready);
|
||||||
let frame = Arc::clone(&frame);
|
let frame = Arc::clone(&frame);
|
||||||
move |appsink| {
|
move |appsink| {
|
||||||
@@ -63,14 +68,13 @@ impl VideoSource {
|
|||||||
core::mem::replace(&mut *guard, sample);
|
core::mem::replace(&mut *guard, sample);
|
||||||
ready.store(true, std::sync::atomic::Ordering::Relaxed);
|
ready.store(true, std::sync::atomic::Ordering::Relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
playbin,
|
playbin,
|
||||||
// videoconvert,
|
videoconvert,
|
||||||
appsink,
|
appsink,
|
||||||
bus,
|
bus,
|
||||||
ready,
|
ready,
|
||||||
@@ -86,6 +90,20 @@ impl VideoSource {
|
|||||||
.attach("Failed to wait for video initialisation")
|
.attach("Failed to wait for video initialisation")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_playing(&self) -> Result<bool> {
|
||||||
|
let state = self.playbin.state(None).change_context(Error)?;
|
||||||
|
Ok(state == gst::State::Playing)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn toggle(&self) -> Result<()> {
|
||||||
|
if self.is_playing()? {
|
||||||
|
self.pause()?;
|
||||||
|
} else {
|
||||||
|
self.play()?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn play(&self) -> Result<()> {
|
pub fn play(&self) -> Result<()> {
|
||||||
self.playbin
|
self.playbin
|
||||||
.play()
|
.play()
|
||||||
@@ -100,6 +118,13 @@ impl VideoSource {
|
|||||||
.attach("Failed to pause video")
|
.attach("Failed to pause video")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn stop(&self) -> Result<()> {
|
||||||
|
self.playbin
|
||||||
|
.stop()
|
||||||
|
.change_context(Error)
|
||||||
|
.attach("Failed to stop video")
|
||||||
|
}
|
||||||
|
|
||||||
pub fn size(&self) -> Result<(i32, i32)> {
|
pub fn size(&self) -> Result<(i32, i32)> {
|
||||||
let caps = self
|
let caps = self
|
||||||
.appsink
|
.appsink
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ edition = "2024"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
# gst = { workspace = true }
|
# gst = { workspace = true }
|
||||||
wgpu = "*"
|
wgpu = "*"
|
||||||
gstreamer = "*"
|
gstreamer = { version = "0.24.4", features = ["v1_26"] }
|
||||||
gstreamer-video = "*"
|
gstreamer-app = { version = "0.24.4", features = ["v1_26"] }
|
||||||
gstreamer-app = "*"
|
gstreamer-base = { version = "0.24.4", features = ["v1_26"] }
|
||||||
gstreamer-base = "*"
|
gstreamer-video = { version = "0.24.4", features = ["v1_26"] }
|
||||||
winit = { version = "*", features = ["wayland"] }
|
winit = { version = "*", features = ["wayland"] }
|
||||||
anyhow = "*"
|
anyhow = "*"
|
||||||
pollster = "0.4.0"
|
pollster = "0.4.0"
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ impl State {
|
|||||||
.await
|
.await
|
||||||
.context("Failed to request wgpu device")?;
|
.context("Failed to request wgpu device")?;
|
||||||
let surface_caps = surface.get_capabilities(&adapter);
|
let surface_caps = surface.get_capabilities(&adapter);
|
||||||
dbg!(&surface_caps);
|
tracing::info!("Caps: {:#?}", &surface_caps);
|
||||||
let surface_format = surface_caps
|
let surface_format = surface_caps
|
||||||
.formats
|
.formats
|
||||||
.iter()
|
.iter()
|
||||||
@@ -85,6 +85,7 @@ impl State {
|
|||||||
.find(|f| f.is_hdr_format())
|
.find(|f| f.is_hdr_format())
|
||||||
.expect("HDR format not supported")
|
.expect("HDR format not supported")
|
||||||
.clone();
|
.clone();
|
||||||
|
tracing::info!("Using surface format: {:?}", surface_format);
|
||||||
let size = window.inner_size();
|
let size = window.inner_size();
|
||||||
let config = wgpu::SurfaceConfiguration {
|
let config = wgpu::SurfaceConfiguration {
|
||||||
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
||||||
@@ -411,9 +412,8 @@ impl State {
|
|||||||
},
|
},
|
||||||
texture.size(),
|
texture.size(),
|
||||||
);
|
);
|
||||||
drop(map);
|
// drop(map);
|
||||||
// drop(buffer);
|
// drop(frame);
|
||||||
drop(frame);
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -426,11 +426,11 @@ impl ApplicationHandler<State> for App {
|
|||||||
|
|
||||||
let window = Arc::new(event_loop.create_window(window_attributes).unwrap());
|
let window = Arc::new(event_loop.create_window(window_attributes).unwrap());
|
||||||
|
|
||||||
let monitor = event_loop
|
// let monitor = event_loop
|
||||||
.primary_monitor()
|
// .primary_monitor()
|
||||||
.or_else(|| window.current_monitor());
|
// .or_else(|| window.current_monitor());
|
||||||
// window.set_fullscreen(None);
|
// window.set_fullscreen(None);
|
||||||
window.set_fullscreen(Some(winit::window::Fullscreen::Borderless(monitor)));
|
// window.set_fullscreen(Some(winit::window::Fullscreen::Borderless(monitor)));
|
||||||
self.state = Some(pollster::block_on(State::new(window)).expect("Failed to block"));
|
self.state = Some(pollster::block_on(State::new(window)).expect("Failed to block"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,7 +528,7 @@ impl Video {
|
|||||||
gst::init()?;
|
gst::init()?;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
let pipeline = gst::parse::launch(
|
let pipeline = gst::parse::launch(
|
||||||
r##"playbin3 uri=https://jellyfin.tsuba.darksailor.dev/Items/6010382cf25273e624d305907010d773/Download?api_key=036c140222464878862231ef66a2bc9c video-sink="videoconvert ! video/x-raw,format=RGB10A2_LE ! appsink name=appsink""##,
|
r##"playbin3 uri=https://jellyfin.tsuba.darksailor.dev/Items/6010382cf25273e624d305907010d773/Download?api_key=036c140222464878862231ef66a2bc9c video-sink="videoconvert ! video/x-raw,format=RGB10A2_LE ! appsink sync=true drop=true name=appsink""##
|
||||||
).context("Failed to parse gst pipeline")?;
|
).context("Failed to parse gst pipeline")?;
|
||||||
let pipeline = pipeline
|
let pipeline = pipeline
|
||||||
.downcast::<gst::Pipeline>()
|
.downcast::<gst::Pipeline>()
|
||||||
@@ -544,11 +544,11 @@ impl Video {
|
|||||||
})?;
|
})?;
|
||||||
// appsink.set_property("max-buffers", 2u32);
|
// appsink.set_property("max-buffers", 2u32);
|
||||||
// appsink.set_property("emit-signals", true);
|
// appsink.set_property("emit-signals", true);
|
||||||
appsink.set_callbacks(
|
// appsink.set_callbacks(
|
||||||
gst_app::AppSinkCallbacks::builder()
|
// gst_app::AppSinkCallbacks::builder()
|
||||||
.new_sample(|_appsink| Ok(gst::FlowSuccess::Ok))
|
// .new_sample(|_appsink| Ok(gst::FlowSuccess::Ok))
|
||||||
.build(),
|
// .build(),
|
||||||
);
|
// );
|
||||||
|
|
||||||
let bus = pipeline.bus().context("Failed to get gst pipeline bus")?;
|
let bus = pipeline.bus().context("Failed to get gst pipeline bus")?;
|
||||||
pipeline.set_state(gst::State::Playing)?;
|
pipeline.set_state(gst::State::Playing)?;
|
||||||
|
|||||||
@@ -87,6 +87,8 @@
|
|||||||
glib
|
glib
|
||||||
glib-networking
|
glib-networking
|
||||||
|
|
||||||
|
wrapGAppsHook4
|
||||||
|
|
||||||
# bzip2_1_1
|
# bzip2_1_1
|
||||||
# libsysprof-capture
|
# libsysprof-capture
|
||||||
# pcre2
|
# pcre2
|
||||||
@@ -181,7 +183,7 @@
|
|||||||
else pkgs.clangStdenv;
|
else pkgs.clangStdenv;
|
||||||
} (commonArgs
|
} (commonArgs
|
||||||
// {
|
// {
|
||||||
GST_PLUGIN_PATH = "/run/current-system/sw/lib/gstreamer-1.0/";
|
# GST_PLUGIN_PATH = "/run/current-system/sw/lib/gstreamer-1.0/";
|
||||||
GIO_EXTRA_MODULES = "${pkgs.glib-networking}/lib/gio/modules";
|
GIO_EXTRA_MODULES = "${pkgs.glib-networking}/lib/gio/modules";
|
||||||
packages = with pkgs;
|
packages = with pkgs;
|
||||||
[
|
[
|
||||||
@@ -202,8 +204,7 @@
|
|||||||
apple-sdk_26
|
apple-sdk_26
|
||||||
])
|
])
|
||||||
++ (lib.optionals pkgs.stdenv.isLinux [
|
++ (lib.optionals pkgs.stdenv.isLinux [
|
||||||
valgrind
|
heaptrack
|
||||||
hotspot
|
|
||||||
samply
|
samply
|
||||||
cargo-flamegraph
|
cargo-flamegraph
|
||||||
perf
|
perf
|
||||||
|
|||||||
@@ -10,11 +10,14 @@ error-stack = "0.6"
|
|||||||
futures = "0.3.31"
|
futures = "0.3.31"
|
||||||
futures-lite = "2.6.1"
|
futures-lite = "2.6.1"
|
||||||
glib = "0.21.5"
|
glib = "0.21.5"
|
||||||
gstreamer = { version = "0.24.4", features = ["v1_18"] }
|
glib-sys = "0.21.5"
|
||||||
gstreamer-app = { version = "0.24.4", features = ["v1_18"] }
|
gstreamer = { version = "0.24.4", features = ["v1_26"] }
|
||||||
gstreamer-video = { version = "0.24.4", features = ["v1_18"] }
|
gstreamer-app = { version = "0.24.4", features = ["v1_26"] }
|
||||||
|
gstreamer-video = { version = "0.24.4", features = ["v1_26"] }
|
||||||
|
gstreamer-base = { version = "0.24.4", features = ["v1_26"] }
|
||||||
thiserror = "2.0"
|
thiserror = "2.0"
|
||||||
tracing = { version = "0.1", features = ["log"] }
|
tracing = { version = "0.1", features = ["log"] }
|
||||||
|
bitflags = "2.10.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
smol = "2.0.2"
|
smol = "2.0.2"
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ pub mod pipeline;
|
|||||||
pub mod plugins;
|
pub mod plugins;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod wrapper;
|
pub mod wrapper;
|
||||||
|
pub mod sample;
|
||||||
|
|
||||||
pub use bin::*;
|
pub use bin::*;
|
||||||
pub use bus::*;
|
pub use bus::*;
|
||||||
@@ -19,6 +20,7 @@ pub use gstreamer::{Message, MessageType, MessageView, State};
|
|||||||
pub use pad::*;
|
pub use pad::*;
|
||||||
pub use pipeline::*;
|
pub use pipeline::*;
|
||||||
pub use plugins::*;
|
pub use plugins::*;
|
||||||
|
pub use sample::*;
|
||||||
|
|
||||||
pub(crate) mod priv_prelude {
|
pub(crate) mod priv_prelude {
|
||||||
pub use crate::errors::*;
|
pub use crate::errors::*;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ impl Pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get the state
|
/// Get the state
|
||||||
#[track_caller]
|
|
||||||
pub fn state(
|
pub fn state(
|
||||||
&self,
|
&self,
|
||||||
timeout: impl Into<Option<core::time::Duration>>,
|
timeout: impl Into<Option<core::time::Duration>>,
|
||||||
@@ -33,7 +32,6 @@ impl Pipeline {
|
|||||||
Ok(current)
|
Ok(current)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[track_caller]
|
|
||||||
pub fn play(&self) -> Result<()> {
|
pub fn play(&self) -> Result<()> {
|
||||||
self.inner
|
self.inner
|
||||||
.set_state(gstreamer::State::Playing)
|
.set_state(gstreamer::State::Playing)
|
||||||
@@ -42,7 +40,6 @@ impl Pipeline {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[track_caller]
|
|
||||||
pub fn pause(&self) -> Result<()> {
|
pub fn pause(&self) -> Result<()> {
|
||||||
self.inner
|
self.inner
|
||||||
.set_state(gstreamer::State::Paused)
|
.set_state(gstreamer::State::Paused)
|
||||||
@@ -51,7 +48,6 @@ impl Pipeline {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[track_caller]
|
|
||||||
pub fn ready(&self) -> Result<()> {
|
pub fn ready(&self) -> Result<()> {
|
||||||
self.inner
|
self.inner
|
||||||
.set_state(gstreamer::State::Ready)
|
.set_state(gstreamer::State::Ready)
|
||||||
@@ -60,7 +56,14 @@ impl Pipeline {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[track_caller]
|
pub fn stop(&self) -> Result<()> {
|
||||||
|
self.inner
|
||||||
|
.set_state(gstreamer::State::Null)
|
||||||
|
.change_context(Error)
|
||||||
|
.attach("Failed to set pipeline to Null state")?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_state(&self, state: gstreamer::State) -> Result<gstreamer::StateChangeSuccess> {
|
pub fn set_state(&self, state: gstreamer::State) -> Result<gstreamer::StateChangeSuccess> {
|
||||||
let result = self
|
let result = self
|
||||||
.inner
|
.inner
|
||||||
@@ -165,6 +168,12 @@ pub trait PipelineExt: ChildOf<Pipeline> + Sync {
|
|||||||
fn ready(&self) -> Result<()> {
|
fn ready(&self) -> Result<()> {
|
||||||
self.upcast_ref().ready()
|
self.upcast_ref().ready()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[track_caller]
|
||||||
|
fn stop(&self) -> Result<()> {
|
||||||
|
self.upcast_ref().stop()
|
||||||
|
}
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn set_state(&self, state: gstreamer::State) -> Result<gstreamer::StateChangeSuccess> {
|
fn set_state(&self, state: gstreamer::State) -> Result<gstreamer::StateChangeSuccess> {
|
||||||
self.upcast_ref().set_state(state)
|
self.upcast_ref().set_state(state)
|
||||||
|
|||||||
@@ -25,41 +25,41 @@ impl AppSink {
|
|||||||
Ok(AppSink { inner })
|
Ok(AppSink { inner })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_emit_signals(self, emit: bool) -> Self {
|
pub fn emit_signals(&mut self, emit: bool) -> &mut Self {
|
||||||
self.inner.set_property("emit-signals", emit);
|
self.inner.set_property("emit-signals", emit);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_async(self, async_: bool) -> Self {
|
pub fn async_(&mut self, async_: bool) -> &mut Self {
|
||||||
self.inner.set_property("async", async_);
|
self.inner.set_property("async", async_);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_sync(self, sync: bool) -> Self {
|
pub fn sync(&mut self, sync: bool) -> &mut Self {
|
||||||
self.inner.set_property("sync", sync);
|
self.inner.set_property("sync", sync);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_drop(self, drop: bool) -> Self {
|
pub fn drop(&mut self, drop: bool) -> &mut Self {
|
||||||
self.inner.set_property("drop", drop);
|
self.inner.set_property("drop", drop);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_caps(self, caps: Caps) -> Self {
|
pub fn caps(&mut self, caps: Caps) -> &mut Self {
|
||||||
self.inner.set_property("caps", caps.inner);
|
self.inner.set_property("caps", caps.inner);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_callbacks(self, callbacks: gstreamer_app::AppSinkCallbacks) -> Self {
|
pub fn callbacks(&mut self, callbacks: gstreamer_app::AppSinkCallbacks) -> &mut Self {
|
||||||
self.appsink().set_callbacks(callbacks);
|
self.appsink().set_callbacks(callbacks);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_new_frame<F>(self, mut f: F) -> Self
|
pub fn on_new_frame<F>(&mut self, mut f: F) -> &mut Self
|
||||||
where
|
where
|
||||||
F: FnMut(&AppSink) -> Result<(), gstreamer::FlowError> + Send + 'static,
|
F: FnMut(&AppSink) -> Result<(), gstreamer::FlowError> + Send + 'static,
|
||||||
{
|
{
|
||||||
self.with_emit_signals(true).with_callbacks(
|
self.emit_signals(true).callbacks(
|
||||||
AppSinkCallbacks::builder()
|
AppSinkCallbacks::builder()
|
||||||
.new_sample(move |appsink| {
|
.new_sample(move |appsink| {
|
||||||
use glib::object::Cast;
|
use glib::object::Cast;
|
||||||
@@ -109,44 +109,6 @@ impl AppSink {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<gstreamer::Sample> for Sample {
|
|
||||||
fn from(inner: gstreamer::Sample) -> Self {
|
|
||||||
Sample { inner }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(transparent)]
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
pub struct Sample {
|
|
||||||
pub inner: gstreamer::Sample,
|
|
||||||
}
|
|
||||||
|
|
||||||
use gstreamer::BufferRef;
|
|
||||||
impl Sample {
|
|
||||||
#[doc(alias = "empty")]
|
|
||||||
pub fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
inner: gstreamer::Sample::builder().build(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn buffer(&self) -> Option<&BufferRef> {
|
|
||||||
self.inner.buffer()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn caps(&self) -> Option<&gstreamer::CapsRef> {
|
|
||||||
self.inner.caps()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn info(&self) -> Option<&gstreamer::StructureRef> {
|
|
||||||
self.inner.info()
|
|
||||||
}
|
|
||||||
|
|
||||||
// pub fn set_buffer(&mut self) {
|
|
||||||
// self.inner.set_buffer(None);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_appsink() {
|
fn test_appsink() {
|
||||||
use gstreamer::prelude::*;
|
use gstreamer::prelude::*;
|
||||||
@@ -164,9 +126,8 @@ fn test_appsink() {
|
|||||||
|
|
||||||
let video_convert = plugins::videoconvertscale::VideoConvert::new("vcvcvcvcvcvcvcvcvcvcvcvcvc")
|
let video_convert = plugins::videoconvertscale::VideoConvert::new("vcvcvcvcvcvcvcvcvcvcvcvcvc")
|
||||||
.expect("Create videoconvert");
|
.expect("Create videoconvert");
|
||||||
let appsink = app::AppSink::new("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
let mut appsink = app::AppSink::new("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").expect("Create appsink");
|
||||||
.expect("Create appsink")
|
appsink.caps(
|
||||||
.with_caps(
|
|
||||||
Caps::builder(CapsType::Video)
|
Caps::builder(CapsType::Video)
|
||||||
.field("format", "RGB")
|
.field("format", "RGB")
|
||||||
.build(),
|
.build(),
|
||||||
|
|||||||
@@ -1,2 +1,84 @@
|
|||||||
pub mod playbin3;
|
pub mod playbin3;
|
||||||
pub use playbin3::*;
|
pub use playbin3::*;
|
||||||
|
pub mod playbin;
|
||||||
|
pub use playbin::*;
|
||||||
|
|
||||||
|
bitflags::bitflags! {
|
||||||
|
/// Extra flags to configure the behaviour of the sinks.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
|
pub struct PlayFlags: u32 {
|
||||||
|
/// Render the video stream
|
||||||
|
const VIDEO = (1 << 0);
|
||||||
|
/// Render the audio stream
|
||||||
|
const AUDIO = (1 << 1);
|
||||||
|
/// Render subtitles
|
||||||
|
const TEXT = (1 << 2);
|
||||||
|
/// Render visualisation when no video is present
|
||||||
|
const VIS = (1 << 3);
|
||||||
|
/// Use software volume
|
||||||
|
const SOFT_VOLUME = (1 << 4);
|
||||||
|
/// Only use native audio formats
|
||||||
|
const NATIVE_AUDIO = (1 << 5);
|
||||||
|
/// Only use native video formats
|
||||||
|
const NATIVE_VIDEO = (1 << 6);
|
||||||
|
/// Attempt progressive download buffering
|
||||||
|
const DOWNLOAD = (1 << 7);
|
||||||
|
/// Buffer demuxed/parsed data
|
||||||
|
const BUFFERING = (1 << 8);
|
||||||
|
/// Deinterlace video if necessary
|
||||||
|
const DEINTERLACE = (1 << 9);
|
||||||
|
/// Use software color balance
|
||||||
|
const SOFT_COLORBALANCE = (1 << 10);
|
||||||
|
/// Force audio/video filter(s) to be applied
|
||||||
|
const FORCE_FILTERS = (1 << 11);
|
||||||
|
/// Force only software-based decoders (no effect for playbin3)
|
||||||
|
const FORCE_SW_DECODERS = (1 << 12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for PlayFlags {
|
||||||
|
/// Flags "GstPlayFlags" Default: 0x00000717, "soft-colorbalance+deinterlace+buffering+soft-volume+text+audio+video"
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::SOFT_COLORBALANCE
|
||||||
|
| Self::DEINTERLACE
|
||||||
|
| Self::BUFFERING
|
||||||
|
| Self::SOFT_VOLUME
|
||||||
|
| Self::TEXT
|
||||||
|
| Self::AUDIO
|
||||||
|
| Self::VIDEO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const _: () = {
|
||||||
|
use glib::types::StaticType;
|
||||||
|
impl glib::types::StaticType for PlayFlags {
|
||||||
|
#[inline]
|
||||||
|
#[doc(alias = "gst_play_flags_get_type")]
|
||||||
|
fn static_type() -> glib::Type {
|
||||||
|
glib::Type::from_name("GstPlayFlags").expect("GstPlayFlags type not found")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl glib::value::ToValue for PlayFlags {
|
||||||
|
#[inline]
|
||||||
|
fn to_value(&self) -> glib::Value {
|
||||||
|
let value = self.bits().to_value();
|
||||||
|
value
|
||||||
|
.transform_with_type(Self::static_type())
|
||||||
|
.expect("Failed to transform PlayFlags(u32) to GstPlayFlags")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn value_type(&self) -> glib::Type {
|
||||||
|
Self::static_type()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<PlayFlags> for glib::Value {
|
||||||
|
#[inline]
|
||||||
|
fn from(v: PlayFlags) -> Self {
|
||||||
|
// skip_assert_initialized!();
|
||||||
|
glib::value::ToValue::to_value(&v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
82
gst/src/plugins/playback/playbin.rs
Normal file
82
gst/src/plugins/playback/playbin.rs
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
use crate::priv_prelude::*;
|
||||||
|
|
||||||
|
wrap_gst!(Playbin, gstreamer::Element);
|
||||||
|
parent_child!(Element, Playbin);
|
||||||
|
parent_child!(Pipeline, Playbin, downcast);
|
||||||
|
parent_child!(Bin, Playbin, downcast);
|
||||||
|
|
||||||
|
impl Drop for Playbin {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
self.set_state(gstreamer::State::Null).ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Playbin {
|
||||||
|
pub fn new(name: impl AsRef<str>) -> Result<Self> {
|
||||||
|
gstreamer::ElementFactory::make("playbin3")
|
||||||
|
.name(name.as_ref())
|
||||||
|
.build()
|
||||||
|
.map(|element| Playbin { inner: element })
|
||||||
|
.change_context(Error)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_uri(self, uri: impl AsRef<str>) -> Self {
|
||||||
|
self.inner.set_property("uri", uri.as_ref());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_buffer_duration(self, duration: impl Into<Option<core::time::Duration>>) -> Self {
|
||||||
|
let duration = match duration.into() {
|
||||||
|
Some(dur) => dur.as_secs() as i64,
|
||||||
|
None => -1,
|
||||||
|
};
|
||||||
|
self.inner.set_property("buffer-duration", duration);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_buffer_size(self, size: impl Into<Option<u32>>) -> Self {
|
||||||
|
let size = match size.into() {
|
||||||
|
Some(size) => size as i32,
|
||||||
|
None => -1,
|
||||||
|
};
|
||||||
|
self.inner.set_property("buffer-size", size);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Sets the maximum size of the ring buffer in bytes.
|
||||||
|
pub fn with_ring_buffer_max_size(self, size: u64) -> Self {
|
||||||
|
self.inner.set_property("ring-buffer-max-size", size);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_video_sink(self, video_sink: &impl ChildOf<Element>) -> Self {
|
||||||
|
self.inner
|
||||||
|
.set_property("video-sink", &video_sink.upcast_ref().inner);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_text_sink(self, text_sink: &impl ChildOf<Element>) -> Self {
|
||||||
|
self.inner
|
||||||
|
.set_property("text-sink", &text_sink.upcast_ref().inner);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_audio_sink(self, audio_sink: &impl ChildOf<Element>) -> Self {
|
||||||
|
self.inner
|
||||||
|
.set_property("audio-sink", &audio_sink.upcast_ref().inner);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_volume(&self, volume: f64) {
|
||||||
|
self.inner.set_property("volume", volume.clamp(1.0, 100.0))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_volume(&self) -> f64 {
|
||||||
|
self.inner.property::<f64>("volume")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_flags(self, flags: playback::PlayFlags) -> Self {
|
||||||
|
self.inner.set_property("flags", flags);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,6 +43,12 @@ impl Playbin3 {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the maximum size of the ring buffer in bytes.
|
||||||
|
pub fn with_ring_buffer_max_size(self, size: u64) -> Self {
|
||||||
|
self.inner.set_property("ring-buffer-max-size", size);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn with_video_sink(self, video_sink: &impl ChildOf<Element>) -> Self {
|
pub fn with_video_sink(self, video_sink: &impl ChildOf<Element>) -> Self {
|
||||||
self.inner
|
self.inner
|
||||||
.set_property("video-sink", &video_sink.upcast_ref().inner);
|
.set_property("video-sink", &video_sink.upcast_ref().inner);
|
||||||
@@ -68,4 +74,9 @@ impl Playbin3 {
|
|||||||
pub fn get_volume(&self) -> f64 {
|
pub fn get_volume(&self) -> f64 {
|
||||||
self.inner.property::<f64>("volume")
|
self.inner.property::<f64>("volume")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn with_flags(self, flags: playback::PlayFlags) -> Self {
|
||||||
|
self.inner.set_property("flags", flags);
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
37
gst/src/sample.rs
Normal file
37
gst/src/sample.rs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
impl From<gstreamer::Sample> for Sample {
|
||||||
|
fn from(inner: gstreamer::Sample) -> Self {
|
||||||
|
Sample { inner }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(transparent)]
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct Sample {
|
||||||
|
pub inner: gstreamer::Sample,
|
||||||
|
}
|
||||||
|
|
||||||
|
use gstreamer::BufferRef;
|
||||||
|
impl Sample {
|
||||||
|
#[doc(alias = "empty")]
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
inner: gstreamer::Sample::builder().build(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn buffer(&self) -> Option<&BufferRef> {
|
||||||
|
self.inner.buffer()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn caps(&self) -> Option<&gstreamer::CapsRef> {
|
||||||
|
self.inner.caps()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn info(&self) -> Option<&gstreamer::StructureRef> {
|
||||||
|
self.inner.info()
|
||||||
|
}
|
||||||
|
|
||||||
|
// pub fn set_buffer(&mut self) {
|
||||||
|
// self.inner.set_buffer(None);
|
||||||
|
// }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user