mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-09-01 01:13:48 +00:00
Merge branch 'vulkan' into 'main'
Draft: Add GStreamer-Vulkan bindings See merge request gstreamer/gstreamer-rs!1748
This commit is contained in:
commit
272e75279d
124 changed files with 9517 additions and 9 deletions
|
@ -151,13 +151,13 @@ trigger:
|
|||
libgraphene-1.0-dev libjpeg-dev libwayland-dev wayland-protocols
|
||||
python3-gi libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev
|
||||
libswscale-dev yasm libx264-dev libfontconfig-dev libfreetype-dev
|
||||
libxkbcommon-dev libxi-dev libxcb-render0-dev libxcb-shm0-dev
|
||||
libxkbcommon-dev libxkbcommon-x11-dev libxi-dev libxcb-render0-dev libxcb-shm0-dev
|
||||
libxcb1-dev libxext-dev libxrender-dev libxrandr-dev libxcursor-dev
|
||||
libxdamage-dev libxfixes-dev libxinerama-dev libgudev-1.0-dev
|
||||
libpango1.0-dev libcairo2-dev libjson-glib-dev libgdk-pixbuf-2.0-dev
|
||||
libtiff-dev libpng-dev libjpeg-dev libepoxy-dev libsass-dev sassc
|
||||
libcsound64-dev llvm clang nasm libsodium-dev libwebp-dev
|
||||
libflac-dev libmysofa-dev libgtk-4-dev libdav1d-dev libclang-dev
|
||||
libflac-dev libmysofa-dev libgtk-4-dev libdav1d-dev libclang-dev libvulkan-dev
|
||||
FDO_DISTRIBUTION_EXEC: >-
|
||||
bash ci/install-gst.sh &&
|
||||
bash ci/install-vvdec.sh &&
|
||||
|
|
241
Cargo.lock
generated
241
Cargo.lock
generated
|
@ -54,12 +54,27 @@ version = "1.0.98"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||
|
||||
[[package]]
|
||||
name = "as-raw-xcb-connection"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
||||
|
||||
[[package]]
|
||||
name = "ash"
|
||||
version = "0.38.0+1.3.281"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-channel"
|
||||
version = "2.5.0"
|
||||
|
@ -96,6 +111,21 @@ version = "0.22.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
|
||||
dependencies = [
|
||||
"bit-vec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-vec"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
|
@ -280,6 +310,17 @@ dependencies = [
|
|||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codespan-reporting"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"termcolor",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.7"
|
||||
|
@ -388,6 +429,12 @@ version = "0.8.21"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
||||
|
||||
[[package]]
|
||||
name = "crunchy"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
||||
|
||||
[[package]]
|
||||
name = "cursor-icon"
|
||||
version = "1.2.0"
|
||||
|
@ -535,9 +582,13 @@ dependencies = [
|
|||
"gstreamer-rtsp-server",
|
||||
"gstreamer-sdp",
|
||||
"gstreamer-video",
|
||||
"gstreamer-vulkan",
|
||||
"gstreamer-vulkan-wayland",
|
||||
"gstreamer-vulkan-xcb",
|
||||
"image",
|
||||
"memfd",
|
||||
"memmap2",
|
||||
"naga",
|
||||
"objc",
|
||||
"pango",
|
||||
"pangocairo",
|
||||
|
@ -574,6 +625,12 @@ dependencies = [
|
|||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
version = "0.5.0"
|
||||
|
@ -1611,6 +1668,86 @@ dependencies = [
|
|||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gstreamer-vulkan"
|
||||
version = "0.25.0"
|
||||
dependencies = [
|
||||
"gir-format-check",
|
||||
"glib",
|
||||
"gstreamer",
|
||||
"gstreamer-base",
|
||||
"gstreamer-video",
|
||||
"gstreamer-vulkan-sys",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gstreamer-vulkan-sys"
|
||||
version = "0.25.0"
|
||||
dependencies = [
|
||||
"ash",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"gstreamer-base-sys",
|
||||
"gstreamer-sys",
|
||||
"gstreamer-video-sys",
|
||||
"libc",
|
||||
"shell-words",
|
||||
"system-deps",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gstreamer-vulkan-wayland"
|
||||
version = "0.25.0"
|
||||
dependencies = [
|
||||
"gir-format-check",
|
||||
"glib",
|
||||
"gstreamer",
|
||||
"gstreamer-vulkan",
|
||||
"gstreamer-vulkan-wayland-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gstreamer-vulkan-wayland-sys"
|
||||
version = "0.25.0"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gstreamer-vulkan-sys",
|
||||
"libc",
|
||||
"shell-words",
|
||||
"system-deps",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gstreamer-vulkan-xcb"
|
||||
version = "0.25.0"
|
||||
dependencies = [
|
||||
"gir-format-check",
|
||||
"glib",
|
||||
"gstreamer",
|
||||
"gstreamer-vulkan",
|
||||
"gstreamer-vulkan-xcb-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gstreamer-vulkan-xcb-sys"
|
||||
version = "0.25.0"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gstreamer-vulkan-sys",
|
||||
"libc",
|
||||
"shell-words",
|
||||
"system-deps",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gstreamer-webrtc"
|
||||
version = "0.25.0"
|
||||
|
@ -1636,11 +1773,25 @@ dependencies = [
|
|||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crunchy",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
||||
dependencies = [
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
|
@ -1654,6 +1805,12 @@ version = "0.5.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
||||
|
||||
[[package]]
|
||||
name = "hexf-parse"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.25.6"
|
||||
|
@ -1766,6 +1923,12 @@ dependencies = [
|
|||
"windows-targets 0.53.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.9"
|
||||
|
@ -1844,6 +2007,31 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0"
|
||||
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "25.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b977c445f26e49757f9aca3631c3b8b836942cb278d69a92e7b80d3b24da632"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-set",
|
||||
"bitflags 2.9.1",
|
||||
"cfg_aliases",
|
||||
"codespan-reporting",
|
||||
"half",
|
||||
"hashbrown",
|
||||
"hexf-parse",
|
||||
"indexmap",
|
||||
"log",
|
||||
"num-traits",
|
||||
"once_cell",
|
||||
"rustc-hash",
|
||||
"spirv",
|
||||
"strum",
|
||||
"thiserror 2.0.12",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk"
|
||||
version = "0.9.0"
|
||||
|
@ -1901,6 +2089,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2430,6 +2619,12 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.44"
|
||||
|
@ -2597,12 +2792,43 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spirv"
|
||||
version = "0.3.0+sdk-1.3.268.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.26.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
|
||||
dependencies = [
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.26.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.104"
|
||||
|
@ -2646,6 +2872,15 @@ dependencies = [
|
|||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termion"
|
||||
version = "4.0.5"
|
||||
|
@ -2789,6 +3024,12 @@ version = "1.12.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.6"
|
||||
|
|
12
Cargo.toml
12
Cargo.toml
|
@ -75,6 +75,9 @@ members = [
|
|||
"gstreamer-sdp/sys",
|
||||
"gstreamer-tag/sys",
|
||||
"gstreamer-video/sys",
|
||||
"gstreamer-vulkan/sys",
|
||||
"gstreamer-vulkan/wayland/sys",
|
||||
"gstreamer-vulkan/xcb/sys",
|
||||
"gstreamer-webrtc/sys",
|
||||
"gstreamer-allocators/sys",
|
||||
"gstreamer",
|
||||
|
@ -103,6 +106,9 @@ members = [
|
|||
"gstreamer-tag",
|
||||
"gstreamer-validate",
|
||||
"gstreamer-video",
|
||||
"gstreamer-vulkan",
|
||||
"gstreamer-vulkan/wayland",
|
||||
"gstreamer-vulkan/xcb",
|
||||
"gstreamer-webrtc",
|
||||
"gstreamer-allocators",
|
||||
"gstreamer-utils",
|
||||
|
@ -157,6 +163,9 @@ gstreamer-sys = { path = "./gstreamer/sys"}
|
|||
gstreamer-validate-sys = { path = "./gstreamer-validate/sys" }
|
||||
gstreamer-video-sys = { path = "./gstreamer-video/sys"}
|
||||
gstreamer-webrtc-sys = { path = "./gstreamer-webrtc/sys" }
|
||||
gstreamer-vulkan-sys = { path = "./gstreamer-vulkan/sys"}
|
||||
gstreamer-vulkan-wayland-sys = { path = "./gstreamer-vulkan/wayland/sys"}
|
||||
gstreamer-vulkan-xcb-sys = { path = "./gstreamer-vulkan/xcb/sys"}
|
||||
ges = { package = "gstreamer-editing-services", path = "./gstreamer-editing-services" }
|
||||
gst = { package = "gstreamer", path = "./gstreamer" }
|
||||
gst-allocators = { package = "gstreamer-allocators", path = "./gstreamer-allocators" }
|
||||
|
@ -177,3 +186,6 @@ gst-rtsp = { package = "gstreamer-rtsp", path = "./gstreamer-rtsp" }
|
|||
gst-rtsp-server = { package = "gstreamer-rtsp-server", path = "./gstreamer-rtsp-server" }
|
||||
gst-sdp = { package = "gstreamer-sdp", path = "./gstreamer-sdp" }
|
||||
gst-video = { package = "gstreamer-video", path = "./gstreamer-video" }
|
||||
gst-vulkan = { package = "gstreamer-vulkan", path = "./gstreamer-vulkan" }
|
||||
gst-vulkan-wayland = { package = "gstreamer-vulkan-wayland", path = "./gstreamer-vulkan/wayland" }
|
||||
gst-vulkan-xcb = { package = "gstreamer-vulkan-xcb", path = "./gstreamer-vulkan/xcb" }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
variables:
|
||||
GST_RS_IMG_TAG: "2025-08-10.0"
|
||||
GST_RS_IMG_WINDOWS_TAG: "2025-08-10.0"
|
||||
GST_RS_IMG_TAG: "2025-08-19.0"
|
||||
GST_RS_IMG_WINDOWS_TAG: "2025-08-19.0"
|
||||
GST_RS_STABLE: "1.89.0"
|
||||
GST_RS_MSRV: "1.83.0"
|
||||
# The branch we use to build GStreamer from in the docker images
|
||||
|
|
|
@ -11,7 +11,7 @@ CARGO_NEXTEST_FLAGS="--profile=ci --no-tests=pass"
|
|||
|
||||
parent="${CI_PROJECT_DIR:-$(pwd)}"
|
||||
|
||||
for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
|
||||
for crate in gstreamer* gstreamer-gl/{egl,wayland,x11} gstreamer-vulkan/{wayland,xcb}; do
|
||||
if [[ "$crate" == gstreamer-d3d12* ]]; then
|
||||
echo "Skipping $crate"
|
||||
continue
|
||||
|
|
|
@ -11,7 +11,7 @@ CARGO_NEXTEST_FLAGS="--profile=ci --no-tests=pass"
|
|||
|
||||
parent="${CI_PROJECT_DIR:-$(pwd)}"
|
||||
|
||||
for crate in gstreamer*/sys gstreamer-gl/*/sys; do
|
||||
for crate in gstreamer*/sys gstreamer-gl/*/sys gstreamer-vulkan/*/sys; do
|
||||
if [[ "$crate" == gstreamer-d3d12* ]]; then
|
||||
echo "Skipping $crate"
|
||||
continue
|
||||
|
@ -48,6 +48,9 @@ for crate in gstreamer/sys \
|
|||
gstreamer-tag/sys \
|
||||
gstreamer-validate/sys \
|
||||
gstreamer-video/sys \
|
||||
gstreamer-vulkan/sys \
|
||||
gstreamer-vulkan/wayland/sys \
|
||||
gstreamer-vulkan/xcb/sys \
|
||||
gstreamer-webrtc/sys; do
|
||||
echo "Testing $crate with --all-features)"
|
||||
RUST_BACKTRACE=1 cargo nextest run $CARGO_NEXTEST_FLAGS $CARGO_FLAGS --locked --manifest-path $crate/Cargo.toml --all-features
|
||||
|
|
|
@ -25,6 +25,9 @@ gst-rtsp = { workspace = true, optional = true }
|
|||
gst-rtsp-server = { workspace = true, optional = true }
|
||||
gst-allocators = { workspace = true, optional = true }
|
||||
gst-d3d12 = { workspace = true, optional = true }
|
||||
gst-vulkan = { workspace = true, optional = true }
|
||||
gst-vulkan-wayland = { workspace = true, optional = true }
|
||||
gst-vulkan-xcb = { workspace = true, optional = true }
|
||||
gio = { workspace = true, optional = true }
|
||||
anyhow = "1.0"
|
||||
byte-slice-cast = "1"
|
||||
|
@ -44,6 +47,7 @@ uds = { version = "0.4", optional = true }
|
|||
winit = { version = "0.30", optional = true, default-features = false } #, features = ["rwh_05"] }
|
||||
atomic_refcell = "0.1"
|
||||
data-encoding = "2.0"
|
||||
naga = { version = "25.0.1", optional = true, features = ["wgsl-in", "spv-out"] }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows = { version = "0.61", features=["Win32_Graphics_Direct3D11",
|
||||
|
@ -81,6 +85,9 @@ gst-gl-egl = ["dep:gst-gl-egl", "glutin-winit?/egl", "glutin-winit?/x11", "gluti
|
|||
allocators = ["gst-allocators", "memmap2", "memfd", "uds"]
|
||||
windows = ["dep:windows"]
|
||||
d3d12 = ["dep:gst-d3d12", "windows"]
|
||||
vulkan = ["dep:gst-vulkan", "gst-vulkan/v1_26", "dep:naga"]
|
||||
gst-vulkan-xcb = ["vulkan", "dep:gst-vulkan-xcb"]
|
||||
gst-vulkan-wayland = ["vulkan", "dep:gst-vulkan-wayland"]
|
||||
|
||||
[[bin]]
|
||||
name = "appsink"
|
||||
|
@ -228,3 +235,7 @@ required-features = ["gst-video/v1_18"]
|
|||
[[bin]]
|
||||
name = "d3d12convert"
|
||||
required-features = ["d3d12"]
|
||||
|
||||
[[bin]]
|
||||
name = "vulkanfilter"
|
||||
required-features = ["vulkan", "gst-vulkan/v1_26_4"]
|
||||
|
|
18
examples/src/bin/vulkanfilter.frag.wgsl
Normal file
18
examples/src/bin/vulkanfilter.frag.wgsl
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
@group(0) @binding(0) var samp: sampler;
|
||||
@group(0) @binding(1) var tex: texture_2d<f32>;
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) pos: vec4<f32>,
|
||||
@location(0) uv: vec2<f32>,
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main(vertex: VertexOutput) -> @location(0) vec4<f32> {
|
||||
var uv = vertex.uv;
|
||||
uv.y = 1. - uv.y; // convert to vulkan coordinates
|
||||
if uv.x > 0.5 { // sample from left half if in right half
|
||||
uv.x = 1. - uv.x;
|
||||
}
|
||||
return textureSample(tex, samp, uv);
|
||||
}
|
292
examples/src/bin/vulkanfilter.rs
Normal file
292
examples/src/bin/vulkanfilter.rs
Normal file
|
@ -0,0 +1,292 @@
|
|||
#![allow(clippy::non_send_fields_in_send_ty)]
|
||||
|
||||
use anyhow::Error;
|
||||
use derive_more::{Display, Error};
|
||||
use gst::prelude::*;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
pub mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display("Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
debug: Option<glib::GString>,
|
||||
}
|
||||
|
||||
mod mirror {
|
||||
use gst_base::subclass::*;
|
||||
use gst_vulkan::prelude::*;
|
||||
use gst_vulkan::subclass::prelude::*;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
pub static CAT: LazyLock<gst::DebugCategory> = LazyLock::new(|| {
|
||||
gst::DebugCategory::new(
|
||||
"rsvulkanmirrorfilter",
|
||||
gst::DebugColorFlags::empty(),
|
||||
Some("Rust Vulkan Mirror Filter"),
|
||||
)
|
||||
});
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct VulkanMirrorFilter(ObjectSubclass<imp::VulkanMirrorFilter>) @extends gst_vulkan::VulkanVideoFilter, gst_base::BaseTransform, gst::Element, gst::Object;
|
||||
}
|
||||
|
||||
impl VulkanMirrorFilter {
|
||||
pub fn new(name: Option<&str>) -> Self {
|
||||
glib::Object::builder().property("name", name).build()
|
||||
}
|
||||
}
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
// Uses the naga crate to transform wgsl shader code to SPIR-V
|
||||
fn compile_shader(wgsl_source: &str) -> Result<Vec<u8>, gst::ErrorMessage> {
|
||||
use naga::valid::*;
|
||||
|
||||
let module = naga::front::wgsl::parse_str(wgsl_source).map_err(|e| {
|
||||
gst::error_msg!(
|
||||
gst::ResourceError::Failed,
|
||||
("Shader compilation error: {e:#?}")
|
||||
)
|
||||
})?;
|
||||
|
||||
let info = Validator::new(ValidationFlags::all(), Capabilities::all())
|
||||
.validate(&module)
|
||||
.map_err(|e| {
|
||||
gst::error_msg!(
|
||||
gst::ResourceError::Failed,
|
||||
("Shader validation error: {e:#?}")
|
||||
)
|
||||
})?;
|
||||
|
||||
let mut words = Vec::<u32>::new();
|
||||
naga::back::spv::Writer::new(&naga::back::spv::Options::default())
|
||||
.unwrap()
|
||||
.write(&module, &info, None, &None, &mut words)
|
||||
.unwrap();
|
||||
|
||||
Ok(words
|
||||
.into_iter()
|
||||
.flat_map(u32::to_be_bytes)
|
||||
.collect::<Vec<_>>())
|
||||
}
|
||||
|
||||
/// Private data consists of the transformation shader which is compiled
|
||||
/// in advance to running the actual filter.
|
||||
#[derive(Default)]
|
||||
pub struct VulkanMirrorFilter {
|
||||
state: Arc<Mutex<State>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct State {
|
||||
render: Option<gst_vulkan::VulkanFullScreenQuad>,
|
||||
}
|
||||
|
||||
// See `subclass.rs` for general documentation on creating a subclass. Extended
|
||||
// information like element metadata have been omitted for brevity.
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for VulkanMirrorFilter {
|
||||
const NAME: &'static str = "RsVulkanMirrorFilter";
|
||||
type Type = super::VulkanMirrorFilter;
|
||||
type ParentType = gst_vulkan::VulkanVideoFilter;
|
||||
}
|
||||
|
||||
impl ElementImpl for VulkanMirrorFilter {
|
||||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||
static PAD_TEMPLATES: std::sync::OnceLock<Vec<gst::PadTemplate>> =
|
||||
std::sync::OnceLock::new();
|
||||
|
||||
PAD_TEMPLATES.get_or_init(|| {
|
||||
let caps = gst::Caps::builder_full()
|
||||
.structure_with_features(
|
||||
gst::Structure::builder("video/x-raw")
|
||||
.field("format", gst::List::new(["BGRA", "RGBA"]))
|
||||
.field("width", gst::IntRange::new(1, i32::MAX))
|
||||
.field("height", gst::IntRange::new(1, i32::MAX))
|
||||
.build(),
|
||||
gst_vulkan::CAPS_FEATURES_MEMORY_VULKAN_IMAGE.clone(),
|
||||
)
|
||||
.build();
|
||||
vec![
|
||||
gst::PadTemplate::new(
|
||||
"src",
|
||||
gst::PadDirection::Src,
|
||||
gst::PadPresence::Always,
|
||||
&caps,
|
||||
)
|
||||
.unwrap(),
|
||||
gst::PadTemplate::new(
|
||||
"sink",
|
||||
gst::PadDirection::Sink,
|
||||
gst::PadPresence::Always,
|
||||
&caps,
|
||||
)
|
||||
.unwrap(),
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
impl GstObjectImpl for VulkanMirrorFilter {}
|
||||
impl ObjectImpl for VulkanMirrorFilter {}
|
||||
impl VulkanVideoFilterImpl for VulkanMirrorFilter {}
|
||||
impl BaseTransformImpl for VulkanMirrorFilter {
|
||||
const MODE: BaseTransformMode = BaseTransformMode::NeverInPlace;
|
||||
const PASSTHROUGH_ON_SAME_CAPS: bool = false;
|
||||
const TRANSFORM_IP_ON_PASSTHROUGH: bool = false;
|
||||
|
||||
fn start(&self) -> Result<(), gst::ErrorMessage> {
|
||||
self.parent_start()?;
|
||||
|
||||
let vertex_spirv = compile_shader(include_str!("vulkanfilter.vert.wgsl"))?;
|
||||
let fragment_spirv = compile_shader(include_str!("vulkanfilter.frag.wgsl"))?;
|
||||
|
||||
let queue = self.obj().queue().ok_or_else(|| {
|
||||
gst::error_msg!(gst::ResourceError::NotFound, ("No Vulkan Queue!"))
|
||||
})?;
|
||||
let device = queue.device().ok_or_else(|| {
|
||||
gst::error_msg!(gst::ResourceError::NotFound, ("No Vulkan Device!"))
|
||||
})?;
|
||||
let render = gst_vulkan::VulkanFullScreenQuad::new(&queue);
|
||||
let vertex = device.create_shader(&vertex_spirv).map_err(|e| {
|
||||
gst::error_msg!(
|
||||
gst::ResourceError::NotFound,
|
||||
("Vertex shader creation failed {e:?}")
|
||||
)
|
||||
})?;
|
||||
let fragment = device.create_shader(&fragment_spirv).map_err(|e| {
|
||||
gst::error_msg!(
|
||||
gst::ResourceError::NotFound,
|
||||
("Fragment shader creation failed {e:?}")
|
||||
)
|
||||
})?;
|
||||
if !render.set_shaders(&vertex, &fragment) {
|
||||
return Err(gst::error_msg!(
|
||||
gst::ResourceError::Failed,
|
||||
("Failed to set shaders")
|
||||
));
|
||||
}
|
||||
let mut state = self.state.lock().unwrap();
|
||||
state.render = Some(render);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn stop(&self) -> Result<(), gst::ErrorMessage> {
|
||||
self.parent_stop()?;
|
||||
|
||||
let mut state = self.state.lock().unwrap();
|
||||
state.render = None;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_caps(
|
||||
&self,
|
||||
input: &gst::Caps,
|
||||
output: &gst::Caps,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_set_caps(input, output)
|
||||
.map_err(|_| gst::loggable_error!(CAT, "parent failed set_caps"))?;
|
||||
|
||||
let state = self.state.lock().unwrap();
|
||||
let render = state
|
||||
.render
|
||||
.as_ref()
|
||||
.ok_or_else(|| gst::loggable_error!(CAT, "No internal renderer!"))?;
|
||||
let in_info = gst_video::VideoInfo::from_caps(input)
|
||||
.map_err(|_| gst::loggable_error!(CAT, "Failed to parse input caps"))?;
|
||||
let out_info = gst_video::VideoInfo::from_caps(input)
|
||||
.map_err(|_| gst::loggable_error!(CAT, "Failed to parse output caps"))?;
|
||||
if !render.set_info(&in_info, &out_info) {
|
||||
return Err(gst::loggable_error!(CAT, "Failed to set caps on renderer"));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn transform(
|
||||
&self,
|
||||
inbuf: &gst::Buffer,
|
||||
outbuf: &mut gst::BufferRef,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
gst::info!(CAT, "start transform");
|
||||
let mut state = self.state.lock().unwrap();
|
||||
let render = state.render.as_mut().ok_or(gst::FlowError::Error)?;
|
||||
render
|
||||
.set_input_buffer(Some(inbuf))
|
||||
.map_err(|_| gst::FlowError::Error)?;
|
||||
gst::info!(CAT, "start draw");
|
||||
render.draw_into_output(outbuf).map_err(|e| {
|
||||
gst::error!(CAT, "Failed to render output: {e:?}");
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
gst::info!(CAT, "done success");
|
||||
Ok(gst::FlowSuccess::Ok)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||
gst::init().unwrap();
|
||||
|
||||
let pipeline = gst::Pipeline::new();
|
||||
let src = gst::ElementFactory::make("videotestsrc").build()?;
|
||||
let upload = gst::ElementFactory::make("vulkanupload").build()?;
|
||||
let vulkanfilter = mirror::VulkanMirrorFilter::new(Some("Mirror filter"));
|
||||
let sink = gst::ElementFactory::make("vulkansink").build()?;
|
||||
|
||||
pipeline.add_many([&src, &upload, vulkanfilter.upcast_ref(), &sink])?;
|
||||
gst::Element::link_many([&src, &upload, vulkanfilter.upcast_ref(), &sink])?;
|
||||
|
||||
pipeline.set_state(gst::State::Playing)?;
|
||||
|
||||
Ok(pipeline)
|
||||
}
|
||||
|
||||
fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> {
|
||||
pipeline.set_state(gst::State::Playing)?;
|
||||
|
||||
let bus = pipeline
|
||||
.bus()
|
||||
.expect("Pipeline without bus. Shouldn't happen!");
|
||||
|
||||
for msg in bus.iter_timed(gst::ClockTime::NONE) {
|
||||
use gst::MessageView;
|
||||
|
||||
match msg.view() {
|
||||
MessageView::Eos(..) => break,
|
||||
MessageView::Error(err) => {
|
||||
pipeline.set_state(gst::State::Null)?;
|
||||
return Err(ErrorMessage {
|
||||
src: msg
|
||||
.src()
|
||||
.map(|s| s.path_string())
|
||||
.unwrap_or_else(|| glib::GString::from("UNKNOWN")),
|
||||
error: err.error(),
|
||||
debug: err.debug(),
|
||||
}
|
||||
.into());
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
pipeline.set_state(gst::State::Null)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn example_main() {
|
||||
match create_pipeline().and_then(main_loop) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
examples_common::run(example_main)
|
||||
}
|
14
examples/src/bin/vulkanfilter.vert.wgsl
Normal file
14
examples/src/bin/vulkanfilter.vert.wgsl
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
struct VertexInput {
|
||||
@location(0) pos: vec3<f32>,
|
||||
@location(1) uv: vec2<f32>,
|
||||
}
|
||||
struct VertexOutput {
|
||||
@builtin(position) pos: vec4<f32>,
|
||||
@location(0) uv: vec2<f32>,
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn main(vertex: VertexInput) -> VertexOutput {
|
||||
return VertexOutput(vec4(vertex.pos, 1.), vertex.uv);
|
||||
}
|
2
gir
2
gir
|
@ -1 +1 @@
|
|||
Subproject commit 19ccbbc9a3d1cc9271b7a5fa5d84b5652ee99492
|
||||
Subproject commit 9732f02ca419e5d414b1080ab498532d8c357a18
|
|
@ -1 +1 @@
|
|||
Subproject commit 5c1e490fe50a56dae5ee72e39c410aa9d9a0a1ae
|
||||
Subproject commit 6668d0f5551ae71a2da254cfa5f3fe5a0805506e
|
|
@ -1 +1 @@
|
|||
Subproject commit 787cf49008c2aed08cc4ece4e9be6a4faa0ebcdf
|
||||
Subproject commit 2dcaaf8ae3d82c6c49fe3a8cae677423763cad60
|
1
gstreamer-vulkan/CHANGELOG.md
Symbolic link
1
gstreamer-vulkan/CHANGELOG.md
Symbolic link
|
@ -0,0 +1 @@
|
|||
../gstreamer/CHANGELOG.md
|
1
gstreamer-vulkan/COPYRIGHT
Symbolic link
1
gstreamer-vulkan/COPYRIGHT
Symbolic link
|
@ -0,0 +1 @@
|
|||
../COPYRIGHT
|
44
gstreamer-vulkan/Cargo.toml
Normal file
44
gstreamer-vulkan/Cargo.toml
Normal file
|
@ -0,0 +1,44 @@
|
|||
[package]
|
||||
name = "gstreamer-vulkan"
|
||||
authors = ["Matthew Waters <matthew@centricular.com>"]
|
||||
description = "Rust bindings for GStreamer Vulkan library"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_vulkan/"
|
||||
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
|
||||
version.workspace = true
|
||||
categories.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
ffi = { package = "gstreamer-vulkan-sys", path = "sys" }
|
||||
glib.workspace = true
|
||||
gst.workspace = true
|
||||
gst-base.workspace = true
|
||||
gst-video.workspace = true
|
||||
serde = { version = "1.0", optional = true }
|
||||
once_cell = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
gir-format-check = "0.1"
|
||||
serde_json = "1.0"
|
||||
|
||||
[features]
|
||||
default = ["v1_18"]
|
||||
v1_18 = ["gst/v1_18", "gst-base/v1_18", "gst-video/v1_18", "ffi/v1_18"]
|
||||
v1_20 = ["gst/v1_20", "gst-base/v1_20", "gst-video/v1_20", "ffi/v1_20", "v1_18"]
|
||||
v1_22 = ["gst/v1_22", "gst-base/v1_22", "gst-video/v1_22", "ffi/v1_22", "v1_20"]
|
||||
v1_24 = ["gst/v1_24", "gst-base/v1_24", "gst-video/v1_24", "ffi/v1_24", "v1_22"]
|
||||
v1_26 = ["gst/v1_26", "gst-base/v1_26", "gst-video/v1_26", "ffi/v1_26", "v1_24"]
|
||||
v1_26_4 = ["gst/v1_26", "gst-base/v1_26", "gst-video/v1_26", "ffi/v1_26_4", "v1_26"]
|
||||
v1_28 = ["gst/v1_28", "gst-base/v1_28", "gst-video/v1_28", "ffi/v1_28", "v1_26_4"]
|
||||
serde = ["dep:serde", "gst/serde", "gst-video/serde"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
|
159
gstreamer-vulkan/Gir.toml
Normal file
159
gstreamer-vulkan/Gir.toml
Normal file
|
@ -0,0 +1,159 @@
|
|||
[options]
|
||||
girs_directories = ["../gir-files", "../gst-gir-files"]
|
||||
library = "GstVulkan"
|
||||
version = "1.0"
|
||||
min_cfg_version = "1.18"
|
||||
work_mode = "normal"
|
||||
concurrency = "send+sync"
|
||||
generate_safety_asserts = true
|
||||
single_version_file = true
|
||||
generate_display_trait = false
|
||||
trust_return_value_nullability = true
|
||||
|
||||
external_libraries = [
|
||||
"GLib",
|
||||
"GObject",
|
||||
"Gst",
|
||||
"GstBase",
|
||||
"GstVideo",
|
||||
]
|
||||
|
||||
generate = [
|
||||
#"GstVulkan.VulkanBufferMemory",
|
||||
"GstVulkan.VulkanBufferMemoryAllocator",
|
||||
"GstVulkan.VulkanBufferPool",
|
||||
"GstVulkan.VulkanCommandBuffer",
|
||||
#"GstVulkan.VulkanDecoder",
|
||||
"GstVulkan.VulkanDescriptorSet",
|
||||
"GstVulkan.VulkanDevice",
|
||||
"GstVulkan.VulkanDisplay",
|
||||
"GstVulkan.VulkanDisplayType",
|
||||
#"GstVulkan.VulkanEncoder",
|
||||
"GstVulkan.VulkanFence",
|
||||
#"GstVulkan.VulkanFullScreenQuad",
|
||||
"GstVulkan.VulkanHandlePool",
|
||||
"GstVulkan.VulkanImageBufferPool",
|
||||
#"GstVulkan.VulkanImageMemory",
|
||||
"GstVulkan.VulkanImageMemoryAllocator",
|
||||
"GstVulkan.VulkanImageView",
|
||||
"GstVulkan.VulkanInstance",
|
||||
#"GstVulkan.VulkanMemory",
|
||||
"GstVulkan.VulkanPhysicalDevice",
|
||||
# "GstVulkan.VulkanSwapper",
|
||||
"GstVulkan.VulkanTrash",
|
||||
"GstVulkan.VulkanVideoFilter",
|
||||
"GstVulkan.VulkanWindow",
|
||||
]
|
||||
|
||||
manual = [
|
||||
"GLib.Error",
|
||||
"GLib.Thread",
|
||||
"GObject.Object",
|
||||
"GObject.Value",
|
||||
"Gst.AllocationParams",
|
||||
"Gst.Allocator",
|
||||
"Gst.BufferPool",
|
||||
"Gst.Context",
|
||||
"Gst.Element",
|
||||
"Gst.FlowReturn",
|
||||
"Gst.Fraction",
|
||||
"Gst.Memory",
|
||||
"Gst.Object",
|
||||
"Gst.PadDirection",
|
||||
"GstBase.BaseSrc",
|
||||
"GstBase.BaseTransform",
|
||||
"GstBase.PushSrc",
|
||||
"GstVideo.VideoAlignment",
|
||||
"GstVideo.VideoInfo",
|
||||
"GstVideo.VideoMultiviewFlags",
|
||||
"GstVideo.VideoMultiviewMode",
|
||||
"GstVideo.VideoOverlay",
|
||||
]
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Buffer"
|
||||
status = "manual"
|
||||
ref_mode = "ref"
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Caps"
|
||||
status = "manual"
|
||||
ref_mode = "ref"
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Query"
|
||||
status = "manual"
|
||||
ref_mode = "ref"
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Structure"
|
||||
status = "manual"
|
||||
ref_mode = "ref"
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkan.VulkanCommandPool"
|
||||
status = "generate"
|
||||
[[object.function]]
|
||||
name = "lock"
|
||||
manual = true
|
||||
[[object.function]]
|
||||
name = "unlock"
|
||||
manual = true
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkan.VulkanDescriptorCache"
|
||||
status = "generate"
|
||||
[[object.function]]
|
||||
name = "new"
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkan.VulkanDescriptorPool"
|
||||
status = "generate"
|
||||
[[object.function]]
|
||||
name = "create"
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkan.VulkanFullScreenQuad"
|
||||
status = "generate"
|
||||
version = "1.26.4"
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkan.VulkanHandle"
|
||||
status = "generate"
|
||||
ref_mode = "ref"
|
||||
[[object.function]]
|
||||
name = "context_query"
|
||||
ignore = true
|
||||
[[object.function]]
|
||||
name = "set_context"
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkan.VulkanOperation"
|
||||
status = "generate"
|
||||
[[object.function]]
|
||||
name = "begin"
|
||||
manual = true
|
||||
[[object.function]]
|
||||
name = "end"
|
||||
manual = true
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkan.VulkanQueue"
|
||||
status = "generate"
|
||||
[[object.function]]
|
||||
name = "submit_lock"
|
||||
manual = true
|
||||
[[object.function]]
|
||||
name = "submit_unlock"
|
||||
manual = true
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkan.VulkanSwapper"
|
||||
status = "generate"
|
||||
[[object.property]]
|
||||
name = "pixel-aspect-ratio"
|
||||
# fraction
|
||||
manual = true
|
1
gstreamer-vulkan/LICENSE-APACHE
Symbolic link
1
gstreamer-vulkan/LICENSE-APACHE
Symbolic link
|
@ -0,0 +1 @@
|
|||
../LICENSE-APACHE
|
1
gstreamer-vulkan/LICENSE-MIT
Symbolic link
1
gstreamer-vulkan/LICENSE-MIT
Symbolic link
|
@ -0,0 +1 @@
|
|||
../LICENSE-MIT
|
215
gstreamer-vulkan/README.md
Normal file
215
gstreamer-vulkan/README.md
Normal file
|
@ -0,0 +1,215 @@
|
|||
# gstreamer-rs [](https://crates.io/crates/gstreamer-vulkan) [](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/commits/main)
|
||||
|
||||
[GStreamer](https://gstreamer.freedesktop.org/) (Vulkan library)
|
||||
bindings for Rust. Documentation can be found
|
||||
[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_vulkan/).
|
||||
|
||||
These bindings are providing a safe API that can be used to interface with
|
||||
GStreamer, e.g. for writing GStreamer-based applications and GStreamer plugins.
|
||||
|
||||
The bindings are mostly autogenerated with [gir](https://github.com/gtk-rs/gir/)
|
||||
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
|
||||
API metadata provided by the GStreamer project.
|
||||
|
||||
## Table of Contents
|
||||
1. [Installation](#installation)
|
||||
1. [Linux/BSDs](#installation-linux)
|
||||
1. [macOS](#installation-macos)
|
||||
1. [Windows](#installation-windows)
|
||||
1. [Getting Started](#getting-started)
|
||||
1. [License](#license)
|
||||
1. [Contribution](#contribution)
|
||||
|
||||
<a name="installation"/>
|
||||
|
||||
## Installation
|
||||
|
||||
To build the GStreamer bindings or anything depending on them, you need to
|
||||
have at least GStreamer 1.14 and gst-plugins-base 1.14 installed. In addition,
|
||||
some of the examples/tutorials require various GStreamer plugins to be
|
||||
available, which can be found in gst-plugins-base, gst-plugins-good,
|
||||
gst-plugins-bad, gst-plugins-ugly and/or gst-libav.
|
||||
|
||||
<a name="installation-linux"/>
|
||||
|
||||
### Linux/BSDs
|
||||
|
||||
You need to install the above mentioned packages with your distributions
|
||||
package manager, or build them from source.
|
||||
|
||||
On Debian/Ubuntu they can be installed with
|
||||
|
||||
```console
|
||||
$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
|
||||
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
|
||||
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
|
||||
gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev
|
||||
```
|
||||
|
||||
The minimum required version of the above libraries is >= 1.14. If you
|
||||
build the gstreamer-player sub-crate, or any of the examples that
|
||||
depend on gstreamer-player, you must ensure that in addition to the above
|
||||
packages, `libgstreamer-plugins-bad1.0-dev` is installed. See the `Cargo.toml`
|
||||
files for the full details,
|
||||
|
||||
```console
|
||||
$ apt-get install libgstreamer-plugins-bad1.0-dev
|
||||
```
|
||||
|
||||
Package names on other distributions should be similar.
|
||||
Please submit a pull request with instructions for yours.
|
||||
|
||||
<a name="installation-macos"/>
|
||||
|
||||
### macOS
|
||||
|
||||
You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
|
||||
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
|
||||
provided by the GStreamer project.
|
||||
|
||||
We recommend using the official GStreamer binaries over Homebrew, especially
|
||||
as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964).
|
||||
|
||||
#### GStreamer Binaries
|
||||
|
||||
You need to download the *two* `.pkg` files from the GStreamer website and
|
||||
install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and
|
||||
`gstreamer-1.0-devel-1.20.4-universal.pkg`.
|
||||
|
||||
After installation, you also need to set the `PATH` environment variable as
|
||||
follows
|
||||
|
||||
```console
|
||||
$ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
|
||||
```
|
||||
|
||||
Also note that the `pkg-config` from GStreamer should be the first one in
|
||||
the `PATH` as other versions have all kinds of quirks that will cause
|
||||
problems.
|
||||
|
||||
#### Homebrew
|
||||
|
||||
Homebrew only installs various plugins if explicitly enabled, so some extra
|
||||
`--with-*` flags may be required.
|
||||
|
||||
```console
|
||||
$ brew install gstreamer gst-plugins-base gst-plugins-good \
|
||||
gst-plugins-bad gst-plugins-ugly gst-libav gst-rtsp-server \
|
||||
gst-editing-services --with-orc --with-libogg --with-opus \
|
||||
--with-pango --with-theora --with-libvorbis --with-libvpx \
|
||||
--enable-gtk3
|
||||
```
|
||||
|
||||
Make sure the version of these libraries is >= 1.14.
|
||||
|
||||
<a name="installation-windows"/>
|
||||
|
||||
### Windows
|
||||
|
||||
You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/)
|
||||
with `pacman` or by installing the
|
||||
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
|
||||
the GStreamer project.
|
||||
|
||||
We recommend using the official GStreamer binaries over MSYS2.
|
||||
|
||||
#### GStreamer Binaries
|
||||
|
||||
You need to download the *two* `.msi` files for your platform from the
|
||||
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and
|
||||
`gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that
|
||||
matches your Rust toolchain, i.e. MinGW or MSVC.
|
||||
|
||||
After installation set the ``PATH` environment variable as follows:
|
||||
|
||||
```console
|
||||
# For a UNIX-style shell:
|
||||
$ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}"
|
||||
|
||||
# For cmd.exe:
|
||||
$ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH%
|
||||
```
|
||||
|
||||
Make sure to update the path to where you have actually installed GStreamer
|
||||
and for the corresponding toolchain.
|
||||
|
||||
Also note that the `pkg-config.exe` from GStreamer should be the first one in
|
||||
the `PATH` as other versions have all kinds of quirks that will cause
|
||||
problems.
|
||||
|
||||
#### MSYS2 / pacman
|
||||
|
||||
```console
|
||||
$ pacman -S glib2-devel pkg-config \
|
||||
mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
|
||||
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
|
||||
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \
|
||||
mingw-w64-x86_64-gst-rtsp-server
|
||||
```
|
||||
|
||||
Make sure the version of these libraries is >= 1.14.
|
||||
|
||||
Note that the version of `pkg-config` included in `MSYS2` is
|
||||
[known to have problems](https://github.com/rust-lang/pkg-config-rs/issues/51#issuecomment-346300858)
|
||||
compiling GStreamer, so you may need to install another version. One option
|
||||
would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/).
|
||||
|
||||
<a name="getting-started"/>
|
||||
|
||||
## Getting Started
|
||||
|
||||
The API reference can be found
|
||||
[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer/), however it is
|
||||
only the Rust API reference and does not explain any of the concepts.
|
||||
|
||||
For getting started with GStreamer development, the best would be to follow
|
||||
the [documentation](https://gstreamer.freedesktop.org/documentation/) on the
|
||||
GStreamer website, especially the [Application Development
|
||||
Manual](https://gstreamer.freedesktop.org/documentation/application-development/).
|
||||
While being C-centric, it explains all the fundamental concepts of GStreamer
|
||||
and the code examples should be relatively easily translatable to Rust. The
|
||||
API is basically the same, function/struct names are the same and everything
|
||||
is only more convenient (hopefully) and safer.
|
||||
|
||||
In addition there are
|
||||
[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the
|
||||
GStreamer website. Many of them were ported to Rust already and the code can
|
||||
be found in the
|
||||
[tutorials](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/tutorials)
|
||||
directory.
|
||||
|
||||
Some further examples for various aspects of GStreamer and how to use it from
|
||||
Rust can be found in the
|
||||
[examples](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/examples)
|
||||
directory.
|
||||
|
||||
Various GStreamer plugins written in Rust can be found in the
|
||||
[gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs)
|
||||
repository.
|
||||
|
||||
<a name="license"/>
|
||||
|
||||
## LICENSE
|
||||
|
||||
gstreamer-rs and all crates contained in here are licensed under either of
|
||||
|
||||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
||||
http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
GStreamer itself is licensed under the Lesser General Public License version
|
||||
2.1 or (at your option) any later version:
|
||||
https://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
<a name="contribution"/>
|
||||
|
||||
## Contribution
|
||||
|
||||
Any kinds of contributions are welcome as a pull request.
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be
|
||||
dual licensed as above, without any additional terms or conditions.
|
117
gstreamer-vulkan/src/auto/flags.rs
Normal file
117
gstreamer-vulkan/src/auto/flags.rs
Normal file
|
@ -0,0 +1,117 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{bitflags::bitflags, prelude::*, translate::*};
|
||||
|
||||
bitflags! {
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[doc(alias = "GstVulkanDisplayType")]
|
||||
pub struct VulkanDisplayType: u32 {
|
||||
#[doc(alias = "GST_VULKAN_DISPLAY_TYPE_NONE")]
|
||||
const NONE = ffi::GST_VULKAN_DISPLAY_TYPE_NONE as _;
|
||||
#[doc(alias = "GST_VULKAN_DISPLAY_TYPE_XCB")]
|
||||
const XCB = ffi::GST_VULKAN_DISPLAY_TYPE_XCB as _;
|
||||
#[doc(alias = "GST_VULKAN_DISPLAY_TYPE_WAYLAND")]
|
||||
const WAYLAND = ffi::GST_VULKAN_DISPLAY_TYPE_WAYLAND as _;
|
||||
#[doc(alias = "GST_VULKAN_DISPLAY_TYPE_COCOA")]
|
||||
const COCOA = ffi::GST_VULKAN_DISPLAY_TYPE_COCOA as _;
|
||||
#[doc(alias = "GST_VULKAN_DISPLAY_TYPE_IOS")]
|
||||
const IOS = ffi::GST_VULKAN_DISPLAY_TYPE_IOS as _;
|
||||
#[doc(alias = "GST_VULKAN_DISPLAY_TYPE_WIN32")]
|
||||
const WIN32 = ffi::GST_VULKAN_DISPLAY_TYPE_WIN32 as _;
|
||||
#[doc(alias = "GST_VULKAN_DISPLAY_TYPE_ANDROID")]
|
||||
const ANDROID = ffi::GST_VULKAN_DISPLAY_TYPE_ANDROID as _;
|
||||
#[doc(alias = "GST_VULKAN_DISPLAY_TYPE_ANY")]
|
||||
const ANY = ffi::GST_VULKAN_DISPLAY_TYPE_ANY as _;
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanDisplayType {
|
||||
#[doc(alias = "gst_vulkan_display_type_to_extension_string")]
|
||||
pub fn to_extension_string(self) -> Option<glib::GString> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib_none(ffi::gst_vulkan_display_type_to_extension_string(
|
||||
self.into_glib(),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl IntoGlib for VulkanDisplayType {
|
||||
type GlibType = ffi::GstVulkanDisplayType;
|
||||
|
||||
#[inline]
|
||||
fn into_glib(self) -> ffi::GstVulkanDisplayType {
|
||||
self.bits()
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl FromGlib<ffi::GstVulkanDisplayType> for VulkanDisplayType {
|
||||
#[inline]
|
||||
unsafe fn from_glib(value: ffi::GstVulkanDisplayType) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self::from_bits_truncate(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl StaticType for VulkanDisplayType {
|
||||
#[inline]
|
||||
#[doc(alias = "gst_vulkan_display_type_get_type")]
|
||||
fn static_type() -> glib::Type {
|
||||
unsafe { from_glib(ffi::gst_vulkan_display_type_get_type()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl glib::HasParamSpec for VulkanDisplayType {
|
||||
type ParamSpec = glib::ParamSpecFlags;
|
||||
type SetValue = Self;
|
||||
type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
|
||||
|
||||
fn param_spec_builder() -> Self::BuilderFn {
|
||||
Self::ParamSpec::builder
|
||||
}
|
||||
}
|
||||
|
||||
impl glib::value::ValueType for VulkanDisplayType {
|
||||
type Type = Self;
|
||||
}
|
||||
|
||||
unsafe impl<'a> glib::value::FromValue<'a> for VulkanDisplayType {
|
||||
type Checker = glib::value::GenericValueTypeChecker<Self>;
|
||||
|
||||
#[inline]
|
||||
unsafe fn from_value(value: &'a glib::Value) -> Self {
|
||||
skip_assert_initialized!();
|
||||
from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToValue for VulkanDisplayType {
|
||||
#[inline]
|
||||
fn to_value(&self) -> glib::Value {
|
||||
let mut value = glib::Value::for_value_type::<Self>();
|
||||
unsafe {
|
||||
glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
|
||||
}
|
||||
value
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn value_type(&self) -> glib::Type {
|
||||
Self::static_type()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<VulkanDisplayType> for glib::Value {
|
||||
#[inline]
|
||||
fn from(v: VulkanDisplayType) -> Self {
|
||||
skip_assert_initialized!();
|
||||
ToValue::to_value(&v)
|
||||
}
|
||||
}
|
108
gstreamer-vulkan/src/auto/mod.rs
Normal file
108
gstreamer-vulkan/src/auto/mod.rs
Normal file
|
@ -0,0 +1,108 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
mod vulkan_buffer_memory_allocator;
|
||||
pub use self::vulkan_buffer_memory_allocator::VulkanBufferMemoryAllocator;
|
||||
|
||||
mod vulkan_buffer_pool;
|
||||
pub use self::vulkan_buffer_pool::VulkanBufferPool;
|
||||
|
||||
mod vulkan_command_pool;
|
||||
pub use self::vulkan_command_pool::VulkanCommandPool;
|
||||
|
||||
mod vulkan_descriptor_cache;
|
||||
pub use self::vulkan_descriptor_cache::VulkanDescriptorCache;
|
||||
|
||||
mod vulkan_descriptor_pool;
|
||||
pub use self::vulkan_descriptor_pool::VulkanDescriptorPool;
|
||||
|
||||
mod vulkan_device;
|
||||
pub use self::vulkan_device::VulkanDevice;
|
||||
|
||||
mod vulkan_display;
|
||||
pub use self::vulkan_display::VulkanDisplay;
|
||||
|
||||
#[cfg(feature = "v1_26_4")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26_4")))]
|
||||
mod vulkan_full_screen_quad;
|
||||
#[cfg(feature = "v1_26_4")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26_4")))]
|
||||
pub use self::vulkan_full_screen_quad::VulkanFullScreenQuad;
|
||||
|
||||
mod vulkan_handle_pool;
|
||||
pub use self::vulkan_handle_pool::VulkanHandlePool;
|
||||
|
||||
mod vulkan_image_buffer_pool;
|
||||
pub use self::vulkan_image_buffer_pool::VulkanImageBufferPool;
|
||||
|
||||
mod vulkan_image_memory_allocator;
|
||||
pub use self::vulkan_image_memory_allocator::VulkanImageMemoryAllocator;
|
||||
|
||||
mod vulkan_instance;
|
||||
pub use self::vulkan_instance::VulkanInstance;
|
||||
|
||||
#[cfg(feature = "v1_24")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
mod vulkan_operation;
|
||||
#[cfg(feature = "v1_24")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
pub use self::vulkan_operation::VulkanOperation;
|
||||
|
||||
mod vulkan_physical_device;
|
||||
pub use self::vulkan_physical_device::VulkanPhysicalDevice;
|
||||
|
||||
mod vulkan_queue;
|
||||
pub use self::vulkan_queue::VulkanQueue;
|
||||
|
||||
mod vulkan_swapper;
|
||||
pub use self::vulkan_swapper::VulkanSwapper;
|
||||
|
||||
mod vulkan_video_filter;
|
||||
pub use self::vulkan_video_filter::VulkanVideoFilter;
|
||||
|
||||
mod vulkan_window;
|
||||
pub use self::vulkan_window::VulkanWindow;
|
||||
|
||||
mod vulkan_command_buffer;
|
||||
pub use self::vulkan_command_buffer::VulkanCommandBuffer;
|
||||
|
||||
mod vulkan_descriptor_set;
|
||||
pub use self::vulkan_descriptor_set::VulkanDescriptorSet;
|
||||
|
||||
mod vulkan_fence;
|
||||
pub use self::vulkan_fence::VulkanFence;
|
||||
|
||||
mod vulkan_handle;
|
||||
pub use self::vulkan_handle::VulkanHandle;
|
||||
|
||||
mod vulkan_image_view;
|
||||
pub use self::vulkan_image_view::VulkanImageView;
|
||||
|
||||
mod vulkan_trash;
|
||||
pub use self::vulkan_trash::VulkanTrash;
|
||||
|
||||
mod flags;
|
||||
pub use self::flags::VulkanDisplayType;
|
||||
|
||||
pub(crate) mod traits {
|
||||
pub use super::vulkan_command_pool::VulkanCommandPoolExt;
|
||||
pub use super::vulkan_descriptor_cache::VulkanDescriptorCacheExt;
|
||||
pub use super::vulkan_descriptor_pool::VulkanDescriptorPoolExt;
|
||||
pub use super::vulkan_device::VulkanDeviceExt;
|
||||
pub use super::vulkan_display::VulkanDisplayExt;
|
||||
#[cfg(feature = "v1_26_4")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26_4")))]
|
||||
pub use super::vulkan_full_screen_quad::VulkanFullScreenQuadExt;
|
||||
pub use super::vulkan_handle_pool::VulkanHandlePoolExt;
|
||||
pub use super::vulkan_instance::VulkanInstanceExt;
|
||||
#[cfg(feature = "v1_24")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
pub use super::vulkan_operation::VulkanOperationExt;
|
||||
pub use super::vulkan_physical_device::VulkanPhysicalDeviceExt;
|
||||
pub use super::vulkan_queue::VulkanQueueExt;
|
||||
pub use super::vulkan_swapper::VulkanSwapperExt;
|
||||
pub use super::vulkan_video_filter::VulkanVideoFilterExt;
|
||||
pub use super::vulkan_window::VulkanWindowExt;
|
||||
}
|
3
gstreamer-vulkan/src/auto/versions.txt
Normal file
3
gstreamer-vulkan/src/auto/versions.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 2d0807e9c5bc)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6668d0f5551a)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 2dcaaf8ae3d8+)
|
22
gstreamer-vulkan/src/auto/vulkan_buffer_memory_allocator.rs
Normal file
22
gstreamer-vulkan/src/auto/vulkan_buffer_memory_allocator.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanBufferMemoryAllocator")]
|
||||
pub struct VulkanBufferMemoryAllocator(Object<ffi::GstVulkanBufferMemoryAllocator, ffi::GstVulkanBufferMemoryAllocatorClass>) @extends gst::Allocator, gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_buffer_memory_allocator_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanBufferMemoryAllocator {
|
||||
pub const NONE: Option<&'static VulkanBufferMemoryAllocator> = None;
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanBufferMemoryAllocator {}
|
||||
unsafe impl Sync for VulkanBufferMemoryAllocator {}
|
41
gstreamer-vulkan/src/auto/vulkan_buffer_pool.rs
Normal file
41
gstreamer-vulkan/src/auto/vulkan_buffer_pool.rs
Normal file
|
@ -0,0 +1,41 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanDevice};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanBufferPool")]
|
||||
pub struct VulkanBufferPool(Object<ffi::GstVulkanBufferPool, ffi::GstVulkanBufferPoolClass>) @extends gst::BufferPool, gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_buffer_pool_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanBufferPool {
|
||||
pub const NONE: Option<&'static VulkanBufferPool> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_buffer_pool_new")]
|
||||
pub fn new(device: &impl IsA<VulkanDevice>) -> VulkanBufferPool {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
gst::BufferPool::from_glib_full(ffi::gst_vulkan_buffer_pool_new(
|
||||
device.as_ref().to_glib_none().0,
|
||||
))
|
||||
.unsafe_cast()
|
||||
}
|
||||
}
|
||||
|
||||
//#[cfg(feature = "v1_24")]
|
||||
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
//#[doc(alias = "gst_vulkan_buffer_pool_config_set_allocation_params")]
|
||||
//pub fn config_set_allocation_params(config: &gst::Structure, usage: /*Ignored*/&vulkan::BufferUsageFlags, mem_properties: /*Ignored*/&vulkan::MemoryPropertyFlags) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_buffer_pool_config_set_allocation_params() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanBufferPool {}
|
||||
unsafe impl Sync for VulkanBufferPool {}
|
27
gstreamer-vulkan/src/auto/vulkan_command_buffer.rs
Normal file
27
gstreamer-vulkan/src/auto/vulkan_command_buffer.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct VulkanCommandBuffer(Boxed<ffi::GstVulkanCommandBuffer>);
|
||||
|
||||
match fn {
|
||||
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_vulkan_command_buffer_get_type(), ptr as *mut _) as *mut ffi::GstVulkanCommandBuffer,
|
||||
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_vulkan_command_buffer_get_type(), ptr as *mut _),
|
||||
type_ => || ffi::gst_vulkan_command_buffer_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanCommandBuffer {
|
||||
//#[doc(alias = "gst_vulkan_command_buffer_new_wrapped")]
|
||||
//pub fn new_wrapped(cmd: /*Ignored*/&vulkan::CommandBuffer, level: /*Ignored*/&vulkan::CommandBufferLevel) -> VulkanCommandBuffer {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_command_buffer_new_wrapped() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanCommandBuffer {}
|
||||
unsafe impl Sync for VulkanCommandBuffer {}
|
51
gstreamer-vulkan/src/auto/vulkan_command_pool.rs
Normal file
51
gstreamer-vulkan/src/auto/vulkan_command_pool.rs
Normal file
|
@ -0,0 +1,51 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanCommandBuffer, VulkanQueue};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanCommandPool")]
|
||||
pub struct VulkanCommandPool(Object<ffi::GstVulkanCommandPool, ffi::GstVulkanCommandPoolClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_command_pool_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanCommandPool {
|
||||
pub const NONE: Option<&'static VulkanCommandPool> = None;
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanCommandPool {}
|
||||
unsafe impl Sync for VulkanCommandPool {}
|
||||
|
||||
pub trait VulkanCommandPoolExt: IsA<VulkanCommandPool> + 'static {
|
||||
#[doc(alias = "gst_vulkan_command_pool_create")]
|
||||
fn create(&self) -> Result<VulkanCommandBuffer, glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let ret =
|
||||
ffi::gst_vulkan_command_pool_create(self.as_ref().to_glib_none().0, &mut error);
|
||||
if error.is_null() {
|
||||
Ok(from_glib_full(ret))
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_command_pool_get_queue")]
|
||||
#[doc(alias = "get_queue")]
|
||||
fn queue(&self) -> VulkanQueue {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_command_pool_get_queue(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanCommandPool>> VulkanCommandPoolExt for O {}
|
43
gstreamer-vulkan/src/auto/vulkan_descriptor_cache.rs
Normal file
43
gstreamer-vulkan/src/auto/vulkan_descriptor_cache.rs
Normal file
|
@ -0,0 +1,43 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanDescriptorSet, VulkanHandlePool};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanDescriptorCache")]
|
||||
pub struct VulkanDescriptorCache(Object<ffi::GstVulkanDescriptorCache, ffi::GstVulkanDescriptorCacheClass>) @extends VulkanHandlePool, gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_descriptor_cache_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanDescriptorCache {
|
||||
pub const NONE: Option<&'static VulkanDescriptorCache> = None;
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanDescriptorCache {}
|
||||
unsafe impl Sync for VulkanDescriptorCache {}
|
||||
|
||||
pub trait VulkanDescriptorCacheExt: IsA<VulkanDescriptorCache> + 'static {
|
||||
#[doc(alias = "gst_vulkan_descriptor_cache_acquire")]
|
||||
fn acquire(&self) -> Result<VulkanDescriptorSet, glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let ret = ffi::gst_vulkan_descriptor_cache_acquire(
|
||||
self.as_ref().to_glib_none().0,
|
||||
&mut error,
|
||||
);
|
||||
if error.is_null() {
|
||||
Ok(from_glib_full(ret))
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanDescriptorCache>> VulkanDescriptorCacheExt for O {}
|
48
gstreamer-vulkan/src/auto/vulkan_descriptor_pool.rs
Normal file
48
gstreamer-vulkan/src/auto/vulkan_descriptor_pool.rs
Normal file
|
@ -0,0 +1,48 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanDevice};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanDescriptorPool")]
|
||||
pub struct VulkanDescriptorPool(Object<ffi::GstVulkanDescriptorPool, ffi::GstVulkanDescriptorPoolClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_descriptor_pool_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanDescriptorPool {
|
||||
pub const NONE: Option<&'static VulkanDescriptorPool> = None;
|
||||
|
||||
//#[doc(alias = "gst_vulkan_descriptor_pool_new_wrapped")]
|
||||
//pub fn new_wrapped(device: &impl IsA<VulkanDevice>, pool: /*Ignored*/vulkan::DescriptorPool, max_sets: usize) -> VulkanDescriptorPool {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_descriptor_pool_new_wrapped() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanDescriptorPool {}
|
||||
unsafe impl Sync for VulkanDescriptorPool {}
|
||||
|
||||
pub trait VulkanDescriptorPoolExt: IsA<VulkanDescriptorPool> + 'static {
|
||||
#[doc(alias = "gst_vulkan_descriptor_pool_get_device")]
|
||||
#[doc(alias = "get_device")]
|
||||
fn device(&self) -> VulkanDevice {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_descriptor_pool_get_device(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_descriptor_pool_get_max_sets")]
|
||||
#[doc(alias = "get_max_sets")]
|
||||
fn max_sets(&self) -> usize {
|
||||
unsafe { ffi::gst_vulkan_descriptor_pool_get_max_sets(self.as_ref().to_glib_none().0) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanDescriptorPool>> VulkanDescriptorPoolExt for O {}
|
27
gstreamer-vulkan/src/auto/vulkan_descriptor_set.rs
Normal file
27
gstreamer-vulkan/src/auto/vulkan_descriptor_set.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct VulkanDescriptorSet(Boxed<ffi::GstVulkanDescriptorSet>);
|
||||
|
||||
match fn {
|
||||
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_vulkan_descriptor_set_get_type(), ptr as *mut _) as *mut ffi::GstVulkanDescriptorSet,
|
||||
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_vulkan_descriptor_set_get_type(), ptr as *mut _),
|
||||
type_ => || ffi::gst_vulkan_descriptor_set_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanDescriptorSet {
|
||||
//#[doc(alias = "gst_vulkan_descriptor_set_new_wrapped")]
|
||||
//pub fn new_wrapped(pool: &impl IsA<VulkanDescriptorPool>, set: /*Ignored*/&vulkan::DescriptorSet, layouts: &[VulkanHandle]) -> VulkanDescriptorSet {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_descriptor_set_new_wrapped() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanDescriptorSet {}
|
||||
unsafe impl Sync for VulkanDescriptorSet {}
|
255
gstreamer-vulkan/src/auto/vulkan_device.rs
Normal file
255
gstreamer-vulkan/src/auto/vulkan_device.rs
Normal file
|
@ -0,0 +1,255 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanFence, VulkanInstance, VulkanPhysicalDevice, VulkanQueue};
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
translate::*,
|
||||
};
|
||||
use std::boxed::Box as Box_;
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanDevice")]
|
||||
pub struct VulkanDevice(Object<ffi::GstVulkanDevice, ffi::GstVulkanDeviceClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_device_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanDevice {
|
||||
pub const NONE: Option<&'static VulkanDevice> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_new")]
|
||||
pub fn new(physical_device: &impl IsA<VulkanPhysicalDevice>) -> VulkanDevice {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_device_new(
|
||||
physical_device.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_new_with_index")]
|
||||
#[doc(alias = "new_with_index")]
|
||||
pub fn with_index(instance: &impl IsA<VulkanInstance>, device_index: u32) -> VulkanDevice {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_device_new_with_index(
|
||||
instance.as_ref().to_glib_none().0,
|
||||
device_index,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_handle_context_query")]
|
||||
pub fn handle_context_query(
|
||||
element: &impl IsA<gst::Element>,
|
||||
query: &gst::Query,
|
||||
device: &impl IsA<VulkanDevice>,
|
||||
) -> bool {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_device_handle_context_query(
|
||||
element.as_ref().to_glib_none().0,
|
||||
query.to_glib_none().0,
|
||||
device.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_device_run_context_query")]
|
||||
//pub fn run_context_query(element: &impl IsA<gst::Element>, device: impl IsA<VulkanDevice>) -> bool {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_device_run_context_query() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanDevice {}
|
||||
unsafe impl Sync for VulkanDevice {}
|
||||
|
||||
pub trait VulkanDeviceExt: IsA<VulkanDevice> + 'static {
|
||||
#[doc(alias = "gst_vulkan_device_create_fence")]
|
||||
fn create_fence(&self) -> Result<Option<VulkanFence>, glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let ret =
|
||||
ffi::gst_vulkan_device_create_fence(self.as_ref().to_glib_none().0, &mut error);
|
||||
if error.is_null() {
|
||||
Ok(from_glib_full(ret))
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_disable_extension")]
|
||||
fn disable_extension(&self, name: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_device_disable_extension(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_enable_extension")]
|
||||
fn enable_extension(&self, name: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_device_enable_extension(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_enable_layer")]
|
||||
fn enable_layer(&self, name: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_device_enable_layer(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_foreach_queue")]
|
||||
fn foreach_queue<P: FnMut(&VulkanDevice, &VulkanQueue) -> bool>(&self, func: P) {
|
||||
let mut func_data: P = func;
|
||||
unsafe extern "C" fn func_func<P: FnMut(&VulkanDevice, &VulkanQueue) -> bool>(
|
||||
device: *mut ffi::GstVulkanDevice,
|
||||
queue: *mut ffi::GstVulkanQueue,
|
||||
user_data: glib::ffi::gpointer,
|
||||
) -> glib::ffi::gboolean {
|
||||
let device = from_glib_borrow(device);
|
||||
let queue = from_glib_borrow(queue);
|
||||
let callback = user_data as *mut P;
|
||||
(*callback)(&device, &queue).into_glib()
|
||||
}
|
||||
let func = Some(func_func::<P> as _);
|
||||
let super_callback0: &mut P = &mut func_data;
|
||||
unsafe {
|
||||
ffi::gst_vulkan_device_foreach_queue(
|
||||
self.as_ref().to_glib_none().0,
|
||||
func,
|
||||
super_callback0 as *mut _ as *mut _,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_get_instance")]
|
||||
#[doc(alias = "get_instance")]
|
||||
fn instance(&self) -> Option<VulkanInstance> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_device_get_instance(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_device_get_physical_device")]
|
||||
//#[doc(alias = "get_physical_device")]
|
||||
//#[doc(alias = "physical-device")]
|
||||
//fn physical_device(&self) -> /*Ignored*/vulkan::PhysicalDevice {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_device_get_physical_device() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_device_get_proc_address")]
|
||||
//#[doc(alias = "get_proc_address")]
|
||||
//fn proc_address(&self, name: &str) -> /*Unimplemented*/Option<Basic: Pointer> {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_device_get_proc_address() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_get_queue")]
|
||||
#[doc(alias = "get_queue")]
|
||||
fn queue(&self, queue_family: u32, queue_i: u32) -> VulkanQueue {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_device_get_queue(
|
||||
self.as_ref().to_glib_none().0,
|
||||
queue_family,
|
||||
queue_i,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_is_extension_enabled")]
|
||||
fn is_extension_enabled(&self, name: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_device_is_extension_enabled(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_is_layer_enabled")]
|
||||
fn is_layer_enabled(&self, name: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_device_is_layer_enabled(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_device_open")]
|
||||
fn open(&self) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_device_open(self.as_ref().to_glib_none().0, &mut error);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#[cfg(feature = "v1_24")]
|
||||
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
//#[doc(alias = "gst_vulkan_device_queue_family_indices")]
|
||||
//fn queue_family_indices(&self) -> /*Unknown conversion*//*Unimplemented*/Array TypeId { ns_id: 0, id: 7 } {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_device_queue_family_indices() }
|
||||
//}
|
||||
|
||||
//#[cfg(feature = "v1_24")]
|
||||
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
//#[doc(alias = "gst_vulkan_device_select_queue")]
|
||||
//fn select_queue(&self, expected_flags: /*Ignored*/&vulkan::QueueFlagBits) -> Option<VulkanQueue> {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_device_select_queue() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "instance")]
|
||||
fn connect_instance_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_instance_trampoline<
|
||||
P: IsA<VulkanDevice>,
|
||||
F: Fn(&P) + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanDevice,
|
||||
_param_spec: glib::ffi::gpointer,
|
||||
f: glib::ffi::gpointer,
|
||||
) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(VulkanDevice::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"notify::instance".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_instance_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanDevice>> VulkanDeviceExt for O {}
|
123
gstreamer-vulkan/src/auto/vulkan_display.rs
Normal file
123
gstreamer-vulkan/src/auto/vulkan_display.rs
Normal file
|
@ -0,0 +1,123 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanDisplayType, VulkanInstance, VulkanWindow};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanDisplay")]
|
||||
pub struct VulkanDisplay(Object<ffi::GstVulkanDisplay, ffi::GstVulkanDisplayClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_display_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanDisplay {
|
||||
pub const NONE: Option<&'static VulkanDisplay> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_display_new")]
|
||||
pub fn new(instance: &impl IsA<VulkanInstance>) -> VulkanDisplay {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_display_new(
|
||||
instance.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_display_new_with_type")]
|
||||
#[doc(alias = "new_with_type")]
|
||||
pub fn with_type(
|
||||
instance: &impl IsA<VulkanInstance>,
|
||||
type_: VulkanDisplayType,
|
||||
) -> Option<VulkanDisplay> {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_display_new_with_type(
|
||||
instance.as_ref().to_glib_none().0,
|
||||
type_.into_glib(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_display_choose_type")]
|
||||
pub fn choose_type(instance: &impl IsA<VulkanInstance>) -> VulkanDisplayType {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_display_choose_type(
|
||||
instance.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_display_handle_context_query")]
|
||||
pub fn handle_context_query(
|
||||
element: &impl IsA<gst::Element>,
|
||||
query: &gst::Query,
|
||||
display: Option<&impl IsA<VulkanDisplay>>,
|
||||
) -> bool {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_display_handle_context_query(
|
||||
element.as_ref().to_glib_none().0,
|
||||
query.to_glib_none().0,
|
||||
display.map(|p| p.as_ref()).to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_display_run_context_query")]
|
||||
//pub fn run_context_query(element: &impl IsA<gst::Element>, display: impl IsA<VulkanDisplay>) -> bool {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_display_run_context_query() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanDisplay {}
|
||||
unsafe impl Sync for VulkanDisplay {}
|
||||
|
||||
pub trait VulkanDisplayExt: IsA<VulkanDisplay> + 'static {
|
||||
#[doc(alias = "gst_vulkan_display_create_window")]
|
||||
fn create_window(&self) -> Option<VulkanWindow> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_display_create_window(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_display_find_window")]
|
||||
//fn find_window(&self, data: /*Unimplemented*/Option<Basic: Pointer>, compare_func: /*Unimplemented*/FnMut(/*Unimplemented*/Option<Basic: Pointer>) -> i32) -> Option<VulkanWindow> {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_display_find_window() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_display_get_handle")]
|
||||
//#[doc(alias = "get_handle")]
|
||||
//fn handle(&self) -> /*Unimplemented*/Option<Basic: Pointer> {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_display_get_handle() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_display_get_handle_type")]
|
||||
#[doc(alias = "get_handle_type")]
|
||||
fn handle_type(&self) -> VulkanDisplayType {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_display_get_handle_type(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_display_remove_window")]
|
||||
fn remove_window(&self, window: &impl IsA<VulkanWindow>) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_display_remove_window(
|
||||
self.as_ref().to_glib_none().0,
|
||||
window.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanDisplay>> VulkanDisplayExt for O {}
|
59
gstreamer-vulkan/src/auto/vulkan_fence.rs
Normal file
59
gstreamer-vulkan/src/auto/vulkan_fence.rs
Normal file
|
@ -0,0 +1,59 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanDevice};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct VulkanFence(Boxed<ffi::GstVulkanFence>);
|
||||
|
||||
match fn {
|
||||
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_vulkan_fence_get_type(), ptr as *mut _) as *mut ffi::GstVulkanFence,
|
||||
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_vulkan_fence_get_type(), ptr as *mut _),
|
||||
type_ => || ffi::gst_vulkan_fence_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanFence {
|
||||
#[doc(alias = "gst_vulkan_fence_new")]
|
||||
pub fn new(device: &impl IsA<VulkanDevice>) -> Result<VulkanFence, glib::Error> {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let ret = ffi::gst_vulkan_fence_new(device.as_ref().to_glib_none().0, &mut error);
|
||||
if error.is_null() {
|
||||
Ok(from_glib_full(ret))
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_fence_new_always_signalled")]
|
||||
pub fn new_always_signalled(device: &impl IsA<VulkanDevice>) -> VulkanFence {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_fence_new_always_signalled(
|
||||
device.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_fence_is_signaled")]
|
||||
pub fn is_signaled(&mut self) -> bool {
|
||||
unsafe { from_glib(ffi::gst_vulkan_fence_is_signaled(self.to_glib_none_mut().0)) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_fence_reset")]
|
||||
pub fn reset(&mut self) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_fence_reset(self.to_glib_none_mut().0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanFence {}
|
||||
unsafe impl Sync for VulkanFence {}
|
275
gstreamer-vulkan/src/auto/vulkan_full_screen_quad.rs
Normal file
275
gstreamer-vulkan/src/auto/vulkan_full_screen_quad.rs
Normal file
|
@ -0,0 +1,275 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanCommandBuffer, VulkanFence, VulkanHandle, VulkanQueue};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanFullScreenQuad")]
|
||||
pub struct VulkanFullScreenQuad(Object<ffi::GstVulkanFullScreenQuad, ffi::GstVulkanFullScreenQuadClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_full_screen_quad_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanFullScreenQuad {
|
||||
pub const NONE: Option<&'static VulkanFullScreenQuad> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_new")]
|
||||
pub fn new(queue: &impl IsA<VulkanQueue>) -> VulkanFullScreenQuad {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_full_screen_quad_new(
|
||||
queue.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanFullScreenQuad {}
|
||||
unsafe impl Sync for VulkanFullScreenQuad {}
|
||||
|
||||
pub trait VulkanFullScreenQuadExt: IsA<VulkanFullScreenQuad> + 'static {
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_draw")]
|
||||
fn draw(&self) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok =
|
||||
ffi::gst_vulkan_full_screen_quad_draw(self.as_ref().to_glib_none().0, &mut error);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_enable_blend")]
|
||||
fn enable_blend(&self, enable_blend: bool) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_full_screen_quad_enable_blend(
|
||||
self.as_ref().to_glib_none().0,
|
||||
enable_blend.into_glib(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_enable_clear")]
|
||||
fn enable_clear(&self, enable_clear: bool) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_full_screen_quad_enable_clear(
|
||||
self.as_ref().to_glib_none().0,
|
||||
enable_clear.into_glib(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_fill_command_buffer")]
|
||||
fn fill_command_buffer(
|
||||
&self,
|
||||
cmd: &mut VulkanCommandBuffer,
|
||||
fence: &mut VulkanFence,
|
||||
) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_full_screen_quad_fill_command_buffer(
|
||||
self.as_ref().to_glib_none().0,
|
||||
cmd.to_glib_none_mut().0,
|
||||
fence.to_glib_none_mut().0,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_get_last_fence")]
|
||||
#[doc(alias = "get_last_fence")]
|
||||
fn last_fence(&self) -> VulkanFence {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_full_screen_quad_get_last_fence(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_get_queue")]
|
||||
#[doc(alias = "get_queue")]
|
||||
fn queue(&self) -> Option<VulkanQueue> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_full_screen_quad_get_queue(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_prepare_draw")]
|
||||
fn prepare_draw(&self, fence: &mut VulkanFence) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_full_screen_quad_prepare_draw(
|
||||
self.as_ref().to_glib_none().0,
|
||||
fence.to_glib_none_mut().0,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_full_screen_quad_set_blend_factors")]
|
||||
//fn set_blend_factors(&self, src_blend_factor: /*Ignored*/&vulkan::BlendFactor, dst_blend_factor: /*Ignored*/&vulkan::BlendFactor, src_alpha_blend_factor: /*Ignored*/&vulkan::BlendFactor, dst_alpha_blend_factor: /*Ignored*/&vulkan::BlendFactor) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_full_screen_quad_set_blend_factors() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_full_screen_quad_set_blend_operation")]
|
||||
//fn set_blend_operation(&self, colour_blend_op: /*Ignored*/&vulkan::BlendOp, alpha_blend_op: /*Ignored*/&vulkan::BlendOp) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_full_screen_quad_set_blend_operation() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_set_index_buffer")]
|
||||
fn set_index_buffer(&self, indices: &gst::Memory, n_indices: usize) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_full_screen_quad_set_index_buffer(
|
||||
self.as_ref().to_glib_none().0,
|
||||
indices.to_glib_none().0,
|
||||
n_indices,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_set_info")]
|
||||
fn set_info(&self, in_info: &gst_video::VideoInfo, out_info: &gst_video::VideoInfo) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_full_screen_quad_set_info(
|
||||
self.as_ref().to_glib_none().0,
|
||||
in_info.to_glib_none().0,
|
||||
out_info.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_set_input_buffer")]
|
||||
fn set_input_buffer(&self, buffer: Option<&gst::Buffer>) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_full_screen_quad_set_input_buffer(
|
||||
self.as_ref().to_glib_none().0,
|
||||
buffer.to_glib_none().0,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_set_output_buffer")]
|
||||
fn set_output_buffer(&self, buffer: Option<&gst::Buffer>) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_full_screen_quad_set_output_buffer(
|
||||
self.as_ref().to_glib_none().0,
|
||||
buffer.to_glib_none().0,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_set_shaders")]
|
||||
fn set_shaders(&self, vert: &VulkanHandle, frag: &VulkanHandle) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_full_screen_quad_set_shaders(
|
||||
self.as_ref().to_glib_none().0,
|
||||
vert.to_glib_none().0,
|
||||
frag.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_set_uniform_buffer")]
|
||||
fn set_uniform_buffer(&self, uniforms: &gst::Memory) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_full_screen_quad_set_uniform_buffer(
|
||||
self.as_ref().to_glib_none().0,
|
||||
uniforms.to_glib_none().0,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_set_vertex_buffer")]
|
||||
fn set_vertex_buffer(&self, vertices: &gst::Memory) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_full_screen_quad_set_vertex_buffer(
|
||||
self.as_ref().to_glib_none().0,
|
||||
vertices.to_glib_none().0,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_full_screen_quad_submit")]
|
||||
fn submit(&self, cmd: VulkanCommandBuffer, fence: &mut VulkanFence) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_full_screen_quad_submit(
|
||||
self.as_ref().to_glib_none().0,
|
||||
cmd.into_glib_ptr(),
|
||||
fence.to_glib_none_mut().0,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanFullScreenQuad>> VulkanFullScreenQuadExt for O {}
|
62
gstreamer-vulkan/src/auto/vulkan_handle.rs
Normal file
62
gstreamer-vulkan/src/auto/vulkan_handle.rs
Normal file
|
@ -0,0 +1,62 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct VulkanHandle(Boxed<ffi::GstVulkanHandle>);
|
||||
|
||||
match fn {
|
||||
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_vulkan_handle_get_type(), ptr as *mut _) as *mut ffi::GstVulkanHandle,
|
||||
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_vulkan_handle_get_type(), ptr as *mut _),
|
||||
type_ => || ffi::gst_vulkan_handle_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanHandle {
|
||||
//#[doc(alias = "gst_vulkan_handle_new_wrapped")]
|
||||
//pub fn new_wrapped<P: FnMut(&VulkanHandle)>(device: &impl IsA<VulkanDevice>, type_: /*Ignored*/VulkanHandleType, handle: VulkanHandleTypedef, notify: P) -> VulkanHandle {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_new_wrapped() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_handle_free_descriptor_set_layout")]
|
||||
//pub fn free_descriptor_set_layout(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_free_descriptor_set_layout() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_handle_free_framebuffer")]
|
||||
//pub fn free_framebuffer(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_free_framebuffer() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_handle_free_pipeline")]
|
||||
//pub fn free_pipeline(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_free_pipeline() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_handle_free_pipeline_layout")]
|
||||
//pub fn free_pipeline_layout(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_free_pipeline_layout() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_handle_free_render_pass")]
|
||||
//pub fn free_render_pass(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_free_render_pass() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_handle_free_sampler")]
|
||||
//pub fn free_sampler(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_free_sampler() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_handle_free_shader")]
|
||||
//pub fn free_shader(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_free_shader() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanHandle {}
|
||||
unsafe impl Sync for VulkanHandle {}
|
42
gstreamer-vulkan/src/auto/vulkan_handle_pool.rs
Normal file
42
gstreamer-vulkan/src/auto/vulkan_handle_pool.rs
Normal file
|
@ -0,0 +1,42 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::prelude::*;
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanHandlePool")]
|
||||
pub struct VulkanHandlePool(Object<ffi::GstVulkanHandlePool, ffi::GstVulkanHandlePoolClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_handle_pool_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanHandlePool {
|
||||
pub const NONE: Option<&'static VulkanHandlePool> = None;
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanHandlePool {}
|
||||
unsafe impl Sync for VulkanHandlePool {}
|
||||
|
||||
pub trait VulkanHandlePoolExt: IsA<VulkanHandlePool> + 'static {
|
||||
//#[doc(alias = "gst_vulkan_handle_pool_acquire")]
|
||||
//fn acquire(&self) -> Result</*Unimplemented*/Option<Basic: Pointer>, glib::Error> {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_pool_acquire() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_handle_pool_alloc")]
|
||||
//fn alloc(&self) -> Result</*Unimplemented*/Option<Basic: Pointer>, glib::Error> {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_pool_alloc() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_handle_pool_release")]
|
||||
//fn release(&self, handle: /*Unimplemented*/Option<Basic: Pointer>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_handle_pool_release() }
|
||||
//}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanHandlePool>> VulkanHandlePoolExt for O {}
|
74
gstreamer-vulkan/src/auto/vulkan_image_buffer_pool.rs
Normal file
74
gstreamer-vulkan/src/auto/vulkan_image_buffer_pool.rs
Normal file
|
@ -0,0 +1,74 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanDevice};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanImageBufferPool")]
|
||||
pub struct VulkanImageBufferPool(Object<ffi::GstVulkanImageBufferPool, ffi::GstVulkanImageBufferPoolClass>) @extends gst::BufferPool, gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_image_buffer_pool_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanImageBufferPool {
|
||||
pub const NONE: Option<&'static VulkanImageBufferPool> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_image_buffer_pool_new")]
|
||||
pub fn new(device: &impl IsA<VulkanDevice>) -> VulkanImageBufferPool {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
gst::BufferPool::from_glib_full(ffi::gst_vulkan_image_buffer_pool_new(
|
||||
device.as_ref().to_glib_none().0,
|
||||
))
|
||||
.unsafe_cast()
|
||||
}
|
||||
}
|
||||
|
||||
//#[cfg(feature = "v1_26")]
|
||||
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
//#[doc(alias = "gst_vulkan_image_buffer_pool_config_get_allocation_params")]
|
||||
//pub fn config_get_allocation_params(config: &gst::Structure, usage: /*Ignored*/vulkan::ImageUsageFlags, mem_props: /*Ignored*/vulkan::MemoryPropertyFlags, initial_layout: /*Ignored*/vulkan::ImageLayout) -> u64 {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_image_buffer_pool_config_get_allocation_params() }
|
||||
//}
|
||||
|
||||
//#[cfg(feature = "v1_24")]
|
||||
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
//#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_allocation_params")]
|
||||
//pub fn config_set_allocation_params(config: &gst::Structure, usage: /*Ignored*/&vulkan::ImageUsageFlags, mem_properties: /*Ignored*/&vulkan::MemoryPropertyFlags, initial_layout: /*Ignored*/&vulkan::ImageLayout, initial_access: u64) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_image_buffer_pool_config_set_allocation_params() }
|
||||
//}
|
||||
|
||||
#[cfg(feature = "v1_24")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_decode_caps")]
|
||||
pub fn config_set_decode_caps(config: &gst::Structure, caps: &gst::Caps) {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
ffi::gst_vulkan_image_buffer_pool_config_set_decode_caps(
|
||||
config.to_glib_none().0,
|
||||
caps.to_glib_none().0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_encode_caps")]
|
||||
pub fn config_set_encode_caps(config: &gst::Structure, caps: &gst::Caps) {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
ffi::gst_vulkan_image_buffer_pool_config_set_encode_caps(
|
||||
config.to_glib_none().0,
|
||||
caps.to_glib_none().0,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanImageBufferPool {}
|
||||
unsafe impl Sync for VulkanImageBufferPool {}
|
22
gstreamer-vulkan/src/auto/vulkan_image_memory_allocator.rs
Normal file
22
gstreamer-vulkan/src/auto/vulkan_image_memory_allocator.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanImageMemoryAllocator")]
|
||||
pub struct VulkanImageMemoryAllocator(Object<ffi::GstVulkanImageMemoryAllocator, ffi::GstVulkanImageMemoryAllocatorClass>) @extends gst::Allocator, gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_image_memory_allocator_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanImageMemoryAllocator {
|
||||
pub const NONE: Option<&'static VulkanImageMemoryAllocator> = None;
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanImageMemoryAllocator {}
|
||||
unsafe impl Sync for VulkanImageMemoryAllocator {}
|
27
gstreamer-vulkan/src/auto/vulkan_image_view.rs
Normal file
27
gstreamer-vulkan/src/auto/vulkan_image_view.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct VulkanImageView(Boxed<ffi::GstVulkanImageView>);
|
||||
|
||||
match fn {
|
||||
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_vulkan_image_view_get_type(), ptr as *mut _) as *mut ffi::GstVulkanImageView,
|
||||
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_vulkan_image_view_get_type(), ptr as *mut _),
|
||||
type_ => || ffi::gst_vulkan_image_view_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanImageView {
|
||||
//#[doc(alias = "gst_vulkan_image_view_new")]
|
||||
//pub fn new(image: /*Ignored*/&mut VulkanImageMemory, create_info: /*Ignored*/&vulkan::ImageViewCreateInfo) -> VulkanImageView {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_image_view_new() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanImageView {}
|
||||
unsafe impl Sync for VulkanImageView {}
|
413
gstreamer-vulkan/src/auto/vulkan_instance.rs
Normal file
413
gstreamer-vulkan/src/auto/vulkan_instance.rs
Normal file
|
@ -0,0 +1,413 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanDevice};
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
use glib::object::ObjectType as _;
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
translate::*,
|
||||
};
|
||||
use std::boxed::Box as Box_;
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanInstance")]
|
||||
pub struct VulkanInstance(Object<ffi::GstVulkanInstance, ffi::GstVulkanInstanceClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_instance_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanInstance {
|
||||
pub const NONE: Option<&'static VulkanInstance> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_new")]
|
||||
pub fn new() -> VulkanInstance {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_vulkan_instance_new()) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_handle_context_query")]
|
||||
pub fn handle_context_query(
|
||||
element: &impl IsA<gst::Element>,
|
||||
query: &gst::Query,
|
||||
instance: Option<&impl IsA<VulkanInstance>>,
|
||||
) -> bool {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_instance_handle_context_query(
|
||||
element.as_ref().to_glib_none().0,
|
||||
query.to_glib_none().0,
|
||||
instance.map(|p| p.as_ref()).to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_instance_run_context_query")]
|
||||
//pub fn run_context_query(element: &impl IsA<gst::Element>, instance: impl IsA<VulkanInstance>) -> bool {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_instance_run_context_query() }
|
||||
//}
|
||||
}
|
||||
|
||||
impl Default for VulkanInstance {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanInstance {}
|
||||
unsafe impl Sync for VulkanInstance {}
|
||||
|
||||
pub trait VulkanInstanceExt: IsA<VulkanInstance> + 'static {
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_vulkan_instance_check_api_version")]
|
||||
fn check_api_version(&self, major: u32, minor: u32, patch: u32) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_instance_check_api_version(
|
||||
self.as_ref().to_glib_none().0,
|
||||
major,
|
||||
minor,
|
||||
patch,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_check_version")]
|
||||
fn check_version(&self, major: u32, minor: u32, patch: u32) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_instance_check_version(
|
||||
self.as_ref().to_glib_none().0,
|
||||
major,
|
||||
minor,
|
||||
patch,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_create_device")]
|
||||
fn create_device(&self) -> Result<VulkanDevice, glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let ret =
|
||||
ffi::gst_vulkan_instance_create_device(self.as_ref().to_glib_none().0, &mut error);
|
||||
if error.is_null() {
|
||||
Ok(from_glib_full(ret))
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_vulkan_instance_create_device_with_index")]
|
||||
fn create_device_with_index(&self, device_index: u32) -> Result<VulkanDevice, glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let ret = ffi::gst_vulkan_instance_create_device_with_index(
|
||||
self.as_ref().to_glib_none().0,
|
||||
device_index,
|
||||
&mut error,
|
||||
);
|
||||
if error.is_null() {
|
||||
Ok(from_glib_full(ret))
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_disable_extension")]
|
||||
fn disable_extension(&self, name: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_instance_disable_extension(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_enable_extension")]
|
||||
fn enable_extension(&self, name: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_instance_enable_extension(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_enable_layer")]
|
||||
fn enable_layer(&self, name: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_instance_enable_layer(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_fill_info")]
|
||||
fn fill_info(&self) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok =
|
||||
ffi::gst_vulkan_instance_fill_info(self.as_ref().to_glib_none().0, &mut error);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_vulkan_instance_get_api_version")]
|
||||
#[doc(alias = "get_api_version")]
|
||||
fn api_version(&self) -> (u32, u32, u32) {
|
||||
unsafe {
|
||||
let mut major = std::mem::MaybeUninit::uninit();
|
||||
let mut minor = std::mem::MaybeUninit::uninit();
|
||||
let mut patch = std::mem::MaybeUninit::uninit();
|
||||
ffi::gst_vulkan_instance_get_api_version(
|
||||
self.as_ref().to_glib_none().0,
|
||||
major.as_mut_ptr(),
|
||||
minor.as_mut_ptr(),
|
||||
patch.as_mut_ptr(),
|
||||
);
|
||||
(
|
||||
major.assume_init(),
|
||||
minor.assume_init(),
|
||||
patch.assume_init(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_get_extension_info")]
|
||||
#[doc(alias = "get_extension_info")]
|
||||
fn extension_info(&self, name: &str) -> Option<u32> {
|
||||
unsafe {
|
||||
let mut spec_version = std::mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_vulkan_instance_get_extension_info(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
spec_version.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(spec_version.assume_init())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_get_layer_info")]
|
||||
#[doc(alias = "get_layer_info")]
|
||||
fn layer_info(&self, name: &str) -> Option<(Option<glib::GString>, u32, u32)> {
|
||||
unsafe {
|
||||
let mut description = std::ptr::null_mut();
|
||||
let mut spec_version = std::mem::MaybeUninit::uninit();
|
||||
let mut implementation_version = std::mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_vulkan_instance_get_layer_info(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
&mut description,
|
||||
spec_version.as_mut_ptr(),
|
||||
implementation_version.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some((
|
||||
from_glib_full(description),
|
||||
spec_version.assume_init(),
|
||||
implementation_version.assume_init(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_instance_get_proc_address")]
|
||||
//#[doc(alias = "get_proc_address")]
|
||||
//fn proc_address(&self, name: &str) -> /*Unimplemented*/Option<Basic: Pointer> {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_instance_get_proc_address() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_get_version")]
|
||||
#[doc(alias = "get_version")]
|
||||
fn version(&self) -> (u32, u32, u32) {
|
||||
unsafe {
|
||||
let mut major = std::mem::MaybeUninit::uninit();
|
||||
let mut minor = std::mem::MaybeUninit::uninit();
|
||||
let mut patch = std::mem::MaybeUninit::uninit();
|
||||
ffi::gst_vulkan_instance_get_version(
|
||||
self.as_ref().to_glib_none().0,
|
||||
major.as_mut_ptr(),
|
||||
minor.as_mut_ptr(),
|
||||
patch.as_mut_ptr(),
|
||||
);
|
||||
(
|
||||
major.assume_init(),
|
||||
minor.assume_init(),
|
||||
patch.assume_init(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_is_extension_enabled")]
|
||||
fn is_extension_enabled(&self, name: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_instance_is_extension_enabled(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_is_layer_enabled")]
|
||||
fn is_layer_enabled(&self, name: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_instance_is_layer_enabled(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_instance_open")]
|
||||
fn open(&self) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_instance_open(self.as_ref().to_glib_none().0, &mut error);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "requested-api-major")]
|
||||
fn requested_api_major(&self) -> u32 {
|
||||
ObjectExt::property(self.as_ref(), "requested-api-major")
|
||||
}
|
||||
|
||||
#[doc(alias = "requested-api-major")]
|
||||
fn set_requested_api_major(&self, requested_api_major: u32) {
|
||||
ObjectExt::set_property(self.as_ref(), "requested-api-major", requested_api_major)
|
||||
}
|
||||
|
||||
#[doc(alias = "requested-api-minor")]
|
||||
fn requested_api_minor(&self) -> u32 {
|
||||
ObjectExt::property(self.as_ref(), "requested-api-minor")
|
||||
}
|
||||
|
||||
#[doc(alias = "requested-api-minor")]
|
||||
fn set_requested_api_minor(&self, requested_api_minor: u32) {
|
||||
ObjectExt::set_property(self.as_ref(), "requested-api-minor", requested_api_minor)
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "create-device")]
|
||||
fn connect_create_device<F: Fn(&Self, u32) -> VulkanDevice + Send + Sync + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn create_device_trampoline<
|
||||
P: IsA<VulkanInstance>,
|
||||
F: Fn(&P, u32) -> VulkanDevice + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanInstance,
|
||||
device_index: std::ffi::c_uint,
|
||||
f: glib::ffi::gpointer,
|
||||
) -> *mut ffi::GstVulkanDevice {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(
|
||||
VulkanInstance::from_glib_borrow(this).unsafe_cast_ref(),
|
||||
device_index,
|
||||
)
|
||||
.to_glib_full()
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"create-device".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
create_device_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "requested-api-major")]
|
||||
fn connect_requested_api_major_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_requested_api_major_trampoline<
|
||||
P: IsA<VulkanInstance>,
|
||||
F: Fn(&P) + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanInstance,
|
||||
_param_spec: glib::ffi::gpointer,
|
||||
f: glib::ffi::gpointer,
|
||||
) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(VulkanInstance::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"notify::requested-api-major".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_requested_api_major_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "requested-api-minor")]
|
||||
fn connect_requested_api_minor_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_requested_api_minor_trampoline<
|
||||
P: IsA<VulkanInstance>,
|
||||
F: Fn(&P) + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanInstance,
|
||||
_param_spec: glib::ffi::gpointer,
|
||||
f: glib::ffi::gpointer,
|
||||
) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(VulkanInstance::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"notify::requested-api-minor".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_requested_api_minor_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanInstance>> VulkanInstanceExt for O {}
|
149
gstreamer-vulkan/src/auto/vulkan_operation.rs
Normal file
149
gstreamer-vulkan/src/auto/vulkan_operation.rs
Normal file
|
@ -0,0 +1,149 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanCommandPool};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanOperation")]
|
||||
pub struct VulkanOperation(Object<ffi::GstVulkanOperation, ffi::GstVulkanOperationClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_operation_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanOperation {
|
||||
pub const NONE: Option<&'static VulkanOperation> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_operation_new")]
|
||||
pub fn new(cmd_pool: &impl IsA<VulkanCommandPool>) -> VulkanOperation {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_operation_new(
|
||||
cmd_pool.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanOperation {}
|
||||
unsafe impl Sync for VulkanOperation {}
|
||||
|
||||
pub trait VulkanOperationExt: IsA<VulkanOperation> + 'static {
|
||||
#[doc(alias = "gst_vulkan_operation_add_dependency_frame")]
|
||||
fn add_dependency_frame(
|
||||
&self,
|
||||
frame: &gst::Buffer,
|
||||
wait_stage: u64,
|
||||
signal_stage: u64,
|
||||
) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_operation_add_dependency_frame(
|
||||
self.as_ref().to_glib_none().0,
|
||||
frame.to_glib_none().0,
|
||||
wait_stage,
|
||||
signal_stage,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_operation_add_extra_image_barriers")]
|
||||
//fn add_extra_image_barriers(&self, extra_barriers: /*Unknown conversion*//*Unimplemented*/Array TypeId { ns_id: 0, id: 25 }) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_operation_add_extra_image_barriers() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_operation_add_frame_barrier")]
|
||||
//fn add_frame_barrier(&self, frame: &gst::Buffer, src_stage: u64, dst_stage: u64, new_access: u64, new_layout: /*Ignored*/&vulkan::ImageLayout, new_queue: Option<&impl IsA<VulkanQueue>>) -> bool {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_operation_add_frame_barrier() }
|
||||
//}
|
||||
|
||||
//#[cfg(feature = "v1_26")]
|
||||
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
//#[doc(alias = "gst_vulkan_operation_begin_query")]
|
||||
//fn begin_query(&self, base: /*Ignored*/&mut vulkan::BaseInStructure, id: u32) -> bool {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_operation_begin_query() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_operation_discard_dependencies")]
|
||||
fn discard_dependencies(&self) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_operation_discard_dependencies(self.as_ref().to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_operation_enable_query")]
|
||||
//fn enable_query(&self, query_type: u32, n_queries: u32, pnext: /*Unimplemented*/Option<Basic: Pointer>) -> Result<(), glib::Error> {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_operation_enable_query() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_operation_end_query")]
|
||||
fn end_query(&self, id: u32) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_operation_end_query(
|
||||
self.as_ref().to_glib_none().0,
|
||||
id,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_operation_get_query")]
|
||||
//#[doc(alias = "get_query")]
|
||||
//fn query(&self, data: /*Unimplemented*/&mut Option<Basic: Pointer>) -> Result<(), glib::Error> {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_operation_get_query() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_operation_new_extra_image_barriers")]
|
||||
//fn new_extra_image_barriers(&self) -> /*Unknown conversion*//*Unimplemented*/Array TypeId { ns_id: 0, id: 25 } {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_operation_new_extra_image_barriers() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_operation_pipeline_barrier2")]
|
||||
//fn pipeline_barrier2(&self, dependency_info: /*Unimplemented*/Option<Basic: Pointer>) -> bool {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_operation_pipeline_barrier2() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_operation_reset")]
|
||||
fn reset(&self) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_operation_reset(self.as_ref().to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_operation_retrieve_image_barriers")]
|
||||
//fn retrieve_image_barriers(&self) -> /*Unknown conversion*//*Unimplemented*/Array TypeId { ns_id: 0, id: 25 } {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_operation_retrieve_image_barriers() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_operation_update_frame")]
|
||||
//fn update_frame(&self, frame: &gst::Buffer, dst_stage: u64, new_access: u64, new_layout: /*Ignored*/&vulkan::ImageLayout, new_queue: Option<&impl IsA<VulkanQueue>>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_operation_update_frame() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_operation_use_sync2")]
|
||||
fn use_sync2(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_operation_use_sync2(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_operation_wait")]
|
||||
fn wait(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_operation_wait(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "command-pool")]
|
||||
fn command_pool(&self) -> Option<VulkanCommandPool> {
|
||||
ObjectExt::property(self.as_ref(), "command-pool")
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanOperation>> VulkanOperationExt for O {}
|
145
gstreamer-vulkan/src/auto/vulkan_physical_device.rs
Normal file
145
gstreamer-vulkan/src/auto/vulkan_physical_device.rs
Normal file
|
@ -0,0 +1,145 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanInstance};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanPhysicalDevice")]
|
||||
pub struct VulkanPhysicalDevice(Object<ffi::GstVulkanPhysicalDevice, ffi::GstVulkanPhysicalDeviceClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_physical_device_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanPhysicalDevice {
|
||||
pub const NONE: Option<&'static VulkanPhysicalDevice> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_physical_device_new")]
|
||||
pub fn new(instance: &impl IsA<VulkanInstance>, device_index: u32) -> VulkanPhysicalDevice {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_physical_device_new(
|
||||
instance.as_ref().to_glib_none().0,
|
||||
device_index,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_physical_device_type_to_string")]
|
||||
//pub fn type_to_string(type_: /*Ignored*/&vulkan::PhysicalDeviceType) -> glib::GString {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_physical_device_type_to_string() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanPhysicalDevice {}
|
||||
unsafe impl Sync for VulkanPhysicalDevice {}
|
||||
|
||||
pub trait VulkanPhysicalDeviceExt: IsA<VulkanPhysicalDevice> + 'static {
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_vulkan_physical_device_check_api_version")]
|
||||
fn check_api_version(&self, major: u32, minor: u32, patch: u32) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_physical_device_check_api_version(
|
||||
self.as_ref().to_glib_none().0,
|
||||
major,
|
||||
minor,
|
||||
patch,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_vulkan_physical_device_get_api_version")]
|
||||
#[doc(alias = "get_api_version")]
|
||||
fn api_version(&self) -> (u32, u32, u32) {
|
||||
unsafe {
|
||||
let mut major = std::mem::MaybeUninit::uninit();
|
||||
let mut minor = std::mem::MaybeUninit::uninit();
|
||||
let mut patch = std::mem::MaybeUninit::uninit();
|
||||
ffi::gst_vulkan_physical_device_get_api_version(
|
||||
self.as_ref().to_glib_none().0,
|
||||
major.as_mut_ptr(),
|
||||
minor.as_mut_ptr(),
|
||||
patch.as_mut_ptr(),
|
||||
);
|
||||
(
|
||||
major.assume_init(),
|
||||
minor.assume_init(),
|
||||
patch.assume_init(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_physical_device_get_extension_info")]
|
||||
#[doc(alias = "get_extension_info")]
|
||||
fn extension_info(&self, name: &str) -> Option<u32> {
|
||||
unsafe {
|
||||
let mut spec_version = std::mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_vulkan_physical_device_get_extension_info(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
spec_version.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(spec_version.assume_init())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_physical_device_get_handle")]
|
||||
//#[doc(alias = "get_handle")]
|
||||
//fn handle(&self) -> /*Ignored*/vulkan::PhysicalDevice {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_physical_device_get_handle() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_physical_device_get_instance")]
|
||||
#[doc(alias = "get_instance")]
|
||||
fn instance(&self) -> VulkanInstance {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_physical_device_get_instance(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_physical_device_get_layer_info")]
|
||||
#[doc(alias = "get_layer_info")]
|
||||
fn layer_info(&self, name: &str) -> Option<(Option<glib::GString>, u32, u32)> {
|
||||
unsafe {
|
||||
let mut description = std::ptr::null_mut();
|
||||
let mut spec_version = std::mem::MaybeUninit::uninit();
|
||||
let mut implementation_version = std::mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_vulkan_physical_device_get_layer_info(
|
||||
self.as_ref().to_glib_none().0,
|
||||
name.to_glib_none().0,
|
||||
&mut description,
|
||||
spec_version.as_mut_ptr(),
|
||||
implementation_version.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some((
|
||||
from_glib_full(description),
|
||||
spec_version.assume_init(),
|
||||
implementation_version.assume_init(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "device-index")]
|
||||
fn device_index(&self) -> u32 {
|
||||
ObjectExt::property(self.as_ref(), "device-index")
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanPhysicalDevice>> VulkanPhysicalDeviceExt for O {}
|
79
gstreamer-vulkan/src/auto/vulkan_queue.rs
Normal file
79
gstreamer-vulkan/src/auto/vulkan_queue.rs
Normal file
|
@ -0,0 +1,79 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanCommandPool, VulkanDevice};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanQueue")]
|
||||
pub struct VulkanQueue(Object<ffi::GstVulkanQueue, ffi::GstVulkanQueueClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_queue_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanQueue {
|
||||
pub const NONE: Option<&'static VulkanQueue> = None;
|
||||
|
||||
//#[doc(alias = "gst_vulkan_queue_flags_to_string")]
|
||||
//pub fn flags_to_string(queue_bits: /*Ignored*/&vulkan::QueueFlags) -> glib::GString {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_queue_flags_to_string() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_queue_handle_context_query")]
|
||||
pub fn handle_context_query(
|
||||
element: &impl IsA<gst::Element>,
|
||||
query: &gst::Query,
|
||||
queue: Option<&impl IsA<VulkanQueue>>,
|
||||
) -> bool {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_queue_handle_context_query(
|
||||
element.as_ref().to_glib_none().0,
|
||||
query.to_glib_none().0,
|
||||
queue.map(|p| p.as_ref()).to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_queue_run_context_query")]
|
||||
//pub fn run_context_query(element: &impl IsA<gst::Element>, queue: impl IsA<VulkanQueue>) -> bool {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_queue_run_context_query() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanQueue {}
|
||||
unsafe impl Sync for VulkanQueue {}
|
||||
|
||||
pub trait VulkanQueueExt: IsA<VulkanQueue> + 'static {
|
||||
#[doc(alias = "gst_vulkan_queue_create_command_pool")]
|
||||
fn create_command_pool(&self) -> Result<VulkanCommandPool, glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let ret = ffi::gst_vulkan_queue_create_command_pool(
|
||||
self.as_ref().to_glib_none().0,
|
||||
&mut error,
|
||||
);
|
||||
if error.is_null() {
|
||||
Ok(from_glib_full(ret))
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_queue_get_device")]
|
||||
#[doc(alias = "get_device")]
|
||||
fn device(&self) -> Option<VulkanDevice> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_queue_get_device(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanQueue>> VulkanQueueExt for O {}
|
162
gstreamer-vulkan/src/auto/vulkan_swapper.rs
Normal file
162
gstreamer-vulkan/src/auto/vulkan_swapper.rs
Normal file
|
@ -0,0 +1,162 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanDevice, VulkanQueue, VulkanWindow};
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
translate::*,
|
||||
};
|
||||
use std::boxed::Box as Box_;
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanSwapper")]
|
||||
pub struct VulkanSwapper(Object<ffi::GstVulkanSwapper, ffi::GstVulkanSwapperClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_swapper_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanSwapper {
|
||||
pub const NONE: Option<&'static VulkanSwapper> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_swapper_new")]
|
||||
pub fn new(device: &impl IsA<VulkanDevice>, window: &impl IsA<VulkanWindow>) -> VulkanSwapper {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_none(ffi::gst_vulkan_swapper_new(
|
||||
device.as_ref().to_glib_none().0,
|
||||
window.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanSwapper {}
|
||||
unsafe impl Sync for VulkanSwapper {}
|
||||
|
||||
pub trait VulkanSwapperExt: IsA<VulkanSwapper> + 'static {
|
||||
#[doc(alias = "gst_vulkan_swapper_choose_queue")]
|
||||
fn choose_queue(
|
||||
&self,
|
||||
available_queue: Option<&impl IsA<VulkanQueue>>,
|
||||
) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_swapper_choose_queue(
|
||||
self.as_ref().to_glib_none().0,
|
||||
available_queue.map(|p| p.as_ref()).to_glib_none().0,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_swapper_get_supported_caps")]
|
||||
#[doc(alias = "get_supported_caps")]
|
||||
fn supported_caps(&self) -> Result<gst::Caps, glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let ret = ffi::gst_vulkan_swapper_get_supported_caps(
|
||||
self.as_ref().to_glib_none().0,
|
||||
&mut error,
|
||||
);
|
||||
if error.is_null() {
|
||||
Ok(from_glib_full(ret))
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_swapper_get_surface_rectangles")]
|
||||
//#[doc(alias = "get_surface_rectangles")]
|
||||
//fn surface_rectangles(&self, input_image: /*Ignored*/Option<gst_video::VideoRectangle>, surface_location: /*Ignored*/Option<gst_video::VideoRectangle>, display_rect: /*Ignored*/Option<gst_video::VideoRectangle>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_swapper_get_surface_rectangles() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_swapper_render_buffer")]
|
||||
fn render_buffer(&self, buffer: &gst::Buffer) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_swapper_render_buffer(
|
||||
self.as_ref().to_glib_none().0,
|
||||
buffer.to_glib_none().0,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_swapper_set_caps")]
|
||||
fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_swapper_set_caps(
|
||||
self.as_ref().to_glib_none().0,
|
||||
caps.to_glib_none().0,
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "force-aspect-ratio")]
|
||||
fn is_force_aspect_ratio(&self) -> bool {
|
||||
ObjectExt::property(self.as_ref(), "force-aspect-ratio")
|
||||
}
|
||||
|
||||
#[doc(alias = "force-aspect-ratio")]
|
||||
fn set_force_aspect_ratio(&self, force_aspect_ratio: bool) {
|
||||
ObjectExt::set_property(self.as_ref(), "force-aspect-ratio", force_aspect_ratio)
|
||||
}
|
||||
|
||||
#[doc(alias = "force-aspect-ratio")]
|
||||
fn connect_force_aspect_ratio_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_force_aspect_ratio_trampoline<
|
||||
P: IsA<VulkanSwapper>,
|
||||
F: Fn(&P) + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanSwapper,
|
||||
_param_spec: glib::ffi::gpointer,
|
||||
f: glib::ffi::gpointer,
|
||||
) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(VulkanSwapper::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"notify::force-aspect-ratio".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_force_aspect_ratio_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanSwapper>> VulkanSwapperExt for O {}
|
65
gstreamer-vulkan/src/auto/vulkan_trash.rs
Normal file
65
gstreamer-vulkan/src/auto/vulkan_trash.rs
Normal file
|
@ -0,0 +1,65 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanDevice, VulkanFence};
|
||||
use glib::translate::*;
|
||||
use std::boxed::Box as Box_;
|
||||
|
||||
glib::wrapper! {
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct VulkanTrash(Boxed<ffi::GstVulkanTrash>);
|
||||
|
||||
match fn {
|
||||
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_vulkan_trash_get_type(), ptr as *mut _) as *mut ffi::GstVulkanTrash,
|
||||
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_vulkan_trash_get_type(), ptr as *mut _),
|
||||
type_ => || ffi::gst_vulkan_trash_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanTrash {
|
||||
#[doc(alias = "gst_vulkan_trash_new")]
|
||||
pub fn new<P: FnOnce(&VulkanDevice) + Send + Sync + 'static>(
|
||||
fence: &mut VulkanFence,
|
||||
notify: P,
|
||||
) -> VulkanTrash {
|
||||
assert_initialized_main_thread!();
|
||||
let notify_data: Box_<P> = Box_::new(notify);
|
||||
unsafe extern "C" fn notify_func<P: FnOnce(&VulkanDevice) + Send + Sync + 'static>(
|
||||
device: *mut ffi::GstVulkanDevice,
|
||||
user_data: glib::ffi::gpointer,
|
||||
) {
|
||||
let device = from_glib_borrow(device);
|
||||
let callback = Box_::from_raw(user_data as *mut P);
|
||||
(*callback)(&device)
|
||||
}
|
||||
let notify = Some(notify_func::<P> as _);
|
||||
let super_callback0: Box_<P> = notify_data;
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_trash_new(
|
||||
fence.to_glib_none_mut().0,
|
||||
notify,
|
||||
Box_::into_raw(super_callback0) as *mut _,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_trash_new_free_semaphore")]
|
||||
//pub fn new_free_semaphore(fence: &mut VulkanFence, semaphore: /*Ignored*/&vulkan::Semaphore) -> VulkanTrash {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_trash_new_free_semaphore() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_trash_mini_object_unref")]
|
||||
//pub fn mini_object_unref(device: &impl IsA<VulkanDevice>, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_trash_mini_object_unref() }
|
||||
//}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_trash_object_unref")]
|
||||
//pub fn object_unref(device: &impl IsA<VulkanDevice>, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_trash_object_unref() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanTrash {}
|
||||
unsafe impl Sync for VulkanTrash {}
|
69
gstreamer-vulkan/src/auto/vulkan_video_filter.rs
Normal file
69
gstreamer-vulkan/src/auto/vulkan_video_filter.rs
Normal file
|
@ -0,0 +1,69 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
use crate::{VulkanDevice, VulkanInstance, VulkanQueue};
|
||||
use glib::prelude::*;
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
use glib::translate::*;
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanVideoFilter")]
|
||||
pub struct VulkanVideoFilter(Object<ffi::GstVulkanVideoFilter, ffi::GstVulkanVideoFilterClass>) @extends gst_base::BaseTransform, gst::Element, gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_video_filter_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanVideoFilter {
|
||||
pub const NONE: Option<&'static VulkanVideoFilter> = None;
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanVideoFilter {}
|
||||
unsafe impl Sync for VulkanVideoFilter {}
|
||||
|
||||
pub trait VulkanVideoFilterExt: IsA<VulkanVideoFilter> + 'static {
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_vulkan_video_filter_get_device")]
|
||||
#[doc(alias = "get_device")]
|
||||
fn device(&self) -> Option<VulkanDevice> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_video_filter_get_device(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_vulkan_video_filter_get_instance")]
|
||||
#[doc(alias = "get_instance")]
|
||||
fn instance(&self) -> Option<VulkanInstance> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_video_filter_get_instance(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
|
||||
#[doc(alias = "gst_vulkan_video_filter_get_queue")]
|
||||
#[doc(alias = "get_queue")]
|
||||
fn queue(&self) -> Option<VulkanQueue> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_video_filter_get_queue(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanVideoFilter>> VulkanVideoFilterExt for O {}
|
349
gstreamer-vulkan/src/auto/vulkan_window.rs
Normal file
349
gstreamer-vulkan/src/auto/vulkan_window.rs
Normal file
|
@ -0,0 +1,349 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::{ffi, VulkanDevice, VulkanDisplay};
|
||||
use glib::{
|
||||
object::ObjectType as _,
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
translate::*,
|
||||
};
|
||||
use std::boxed::Box as Box_;
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanWindow")]
|
||||
pub struct VulkanWindow(Object<ffi::GstVulkanWindow, ffi::GstVulkanWindowClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_window_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanWindow {
|
||||
pub const NONE: Option<&'static VulkanWindow> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_window_new")]
|
||||
pub fn new(display: &impl IsA<VulkanDisplay>) -> VulkanWindow {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_window_new(
|
||||
display.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanWindow {}
|
||||
unsafe impl Sync for VulkanWindow {}
|
||||
|
||||
pub trait VulkanWindowExt: IsA<VulkanWindow> + 'static {
|
||||
#[doc(alias = "gst_vulkan_window_close")]
|
||||
fn close(&self) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_window_close(self.as_ref().to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_window_get_display")]
|
||||
#[doc(alias = "get_display")]
|
||||
fn display(&self) -> VulkanDisplay {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_vulkan_window_get_display(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_window_get_presentation_support")]
|
||||
#[doc(alias = "get_presentation_support")]
|
||||
fn is_presentation_support(
|
||||
&self,
|
||||
device: &impl IsA<VulkanDevice>,
|
||||
queue_family_idx: u32,
|
||||
) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_window_get_presentation_support(
|
||||
self.as_ref().to_glib_none().0,
|
||||
device.as_ref().to_glib_none().0,
|
||||
queue_family_idx,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_window_get_surface")]
|
||||
//#[doc(alias = "get_surface")]
|
||||
//fn surface(&self) -> Result</*Ignored*/vulkan::SurfaceKHR, glib::Error> {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_window_get_surface() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_vulkan_window_get_surface_dimensions")]
|
||||
#[doc(alias = "get_surface_dimensions")]
|
||||
fn surface_dimensions(&self) -> (u32, u32) {
|
||||
unsafe {
|
||||
let mut width = std::mem::MaybeUninit::uninit();
|
||||
let mut height = std::mem::MaybeUninit::uninit();
|
||||
ffi::gst_vulkan_window_get_surface_dimensions(
|
||||
self.as_ref().to_glib_none().0,
|
||||
width.as_mut_ptr(),
|
||||
height.as_mut_ptr(),
|
||||
);
|
||||
(width.assume_init(), height.assume_init())
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_window_handle_events")]
|
||||
fn handle_events(&self, handle_events: bool) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_window_handle_events(
|
||||
self.as_ref().to_glib_none().0,
|
||||
handle_events.into_glib(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_window_open")]
|
||||
fn open(&self) -> Result<(), glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_window_open(self.as_ref().to_glib_none().0, &mut error);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_window_redraw")]
|
||||
fn redraw(&self) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_window_redraw(self.as_ref().to_glib_none().0);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_window_resize")]
|
||||
fn resize(&self, width: i32, height: i32) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_window_resize(self.as_ref().to_glib_none().0, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_window_send_key_event")]
|
||||
fn send_key_event(&self, event_type: &str, key_str: &str) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_window_send_key_event(
|
||||
self.as_ref().to_glib_none().0,
|
||||
event_type.to_glib_none().0,
|
||||
key_str.to_glib_none().0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_vulkan_window_send_mouse_event")]
|
||||
fn send_mouse_event(&self, event_type: &str, button: i32, posx: f64, posy: f64) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_window_send_mouse_event(
|
||||
self.as_ref().to_glib_none().0,
|
||||
event_type.to_glib_none().0,
|
||||
button,
|
||||
posx,
|
||||
posy,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_window_set_window_handle")]
|
||||
//fn set_window_handle(&self, handle: /*Unimplemented*/Basic: UIntPtr) {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_window_set_window_handle() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "close")]
|
||||
fn connect_close<F: Fn(&Self) -> bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn close_trampoline<
|
||||
P: IsA<VulkanWindow>,
|
||||
F: Fn(&P) -> bool + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanWindow,
|
||||
f: glib::ffi::gpointer,
|
||||
) -> glib::ffi::gboolean {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(VulkanWindow::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"close".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
close_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "draw")]
|
||||
fn connect_draw<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn draw_trampoline<
|
||||
P: IsA<VulkanWindow>,
|
||||
F: Fn(&P) + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanWindow,
|
||||
f: glib::ffi::gpointer,
|
||||
) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(VulkanWindow::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"draw".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
draw_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "key-event")]
|
||||
fn connect_key_event<F: Fn(&Self, &str, &str) + Send + Sync + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn key_event_trampoline<
|
||||
P: IsA<VulkanWindow>,
|
||||
F: Fn(&P, &str, &str) + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanWindow,
|
||||
id: *mut std::ffi::c_char,
|
||||
key: *mut std::ffi::c_char,
|
||||
f: glib::ffi::gpointer,
|
||||
) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(
|
||||
VulkanWindow::from_glib_borrow(this).unsafe_cast_ref(),
|
||||
&glib::GString::from_glib_borrow(id),
|
||||
&glib::GString::from_glib_borrow(key),
|
||||
)
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"key-event".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
key_event_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "mouse-event")]
|
||||
fn connect_mouse_event<F: Fn(&Self, &str, i32, f64, f64) + Send + Sync + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn mouse_event_trampoline<
|
||||
P: IsA<VulkanWindow>,
|
||||
F: Fn(&P, &str, i32, f64, f64) + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanWindow,
|
||||
id: *mut std::ffi::c_char,
|
||||
button: std::ffi::c_int,
|
||||
x: std::ffi::c_double,
|
||||
y: std::ffi::c_double,
|
||||
f: glib::ffi::gpointer,
|
||||
) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(
|
||||
VulkanWindow::from_glib_borrow(this).unsafe_cast_ref(),
|
||||
&glib::GString::from_glib_borrow(id),
|
||||
button,
|
||||
x,
|
||||
y,
|
||||
)
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"mouse-event".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
mouse_event_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "resize")]
|
||||
fn connect_resize<F: Fn(&Self, u32, u32) + Send + Sync + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn resize_trampoline<
|
||||
P: IsA<VulkanWindow>,
|
||||
F: Fn(&P, u32, u32) + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanWindow,
|
||||
object: std::ffi::c_uint,
|
||||
p0: std::ffi::c_uint,
|
||||
f: glib::ffi::gpointer,
|
||||
) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(
|
||||
VulkanWindow::from_glib_borrow(this).unsafe_cast_ref(),
|
||||
object,
|
||||
p0,
|
||||
)
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"resize".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
resize_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "display")]
|
||||
fn connect_display_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_display_trampoline<
|
||||
P: IsA<VulkanWindow>,
|
||||
F: Fn(&P) + Send + Sync + 'static,
|
||||
>(
|
||||
this: *mut ffi::GstVulkanWindow,
|
||||
_param_spec: glib::ffi::gpointer,
|
||||
f: glib::ffi::gpointer,
|
||||
) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(VulkanWindow::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
c"notify::display".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_display_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<VulkanWindow>> VulkanWindowExt for O {}
|
9
gstreamer-vulkan/src/caps_features.rs
Normal file
9
gstreamer-vulkan/src/caps_features.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
use gst::CapsFeatures;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static CAPS_FEATURE_MEMORY_VULKAN_IMAGE: &glib::GStr =
|
||||
unsafe { glib::GStr::from_utf8_with_nul_unchecked(ffi::GST_CAPS_FEATURE_MEMORY_VULKAN_IMAGE) };
|
||||
pub static CAPS_FEATURES_MEMORY_VULKAN_IMAGE: Lazy<CapsFeatures> =
|
||||
Lazy::new(|| CapsFeatures::new([CAPS_FEATURE_MEMORY_VULKAN_IMAGE]));
|
60
gstreamer-vulkan/src/lib.rs
Normal file
60
gstreamer-vulkan/src/lib.rs
Normal file
|
@ -0,0 +1,60 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![allow(clippy::missing_safety_doc)]
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
pub use ffi;
|
||||
pub use glib;
|
||||
pub use gst;
|
||||
pub use gst_base;
|
||||
pub use gst_video;
|
||||
|
||||
macro_rules! assert_initialized_main_thread {
|
||||
() => {
|
||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||
gst::assert_initialized();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! skip_assert_initialized {
|
||||
() => {};
|
||||
}
|
||||
|
||||
mod auto;
|
||||
pub use crate::auto::*;
|
||||
|
||||
mod vulkan_command_pool;
|
||||
mod vulkan_device;
|
||||
#[cfg(feature = "v1_26_4")]
|
||||
mod vulkan_full_screen_quad;
|
||||
#[cfg(feature = "v1_24")]
|
||||
mod vulkan_operation;
|
||||
mod vulkan_queue;
|
||||
mod vulkan_swapper;
|
||||
mod vulkan_utils;
|
||||
|
||||
// Re-export all the traits in a prelude module, so that applications
|
||||
// can always "use gst_vulkan::prelude::*" without getting conflicts
|
||||
pub mod prelude {
|
||||
#[doc(hidden)]
|
||||
pub use gst_video::prelude::*;
|
||||
|
||||
pub use super::vulkan_command_pool::VulkanCommandPoolExtManual;
|
||||
pub use super::vulkan_device::VulkanDeviceExtManual;
|
||||
#[cfg(feature = "v1_26_4")]
|
||||
pub use super::vulkan_full_screen_quad::VulkanFullScreenQuadExtManual;
|
||||
#[cfg(feature = "v1_24")]
|
||||
pub use super::vulkan_operation::VulkanOperationExtManual;
|
||||
pub use super::vulkan_queue::VulkanQueueExtManual;
|
||||
pub use super::vulkan_swapper::VulkanSwapperExtManual;
|
||||
pub use crate::auto::traits::*;
|
||||
}
|
||||
|
||||
pub mod subclass;
|
||||
|
||||
mod caps_features;
|
||||
pub use caps_features::*;
|
||||
|
||||
pub use vulkan_utils::context_query;
|
8
gstreamer-vulkan/src/subclass/mod.rs
Normal file
8
gstreamer-vulkan/src/subclass/mod.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
mod vulkan_video_filter;
|
||||
|
||||
pub mod prelude {
|
||||
#[doc(hidden)]
|
||||
pub use gst_video::subclass::prelude::*;
|
||||
|
||||
pub use super::vulkan_video_filter::{VulkanVideoFilterImpl, VulkanVideoFilterImplExt};
|
||||
}
|
17
gstreamer-vulkan/src/subclass/vulkan_video_filter.rs
Normal file
17
gstreamer-vulkan/src/subclass/vulkan_video_filter.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
use crate::VulkanVideoFilter;
|
||||
|
||||
use gst::subclass::prelude::*;
|
||||
use gst_base::subclass::prelude::*;
|
||||
|
||||
pub trait VulkanVideoFilterImpl: VulkanVideoFilterImplExt + BaseTransformImpl {}
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
impl<T: super::VulkanVideoFilterImplExt> Sealed for T {}
|
||||
}
|
||||
|
||||
pub trait VulkanVideoFilterImplExt: sealed::Sealed + ObjectSubclass {}
|
||||
|
||||
impl<T: VulkanVideoFilterImpl> VulkanVideoFilterImplExt for T {}
|
||||
|
||||
unsafe impl<T: VulkanVideoFilterImpl> IsSubclassable<T> for VulkanVideoFilter {}
|
42
gstreamer-vulkan/src/vulkan_command_pool.rs
Normal file
42
gstreamer-vulkan/src/vulkan_command_pool.rs
Normal file
|
@ -0,0 +1,42 @@
|
|||
use crate::VulkanCommandPool;
|
||||
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
impl<T: super::IsA<super::VulkanCommandPool>> Sealed for T {}
|
||||
}
|
||||
|
||||
/// Represents a locked VulkanCommandPool. The command pool is unlocked when this struct is dropped.
|
||||
#[derive(Debug)]
|
||||
pub struct VulkanCommandPoolGuard<'a> {
|
||||
obj: &'a VulkanCommandPool,
|
||||
}
|
||||
|
||||
impl Drop for VulkanCommandPoolGuard<'_> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_command_pool_unlock(self.obj.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq for VulkanCommandPoolGuard<'_> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.obj == other.obj
|
||||
}
|
||||
}
|
||||
impl Eq for VulkanCommandPoolGuard<'_> {}
|
||||
|
||||
pub trait VulkanCommandPoolExtManual: sealed::Sealed + IsA<VulkanCommandPool> + 'static {
|
||||
/// Locks the command pool. A struct similar to `MutexGuard` is retured that unlocks the command pool once dropped.
|
||||
#[doc(alias = "gst_vulkan_command_pool_lock")]
|
||||
fn lock<'a>(&'a self) -> VulkanCommandPoolGuard<'a> {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_command_pool_lock(self.as_ref().to_glib_none().0);
|
||||
}
|
||||
VulkanCommandPoolGuard {
|
||||
obj: self.upcast_ref(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<O: IsA<VulkanCommandPool>> VulkanCommandPoolExtManual for O {}
|
30
gstreamer-vulkan/src/vulkan_device.rs
Normal file
30
gstreamer-vulkan/src/vulkan_device.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
use crate::VulkanDevice;
|
||||
|
||||
use glib::prelude::*;
|
||||
use glib::translate::*;
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
impl<T: super::IsA<super::VulkanDevice>> Sealed for T {}
|
||||
}
|
||||
|
||||
pub trait VulkanDeviceExtManual: sealed::Sealed + IsA<VulkanDevice> + 'static {
|
||||
fn create_shader(&self, code: &[u8]) -> Result<crate::VulkanHandle, glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let shader = crate::ffi::gst_vulkan_create_shader(
|
||||
self.as_ref().to_glib_none().0,
|
||||
code.as_ptr() as *const i8,
|
||||
code.len(),
|
||||
&mut error,
|
||||
);
|
||||
debug_assert_eq!(shader.is_null(), !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(crate::VulkanHandle::from_glib_full(shader))
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<O: IsA<VulkanDevice>> VulkanDeviceExtManual for O {}
|
24
gstreamer-vulkan/src/vulkan_full_screen_quad.rs
Normal file
24
gstreamer-vulkan/src/vulkan_full_screen_quad.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
use crate::VulkanFullScreenQuad;
|
||||
|
||||
use crate::traits::VulkanFullScreenQuadExt;
|
||||
|
||||
use glib::prelude::*;
|
||||
use glib::translate::*;
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
impl<T: super::IsA<super::VulkanFullScreenQuad>> Sealed for T {}
|
||||
}
|
||||
|
||||
pub trait VulkanFullScreenQuadExtManual:
|
||||
sealed::Sealed + IsA<VulkanFullScreenQuad> + 'static
|
||||
{
|
||||
fn draw_into_output(&self, outbuf: &mut gst::BufferRef) -> Result<(), glib::Error> {
|
||||
let out = unsafe { gst::Buffer::from_glib_borrow(outbuf.as_ptr()) };
|
||||
self.set_output_buffer(Some(&out))?;
|
||||
let ret = self.draw();
|
||||
self.set_output_buffer(None)?;
|
||||
ret
|
||||
}
|
||||
}
|
||||
impl<O: IsA<VulkanFullScreenQuad>> VulkanFullScreenQuadExtManual for O {}
|
66
gstreamer-vulkan/src/vulkan_operation.rs
Normal file
66
gstreamer-vulkan/src/vulkan_operation.rs
Normal file
|
@ -0,0 +1,66 @@
|
|||
use super::VulkanOperation;
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
impl<T: super::IsA<super::VulkanOperation>> Sealed for T {}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[must_use = "Need to call `end`, otherwise drop will panic."]
|
||||
pub struct VulkanOperationGuard<'a> {
|
||||
obj: &'a VulkanOperation,
|
||||
ended: bool,
|
||||
}
|
||||
|
||||
impl VulkanOperationGuard<'_> {
|
||||
pub fn end(mut self) -> Result<(), glib::Error> {
|
||||
self.ended = true;
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_operation_end(self.obj.to_glib_none().0, &mut error);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if error.is_null() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(from_glib_full(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for VulkanOperationGuard<'_> {
|
||||
fn drop(&mut self) {
|
||||
if !self.ended {
|
||||
panic!("Dropped a VulkanOperationGuard without calling `end`.")
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq for VulkanOperationGuard<'_> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.obj == other.obj
|
||||
}
|
||||
}
|
||||
impl Eq for VulkanOperationGuard<'_> {}
|
||||
|
||||
pub trait VulkanOperationExtManual: sealed::Sealed + IsA<VulkanOperation> + 'static {
|
||||
/// Returns a guard struct for the begun operation.
|
||||
/// The `end` method on the guard **must** be called; Dropping it without results in a panic
|
||||
#[doc(alias = "gst_vulkan_operation_begin")]
|
||||
#[must_use]
|
||||
fn begin<'a>(&'a self) -> Result<VulkanOperationGuard<'a>, glib::Error> {
|
||||
unsafe {
|
||||
let mut error = std::ptr::null_mut();
|
||||
let is_ok = ffi::gst_vulkan_operation_begin(self.as_ref().to_glib_none().0, &mut error);
|
||||
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
|
||||
if !error.is_null() {
|
||||
return Err(from_glib_full(error));
|
||||
}
|
||||
}
|
||||
Ok(VulkanOperationGuard {
|
||||
obj: self.upcast_ref(),
|
||||
ended: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<O: IsA<VulkanOperation>> VulkanOperationExtManual for O {}
|
42
gstreamer-vulkan/src/vulkan_queue.rs
Normal file
42
gstreamer-vulkan/src/vulkan_queue.rs
Normal file
|
@ -0,0 +1,42 @@
|
|||
use crate::VulkanQueue;
|
||||
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
impl<T: super::IsA<super::VulkanQueue>> Sealed for T {}
|
||||
}
|
||||
|
||||
/// Represents a locked vulkan queue that can be submitted too. The queue is unlock when this struct is dropped.
|
||||
#[derive(Debug)]
|
||||
pub struct VulkanQueueSubmitGuard<'a> {
|
||||
obj: &'a VulkanQueue,
|
||||
}
|
||||
|
||||
impl Drop for VulkanQueueSubmitGuard<'_> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_queue_submit_unlock(self.obj.to_glib_none().0);
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq for VulkanQueueSubmitGuard<'_> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.obj == other.obj
|
||||
}
|
||||
}
|
||||
impl Eq for VulkanQueueSubmitGuard<'_> {}
|
||||
|
||||
pub trait VulkanQueueExtManual: sealed::Sealed + IsA<VulkanQueue> + 'static {
|
||||
/// Locks the vulkan queue for submission. A struct similar to `MutexGuard` is retured that unlocks the queue once dropped.
|
||||
#[doc(alias = "gst_vulkan_queue_submit_lock")]
|
||||
fn submit_lock<'a>(&'a self) -> VulkanQueueSubmitGuard<'a> {
|
||||
unsafe {
|
||||
ffi::gst_vulkan_queue_submit_lock(self.as_ref().to_glib_none().0);
|
||||
}
|
||||
VulkanQueueSubmitGuard {
|
||||
obj: self.upcast_ref(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<O: IsA<VulkanQueue>> VulkanQueueExtManual for O {}
|
21
gstreamer-vulkan/src/vulkan_swapper.rs
Normal file
21
gstreamer-vulkan/src/vulkan_swapper.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use crate::VulkanSwapper;
|
||||
|
||||
use glib::prelude::*;
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
impl<T: super::IsA<super::VulkanSwapper>> Sealed for T {}
|
||||
}
|
||||
|
||||
pub trait VulkanSwapperExtManual: sealed::Sealed + IsA<VulkanSwapper> + 'static {
|
||||
#[doc(alias = "pixel-aspect-ratio")]
|
||||
fn is_force_aspect_ratio(&self) -> gst::Fraction {
|
||||
ObjectExt::property(self.as_ref(), "pixel-aspect-ratio")
|
||||
}
|
||||
|
||||
#[doc(alias = "pixel-aspect-ratio")]
|
||||
fn set_force_aspect_ratio(&self, pixel_aspect_ratio: gst::Fraction) {
|
||||
ObjectExt::set_property(self.as_ref(), "pixel-aspect-ratio", pixel_aspect_ratio)
|
||||
}
|
||||
}
|
||||
impl<O: IsA<VulkanSwapper>> VulkanSwapperExtManual for O {}
|
26
gstreamer-vulkan/src/vulkan_utils.rs
Normal file
26
gstreamer-vulkan/src/vulkan_utils.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
use glib::prelude::*;
|
||||
use glib::translate::*;
|
||||
|
||||
use crate::VulkanDevice;
|
||||
use crate::VulkanDisplay;
|
||||
use crate::VulkanInstance;
|
||||
|
||||
#[doc(alias = "gst_vulkan_handle_context_query")]
|
||||
pub fn context_query(
|
||||
element: &impl IsA<gst::Element>,
|
||||
query: &gst::Query,
|
||||
display: Option<&impl IsA<VulkanDisplay>>,
|
||||
instance: Option<&impl IsA<VulkanInstance>>,
|
||||
device: Option<&impl IsA<VulkanDevice>>,
|
||||
) -> bool {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_vulkan_handle_context_query(
|
||||
element.as_ref().to_glib_none().0,
|
||||
query.to_glib_none().0,
|
||||
display.map(|p| p.as_ref()).to_glib_none().0,
|
||||
instance.map(|p| p.as_ref()).to_glib_none().0,
|
||||
device.map(|p| p.as_ref()).to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
1
gstreamer-vulkan/sys/CHANGELOG.md
Symbolic link
1
gstreamer-vulkan/sys/CHANGELOG.md
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../gstreamer/CHANGELOG.md
|
1
gstreamer-vulkan/sys/COPYRIGHT
Symbolic link
1
gstreamer-vulkan/sys/COPYRIGHT
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../COPYRIGHT
|
100
gstreamer-vulkan/sys/Cargo.toml
Normal file
100
gstreamer-vulkan/sys/Cargo.toml
Normal file
|
@ -0,0 +1,100 @@
|
|||
[build-dependencies]
|
||||
system-deps = "7"
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
[dependencies.glib-sys]
|
||||
workspace = true
|
||||
|
||||
[dependencies.gobject-sys]
|
||||
workspace = true
|
||||
|
||||
[dependencies.gstreamer-sys]
|
||||
workspace = true
|
||||
|
||||
[dependencies.gstreamer-base-sys]
|
||||
workspace = true
|
||||
|
||||
[dependencies.gstreamer-video-sys]
|
||||
workspace = true
|
||||
|
||||
[dependencies.ash]
|
||||
version = "0.38"
|
||||
|
||||
[dev-dependencies]
|
||||
shell-words = "1.0.0"
|
||||
tempfile = "3"
|
||||
|
||||
[features]
|
||||
v1_18 = []
|
||||
v1_20 = []
|
||||
v1_22 = ["v1_20"]
|
||||
v1_24 = ["v1_22"]
|
||||
v1_26 = ["v1_24"]
|
||||
v1_26_4 = ["v1_26"]
|
||||
v1_28 = ["v1_26_4"]
|
||||
|
||||
[lib]
|
||||
name = "gstreamer_vulkan_sys"
|
||||
|
||||
[package]
|
||||
authors = ["Matthew Waters <matthew@centricular.com>"]
|
||||
build = "build.rs"
|
||||
description = "FFI bindings to libgstvulkan-1.0"
|
||||
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_vulkan_sys/"
|
||||
keywords = ["ffi", "gstreamer", "gnome", "multimedia"]
|
||||
license = "MIT"
|
||||
name = "gstreamer-vulkan-sys"
|
||||
readme = "README.md"
|
||||
|
||||
[package.version]
|
||||
workspace = true
|
||||
|
||||
[package.categories]
|
||||
workspace = true
|
||||
|
||||
[package.repository]
|
||||
workspace = true
|
||||
|
||||
[package.homepage]
|
||||
workspace = true
|
||||
|
||||
[package.edition]
|
||||
workspace = true
|
||||
|
||||
[package.rust-version]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_1_0]
|
||||
name = "gstreamer-vulkan-1.0"
|
||||
version = "1.14"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_16]
|
||||
version = "1.16"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_18]
|
||||
version = "1.18"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_20]
|
||||
version = "1.20"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_22]
|
||||
version = "1.22"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_24]
|
||||
version = "1.24"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_26]
|
||||
version = "1.26"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_26_4]
|
||||
version = "1.26.4"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_28]
|
||||
version = "1.27"
|
40
gstreamer-vulkan/sys/Gir.toml
Normal file
40
gstreamer-vulkan/sys/Gir.toml
Normal file
|
@ -0,0 +1,40 @@
|
|||
[options]
|
||||
girs_directories = ["../../gir-files", "../../gst-gir-files"]
|
||||
library = "GstVulkan"
|
||||
version = "1.0"
|
||||
min_cfg_version = "1.18"
|
||||
work_mode = "sys"
|
||||
single_version_file = true
|
||||
|
||||
extra_versions = [
|
||||
"1.24",
|
||||
"1.22",
|
||||
"1.20",
|
||||
]
|
||||
|
||||
ignore = [
|
||||
]
|
||||
|
||||
external_libraries = [
|
||||
"GLib",
|
||||
"GObject",
|
||||
]
|
||||
|
||||
[external_libraries]
|
||||
gstreamer="Gst"
|
||||
gstreamer-base="GstBase"
|
||||
gstreamer-video="GstVideo"
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkan.VulkanBufferMemory"
|
||||
status = "generate"
|
||||
[[object.function]]
|
||||
name = "get_type"
|
||||
version = "1.18"
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkan.VulkanImageMemory"
|
||||
status = "generate"
|
||||
[[object.function]]
|
||||
name = "get_type"
|
||||
version = "1.18"
|
1
gstreamer-vulkan/sys/LICENSE
Symbolic link
1
gstreamer-vulkan/sys/LICENSE
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../LICENSE-MIT
|
31
gstreamer-vulkan/sys/README.md
Normal file
31
gstreamer-vulkan/sys/README.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
# gstreamer-sys [](https://crates.io/crates/gstreamer-vulkan-sys) [](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/commits/main)
|
||||
|
||||
[GStreamer](https://gstreamer.freedesktop.org/) (Vulkan library) FFI bindings for Rust.
|
||||
|
||||
These bindings are providing unsafe FFI API that can be used to interface with
|
||||
GStreamer. Generally they are meant to be used as the building block for
|
||||
higher-level abstractions like:
|
||||
|
||||
* Bindings for GStreamer applications and plugins: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs
|
||||
* Various GStreamer plugins written in Rust: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
|
||||
|
||||
The bindings are autogenerated with [gir](https://github.com/gtk-rs/gir/)
|
||||
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
|
||||
API metadata provided by the GStreamer project.
|
||||
|
||||
## LICENSE
|
||||
|
||||
gstreamer-sys and all crates contained here are licensed under the MIT
|
||||
license ([LICENSE](LICENSE) or http://opensource.org/licenses/MIT).
|
||||
|
||||
GStreamer itself is licensed under the Lesser General Public License version
|
||||
2.1 or (at your option) any later version:
|
||||
https://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
## Contribution
|
||||
|
||||
Any kinds of contributions are welcome as a pull request.
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in gstreamer-rs by you shall be licensed under the MIT license as above,
|
||||
without any additional terms or conditions.
|
18
gstreamer-vulkan/sys/build.rs
Normal file
18
gstreamer-vulkan/sys/build.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
#[cfg(not(docsrs))]
|
||||
use std::process;
|
||||
|
||||
#[cfg(docsrs)]
|
||||
fn main() {} // prevent linking libraries to avoid documentation failure
|
||||
|
||||
#[cfg(not(docsrs))]
|
||||
fn main() {
|
||||
if let Err(s) = system_deps::Config::new().probe() {
|
||||
println!("cargo:warning={s}");
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
3
gstreamer-vulkan/sys/src/auto/versions.txt
Normal file
3
gstreamer-vulkan/sys/src/auto/versions.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 2d0807e9c5bc)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6668d0f5551a)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 2dcaaf8ae3d8+)
|
2468
gstreamer-vulkan/sys/src/lib.rs
Normal file
2468
gstreamer-vulkan/sys/src/lib.rs
Normal file
File diff suppressed because it is too large
Load diff
32
gstreamer-vulkan/sys/src/manual.rs
Normal file
32
gstreamer-vulkan/sys/src/manual.rs
Normal file
|
@ -0,0 +1,32 @@
|
|||
pub mod vulkan {
|
||||
pub use ash::vk::BaseInStructure as VkBaseInStructure;
|
||||
pub use ash::vk::BlendFactor as VkBlendFactor;
|
||||
pub use ash::vk::BlendOp as VkBlendOp;
|
||||
pub use ash::vk::Buffer as VkBuffer;
|
||||
pub use ash::vk::BufferCreateInfo as VkBufferCreateInfo;
|
||||
pub use ash::vk::BufferUsageFlags as VkBufferUsageFlags;
|
||||
pub use ash::vk::CommandBuffer as VkCommandBuffer;
|
||||
pub use ash::vk::CommandBufferLevel as VkCommandBufferLevel;
|
||||
pub use ash::vk::DescriptorPool as VkDescriptorPool;
|
||||
pub use ash::vk::DescriptorSet as VkDescriptorSet;
|
||||
pub use ash::vk::Format as VkFormat;
|
||||
pub use ash::vk::Image as VkImage;
|
||||
pub use ash::vk::ImageCreateInfo as VkImageCreateInfo;
|
||||
pub use ash::vk::ImageLayout as VkImageLayout;
|
||||
pub use ash::vk::ImageTiling as VkImageTiling;
|
||||
pub use ash::vk::ImageUsageFlags as VkImageUsageFlags;
|
||||
pub use ash::vk::ImageViewCreateInfo as VkImageViewCreateInfo;
|
||||
pub use ash::vk::MemoryHeapFlags as VkMemoryHeapFlags;
|
||||
pub use ash::vk::MemoryPropertyFlags as VkMemoryPropertyFlags;
|
||||
pub use ash::vk::MemoryRequirements as VkMemoryRequirements;
|
||||
pub use ash::vk::PhysicalDevice as VkPhysicalDevice;
|
||||
pub use ash::vk::PhysicalDeviceType as VkPhysicalDeviceType;
|
||||
pub use ash::vk::PresentModeKHR as VkPresentModeKHR;
|
||||
pub use ash::vk::Queue as VkQueue;
|
||||
pub use ash::vk::QueueFlags as VkQueueFlags;
|
||||
pub type VkQueueFlagBits = u32;
|
||||
pub use ash::vk::Result as VkResult;
|
||||
pub use ash::vk::SampleCountFlags as VkSampleCountFlags;
|
||||
pub use ash::vk::Semaphore as VkSemaphore;
|
||||
pub use ash::vk::SurfaceKHR as VkSurfaceKHR;
|
||||
}
|
623
gstreamer-vulkan/sys/tests/abi.rs
Normal file
623
gstreamer-vulkan/sys/tests/abi.rs
Normal file
|
@ -0,0 +1,623 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
#![cfg(unix)]
|
||||
|
||||
use gstreamer_vulkan_sys::*;
|
||||
use std::env;
|
||||
use std::error::Error;
|
||||
use std::ffi::OsString;
|
||||
use std::mem::{align_of, size_of};
|
||||
use std::path::Path;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::str;
|
||||
use tempfile::Builder;
|
||||
|
||||
static PACKAGES: &[&str] = &["gstreamer-vulkan-1.0"];
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Compiler {
|
||||
pub args: Vec<String>,
|
||||
}
|
||||
|
||||
impl Compiler {
|
||||
pub fn new() -> Result<Self, Box<dyn Error>> {
|
||||
let mut args = get_var("CC", "cc")?;
|
||||
args.push("-Wno-deprecated-declarations".to_owned());
|
||||
// For _Generic
|
||||
args.push("-std=c11".to_owned());
|
||||
// For %z support in printf when using MinGW.
|
||||
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
|
||||
args.extend(get_var("CFLAGS", "")?);
|
||||
args.extend(get_var("CPPFLAGS", "")?);
|
||||
args.extend(pkg_config_cflags(PACKAGES)?);
|
||||
Ok(Self { args })
|
||||
}
|
||||
|
||||
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
|
||||
let mut cmd = self.to_command();
|
||||
cmd.arg(src);
|
||||
cmd.arg("-o");
|
||||
cmd.arg(out);
|
||||
let status = cmd.spawn()?.wait()?;
|
||||
if !status.success() {
|
||||
return Err(format!("compilation command {cmd:?} failed, {status}").into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn to_command(&self) -> Command {
|
||||
let mut cmd = Command::new(&self.args[0]);
|
||||
cmd.args(&self.args[1..]);
|
||||
cmd
|
||||
}
|
||||
}
|
||||
|
||||
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<dyn Error>> {
|
||||
match env::var(name) {
|
||||
Ok(value) => Ok(shell_words::split(&value)?),
|
||||
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
|
||||
Err(err) => Err(format!("{name} {err}").into()),
|
||||
}
|
||||
}
|
||||
|
||||
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
|
||||
if packages.is_empty() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
|
||||
let mut cmd = Command::new(pkg_config);
|
||||
cmd.arg("--cflags");
|
||||
cmd.args(packages);
|
||||
cmd.stderr(Stdio::inherit());
|
||||
let out = cmd.output()?;
|
||||
if !out.status.success() {
|
||||
let (status, stdout) = (out.status, String::from_utf8_lossy(&out.stdout));
|
||||
return Err(format!("command {cmd:?} failed, {status:?}\nstdout: {stdout}").into());
|
||||
}
|
||||
let stdout = str::from_utf8(&out.stdout)?;
|
||||
Ok(shell_words::split(stdout.trim())?)
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
struct Layout {
|
||||
size: usize,
|
||||
alignment: usize,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
|
||||
struct Results {
|
||||
/// Number of successfully completed tests.
|
||||
passed: usize,
|
||||
/// Total number of failed tests (including those that failed to compile).
|
||||
failed: usize,
|
||||
}
|
||||
|
||||
impl Results {
|
||||
fn record_passed(&mut self) {
|
||||
self.passed += 1;
|
||||
}
|
||||
fn record_failed(&mut self) {
|
||||
self.failed += 1;
|
||||
}
|
||||
fn summary(&self) -> String {
|
||||
format!("{} passed; {} failed", self.passed, self.failed)
|
||||
}
|
||||
fn expect_total_success(&self) {
|
||||
if self.failed == 0 {
|
||||
println!("OK: {}", self.summary());
|
||||
} else {
|
||||
panic!("FAILED: {}", self.summary());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cross_validate_constants_with_c() {
|
||||
let mut c_constants: Vec<(String, String)> = Vec::new();
|
||||
|
||||
for l in get_c_output("constant").unwrap().lines() {
|
||||
let (name, value) = l.split_once(';').expect("Missing ';' separator");
|
||||
c_constants.push((name.to_owned(), value.to_owned()));
|
||||
}
|
||||
|
||||
let mut results = Results::default();
|
||||
|
||||
for ((rust_name, rust_value), (c_name, c_value)) in
|
||||
RUST_CONSTANTS.iter().zip(c_constants.iter())
|
||||
{
|
||||
if rust_name != c_name {
|
||||
results.record_failed();
|
||||
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if rust_value != c_value {
|
||||
results.record_failed();
|
||||
eprintln!(
|
||||
"Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}",
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
results.record_passed();
|
||||
}
|
||||
|
||||
results.expect_total_success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cross_validate_layout_with_c() {
|
||||
let mut c_layouts = Vec::new();
|
||||
|
||||
for l in get_c_output("layout").unwrap().lines() {
|
||||
let (name, value) = l.split_once(';').expect("Missing first ';' separator");
|
||||
let (size, alignment) = value.split_once(';').expect("Missing second ';' separator");
|
||||
let size = size.parse().expect("Failed to parse size");
|
||||
let alignment = alignment.parse().expect("Failed to parse alignment");
|
||||
c_layouts.push((name.to_owned(), Layout { size, alignment }));
|
||||
}
|
||||
|
||||
let mut results = Results::default();
|
||||
|
||||
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
|
||||
{
|
||||
if rust_name != c_name {
|
||||
results.record_failed();
|
||||
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if rust_layout != c_layout {
|
||||
results.record_failed();
|
||||
eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",);
|
||||
continue;
|
||||
}
|
||||
|
||||
results.record_passed();
|
||||
}
|
||||
|
||||
results.expect_total_success();
|
||||
}
|
||||
|
||||
fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
|
||||
let tmpdir = Builder::new().prefix("abi").tempdir()?;
|
||||
let exe = tmpdir.path().join(name);
|
||||
let c_file = Path::new("tests").join(name).with_extension("c");
|
||||
|
||||
let cc = Compiler::new().expect("configured compiler");
|
||||
cc.compile(&c_file, &exe)?;
|
||||
|
||||
let mut cmd = Command::new(exe);
|
||||
cmd.stderr(Stdio::inherit());
|
||||
let out = cmd.output()?;
|
||||
if !out.status.success() {
|
||||
let (status, stdout) = (out.status, String::from_utf8_lossy(&out.stdout));
|
||||
return Err(format!("command {cmd:?} failed, {status:?}\nstdout: {stdout}").into());
|
||||
}
|
||||
|
||||
Ok(String::from_utf8(out.stdout)?)
|
||||
}
|
||||
|
||||
const RUST_LAYOUTS: &[(&str, Layout)] = &[
|
||||
(
|
||||
"GstVulkanBarrierFlags",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanBarrierFlags>(),
|
||||
alignment: align_of::<GstVulkanBarrierFlags>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanBarrierType",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanBarrierType>(),
|
||||
alignment: align_of::<GstVulkanBarrierType>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanBufferMemoryAllocator",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanBufferMemoryAllocator>(),
|
||||
alignment: align_of::<GstVulkanBufferMemoryAllocator>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanBufferMemoryAllocatorClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanBufferMemoryAllocatorClass>(),
|
||||
alignment: align_of::<GstVulkanBufferMemoryAllocatorClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanBufferPool",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanBufferPool>(),
|
||||
alignment: align_of::<GstVulkanBufferPool>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanBufferPoolClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanBufferPoolClass>(),
|
||||
alignment: align_of::<GstVulkanBufferPoolClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanCommandPoolClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanCommandPoolClass>(),
|
||||
alignment: align_of::<GstVulkanCommandPoolClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanDescriptorCache",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanDescriptorCache>(),
|
||||
alignment: align_of::<GstVulkanDescriptorCache>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanDescriptorCacheClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanDescriptorCacheClass>(),
|
||||
alignment: align_of::<GstVulkanDescriptorCacheClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanDescriptorPoolClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanDescriptorPoolClass>(),
|
||||
alignment: align_of::<GstVulkanDescriptorPoolClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanDeviceClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanDeviceClass>(),
|
||||
alignment: align_of::<GstVulkanDeviceClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanDisplay",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanDisplay>(),
|
||||
alignment: align_of::<GstVulkanDisplay>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanDisplayClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanDisplayClass>(),
|
||||
alignment: align_of::<GstVulkanDisplayClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanDisplayType",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanDisplayType>(),
|
||||
alignment: align_of::<GstVulkanDisplayType>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanEncodeQueryResult",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanEncodeQueryResult>(),
|
||||
alignment: align_of::<GstVulkanEncodeQueryResult>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanError",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanError>(),
|
||||
alignment: align_of::<GstVulkanError>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanFenceCache",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanFenceCache>(),
|
||||
alignment: align_of::<GstVulkanFenceCache>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanFenceCacheClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanFenceCacheClass>(),
|
||||
alignment: align_of::<GstVulkanFenceCacheClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanFormatFlags",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanFormatFlags>(),
|
||||
alignment: align_of::<GstVulkanFormatFlags>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanFormatScaling",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanFormatScaling>(),
|
||||
alignment: align_of::<GstVulkanFormatScaling>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanFullScreenQuad",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanFullScreenQuad>(),
|
||||
alignment: align_of::<GstVulkanFullScreenQuad>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanFullScreenQuadClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanFullScreenQuadClass>(),
|
||||
alignment: align_of::<GstVulkanFullScreenQuadClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanHandle",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanHandle>(),
|
||||
alignment: align_of::<GstVulkanHandle>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanHandlePool",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanHandlePool>(),
|
||||
alignment: align_of::<GstVulkanHandlePool>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanHandlePoolClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanHandlePoolClass>(),
|
||||
alignment: align_of::<GstVulkanHandlePoolClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanHandleType",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanHandleType>(),
|
||||
alignment: align_of::<GstVulkanHandleType>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanHandleTypedef",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanHandleTypedef>(),
|
||||
alignment: align_of::<GstVulkanHandleTypedef>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanImageBufferPool",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanImageBufferPool>(),
|
||||
alignment: align_of::<GstVulkanImageBufferPool>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanImageBufferPoolClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanImageBufferPoolClass>(),
|
||||
alignment: align_of::<GstVulkanImageBufferPoolClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanImageMemoryAllocator",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanImageMemoryAllocator>(),
|
||||
alignment: align_of::<GstVulkanImageMemoryAllocator>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanImageMemoryAllocatorClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanImageMemoryAllocatorClass>(),
|
||||
alignment: align_of::<GstVulkanImageMemoryAllocatorClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanInstanceClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanInstanceClass>(),
|
||||
alignment: align_of::<GstVulkanInstanceClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanMemoryAllocator",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanMemoryAllocator>(),
|
||||
alignment: align_of::<GstVulkanMemoryAllocator>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanMemoryAllocatorClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanMemoryAllocatorClass>(),
|
||||
alignment: align_of::<GstVulkanMemoryAllocatorClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanOperation",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanOperation>(),
|
||||
alignment: align_of::<GstVulkanOperation>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanOperationClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanOperationClass>(),
|
||||
alignment: align_of::<GstVulkanOperationClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanPhysicalDeviceClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanPhysicalDeviceClass>(),
|
||||
alignment: align_of::<GstVulkanPhysicalDeviceClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanQueueClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanQueueClass>(),
|
||||
alignment: align_of::<GstVulkanQueueClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanQueueFamilyOps",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanQueueFamilyOps>(),
|
||||
alignment: align_of::<GstVulkanQueueFamilyOps>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanSwapper",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanSwapper>(),
|
||||
alignment: align_of::<GstVulkanSwapper>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanSwapperClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanSwapperClass>(),
|
||||
alignment: align_of::<GstVulkanSwapperClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanTrash",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanTrash>(),
|
||||
alignment: align_of::<GstVulkanTrash>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanTrashFenceListClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanTrashFenceListClass>(),
|
||||
alignment: align_of::<GstVulkanTrashFenceListClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanTrashList",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanTrashList>(),
|
||||
alignment: align_of::<GstVulkanTrashList>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanTrashListClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanTrashListClass>(),
|
||||
alignment: align_of::<GstVulkanTrashListClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanVideoFilter",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanVideoFilter>(),
|
||||
alignment: align_of::<GstVulkanVideoFilter>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanVideoFilterClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanVideoFilterClass>(),
|
||||
alignment: align_of::<GstVulkanVideoFilterClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanWindow",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanWindow>(),
|
||||
alignment: align_of::<GstVulkanWindow>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanWindowClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanWindowClass>(),
|
||||
alignment: align_of::<GstVulkanWindowClass>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanWindowError",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanWindowError>(),
|
||||
alignment: align_of::<GstVulkanWindowError>(),
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
const RUST_CONSTANTS: &[(&str, &str)] = &[
|
||||
(
|
||||
"GST_CAPS_FEATURE_MEMORY_VULKAN_BUFFER",
|
||||
"memory:VulkanBuffer",
|
||||
),
|
||||
("GST_CAPS_FEATURE_MEMORY_VULKAN_IMAGE", "memory:VulkanImage"),
|
||||
("(gint) GST_VULKAN_BARRIER_FLAG_NONE", "0"),
|
||||
("(gint) GST_VULKAN_BARRIER_NONE", "0"),
|
||||
("(gint) GST_VULKAN_BARRIER_TYPE_BUFFER", "2"),
|
||||
("(gint) GST_VULKAN_BARRIER_TYPE_IMAGE", "3"),
|
||||
("(gint) GST_VULKAN_BARRIER_TYPE_MEMORY", "1"),
|
||||
("GST_VULKAN_BUFFER_MEMORY_ALLOCATOR_NAME", "VulkanBuffer"),
|
||||
("GST_VULKAN_DEVICE_CONTEXT_TYPE_STR", "gst.vulkan.device"),
|
||||
("GST_VULKAN_DISPLAY_CONTEXT_TYPE_STR", "gst.vulkan.display"),
|
||||
("(guint) GST_VULKAN_DISPLAY_TYPE_ANDROID", "32"),
|
||||
("(guint) GST_VULKAN_DISPLAY_TYPE_ANY", "4294967295"),
|
||||
("(guint) GST_VULKAN_DISPLAY_TYPE_COCOA", "4"),
|
||||
("(guint) GST_VULKAN_DISPLAY_TYPE_IOS", "8"),
|
||||
("(guint) GST_VULKAN_DISPLAY_TYPE_NONE", "0"),
|
||||
("(guint) GST_VULKAN_DISPLAY_TYPE_WAYLAND", "2"),
|
||||
("(guint) GST_VULKAN_DISPLAY_TYPE_WIN32", "16"),
|
||||
("(guint) GST_VULKAN_DISPLAY_TYPE_XCB", "1"),
|
||||
("(gint) GST_VULKAN_FAILED", "0"),
|
||||
("(guint) GST_VULKAN_FORMAT_FLAG_ALPHA", "4"),
|
||||
("(guint) GST_VULKAN_FORMAT_FLAG_COMPLEX", "16"),
|
||||
("(guint) GST_VULKAN_FORMAT_FLAG_LE", "8"),
|
||||
("(guint) GST_VULKAN_FORMAT_FLAG_RGB", "2"),
|
||||
("(guint) GST_VULKAN_FORMAT_FLAG_YUV", "1"),
|
||||
("(gint) GST_VULKAN_FORMAT_SCALING_SINT", "6"),
|
||||
("(gint) GST_VULKAN_FORMAT_SCALING_SNORM", "2"),
|
||||
("(gint) GST_VULKAN_FORMAT_SCALING_SRGB", "7"),
|
||||
("(gint) GST_VULKAN_FORMAT_SCALING_SSCALED", "4"),
|
||||
("(gint) GST_VULKAN_FORMAT_SCALING_UINT", "5"),
|
||||
("(gint) GST_VULKAN_FORMAT_SCALING_UNORM", "1"),
|
||||
("(gint) GST_VULKAN_FORMAT_SCALING_USCALED", "3"),
|
||||
("(gint) GST_VULKAN_HANDLE_TYPE_DESCRIPTOR_SET_LAYOUT", "1"),
|
||||
("(gint) GST_VULKAN_HANDLE_TYPE_FRAMEBUFFER", "6"),
|
||||
("(gint) GST_VULKAN_HANDLE_TYPE_PIPELINE", "3"),
|
||||
("(gint) GST_VULKAN_HANDLE_TYPE_PIPELINE_LAYOUT", "2"),
|
||||
("(gint) GST_VULKAN_HANDLE_TYPE_RENDER_PASS", "4"),
|
||||
("(gint) GST_VULKAN_HANDLE_TYPE_SAMPLER", "5"),
|
||||
(
|
||||
"(gint) GST_VULKAN_HANDLE_TYPE_SAMPLER_YCBCR_CONVERSION",
|
||||
"10",
|
||||
),
|
||||
("(gint) GST_VULKAN_HANDLE_TYPE_SHADER", "7"),
|
||||
("(gint) GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION", "8"),
|
||||
(
|
||||
"(gint) GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION_PARAMETERS",
|
||||
"9",
|
||||
),
|
||||
("GST_VULKAN_IMAGE_MEMORY_ALLOCATOR_NAME", "VulkanImage"),
|
||||
(
|
||||
"GST_VULKAN_INSTANCE_CONTEXT_TYPE_STR",
|
||||
"gst.vulkan.instance",
|
||||
),
|
||||
("GST_VULKAN_MAX_COMPONENTS", "4"),
|
||||
("GST_VULKAN_MEMORY_ALLOCATOR_NAME", "Vulkan"),
|
||||
("GST_VULKAN_QUEUE_CONTEXT_TYPE_STR", "gst.vulkan.queue"),
|
||||
(
|
||||
"GST_VULKAN_SWAPPER_VIDEO_FORMATS",
|
||||
" { RGBA, BGRA, RGB, BGR } ",
|
||||
),
|
||||
("(gint) GST_VULKAN_WINDOW_ERROR_FAILED", "0"),
|
||||
("(gint) GST_VULKAN_WINDOW_ERROR_OLD_LIBS", "1"),
|
||||
("(gint) GST_VULKAN_WINDOW_ERROR_RESOURCE_UNAVAILABLE", "2"),
|
||||
];
|
83
gstreamer-vulkan/sys/tests/constant.c
Normal file
83
gstreamer-vulkan/sys/tests/constant.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
#include "manual.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define PRINT_CONSTANT(CONSTANT_NAME) \
|
||||
printf("%s;", #CONSTANT_NAME); \
|
||||
printf(_Generic((CONSTANT_NAME), \
|
||||
char *: "%s", \
|
||||
const char *: "%s", \
|
||||
char: "%c", \
|
||||
signed char: "%hhd", \
|
||||
unsigned char: "%hhu", \
|
||||
short int: "%hd", \
|
||||
unsigned short int: "%hu", \
|
||||
int: "%d", \
|
||||
unsigned int: "%u", \
|
||||
long: "%ld", \
|
||||
unsigned long: "%lu", \
|
||||
long long: "%lld", \
|
||||
unsigned long long: "%llu", \
|
||||
float: "%f", \
|
||||
double: "%f", \
|
||||
long double: "%ld"), \
|
||||
CONSTANT_NAME); \
|
||||
printf("\n");
|
||||
|
||||
int main() {
|
||||
PRINT_CONSTANT(GST_CAPS_FEATURE_MEMORY_VULKAN_BUFFER);
|
||||
PRINT_CONSTANT(GST_CAPS_FEATURE_MEMORY_VULKAN_IMAGE);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_BARRIER_FLAG_NONE);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_BARRIER_NONE);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_BARRIER_TYPE_BUFFER);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_BARRIER_TYPE_IMAGE);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_BARRIER_TYPE_MEMORY);
|
||||
PRINT_CONSTANT(GST_VULKAN_BUFFER_MEMORY_ALLOCATOR_NAME);
|
||||
PRINT_CONSTANT(GST_VULKAN_DEVICE_CONTEXT_TYPE_STR);
|
||||
PRINT_CONSTANT(GST_VULKAN_DISPLAY_CONTEXT_TYPE_STR);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_DISPLAY_TYPE_ANDROID);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_DISPLAY_TYPE_ANY);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_DISPLAY_TYPE_COCOA);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_DISPLAY_TYPE_IOS);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_DISPLAY_TYPE_NONE);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_DISPLAY_TYPE_WAYLAND);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_DISPLAY_TYPE_WIN32);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_DISPLAY_TYPE_XCB);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_FAILED);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_FORMAT_FLAG_ALPHA);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_FORMAT_FLAG_COMPLEX);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_FORMAT_FLAG_LE);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_FORMAT_FLAG_RGB);
|
||||
PRINT_CONSTANT((guint) GST_VULKAN_FORMAT_FLAG_YUV);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_FORMAT_SCALING_SINT);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_FORMAT_SCALING_SNORM);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_FORMAT_SCALING_SRGB);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_FORMAT_SCALING_SSCALED);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_FORMAT_SCALING_UINT);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_FORMAT_SCALING_UNORM);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_FORMAT_SCALING_USCALED);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_HANDLE_TYPE_DESCRIPTOR_SET_LAYOUT);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_HANDLE_TYPE_FRAMEBUFFER);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_HANDLE_TYPE_PIPELINE);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_HANDLE_TYPE_PIPELINE_LAYOUT);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_HANDLE_TYPE_RENDER_PASS);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_HANDLE_TYPE_SAMPLER);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_HANDLE_TYPE_SAMPLER_YCBCR_CONVERSION);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_HANDLE_TYPE_SHADER);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION_PARAMETERS);
|
||||
PRINT_CONSTANT(GST_VULKAN_IMAGE_MEMORY_ALLOCATOR_NAME);
|
||||
PRINT_CONSTANT(GST_VULKAN_INSTANCE_CONTEXT_TYPE_STR);
|
||||
PRINT_CONSTANT(GST_VULKAN_MAX_COMPONENTS);
|
||||
PRINT_CONSTANT(GST_VULKAN_MEMORY_ALLOCATOR_NAME);
|
||||
PRINT_CONSTANT(GST_VULKAN_QUEUE_CONTEXT_TYPE_STR);
|
||||
PRINT_CONSTANT(GST_VULKAN_SWAPPER_VIDEO_FORMATS);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_WINDOW_ERROR_FAILED);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_WINDOW_ERROR_OLD_LIBS);
|
||||
PRINT_CONSTANT((gint) GST_VULKAN_WINDOW_ERROR_RESOURCE_UNAVAILABLE);
|
||||
return 0;
|
||||
}
|
62
gstreamer-vulkan/sys/tests/layout.c
Normal file
62
gstreamer-vulkan/sys/tests/layout.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
#include "manual.h"
|
||||
#include <stdalign.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("%s;%zu;%zu\n", "GstVulkanBarrierFlags", sizeof(GstVulkanBarrierFlags), alignof(GstVulkanBarrierFlags));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanBarrierType", sizeof(GstVulkanBarrierType), alignof(GstVulkanBarrierType));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanBufferMemoryAllocator", sizeof(GstVulkanBufferMemoryAllocator), alignof(GstVulkanBufferMemoryAllocator));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanBufferMemoryAllocatorClass", sizeof(GstVulkanBufferMemoryAllocatorClass), alignof(GstVulkanBufferMemoryAllocatorClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanBufferPool", sizeof(GstVulkanBufferPool), alignof(GstVulkanBufferPool));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanBufferPoolClass", sizeof(GstVulkanBufferPoolClass), alignof(GstVulkanBufferPoolClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanCommandPoolClass", sizeof(GstVulkanCommandPoolClass), alignof(GstVulkanCommandPoolClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanDescriptorCache", sizeof(GstVulkanDescriptorCache), alignof(GstVulkanDescriptorCache));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanDescriptorCacheClass", sizeof(GstVulkanDescriptorCacheClass), alignof(GstVulkanDescriptorCacheClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanDescriptorPoolClass", sizeof(GstVulkanDescriptorPoolClass), alignof(GstVulkanDescriptorPoolClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanDeviceClass", sizeof(GstVulkanDeviceClass), alignof(GstVulkanDeviceClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanDisplay", sizeof(GstVulkanDisplay), alignof(GstVulkanDisplay));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanDisplayClass", sizeof(GstVulkanDisplayClass), alignof(GstVulkanDisplayClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanDisplayType", sizeof(GstVulkanDisplayType), alignof(GstVulkanDisplayType));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanEncodeQueryResult", sizeof(GstVulkanEncodeQueryResult), alignof(GstVulkanEncodeQueryResult));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanError", sizeof(GstVulkanError), alignof(GstVulkanError));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanFenceCache", sizeof(GstVulkanFenceCache), alignof(GstVulkanFenceCache));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanFenceCacheClass", sizeof(GstVulkanFenceCacheClass), alignof(GstVulkanFenceCacheClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanFormatFlags", sizeof(GstVulkanFormatFlags), alignof(GstVulkanFormatFlags));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanFormatScaling", sizeof(GstVulkanFormatScaling), alignof(GstVulkanFormatScaling));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanFullScreenQuad", sizeof(GstVulkanFullScreenQuad), alignof(GstVulkanFullScreenQuad));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanFullScreenQuadClass", sizeof(GstVulkanFullScreenQuadClass), alignof(GstVulkanFullScreenQuadClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanHandle", sizeof(GstVulkanHandle), alignof(GstVulkanHandle));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanHandlePool", sizeof(GstVulkanHandlePool), alignof(GstVulkanHandlePool));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanHandlePoolClass", sizeof(GstVulkanHandlePoolClass), alignof(GstVulkanHandlePoolClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanHandleType", sizeof(GstVulkanHandleType), alignof(GstVulkanHandleType));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanHandleTypedef", sizeof(GstVulkanHandleTypedef), alignof(GstVulkanHandleTypedef));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanImageBufferPool", sizeof(GstVulkanImageBufferPool), alignof(GstVulkanImageBufferPool));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanImageBufferPoolClass", sizeof(GstVulkanImageBufferPoolClass), alignof(GstVulkanImageBufferPoolClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanImageMemoryAllocator", sizeof(GstVulkanImageMemoryAllocator), alignof(GstVulkanImageMemoryAllocator));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanImageMemoryAllocatorClass", sizeof(GstVulkanImageMemoryAllocatorClass), alignof(GstVulkanImageMemoryAllocatorClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanInstanceClass", sizeof(GstVulkanInstanceClass), alignof(GstVulkanInstanceClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanMemoryAllocator", sizeof(GstVulkanMemoryAllocator), alignof(GstVulkanMemoryAllocator));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanMemoryAllocatorClass", sizeof(GstVulkanMemoryAllocatorClass), alignof(GstVulkanMemoryAllocatorClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanOperation", sizeof(GstVulkanOperation), alignof(GstVulkanOperation));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanOperationClass", sizeof(GstVulkanOperationClass), alignof(GstVulkanOperationClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanPhysicalDeviceClass", sizeof(GstVulkanPhysicalDeviceClass), alignof(GstVulkanPhysicalDeviceClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanQueueClass", sizeof(GstVulkanQueueClass), alignof(GstVulkanQueueClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanQueueFamilyOps", sizeof(GstVulkanQueueFamilyOps), alignof(GstVulkanQueueFamilyOps));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanSwapper", sizeof(GstVulkanSwapper), alignof(GstVulkanSwapper));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanSwapperClass", sizeof(GstVulkanSwapperClass), alignof(GstVulkanSwapperClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanTrash", sizeof(GstVulkanTrash), alignof(GstVulkanTrash));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanTrashFenceListClass", sizeof(GstVulkanTrashFenceListClass), alignof(GstVulkanTrashFenceListClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanTrashList", sizeof(GstVulkanTrashList), alignof(GstVulkanTrashList));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanTrashListClass", sizeof(GstVulkanTrashListClass), alignof(GstVulkanTrashListClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanVideoFilter", sizeof(GstVulkanVideoFilter), alignof(GstVulkanVideoFilter));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanVideoFilterClass", sizeof(GstVulkanVideoFilterClass), alignof(GstVulkanVideoFilterClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanWindow", sizeof(GstVulkanWindow), alignof(GstVulkanWindow));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanWindowClass", sizeof(GstVulkanWindowClass), alignof(GstVulkanWindowClass));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanWindowError", sizeof(GstVulkanWindowError), alignof(GstVulkanWindowError));
|
||||
return 0;
|
||||
}
|
3
gstreamer-vulkan/sys/tests/manual.h
Normal file
3
gstreamer-vulkan/sys/tests/manual.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
|
||||
|
||||
#include <gst/vulkan/vulkan.h>
|
8
gstreamer-vulkan/tests/check_gir.rs
Normal file
8
gstreamer-vulkan/tests/check_gir.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
1
gstreamer-vulkan/wayland/CHANGELOG.md
Symbolic link
1
gstreamer-vulkan/wayland/CHANGELOG.md
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../gstreamer/CHANGELOG.md
|
1
gstreamer-vulkan/wayland/COPYRIGHT
Symbolic link
1
gstreamer-vulkan/wayland/COPYRIGHT
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../COPYRIGHT
|
37
gstreamer-vulkan/wayland/Cargo.toml
Normal file
37
gstreamer-vulkan/wayland/Cargo.toml
Normal file
|
@ -0,0 +1,37 @@
|
|||
[package]
|
||||
name = "gstreamer-vulkan-wayland"
|
||||
authors = ["Matthew Waters <matthew@centricular.com>"]
|
||||
description = "Rust bindings for GStreamer Vulkan library (Wayland support)"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_vulkan_wayland/"
|
||||
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
|
||||
version.workspace = true
|
||||
categories.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
ffi = { package = "gstreamer-vulkan-wayland-sys", path = "sys" }
|
||||
glib.workspace = true
|
||||
gst.workspace = true
|
||||
gst-vulkan.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
gir-format-check = "0.1"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
v1_20 = ["gst/v1_20", "gst-vulkan/v1_20", "ffi/v1_20"]
|
||||
v1_22 = ["gst/v1_22", "gst-vulkan/v1_22", "ffi/v1_22", "v1_20"]
|
||||
v1_24 = ["gst/v1_24", "gst-vulkan/v1_24", "ffi/v1_24", "v1_22"]
|
||||
v1_26 = ["gst/v1_26", "gst-vulkan/v1_26", "ffi/v1_26", "v1_24"]
|
||||
v1_28 = ["gst/v1_28", "gst-vulkan/v1_28", "ffi/v1_28", "v1_26"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
|
59
gstreamer-vulkan/wayland/Gir.toml
Normal file
59
gstreamer-vulkan/wayland/Gir.toml
Normal file
|
@ -0,0 +1,59 @@
|
|||
[options]
|
||||
girs_directories = ["../../gir-files", "../../gst-gir-files"]
|
||||
library = "GstVulkanWayland"
|
||||
version = "1.0"
|
||||
min_cfg_version = "1.18"
|
||||
work_mode = "normal"
|
||||
concurrency = "send+sync"
|
||||
generate_safety_asserts = true
|
||||
single_version_file = true
|
||||
generate_display_trait = false
|
||||
trust_return_value_nullability = true
|
||||
|
||||
external_libraries = [
|
||||
"GLib",
|
||||
"GObject",
|
||||
"Gst",
|
||||
"GstBase",
|
||||
"GstVideo",
|
||||
"GstVulkan",
|
||||
]
|
||||
|
||||
generate = []
|
||||
|
||||
manual = [
|
||||
"GLib.Error",
|
||||
"GLib.Thread",
|
||||
"GObject.Object",
|
||||
"Gst.FlowReturn",
|
||||
"Gst.Object",
|
||||
"Gst.PadDirection",
|
||||
]
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Buffer"
|
||||
status = "manual"
|
||||
ref_mode = "ref"
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Caps"
|
||||
status = "manual"
|
||||
ref_mode = "ref"
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Query"
|
||||
status = "manual"
|
||||
ref_mode = "ref"
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Structure"
|
||||
status = "manual"
|
||||
ref_mode = "ref"
|
||||
|
||||
[[object]]
|
||||
name = "GstVulkanWayland.VulkanDisplayWayland"
|
||||
status = "generate"
|
||||
[[object.function]]
|
||||
name = "new"
|
||||
[object.function.return]
|
||||
nullable_return_is_error = "Failed to create Wayland display"
|
1
gstreamer-vulkan/wayland/LICENSE-APACHE
Symbolic link
1
gstreamer-vulkan/wayland/LICENSE-APACHE
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../LICENSE-APACHE
|
1
gstreamer-vulkan/wayland/LICENSE-MIT
Symbolic link
1
gstreamer-vulkan/wayland/LICENSE-MIT
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../LICENSE-MIT
|
215
gstreamer-vulkan/wayland/README.md
Normal file
215
gstreamer-vulkan/wayland/README.md
Normal file
|
@ -0,0 +1,215 @@
|
|||
# gstreamer-rs [](https://crates.io/crates/gstreamer-vulkan-wayland) [](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/commits/main)
|
||||
|
||||
[GStreamer](https://gstreamer.freedesktop.org/) (Vulkan library, Wayland support)
|
||||
bindings for Rust. Documentation can be found
|
||||
[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_gl_wayland/).
|
||||
|
||||
These bindings are providing a safe API that can be used to interface with
|
||||
GStreamer, e.g. for writing GStreamer-based applications and GStreamer plugins.
|
||||
|
||||
The bindings are mostly autogenerated with [gir](https://github.com/gtk-rs/gir/)
|
||||
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
|
||||
API metadata provided by the GStreamer project.
|
||||
|
||||
## Table of Contents
|
||||
1. [Installation](#installation)
|
||||
1. [Linux/BSDs](#installation-linux)
|
||||
1. [macOS](#installation-macos)
|
||||
1. [Windows](#installation-windows)
|
||||
1. [Getting Started](#getting-started)
|
||||
1. [License](#license)
|
||||
1. [Contribution](#contribution)
|
||||
|
||||
<a name="installation"/>
|
||||
|
||||
## Installation
|
||||
|
||||
To build the GStreamer bindings or anything depending on them, you need to
|
||||
have at least GStreamer 1.14 and gst-plugins-base 1.14 installed. In addition,
|
||||
some of the examples/tutorials require various GStreamer plugins to be
|
||||
available, which can be found in gst-plugins-base, gst-plugins-good,
|
||||
gst-plugins-bad, gst-plugins-ugly and/or gst-libav.
|
||||
|
||||
<a name="installation-linux"/>
|
||||
|
||||
### Linux/BSDs
|
||||
|
||||
You need to install the above mentioned packages with your distributions
|
||||
package manager, or build them from source.
|
||||
|
||||
On Debian/Ubuntu they can be installed with
|
||||
|
||||
```console
|
||||
$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
|
||||
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
|
||||
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
|
||||
gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev
|
||||
```
|
||||
|
||||
The minimum required version of the above libraries is >= 1.14. If you
|
||||
build the gstreamer-player sub-crate, or any of the examples that
|
||||
depend on gstreamer-player, you must ensure that in addition to the above
|
||||
packages, `libgstreamer-plugins-bad1.0-dev` is installed. See the `Cargo.toml`
|
||||
files for the full details,
|
||||
|
||||
```console
|
||||
$ apt-get install libgstreamer-plugins-bad1.0-dev
|
||||
```
|
||||
|
||||
Package names on other distributions should be similar.
|
||||
Please submit a pull request with instructions for yours.
|
||||
|
||||
<a name="installation-macos"/>
|
||||
|
||||
### macOS
|
||||
|
||||
You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
|
||||
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
|
||||
provided by the GStreamer project.
|
||||
|
||||
We recommend using the official GStreamer binaries over Homebrew, especially
|
||||
as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964).
|
||||
|
||||
#### GStreamer Binaries
|
||||
|
||||
You need to download the *two* `.pkg` files from the GStreamer website and
|
||||
install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and
|
||||
`gstreamer-1.0-devel-1.20.4-universal.pkg`.
|
||||
|
||||
After installation, you also need to set the `PATH` environment variable as
|
||||
follows
|
||||
|
||||
```console
|
||||
$ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
|
||||
```
|
||||
|
||||
Also note that the `pkg-config` from GStreamer should be the first one in
|
||||
the `PATH` as other versions have all kinds of quirks that will cause
|
||||
problems.
|
||||
|
||||
#### Homebrew
|
||||
|
||||
Homebrew only installs various plugins if explicitly enabled, so some extra
|
||||
`--with-*` flags may be required.
|
||||
|
||||
```console
|
||||
$ brew install gstreamer gst-plugins-base gst-plugins-good \
|
||||
gst-plugins-bad gst-plugins-ugly gst-libav gst-rtsp-server \
|
||||
gst-editing-services --with-orc --with-libogg --with-opus \
|
||||
--with-pango --with-theora --with-libvorbis --with-libvpx \
|
||||
--enable-gtk3
|
||||
```
|
||||
|
||||
Make sure the version of these libraries is >= 1.14.
|
||||
|
||||
<a name="installation-windows"/>
|
||||
|
||||
### Windows
|
||||
|
||||
You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/)
|
||||
with `pacman` or by installing the
|
||||
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
|
||||
the GStreamer project.
|
||||
|
||||
We recommend using the official GStreamer binaries over MSYS2.
|
||||
|
||||
#### GStreamer Binaries
|
||||
|
||||
You need to download the *two* `.msi` files for your platform from the
|
||||
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and
|
||||
`gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that
|
||||
matches your Rust toolchain, i.e. MinGW or MSVC.
|
||||
|
||||
After installation set the ``PATH` environment variable as follows:
|
||||
|
||||
```console
|
||||
# For a UNIX-style shell:
|
||||
$ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}"
|
||||
|
||||
# For cmd.exe:
|
||||
$ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH%
|
||||
```
|
||||
|
||||
Make sure to update the path to where you have actually installed GStreamer
|
||||
and for the corresponding toolchain.
|
||||
|
||||
Also note that the `pkg-config.exe` from GStreamer should be the first one in
|
||||
the `PATH` as other versions have all kinds of quirks that will cause
|
||||
problems.
|
||||
|
||||
#### MSYS2 / pacman
|
||||
|
||||
```console
|
||||
$ pacman -S glib2-devel pkg-config \
|
||||
mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
|
||||
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
|
||||
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \
|
||||
mingw-w64-x86_64-gst-rtsp-server
|
||||
```
|
||||
|
||||
Make sure the version of these libraries is >= 1.14.
|
||||
|
||||
Note that the version of `pkg-config` included in `MSYS2` is
|
||||
[known to have problems](https://github.com/rust-lang/pkg-config-rs/issues/51#issuecomment-346300858)
|
||||
compiling GStreamer, so you may need to install another version. One option
|
||||
would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/).
|
||||
|
||||
<a name="getting-started"/>
|
||||
|
||||
## Getting Started
|
||||
|
||||
The API reference can be found
|
||||
[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer/), however it is
|
||||
only the Rust API reference and does not explain any of the concepts.
|
||||
|
||||
For getting started with GStreamer development, the best would be to follow
|
||||
the [documentation](https://gstreamer.freedesktop.org/documentation/) on the
|
||||
GStreamer website, especially the [Application Development
|
||||
Manual](https://gstreamer.freedesktop.org/documentation/application-development/).
|
||||
While being C-centric, it explains all the fundamental concepts of GStreamer
|
||||
and the code examples should be relatively easily translatable to Rust. The
|
||||
API is basically the same, function/struct names are the same and everything
|
||||
is only more convenient (hopefully) and safer.
|
||||
|
||||
In addition there are
|
||||
[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the
|
||||
GStreamer website. Many of them were ported to Rust already and the code can
|
||||
be found in the
|
||||
[tutorials](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/tutorials)
|
||||
directory.
|
||||
|
||||
Some further examples for various aspects of GStreamer and how to use it from
|
||||
Rust can be found in the
|
||||
[examples](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/examples)
|
||||
directory.
|
||||
|
||||
Various GStreamer plugins written in Rust can be found in the
|
||||
[gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs)
|
||||
repository.
|
||||
|
||||
<a name="license"/>
|
||||
|
||||
## LICENSE
|
||||
|
||||
gstreamer-rs and all crates contained in here are licensed under either of
|
||||
|
||||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
||||
http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
GStreamer itself is licensed under the Lesser General Public License version
|
||||
2.1 or (at your option) any later version:
|
||||
https://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
<a name="contribution"/>
|
||||
|
||||
## Contribution
|
||||
|
||||
Any kinds of contributions are welcome as a pull request.
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be
|
||||
dual licensed as above, without any additional terms or conditions.
|
7
gstreamer-vulkan/wayland/src/auto/mod.rs
Normal file
7
gstreamer-vulkan/wayland/src/auto/mod.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
mod vulkan_display_wayland;
|
||||
pub use self::vulkan_display_wayland::VulkanDisplayWayland;
|
3
gstreamer-vulkan/wayland/src/auto/versions.txt
Normal file
3
gstreamer-vulkan/wayland/src/auto/versions.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 2d0807e9c5bc)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6668d0f5551a)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 2dcaaf8ae3d8+)
|
38
gstreamer-vulkan/wayland/src/auto/vulkan_display_wayland.rs
Normal file
38
gstreamer-vulkan/wayland/src/auto/vulkan_display_wayland.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::translate::*;
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstVulkanDisplayWayland")]
|
||||
pub struct VulkanDisplayWayland(Object<ffi::GstVulkanDisplayWayland, ffi::GstVulkanDisplayWaylandClass>) @extends gst::Object;
|
||||
|
||||
match fn {
|
||||
type_ => || ffi::gst_vulkan_display_wayland_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanDisplayWayland {
|
||||
pub const NONE: Option<&'static VulkanDisplayWayland> = None;
|
||||
|
||||
#[doc(alias = "gst_vulkan_display_wayland_new")]
|
||||
pub fn new(name: Option<&str>) -> Result<VulkanDisplayWayland, glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_vulkan_display_wayland_new(name.to_glib_none().0))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create Wayland display"))
|
||||
}
|
||||
}
|
||||
|
||||
//#[doc(alias = "gst_vulkan_display_wayland_new_with_display")]
|
||||
//#[doc(alias = "new_with_display")]
|
||||
//pub fn with_display(display: /*Unimplemented*/Option<Basic: Pointer>) -> VulkanDisplayWayland {
|
||||
// unsafe { TODO: call ffi:gst_vulkan_display_wayland_new_with_display() }
|
||||
//}
|
||||
}
|
||||
|
||||
unsafe impl Send for VulkanDisplayWayland {}
|
||||
unsafe impl Sync for VulkanDisplayWayland {}
|
26
gstreamer-vulkan/wayland/src/lib.rs
Normal file
26
gstreamer-vulkan/wayland/src/lib.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2020 Sebastian Dröge <sebastian@centricular.com>
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![allow(clippy::missing_safety_doc)]
|
||||
|
||||
pub use ffi;
|
||||
pub use gst_vulkan;
|
||||
|
||||
macro_rules! assert_initialized_main_thread {
|
||||
() => {
|
||||
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||
gst::assert_initialized();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
mod auto;
|
||||
pub use auto::*;
|
||||
|
||||
mod vulkan_display_wayland;
|
23
gstreamer-vulkan/wayland/src/vulkan_display_wayland.rs
Normal file
23
gstreamer-vulkan/wayland/src/vulkan_display_wayland.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2024 Matthew Waters <matthew@centricular.com>
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use glib::{ffi::gpointer, translate::*};
|
||||
use libc::uintptr_t;
|
||||
|
||||
use crate::VulkanDisplayWayland;
|
||||
|
||||
impl VulkanDisplayWayland {
|
||||
pub unsafe fn with_display(
|
||||
display: uintptr_t,
|
||||
) -> Result<VulkanDisplayWayland, glib::error::BoolError> {
|
||||
from_glib_full::<_, Option<VulkanDisplayWayland>>(
|
||||
ffi::gst_vulkan_display_wayland_new_with_display(display as gpointer),
|
||||
)
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create new Wayland Vulkan display"))
|
||||
}
|
||||
}
|
1
gstreamer-vulkan/wayland/sys/CHANGELOG.md
Symbolic link
1
gstreamer-vulkan/wayland/sys/CHANGELOG.md
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../gstreamer/CHANGELOG.md
|
1
gstreamer-vulkan/wayland/sys/COPYRIGHT
Symbolic link
1
gstreamer-vulkan/wayland/sys/COPYRIGHT
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../COPYRIGHT
|
77
gstreamer-vulkan/wayland/sys/Cargo.toml
Normal file
77
gstreamer-vulkan/wayland/sys/Cargo.toml
Normal file
|
@ -0,0 +1,77 @@
|
|||
[package]
|
||||
authors = ["Matthew Waters <matthew@centricular.com>"]
|
||||
build = "build.rs"
|
||||
description = "FFI bindings to libgstvulkan-1.0 (Wayland support)"
|
||||
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_vulkan_wayland_sys/"
|
||||
keywords = ["ffi", "gstreamer", "gnome", "multimedia"]
|
||||
license = "MIT"
|
||||
name = "gstreamer-vulkan-wayland-sys"
|
||||
readme = "README.md"
|
||||
|
||||
[package.version]
|
||||
workspace = true
|
||||
|
||||
[package.categories]
|
||||
workspace = true
|
||||
|
||||
[package.repository]
|
||||
workspace = true
|
||||
|
||||
[package.homepage]
|
||||
workspace = true
|
||||
|
||||
[package.edition]
|
||||
workspace = true
|
||||
|
||||
[package.rust-version]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0]
|
||||
name = "gstreamer-vulkan-wayland-1.0"
|
||||
version = "1.20"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0.v1_22]
|
||||
version = "1.22"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0.v1_24]
|
||||
version = "1.24"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0.v1_26]
|
||||
version = "1.26"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0.v1_28]
|
||||
version = "1.27"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0.v1_20]
|
||||
version = "1.20"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
|
||||
|
||||
[lib]
|
||||
name = "gstreamer_vulkan_wayland_sys"
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
[dependencies.glib-sys]
|
||||
workspace = true
|
||||
|
||||
[dependencies.gstreamer-vulkan-sys]
|
||||
workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
system-deps = "7"
|
||||
|
||||
[dev-dependencies]
|
||||
shell-words = "1.0.0"
|
||||
tempfile = "3"
|
||||
|
||||
[features]
|
||||
v1_20 = []
|
||||
v1_22 = ["v1_20"]
|
||||
v1_24 = ["v1_22"]
|
||||
v1_26 = ["v1_24"]
|
||||
v1_28 = ["v1_26"]
|
24
gstreamer-vulkan/wayland/sys/Gir.toml
Normal file
24
gstreamer-vulkan/wayland/sys/Gir.toml
Normal file
|
@ -0,0 +1,24 @@
|
|||
[options]
|
||||
girs_directories = ["../../../gir-files", "../../../gst-gir-files"]
|
||||
library = "GstVulkanWayland"
|
||||
min_cfg_version = "1.18"
|
||||
version = "1.0"
|
||||
work_mode = "sys"
|
||||
single_version_file = true
|
||||
|
||||
extra_versions = [
|
||||
"1.24",
|
||||
"1.22",
|
||||
"1.20",
|
||||
]
|
||||
|
||||
external_libraries = [
|
||||
"GLib",
|
||||
]
|
||||
|
||||
generate = [
|
||||
"GstVulkanWayland.VulkanDisplayWayland",
|
||||
]
|
||||
|
||||
[external_libraries]
|
||||
gstreamer-vulkan = "GstVulkan"
|
1
gstreamer-vulkan/wayland/sys/LICENSE
Symbolic link
1
gstreamer-vulkan/wayland/sys/LICENSE
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../LICENSE-MIT
|
31
gstreamer-vulkan/wayland/sys/README.md
Normal file
31
gstreamer-vulkan/wayland/sys/README.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
# gstreamer-sys [](https://crates.io/crates/gstreamer-gl-wayland-sys) [](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/commits/main)
|
||||
|
||||
[GStreamer](https://gstreamer.freedesktop.org/) (OpenGL library, Wayland support) FFI bindings for Rust.
|
||||
|
||||
These bindings are providing unsafe FFI API that can be used to interface with
|
||||
GStreamer. Generally they are meant to be used as the building block for
|
||||
higher-level abstractions like:
|
||||
|
||||
* Bindings for GStreamer applications and plugins: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs
|
||||
* Various GStreamer plugins written in Rust: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
|
||||
|
||||
The bindings are autogenerated with [gir](https://github.com/gtk-rs/gir/)
|
||||
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
|
||||
API metadata provided by the GStreamer project.
|
||||
|
||||
## LICENSE
|
||||
|
||||
gstreamer-sys and all crates contained here are licensed under the MIT
|
||||
license ([LICENSE](LICENSE) or http://opensource.org/licenses/MIT).
|
||||
|
||||
GStreamer itself is licensed under the Lesser General Public License version
|
||||
2.1 or (at your option) any later version:
|
||||
https://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
## Contribution
|
||||
|
||||
Any kinds of contributions are welcome as a pull request.
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in gstreamer-rs by you shall be licensed under the MIT license as above,
|
||||
without any additional terms or conditions.
|
18
gstreamer-vulkan/wayland/sys/build.rs
Normal file
18
gstreamer-vulkan/wayland/sys/build.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
#[cfg(not(docsrs))]
|
||||
use std::process;
|
||||
|
||||
#[cfg(docsrs)]
|
||||
fn main() {} // prevent linking libraries to avoid documentation failure
|
||||
|
||||
#[cfg(not(docsrs))]
|
||||
fn main() {
|
||||
if let Err(s) = system_deps::Config::new().probe() {
|
||||
println!("cargo:warning={s}");
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
3
gstreamer-vulkan/wayland/sys/src/auto/versions.txt
Normal file
3
gstreamer-vulkan/wayland/sys/src/auto/versions.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 2d0807e9c5bc)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6668d0f5551a)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 2dcaaf8ae3d8+)
|
83
gstreamer-vulkan/wayland/sys/src/lib.rs
Normal file
83
gstreamer-vulkan/wayland/sys/src/lib.rs
Normal file
|
@ -0,0 +1,83 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
|
||||
#![allow(
|
||||
clippy::approx_constant,
|
||||
clippy::type_complexity,
|
||||
clippy::unreadable_literal,
|
||||
clippy::upper_case_acronyms
|
||||
)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
use glib_sys as glib;
|
||||
use gstreamer_vulkan_sys as gst_vulkan;
|
||||
|
||||
#[cfg(unix)]
|
||||
#[allow(unused_imports)]
|
||||
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
|
||||
#[allow(unused_imports)]
|
||||
use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE};
|
||||
#[allow(unused_imports)]
|
||||
use std::ffi::{
|
||||
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
|
||||
};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use glib::{gboolean, gconstpointer, gpointer, GType};
|
||||
|
||||
// Records
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct GstVulkanDisplayWaylandClass {
|
||||
pub object_class: gst_vulkan::GstVulkanDisplayClass,
|
||||
}
|
||||
|
||||
impl ::std::fmt::Debug for GstVulkanDisplayWaylandClass {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
f.debug_struct(&format!("GstVulkanDisplayWaylandClass @ {self:p}"))
|
||||
.field("object_class", &self.object_class)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
// Classes
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct GstVulkanDisplayWayland {
|
||||
pub parent: gst_vulkan::GstVulkanDisplay,
|
||||
pub display: gpointer,
|
||||
pub registry: gpointer,
|
||||
pub compositor: gpointer,
|
||||
pub subcompositor: gpointer,
|
||||
pub shell: gpointer,
|
||||
pub foreign_display: gboolean,
|
||||
}
|
||||
|
||||
impl ::std::fmt::Debug for GstVulkanDisplayWayland {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
f.debug_struct(&format!("GstVulkanDisplayWayland @ {self:p}"))
|
||||
.field("parent", &self.parent)
|
||||
.field("display", &self.display)
|
||||
.field("registry", &self.registry)
|
||||
.field("compositor", &self.compositor)
|
||||
.field("subcompositor", &self.subcompositor)
|
||||
.field("shell", &self.shell)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
//=========================================================================
|
||||
// GstVulkanDisplayWayland
|
||||
//=========================================================================
|
||||
pub fn gst_vulkan_display_wayland_get_type() -> GType;
|
||||
pub fn gst_vulkan_display_wayland_new(name: *const c_char) -> *mut GstVulkanDisplayWayland;
|
||||
pub fn gst_vulkan_display_wayland_new_with_display(
|
||||
display: gpointer,
|
||||
) -> *mut GstVulkanDisplayWayland;
|
||||
|
||||
}
|
221
gstreamer-vulkan/wayland/sys/tests/abi.rs
Normal file
221
gstreamer-vulkan/wayland/sys/tests/abi.rs
Normal file
|
@ -0,0 +1,221 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
#![cfg(unix)]
|
||||
|
||||
use gstreamer_vulkan_wayland_sys::*;
|
||||
use std::env;
|
||||
use std::error::Error;
|
||||
use std::ffi::OsString;
|
||||
use std::mem::{align_of, size_of};
|
||||
use std::path::Path;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::str;
|
||||
use tempfile::Builder;
|
||||
|
||||
static PACKAGES: &[&str] = &["gstreamer-vulkan-wayland-1.0"];
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Compiler {
|
||||
pub args: Vec<String>,
|
||||
}
|
||||
|
||||
impl Compiler {
|
||||
pub fn new() -> Result<Self, Box<dyn Error>> {
|
||||
let mut args = get_var("CC", "cc")?;
|
||||
args.push("-Wno-deprecated-declarations".to_owned());
|
||||
// For _Generic
|
||||
args.push("-std=c11".to_owned());
|
||||
// For %z support in printf when using MinGW.
|
||||
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
|
||||
args.extend(get_var("CFLAGS", "")?);
|
||||
args.extend(get_var("CPPFLAGS", "")?);
|
||||
args.extend(pkg_config_cflags(PACKAGES)?);
|
||||
Ok(Self { args })
|
||||
}
|
||||
|
||||
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
|
||||
let mut cmd = self.to_command();
|
||||
cmd.arg(src);
|
||||
cmd.arg("-o");
|
||||
cmd.arg(out);
|
||||
let status = cmd.spawn()?.wait()?;
|
||||
if !status.success() {
|
||||
return Err(format!("compilation command {cmd:?} failed, {status}").into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn to_command(&self) -> Command {
|
||||
let mut cmd = Command::new(&self.args[0]);
|
||||
cmd.args(&self.args[1..]);
|
||||
cmd
|
||||
}
|
||||
}
|
||||
|
||||
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<dyn Error>> {
|
||||
match env::var(name) {
|
||||
Ok(value) => Ok(shell_words::split(&value)?),
|
||||
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
|
||||
Err(err) => Err(format!("{name} {err}").into()),
|
||||
}
|
||||
}
|
||||
|
||||
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
|
||||
if packages.is_empty() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
|
||||
let mut cmd = Command::new(pkg_config);
|
||||
cmd.arg("--cflags");
|
||||
cmd.args(packages);
|
||||
cmd.stderr(Stdio::inherit());
|
||||
let out = cmd.output()?;
|
||||
if !out.status.success() {
|
||||
let (status, stdout) = (out.status, String::from_utf8_lossy(&out.stdout));
|
||||
return Err(format!("command {cmd:?} failed, {status:?}\nstdout: {stdout}").into());
|
||||
}
|
||||
let stdout = str::from_utf8(&out.stdout)?;
|
||||
Ok(shell_words::split(stdout.trim())?)
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
struct Layout {
|
||||
size: usize,
|
||||
alignment: usize,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
|
||||
struct Results {
|
||||
/// Number of successfully completed tests.
|
||||
passed: usize,
|
||||
/// Total number of failed tests (including those that failed to compile).
|
||||
failed: usize,
|
||||
}
|
||||
|
||||
impl Results {
|
||||
fn record_passed(&mut self) {
|
||||
self.passed += 1;
|
||||
}
|
||||
fn record_failed(&mut self) {
|
||||
self.failed += 1;
|
||||
}
|
||||
fn summary(&self) -> String {
|
||||
format!("{} passed; {} failed", self.passed, self.failed)
|
||||
}
|
||||
fn expect_total_success(&self) {
|
||||
if self.failed == 0 {
|
||||
println!("OK: {}", self.summary());
|
||||
} else {
|
||||
panic!("FAILED: {}", self.summary());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cross_validate_constants_with_c() {
|
||||
let mut c_constants: Vec<(String, String)> = Vec::new();
|
||||
|
||||
for l in get_c_output("constant").unwrap().lines() {
|
||||
let (name, value) = l.split_once(';').expect("Missing ';' separator");
|
||||
c_constants.push((name.to_owned(), value.to_owned()));
|
||||
}
|
||||
|
||||
let mut results = Results::default();
|
||||
|
||||
for ((rust_name, rust_value), (c_name, c_value)) in
|
||||
RUST_CONSTANTS.iter().zip(c_constants.iter())
|
||||
{
|
||||
if rust_name != c_name {
|
||||
results.record_failed();
|
||||
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if rust_value != c_value {
|
||||
results.record_failed();
|
||||
eprintln!(
|
||||
"Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}",
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
results.record_passed();
|
||||
}
|
||||
|
||||
results.expect_total_success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cross_validate_layout_with_c() {
|
||||
let mut c_layouts = Vec::new();
|
||||
|
||||
for l in get_c_output("layout").unwrap().lines() {
|
||||
let (name, value) = l.split_once(';').expect("Missing first ';' separator");
|
||||
let (size, alignment) = value.split_once(';').expect("Missing second ';' separator");
|
||||
let size = size.parse().expect("Failed to parse size");
|
||||
let alignment = alignment.parse().expect("Failed to parse alignment");
|
||||
c_layouts.push((name.to_owned(), Layout { size, alignment }));
|
||||
}
|
||||
|
||||
let mut results = Results::default();
|
||||
|
||||
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
|
||||
{
|
||||
if rust_name != c_name {
|
||||
results.record_failed();
|
||||
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if rust_layout != c_layout {
|
||||
results.record_failed();
|
||||
eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",);
|
||||
continue;
|
||||
}
|
||||
|
||||
results.record_passed();
|
||||
}
|
||||
|
||||
results.expect_total_success();
|
||||
}
|
||||
|
||||
fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
|
||||
let tmpdir = Builder::new().prefix("abi").tempdir()?;
|
||||
let exe = tmpdir.path().join(name);
|
||||
let c_file = Path::new("tests").join(name).with_extension("c");
|
||||
|
||||
let cc = Compiler::new().expect("configured compiler");
|
||||
cc.compile(&c_file, &exe)?;
|
||||
|
||||
let mut cmd = Command::new(exe);
|
||||
cmd.stderr(Stdio::inherit());
|
||||
let out = cmd.output()?;
|
||||
if !out.status.success() {
|
||||
let (status, stdout) = (out.status, String::from_utf8_lossy(&out.stdout));
|
||||
return Err(format!("command {cmd:?} failed, {status:?}\nstdout: {stdout}").into());
|
||||
}
|
||||
|
||||
Ok(String::from_utf8(out.stdout)?)
|
||||
}
|
||||
|
||||
const RUST_LAYOUTS: &[(&str, Layout)] = &[
|
||||
(
|
||||
"GstVulkanDisplayWayland",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanDisplayWayland>(),
|
||||
alignment: align_of::<GstVulkanDisplayWayland>(),
|
||||
},
|
||||
),
|
||||
(
|
||||
"GstVulkanDisplayWaylandClass",
|
||||
Layout {
|
||||
size: size_of::<GstVulkanDisplayWaylandClass>(),
|
||||
alignment: align_of::<GstVulkanDisplayWaylandClass>(),
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
const RUST_CONSTANTS: &[(&str, &str)] = &[];
|
33
gstreamer-vulkan/wayland/sys/tests/constant.c
Normal file
33
gstreamer-vulkan/wayland/sys/tests/constant.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
#include "manual.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define PRINT_CONSTANT(CONSTANT_NAME) \
|
||||
printf("%s;", #CONSTANT_NAME); \
|
||||
printf(_Generic((CONSTANT_NAME), \
|
||||
char *: "%s", \
|
||||
const char *: "%s", \
|
||||
char: "%c", \
|
||||
signed char: "%hhd", \
|
||||
unsigned char: "%hhu", \
|
||||
short int: "%hd", \
|
||||
unsigned short int: "%hu", \
|
||||
int: "%d", \
|
||||
unsigned int: "%u", \
|
||||
long: "%ld", \
|
||||
unsigned long: "%lu", \
|
||||
long long: "%lld", \
|
||||
unsigned long long: "%llu", \
|
||||
float: "%f", \
|
||||
double: "%f", \
|
||||
long double: "%ld"), \
|
||||
CONSTANT_NAME); \
|
||||
printf("\n");
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
14
gstreamer-vulkan/wayland/sys/tests/layout.c
Normal file
14
gstreamer-vulkan/wayland/sys/tests/layout.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
#include "manual.h"
|
||||
#include <stdalign.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("%s;%zu;%zu\n", "GstVulkanDisplayWayland", sizeof(GstVulkanDisplayWayland), alignof(GstVulkanDisplayWayland));
|
||||
printf("%s;%zu;%zu\n", "GstVulkanDisplayWaylandClass", sizeof(GstVulkanDisplayWaylandClass), alignof(GstVulkanDisplayWaylandClass));
|
||||
return 0;
|
||||
}
|
3
gstreamer-vulkan/wayland/sys/tests/manual.h
Normal file
3
gstreamer-vulkan/wayland/sys/tests/manual.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
|
||||
|
||||
#include <gst/vulkan/wayland/wayland.h>
|
8
gstreamer-vulkan/wayland/tests/check_gir.rs
Normal file
8
gstreamer-vulkan/wayland/tests/check_gir.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
1
gstreamer-vulkan/xcb/CHANGELOG.md
Symbolic link
1
gstreamer-vulkan/xcb/CHANGELOG.md
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../gstreamer/CHANGELOG.md
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue