Merge branch 'vulkan' into 'main'

Draft: Create Rust bindings to GStreamer Vulkan architecture

Closes #389

See merge request gstreamer/gstreamer-rs!1456
This commit is contained in:
Marijn Suijten 2025-02-13 19:41:06 +00:00
commit b1501a7a2e
108 changed files with 12058 additions and 32 deletions

View file

@ -151,14 +151,15 @@ 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
libflac-dev libmysofa-dev libgtk-4-dev libvulkan-dev
FDO_DISTRIBUTION_EXEC: >-
bash ci/install-glslc.sh &&
bash ci/install-gst.sh &&
bash ci/install-dav1d.sh &&
pip3 install --break-system-packages git+http://gitlab.freedesktop.org/freedesktop/ci-templates

195
Cargo.lock generated
View file

@ -60,6 +60,26 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
[[package]]
name = "ash"
version = "0.37.3+1.3.251"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a"
dependencies = [
"libloading 0.7.4",
]
[[package]]
name = "ash-window"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b912285a7c29f3a8f87ca6f55afc48768624e5e33ec17dbd2f2075903f5e35ab"
dependencies = [
"ash",
"raw-window-handle",
"raw-window-metal",
]
[[package]]
name = "async-channel"
version = "2.3.1"
@ -261,6 +281,22 @@ dependencies = [
"libc",
]
[[package]]
name = "cocoa"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c"
dependencies = [
"bitflags 1.3.2",
"block",
"cocoa-foundation 0.1.2",
"core-foundation 0.9.4",
"core-graphics 0.23.2",
"foreign-types",
"libc",
"objc",
]
[[package]]
name = "cocoa"
version = "0.26.0"
@ -269,7 +305,7 @@ checksum = "f79398230a6e2c08f5c9760610eb6924b52aa9e7950a619602baba59dcbbdbb2"
dependencies = [
"bitflags 2.7.0",
"block",
"cocoa-foundation",
"cocoa-foundation 0.2.0",
"core-foundation 0.10.0",
"core-graphics 0.24.0",
"foreign-types",
@ -277,6 +313,20 @@ dependencies = [
"objc",
]
[[package]]
name = "cocoa-foundation"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7"
dependencies = [
"bitflags 1.3.2",
"block",
"core-foundation 0.9.4",
"core-graphics-types 0.1.3",
"libc",
"objc",
]
[[package]]
name = "cocoa-foundation"
version = "0.2.0"
@ -450,7 +500,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
dependencies = [
"libloading",
"libloading 0.8.6",
]
[[package]]
@ -507,10 +557,12 @@ name = "examples"
version = "0.24.0"
dependencies = [
"anyhow",
"ash",
"ash-window",
"atomic_refcell",
"byte-slice-cast",
"cairo-rs",
"cocoa",
"cocoa 0.26.0",
"data-encoding",
"derive_more",
"futures",
@ -535,6 +587,9 @@ dependencies = [
"gstreamer-rtsp-server",
"gstreamer-sdp",
"gstreamer-video",
"gstreamer-vulkan",
"gstreamer-vulkan-wayland",
"gstreamer-vulkan-xcb",
"image",
"memfd",
"memmap2",
@ -811,7 +866,7 @@ dependencies = [
"glutin_glx_sys",
"glutin_wgl_sys",
"icrate",
"libloading",
"libloading 0.8.6",
"objc2",
"once_cell",
"raw-window-handle",
@ -1561,6 +1616,83 @@ dependencies = [
"tempfile",
]
[[package]]
name = "gstreamer-vulkan"
version = "0.24.0"
dependencies = [
"bitflags 1.3.2",
"byteorder",
"glib",
"gstreamer",
"gstreamer-base",
"gstreamer-video",
"gstreamer-vulkan-sys",
"gtk-rs-vulkan",
"libc",
"once_cell",
]
[[package]]
name = "gstreamer-vulkan-sys"
version = "0.24.0"
dependencies = [
"glib-sys",
"gstreamer-base-sys",
"gstreamer-sys",
"gstreamer-video-sys",
"gtk-rs-vulkan",
"libc",
"shell-words",
"system-deps",
"tempfile",
]
[[package]]
name = "gstreamer-vulkan-wayland"
version = "0.24.0"
dependencies = [
"glib",
"gstreamer",
"gstreamer-vulkan",
"gstreamer-vulkan-wayland-sys",
"libc",
]
[[package]]
name = "gstreamer-vulkan-wayland-sys"
version = "0.24.0"
dependencies = [
"glib-sys",
"gstreamer-vulkan-sys",
"libc",
"shell-words",
"system-deps",
"tempfile",
]
[[package]]
name = "gstreamer-vulkan-xcb"
version = "0.24.0"
dependencies = [
"glib",
"gstreamer",
"gstreamer-vulkan",
"gstreamer-vulkan-xcb-sys",
"libc",
]
[[package]]
name = "gstreamer-vulkan-xcb-sys"
version = "0.24.0"
dependencies = [
"glib-sys",
"gstreamer-vulkan-sys",
"libc",
"shell-words",
"system-deps",
"tempfile",
]
[[package]]
name = "gstreamer-webrtc"
version = "0.24.0"
@ -1586,6 +1718,13 @@ dependencies = [
"tempfile",
]
[[package]]
name = "gtk-rs-vulkan"
version = "0.22.0"
dependencies = [
"ash",
]
[[package]]
name = "hashbrown"
version = "0.15.2"
@ -1722,6 +1861,16 @@ version = "0.2.169"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
[[package]]
name = "libloading"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
dependencies = [
"cfg-if",
"winapi",
]
[[package]]
name = "libloading"
version = "0.8.6"
@ -2108,6 +2257,18 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"
[[package]]
name = "raw-window-metal"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac4ea493258d54c24cb46aa9345d099e58e2ea3f30dd63667fc54fc892f18e76"
dependencies = [
"cocoa 0.25.0",
"core-graphics 0.23.2",
"objc",
"raw-window-handle",
]
[[package]]
name = "redox_syscall"
version = "0.3.5"
@ -2469,7 +2630,7 @@ dependencies = [
"anyhow",
"async-channel",
"byte-slice-cast",
"cocoa",
"cocoa 0.26.0",
"futures",
"glib",
"gstreamer",
@ -2737,6 +2898,22 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.9"
@ -2746,6 +2923,12 @@ dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.59.0"
@ -3154,7 +3337,7 @@ dependencies = [
"as-raw-xcb-connection",
"gethostname",
"libc",
"libloading",
"libloading 0.8.6",
"once_cell",
"rustix",
"x11rb-protocol",

View file

@ -71,6 +71,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",
@ -97,11 +100,16 @@ members = [
"gstreamer-tag",
"gstreamer-validate",
"gstreamer-video",
"gstreamer-vulkan",
"gstreamer-vulkan/wayland",
"gstreamer-vulkan/xcb",
"gstreamer-webrtc",
"gstreamer-allocators",
"gstreamer-utils",
"examples",
"tutorials",
"gtk-rs-vulkan",
]
exclude = ["gir"]
@ -148,6 +156,9 @@ gstreamer-tag-sys = { path = "./gstreamer-tag/sys" }
gstreamer-sys = { path = "./gstreamer/sys"}
gstreamer-validate-sys = { path = "./gstreamer-validate/sys" }
gstreamer-video-sys = { path = "./gstreamer-video/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"}
gstreamer-webrtc-sys = { path = "./gstreamer-webrtc/sys" }
ges = { package = "gstreamer-editing-services", path = "./gstreamer-editing-services" }
gst = { package = "gstreamer", path = "./gstreamer" }
@ -167,3 +178,10 @@ 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" }
# [patch.crates-io]
# ash = { path = "../../TraverseResearch/ash/ash" }
# ash-window = { path = "../../TraverseResearch/ash/ash-window" }

15
ci/install-glslc.sh Executable file
View file

@ -0,0 +1,15 @@
set -e
apt -y install cmake
pushd .
cd ..
git clone --depth=1 https://github.com/google/shaderc
cd shaderc
./utils/git-sync-deps
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
popd

View file

@ -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 [ -e "$crate/Cargo.toml" ]; then
if [ -n "$ALL_FEATURES" ]; then
FEATURES="--all-features"

View file

@ -22,7 +22,7 @@ get_features() {
esac
}
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 [ -e "$crate/Cargo.toml" ]; then
FEATURES=$(get_features "$crate")

View file

@ -43,6 +43,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

View file

@ -30,6 +30,12 @@ $env:ErrorActionPreference='Stop'
'gstreamer-tag',
'gstreamer-tag/sys',
'gstreamer-video',
# cargo:warning=`"pkg-config" "--libs" "--cflags" "gstreamer-vulkan-1.0" "gstreamer-vulkan-1.0 >= 1.20"` did not exit successfully: exit code: 1
# error: could not find system library 'gstreamer-vulkan-1.0' required by the 'gstreamer-vulkan-sys' crate
# 'gstreamer-vulkan',
# Linux WMs not available on Windows
# 'gstreamer-vulkan/wayland',
# 'gstreamer-vulkan/xcb',
'gstreamer-webrtc',
'tutorials',
'examples'

View file

@ -25,9 +25,14 @@ gst-rtsp = { workspace = true, optional = true }
gst-rtsp-server = { workspace = true, optional = true }
gst-allocators = { workspace = true, optional = true }
gio = { workspace = true, optional = true }
gst-vulkan = { workspace = true, optional = true }
gst-vulkan-wayland = { workspace = true, optional = true }
gst-vulkan-xcb = { workspace = true, optional = true }
ash = { version = "0.37", optional = true }
ash-window = { version = "0.12", optional = true }
anyhow = "1.0"
byte-slice-cast = "1"
cairo-rs = { workspace = true, features=["use_glib"], optional = true }
cairo-rs = { workspace = true, features = ["use_glib"], optional = true }
derive_more = { version = "1", features = ["display", "error"] }
futures = "0.3"
# Since there's nothing Windows-specific to enable on gstreamer-rs, unconditionally enable glutin's WGL backend
@ -71,9 +76,13 @@ rtsp-server-record = ["gst-rtsp-server", "gst-rtsp", "gio"]
pango-cairo = ["pango", "pangocairo", "cairo-rs"]
overlay-composition = ["pango", "pangocairo", "cairo-rs"]
gl = ["dep:gst-gl", "dep:gl_generator", "dep:glutin", "dep:glutin-winit", "dep:winit", "dep:raw-window-handle"]
gst-gl-x11 = ["dep:gst-gl-x11", "glutin-winit?/glx"] # glx turns on x11
gst-gl-egl = ["dep:gst-gl-egl", "glutin-winit?/egl", "glutin-winit?/x11", "glutin-winit?/wayland"] # Use X11 or Wayland via EGL
gst-gl-x11 = ["gl", "dep:gst-gl-x11", "glutin-winit?/glx"] # glx turns on x11
gst-gl-egl = ["gl", "dep:gst-gl-egl", "glutin-winit?/egl", "glutin-winit?/x11", "glutin-winit?/wayland"] # Use X11 or Wayland via EGL
allocators = ["gst-allocators", "memmap2", "memfd", "uds"]
# TODO: Suffix with gst-?
vulkan = ["dep:ash", "dep:ash-window", "dep:gst-vulkan", "dep:winit", "dep:raw-window-handle"]
gst-vulkan-xcb = ["vulkan", "dep:gst-vulkan-xcb", "winit?/x11"]
gst-vulkan-wayland = ["vulkan", "dep:gst-vulkan-wayland", "winit?/wayland"]
[[bin]]
name = "appsink"
@ -217,3 +226,7 @@ name = "audio_multichannel_interleave"
[[bin]]
name = "zoom"
required-features = ["gst-video/v1_18"]
[[bin]]
name = "vkwindow"
required-features = ["vulkan"] #, "gst-vulkan/v1_24"]

View file

@ -0,0 +1,16 @@
#[path = "../vkupload.rs"]
mod vkupload;
use vkupload::*;
#[path = "../examples-common.rs"]
pub mod examples_common;
fn example_main() {
App::new(None)
.and_then(main_loop)
.unwrap_or_else(|e| eprintln!("Error! {}", e))
}
fn main() {
examples_common::run(example_main);
}

View file

@ -5,6 +5,8 @@
//! <https://github.com/rust-windowing/glutin/blob/master/glutin_examples/src/lib.rs>
// {videotestsrc} - { glsinkbin }
// Or:
// {videotestsrc} - { glupload } - { filter }? - { appsink }
use std::{
ffi::{CStr, CString},
@ -649,9 +651,7 @@ impl App {
if let Some(gl_element) = gl_element {
let glupload = gst::ElementFactory::make("glupload").build()?;
pipeline.add_many([&src, &glupload])?;
pipeline.add(gl_element)?;
pipeline.add(&appsink)?;
pipeline.add_many([&src, &glupload, gl_element, appsink.upcast_ref()])?;
src.link(&glupload)?;
glupload.link(gl_element)?;

1031
examples/src/vkupload.rs Normal file

File diff suppressed because it is too large Load diff

2
gir

@ -1 +1 @@
Subproject commit be3ecc201d39c77befa1eb3abad2a3eed3c83eb0
Subproject commit 876968b635c3e2b7ad2de550e608314aee67b98b

@ -1 +1 @@
Subproject commit b8b3d27875d1842626ce056a198017630b1c1eb3
Subproject commit 83be677e75781435540f3c8a0223330771da0770

View file

@ -8,13 +8,13 @@ description = "Rust bindings for GStreamer GL library"
license = "MIT OR Apache-2.0"
readme = "README.md"
documentation = "https://gstreamer.freedesktop.org/documentation/rust/stable/latest/docs/gstreamer_gl/"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
keywords = ["gstreamer", "multimedia", "gl", "video", "gnome"]
version.workspace = true
categories.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
[dependencies]
libc = "0.2"

View file

@ -10,10 +10,10 @@ readme = "README.md"
documentation = "https://gstreamer.freedesktop.org/documentation/rust/stable/latest/docs/gstreamer_gl_egl/"
version.workspace = true
categories.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
[dependencies]
libc = "0.2"

View file

@ -3,15 +3,15 @@ name = "gstreamer-utils"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>", "Thibault Saunier <tsaunier@igalia.com>"]
categories = ["multimedia"]
description = "Exposes an object to build several Gst pipeline with one producer and several consumer"
license = "MIT/Apache-2.0"
license = "MIT OR Apache-2.0"
readme = "README.md"
documentation = "https://gstreamer.freedesktop.org/documentation/rust/stable/latest/docs/gstreamer_utils/"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
version.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -0,0 +1,43 @@
[package]
name = "gstreamer-vulkan"
authors = [
"Marijn Suijten <marijns95@gmail.com>",
]
description = "Rust bindings for GStreamer Vulkan library"
license = "MIT OR Apache-2.0"
readme = "README.md"
documentation = "https://gstreamer.freedesktop.org/documentation/rust/stable/latest/docs/gstreamer_vulkan/"
keywords = ["gstreamer", "multimedia", "vulkan", "video", "gnome"]
version.workspace = true
categories.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
[dependencies]
bitflags = "1"
byteorder = "1"
glib.workspace = true
gst-base.workspace = true
gst-video.workspace = true
gst.workspace = true
gstreamer-vulkan-sys.workspace = true
libc = "0.2"
once_cell = "1"
vulkan = { package = "gtk-rs-vulkan", path = "../gtk-rs-vulkan" }
[features]
default = []
# v1_18 is minimum for this crate... TODO: Enable those flags by default for gst{,-base,-video}?
# v1_16 = ["gst/v1_16", "gst-base/v1_16", "gst-video/v1_16", "gstreamer-vulkan-sys/v1_16"]
# v1_18 = ["gst/v1_18", "gst-base/v1_18", "gst-video/v1_18", "gstreamer-vulkan-sys/v1_18", "v1_16"]
v1_20 = ["gst/v1_20", "gst-base/v1_20", "gst-video/v1_20", "gstreamer-vulkan-sys/v1_20"] # "v1_18"]
v1_22 = ["gst/v1_22", "gst-base/v1_22", "gst-video/v1_22", "gstreamer-vulkan-sys/v1_22", "v1_20"]
v1_24 = ["gst/v1_24", "gst-base/v1_24", "gst-video/v1_24", "gstreamer-vulkan-sys/v1_24", "v1_22"]
v1_26 = ["gst/v1_26", "gst-base/v1_26", "gst-video/v1_26", "gstreamer-vulkan-sys/v1_26", "v1_24"]
[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]

185
gstreamer-vulkan/Gir.toml Normal file
View file

@ -0,0 +1,185 @@
[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
# https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1933
trust_return_value_nullability = true
external_libraries = [
"GLib",
# "Vulkan",
# "GObject",
"Gst",
"GstBase",
"GstVideo",
]
generate = [
# Classes
"GstVulkan.VulkanBufferMemoryAllocator",
"GstVulkan.VulkanCommandPool",
"GstVulkan.VulkanDescriptorCache",
"GstVulkan.VulkanDescriptorPool",
"GstVulkan.VulkanDevice",
"GstVulkan.VulkanDisplay",
"GstVulkan.VulkanFenceCache",
"GstVulkan.VulkanFullScreenQuad",
"GstVulkan.VulkanHandlePool",
"GstVulkan.VulkanImageMemoryAllocator",
"GstVulkan.VulkanInstance",
"GstVulkan.VulkanMemoryAllocator",
"GstVulkan.VulkanOperation",
"GstVulkan.VulkanPhysicalDevice",
"GstVulkan.VulkanQueue",
"GstVulkan.VulkanTrashFenceList",
"GstVulkan.VulkanTrashList",
"GstVulkan.VulkanVideoFilter",
"GstVulkan.VulkanWindow",
# Enumerations
"GstVulkan.VulkanBarrierFlags",
"GstVulkan.VulkanBarrierType",
"GstVulkan.VulkanError",
"GstVulkan.VulkanFormatScaling",
"GstVulkan.VulkanHandleType",
"GstVulkan.VulkanVideoOperation",
"GstVulkan.VulkanWindowError",
# Bitfields
"GstVulkan.VulkanDisplayType",
"GstVulkan.VulkanFormatFlags",
# Records
# "GstVulkan.VulkanBarrierBufferInfo", # No get_type
# "GstVulkan.VulkanBarrierImageInfo", # No get_type
# "GstVulkan.VulkanBarrierMemoryInfo", # No get_type
# "GstVulkan.VulkanBufferMemoryAllocatorClass",
# "GstVulkan.VulkanBufferPoolClass",
# "GstVulkan.VulkanBufferPoolPrivate",
# "GstVulkan.VulkanCommandPoolClass",
# "GstVulkan.VulkanCommandPoolPrivate",
# "GstVulkan.VulkanDescriptorCacheClass",
# "GstVulkan.VulkanDescriptorCachePrivate",
# "GstVulkan.VulkanDescriptorPoolClass",
# "GstVulkan.VulkanDescriptorPoolPrivate",
# "GstVulkan.VulkanDeviceClass",
# "GstVulkan.VulkanDevicePrivate",
# "GstVulkan.VulkanDisplayClass",
# "GstVulkan.VulkanDisplayPrivate",
# "GstVulkan.VulkanEncodeQueryResult", # No get_type
"GstVulkan.VulkanFence",
# "GstVulkan.VulkanFenceCacheClass",
# "GstVulkan.VulkanFormatInfo", # No get_type
# "GstVulkan.VulkanFormatMap", # No get_type
# "GstVulkan.VulkanFullScreenQuadClass",
# "GstVulkan.VulkanFullScreenQuadPrivate",
"GstVulkan.VulkanHandle",
# "GstVulkan.VulkanHandlePoolClass",
# "GstVulkan.VulkanImageBufferPoolClass",
# "GstVulkan.VulkanImageBufferPoolPrivate",
# "GstVulkan.VulkanImageMemoryAllocatorClass",
# "GstVulkan.VulkanInstanceClass",
# "GstVulkan.VulkanInstancePrivate",
# "GstVulkan.VulkanMemoryAllocatorClass",
# "GstVulkan.VulkanOperationClass",
# "GstVulkan.VulkanOperationPrivate",
# "GstVulkan.VulkanPhysicalDeviceClass",
# "GstVulkan.VulkanPhysicalDevicePrivate",
# "GstVulkan.VulkanQueueClass",
# "GstVulkan.VulkanQueueFamilyOps", # No get_type
# "GstVulkan.VulkanQueuePrivate",
# "GstVulkan.VulkanSwapperClass",
# "GstVulkan.VulkanSwapperPrivate",
"GstVulkan.VulkanTrash",
# "GstVulkan.VulkanTrashFenceListClass",
# "GstVulkan.VulkanTrashListClass",
# "GstVulkan.VulkanVideoCapabilities", # No get_type
# "GstVulkan.VulkanVideoFilterClass",
# "GstVulkan.VulkanVideoProfile", # No get_type
# "GstVulkan.VulkanWindowClass",
# "GstVulkan.VulkanWindowPrivate",
# Objects
]
manual = [
"GLib.Error",
"GLib.Quark",
"Gst.AllocationParams",
"Gst.Allocator",
"Gst.Buffer",
"Gst.BufferPool",
"Gst.Caps",
"Gst.Context",
"Gst.Element",
"Gst.Memory",
"Gst.Object",
"Gst.PadDirection",
"Gst.Query",
"Gst.Structure",
"GstBase.BaseTransform",
"GstVideo.VideoFormat",
"GstVideo.VideoInfo",
"GstVideo.VideoRectangle",
"GstVulkan.VulkanBufferMemory",
"GstVulkan.VulkanCommandBuffer",
"GstVulkan.VulkanDescriptorSet",
"GstVulkan.VulkanImageMemory",
"GstVulkan.VulkanImageView",
"GstVulkan.VulkanMemory",
]
[[object]]
name = "GstVulkan.*"
status = "generate"
[[object.function]]
pattern = "context_.*"
manual = true
[[object.function]]
name = "vulkan_format_from_video_info"
[[object.function.parameter]]
name = "v_info"
const = true
[[object]]
name = "Gst.Fraction"
status = "manual"
# Prevent nullable references on properties
ref_mode = "none"
[[object]]
name = "GstVulkan.VulkanHandleTypedef"
# Disguised type, custom Vulkan non-dispatchable handle
# TODO: Move to manual array
status = "manual"
[[object]]
name = "GstVulkan.VulkanSwapper"
status = "generate"
manual_traits = ["VulkanSwapperExtManual"]
[[object.function]]
name = "get_surface_rectangles"
# Function returns optional values in arguments
# (Caller should specify what it wishes to retrieve)
manual = true
[[object]]
name = "GstVulkan.VulkanBufferPool"
status = "generate"
[[object.function]]
pattern = "config_.*"
# Implemented as extension on gst::BufferPoolConfigRef
manual = true
[[object]]
name = "GstVulkan.VulkanImageBufferPool"
status = "generate"
[[object.function]]
pattern = "config_.*"
# Implemented as extension on gst::BufferPoolConfigRef
manual = true

202
gstreamer-vulkan/README.md Normal file
View file

@ -0,0 +1,202 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-vulkan.svg)](https://crates.io/crates/gstreamer-vulkan) [![pipeline status](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/badges/main/pipeline.svg)](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.freedesktop.org/documentation/rust/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 and
that the version is >= 1.12. See the `Cargo.toml` files for the full
details,
```console
$ # Only if you wish to install gstreamer-player, make sure the version
$ # of this package is >= 1.12.
$ 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.
#### 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
```
If you wish to install the gstreamer-player sub-crate, make sure the
version of these libraries is >= 1.12. Otherwise, a version >= 1.8 is
sufficient.
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<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.
#### 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
```
If you wish to install the gstreamer-player sub-crate, make sure the
version of these libraries is >= 1.12. Otherwise, a version >= 1.8 is
sufficient.
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/).
#### 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.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://gstreamer.freedesktop.org/documentation/rust/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.

View 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::GStr;
#[doc(alias = "GST_CAPS_FEATURE_MEMORY_VULKAN_BUFFER")]
pub static CAPS_FEATURE_MEMORY_VULKAN_BUFFER: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_CAPS_FEATURE_MEMORY_VULKAN_BUFFER) };
#[doc(alias = "GST_CAPS_FEATURE_MEMORY_VULKAN_IMAGE")]
pub static CAPS_FEATURE_MEMORY_VULKAN_IMAGE: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_CAPS_FEATURE_MEMORY_VULKAN_IMAGE) };
#[doc(alias = "GST_VULKAN_BUFFER_MEMORY_ALLOCATOR_NAME")]
pub static VULKAN_BUFFER_MEMORY_ALLOCATOR_NAME: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_VULKAN_BUFFER_MEMORY_ALLOCATOR_NAME) };
#[doc(alias = "GST_VULKAN_DEVICE_CONTEXT_TYPE_STR")]
pub static VULKAN_DEVICE_CONTEXT_TYPE_STR: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_VULKAN_DEVICE_CONTEXT_TYPE_STR) };
#[doc(alias = "GST_VULKAN_DISPLAY_CONTEXT_TYPE_STR")]
pub static VULKAN_DISPLAY_CONTEXT_TYPE_STR: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_VULKAN_DISPLAY_CONTEXT_TYPE_STR) };
#[doc(alias = "GST_VULKAN_IMAGE_MEMORY_ALLOCATOR_NAME")]
pub static VULKAN_IMAGE_MEMORY_ALLOCATOR_NAME: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_VULKAN_IMAGE_MEMORY_ALLOCATOR_NAME) };
#[doc(alias = "GST_VULKAN_INSTANCE_CONTEXT_TYPE_STR")]
pub static VULKAN_INSTANCE_CONTEXT_TYPE_STR: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_VULKAN_INSTANCE_CONTEXT_TYPE_STR) };
#[doc(alias = "GST_VULKAN_MEMORY_ALLOCATOR_NAME")]
pub static VULKAN_MEMORY_ALLOCATOR_NAME: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_VULKAN_MEMORY_ALLOCATOR_NAME) };
#[doc(alias = "GST_VULKAN_QUEUE_CONTEXT_TYPE_STR")]
pub static VULKAN_QUEUE_CONTEXT_TYPE_STR: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_VULKAN_QUEUE_CONTEXT_TYPE_STR) };
#[doc(alias = "GST_VULKAN_SWAPPER_VIDEO_FORMATS")]
pub static VULKAN_SWAPPER_VIDEO_FORMATS: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_VULKAN_SWAPPER_VIDEO_FORMATS) };

View file

@ -0,0 +1,838 @@
// 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::*, translate::*};
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstVulkanBarrierFlags")]
pub enum VulkanBarrierFlags {
#[doc(alias = "GST_VULKAN_BARRIER_FLAG_NONE")]
None,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl IntoGlib for VulkanBarrierFlags {
type GlibType = ffi::GstVulkanBarrierFlags;
#[inline]
fn into_glib(self) -> ffi::GstVulkanBarrierFlags {
match self {
Self::None => ffi::GST_VULKAN_BARRIER_FLAG_NONE,
Self::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVulkanBarrierFlags> for VulkanBarrierFlags {
#[inline]
unsafe fn from_glib(value: ffi::GstVulkanBarrierFlags) -> Self {
skip_assert_initialized!();
match value {
ffi::GST_VULKAN_BARRIER_FLAG_NONE => Self::None,
value => Self::__Unknown(value),
}
}
}
impl StaticType for VulkanBarrierFlags {
#[inline]
#[doc(alias = "gst_vulkan_barrier_flags_get_type")]
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_vulkan_barrier_flags_get_type()) }
}
}
impl glib::HasParamSpec for VulkanBarrierFlags {
type ParamSpec = glib::ParamSpecEnum;
type SetValue = Self;
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
fn param_spec_builder() -> Self::BuilderFn {
Self::ParamSpec::builder_with_default
}
}
impl glib::value::ValueType for VulkanBarrierFlags {
type Type = Self;
}
unsafe impl<'a> glib::value::FromValue<'a> for VulkanBarrierFlags {
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_enum(value.to_glib_none().0))
}
}
impl ToValue for VulkanBarrierFlags {
#[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
}
value
}
#[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
impl From<VulkanBarrierFlags> for glib::Value {
#[inline]
fn from(v: VulkanBarrierFlags) -> Self {
skip_assert_initialized!();
ToValue::to_value(&v)
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstVulkanBarrierType")]
pub enum VulkanBarrierType {
#[doc(alias = "GST_VULKAN_BARRIER_NONE")]
None,
#[doc(alias = "GST_VULKAN_BARRIER_TYPE_MEMORY")]
TypeMemory,
#[doc(alias = "GST_VULKAN_BARRIER_TYPE_BUFFER")]
TypeBuffer,
#[doc(alias = "GST_VULKAN_BARRIER_TYPE_IMAGE")]
TypeImage,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl IntoGlib for VulkanBarrierType {
type GlibType = ffi::GstVulkanBarrierType;
#[inline]
fn into_glib(self) -> ffi::GstVulkanBarrierType {
match self {
Self::None => ffi::GST_VULKAN_BARRIER_NONE,
Self::TypeMemory => ffi::GST_VULKAN_BARRIER_TYPE_MEMORY,
Self::TypeBuffer => ffi::GST_VULKAN_BARRIER_TYPE_BUFFER,
Self::TypeImage => ffi::GST_VULKAN_BARRIER_TYPE_IMAGE,
Self::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVulkanBarrierType> for VulkanBarrierType {
#[inline]
unsafe fn from_glib(value: ffi::GstVulkanBarrierType) -> Self {
skip_assert_initialized!();
match value {
ffi::GST_VULKAN_BARRIER_NONE => Self::None,
ffi::GST_VULKAN_BARRIER_TYPE_MEMORY => Self::TypeMemory,
ffi::GST_VULKAN_BARRIER_TYPE_BUFFER => Self::TypeBuffer,
ffi::GST_VULKAN_BARRIER_TYPE_IMAGE => Self::TypeImage,
value => Self::__Unknown(value),
}
}
}
impl StaticType for VulkanBarrierType {
#[inline]
#[doc(alias = "gst_vulkan_barrier_type_get_type")]
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_vulkan_barrier_type_get_type()) }
}
}
impl glib::HasParamSpec for VulkanBarrierType {
type ParamSpec = glib::ParamSpecEnum;
type SetValue = Self;
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
fn param_spec_builder() -> Self::BuilderFn {
Self::ParamSpec::builder_with_default
}
}
impl glib::value::ValueType for VulkanBarrierType {
type Type = Self;
}
unsafe impl<'a> glib::value::FromValue<'a> for VulkanBarrierType {
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_enum(value.to_glib_none().0))
}
}
impl ToValue for VulkanBarrierType {
#[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
}
value
}
#[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
impl From<VulkanBarrierType> for glib::Value {
#[inline]
fn from(v: VulkanBarrierType) -> Self {
skip_assert_initialized!();
ToValue::to_value(&v)
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstVulkanError")]
pub enum VulkanError {
#[doc(alias = "GST_VULKAN_FAILED")]
Failed,
#[doc(hidden)]
__Unknown(i32),
}
impl VulkanError {
//#[doc(alias = "gst_vulkan_error_to_g_error")]
//pub fn to_g_error(result: vulkan::Result, format: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> (vulkan::Result, glib::Error) {
// unsafe { TODO: call ffi:gst_vulkan_error_to_g_error() }
//}
}
#[doc(hidden)]
impl IntoGlib for VulkanError {
type GlibType = ffi::GstVulkanError;
#[inline]
fn into_glib(self) -> ffi::GstVulkanError {
match self {
Self::Failed => ffi::GST_VULKAN_FAILED,
Self::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVulkanError> for VulkanError {
#[inline]
unsafe fn from_glib(value: ffi::GstVulkanError) -> Self {
skip_assert_initialized!();
match value {
ffi::GST_VULKAN_FAILED => Self::Failed,
value => Self::__Unknown(value),
}
}
}
impl glib::error::ErrorDomain for VulkanError {
#[inline]
fn domain() -> glib::Quark {
skip_assert_initialized!();
unsafe { from_glib(ffi::gst_vulkan_error_quark()) }
}
#[inline]
fn code(self) -> i32 {
self.into_glib()
}
#[inline]
#[allow(clippy::match_single_binding)]
fn from(code: i32) -> Option<Self> {
skip_assert_initialized!();
match unsafe { from_glib(code) } {
Self::__Unknown(_) => Some(Self::Failed),
value => Some(value),
}
}
}
impl StaticType for VulkanError {
#[inline]
#[doc(alias = "gst_vulkan_error_get_type")]
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_vulkan_error_get_type()) }
}
}
impl glib::HasParamSpec for VulkanError {
type ParamSpec = glib::ParamSpecEnum;
type SetValue = Self;
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
fn param_spec_builder() -> Self::BuilderFn {
Self::ParamSpec::builder_with_default
}
}
impl glib::value::ValueType for VulkanError {
type Type = Self;
}
unsafe impl<'a> glib::value::FromValue<'a> for VulkanError {
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_enum(value.to_glib_none().0))
}
}
impl ToValue for VulkanError {
#[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
}
value
}
#[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
impl From<VulkanError> for glib::Value {
#[inline]
fn from(v: VulkanError) -> Self {
skip_assert_initialized!();
ToValue::to_value(&v)
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstVulkanFormatScaling")]
pub enum VulkanFormatScaling {
#[doc(alias = "GST_VULKAN_FORMAT_SCALING_UNORM")]
Unorm,
#[doc(alias = "GST_VULKAN_FORMAT_SCALING_SNORM")]
Snorm,
#[doc(alias = "GST_VULKAN_FORMAT_SCALING_USCALED")]
Uscaled,
#[doc(alias = "GST_VULKAN_FORMAT_SCALING_SSCALED")]
Sscaled,
#[doc(alias = "GST_VULKAN_FORMAT_SCALING_UINT")]
Uint,
#[doc(alias = "GST_VULKAN_FORMAT_SCALING_SINT")]
Sint,
#[doc(alias = "GST_VULKAN_FORMAT_SCALING_SRGB")]
Srgb,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl IntoGlib for VulkanFormatScaling {
type GlibType = ffi::GstVulkanFormatScaling;
#[inline]
fn into_glib(self) -> ffi::GstVulkanFormatScaling {
match self {
Self::Unorm => ffi::GST_VULKAN_FORMAT_SCALING_UNORM,
Self::Snorm => ffi::GST_VULKAN_FORMAT_SCALING_SNORM,
Self::Uscaled => ffi::GST_VULKAN_FORMAT_SCALING_USCALED,
Self::Sscaled => ffi::GST_VULKAN_FORMAT_SCALING_SSCALED,
Self::Uint => ffi::GST_VULKAN_FORMAT_SCALING_UINT,
Self::Sint => ffi::GST_VULKAN_FORMAT_SCALING_SINT,
Self::Srgb => ffi::GST_VULKAN_FORMAT_SCALING_SRGB,
Self::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVulkanFormatScaling> for VulkanFormatScaling {
#[inline]
unsafe fn from_glib(value: ffi::GstVulkanFormatScaling) -> Self {
skip_assert_initialized!();
match value {
ffi::GST_VULKAN_FORMAT_SCALING_UNORM => Self::Unorm,
ffi::GST_VULKAN_FORMAT_SCALING_SNORM => Self::Snorm,
ffi::GST_VULKAN_FORMAT_SCALING_USCALED => Self::Uscaled,
ffi::GST_VULKAN_FORMAT_SCALING_SSCALED => Self::Sscaled,
ffi::GST_VULKAN_FORMAT_SCALING_UINT => Self::Uint,
ffi::GST_VULKAN_FORMAT_SCALING_SINT => Self::Sint,
ffi::GST_VULKAN_FORMAT_SCALING_SRGB => Self::Srgb,
value => Self::__Unknown(value),
}
}
}
impl StaticType for VulkanFormatScaling {
#[inline]
#[doc(alias = "gst_vulkan_format_scaling_get_type")]
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_vulkan_format_scaling_get_type()) }
}
}
impl glib::HasParamSpec for VulkanFormatScaling {
type ParamSpec = glib::ParamSpecEnum;
type SetValue = Self;
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
fn param_spec_builder() -> Self::BuilderFn {
Self::ParamSpec::builder_with_default
}
}
impl glib::value::ValueType for VulkanFormatScaling {
type Type = Self;
}
unsafe impl<'a> glib::value::FromValue<'a> for VulkanFormatScaling {
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_enum(value.to_glib_none().0))
}
}
impl ToValue for VulkanFormatScaling {
#[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
}
value
}
#[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
impl From<VulkanFormatScaling> for glib::Value {
#[inline]
fn from(v: VulkanFormatScaling) -> Self {
skip_assert_initialized!();
ToValue::to_value(&v)
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstVulkanHandleType")]
pub enum VulkanHandleType {
#[doc(alias = "GST_VULKAN_HANDLE_TYPE_DESCRIPTOR_SET_LAYOUT")]
DescriptorSetLayout,
#[doc(alias = "GST_VULKAN_HANDLE_TYPE_PIPELINE_LAYOUT")]
PipelineLayout,
#[doc(alias = "GST_VULKAN_HANDLE_TYPE_PIPELINE")]
Pipeline,
#[doc(alias = "GST_VULKAN_HANDLE_TYPE_RENDER_PASS")]
RenderPass,
#[doc(alias = "GST_VULKAN_HANDLE_TYPE_SAMPLER")]
Sampler,
#[doc(alias = "GST_VULKAN_HANDLE_TYPE_FRAMEBUFFER")]
Framebuffer,
#[doc(alias = "GST_VULKAN_HANDLE_TYPE_SHADER")]
Shader,
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION")]
VideoSession,
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION_PARAMETERS")]
VideoSessionParameters,
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "GST_VULKAN_HANDLE_TYPE_SAMPLER_YCBCR_CONVERSION")]
SamplerYcbcrConversion,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl IntoGlib for VulkanHandleType {
type GlibType = ffi::GstVulkanHandleType;
#[inline]
fn into_glib(self) -> ffi::GstVulkanHandleType {
match self {
Self::DescriptorSetLayout => ffi::GST_VULKAN_HANDLE_TYPE_DESCRIPTOR_SET_LAYOUT,
Self::PipelineLayout => ffi::GST_VULKAN_HANDLE_TYPE_PIPELINE_LAYOUT,
Self::Pipeline => ffi::GST_VULKAN_HANDLE_TYPE_PIPELINE,
Self::RenderPass => ffi::GST_VULKAN_HANDLE_TYPE_RENDER_PASS,
Self::Sampler => ffi::GST_VULKAN_HANDLE_TYPE_SAMPLER,
Self::Framebuffer => ffi::GST_VULKAN_HANDLE_TYPE_FRAMEBUFFER,
Self::Shader => ffi::GST_VULKAN_HANDLE_TYPE_SHADER,
#[cfg(feature = "v1_24")]
Self::VideoSession => ffi::GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION,
#[cfg(feature = "v1_24")]
Self::VideoSessionParameters => ffi::GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION_PARAMETERS,
#[cfg(feature = "v1_24")]
Self::SamplerYcbcrConversion => ffi::GST_VULKAN_HANDLE_TYPE_SAMPLER_YCBCR_CONVERSION,
Self::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVulkanHandleType> for VulkanHandleType {
#[inline]
unsafe fn from_glib(value: ffi::GstVulkanHandleType) -> Self {
skip_assert_initialized!();
match value {
ffi::GST_VULKAN_HANDLE_TYPE_DESCRIPTOR_SET_LAYOUT => Self::DescriptorSetLayout,
ffi::GST_VULKAN_HANDLE_TYPE_PIPELINE_LAYOUT => Self::PipelineLayout,
ffi::GST_VULKAN_HANDLE_TYPE_PIPELINE => Self::Pipeline,
ffi::GST_VULKAN_HANDLE_TYPE_RENDER_PASS => Self::RenderPass,
ffi::GST_VULKAN_HANDLE_TYPE_SAMPLER => Self::Sampler,
ffi::GST_VULKAN_HANDLE_TYPE_FRAMEBUFFER => Self::Framebuffer,
ffi::GST_VULKAN_HANDLE_TYPE_SHADER => Self::Shader,
#[cfg(feature = "v1_24")]
ffi::GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION => Self::VideoSession,
#[cfg(feature = "v1_24")]
ffi::GST_VULKAN_HANDLE_TYPE_VIDEO_SESSION_PARAMETERS => Self::VideoSessionParameters,
#[cfg(feature = "v1_24")]
ffi::GST_VULKAN_HANDLE_TYPE_SAMPLER_YCBCR_CONVERSION => Self::SamplerYcbcrConversion,
value => Self::__Unknown(value),
}
}
}
impl StaticType for VulkanHandleType {
#[inline]
#[doc(alias = "gst_vulkan_handle_type_get_type")]
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_vulkan_handle_type_get_type()) }
}
}
impl glib::HasParamSpec for VulkanHandleType {
type ParamSpec = glib::ParamSpecEnum;
type SetValue = Self;
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
fn param_spec_builder() -> Self::BuilderFn {
Self::ParamSpec::builder_with_default
}
}
impl glib::value::ValueType for VulkanHandleType {
type Type = Self;
}
unsafe impl<'a> glib::value::FromValue<'a> for VulkanHandleType {
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_enum(value.to_glib_none().0))
}
}
impl ToValue for VulkanHandleType {
#[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
}
value
}
#[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
impl From<VulkanHandleType> for glib::Value {
#[inline]
fn from(v: VulkanHandleType) -> Self {
skip_assert_initialized!();
ToValue::to_value(&v)
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstVulkanVideoOperation")]
pub enum VulkanVideoOperation {
#[doc(alias = "GST_VULKAN_VIDEO_OPERATION_DECODE")]
Decode,
#[doc(alias = "GST_VULKAN_VIDEO_OPERATION_ENCODE")]
Encode,
#[doc(alias = "GST_VULKAN_VIDEO_OPERATION_UNKNOWN")]
Unknown,
#[doc(hidden)]
__Unknown(i32),
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(hidden)]
impl IntoGlib for VulkanVideoOperation {
type GlibType = ffi::GstVulkanVideoOperation;
#[inline]
fn into_glib(self) -> ffi::GstVulkanVideoOperation {
match self {
Self::Decode => ffi::GST_VULKAN_VIDEO_OPERATION_DECODE,
Self::Encode => ffi::GST_VULKAN_VIDEO_OPERATION_ENCODE,
Self::Unknown => ffi::GST_VULKAN_VIDEO_OPERATION_UNKNOWN,
Self::__Unknown(value) => value,
}
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(hidden)]
impl FromGlib<ffi::GstVulkanVideoOperation> for VulkanVideoOperation {
#[inline]
unsafe fn from_glib(value: ffi::GstVulkanVideoOperation) -> Self {
skip_assert_initialized!();
match value {
ffi::GST_VULKAN_VIDEO_OPERATION_DECODE => Self::Decode,
ffi::GST_VULKAN_VIDEO_OPERATION_ENCODE => Self::Encode,
ffi::GST_VULKAN_VIDEO_OPERATION_UNKNOWN => Self::Unknown,
value => Self::__Unknown(value),
}
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
impl StaticType for VulkanVideoOperation {
#[inline]
#[doc(alias = "gst_vulkan_video_operation_get_type")]
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_vulkan_video_operation_get_type()) }
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
impl glib::HasParamSpec for VulkanVideoOperation {
type ParamSpec = glib::ParamSpecEnum;
type SetValue = Self;
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
fn param_spec_builder() -> Self::BuilderFn {
Self::ParamSpec::builder_with_default
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
impl glib::value::ValueType for VulkanVideoOperation {
type Type = Self;
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
unsafe impl<'a> glib::value::FromValue<'a> for VulkanVideoOperation {
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_enum(value.to_glib_none().0))
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
impl ToValue for VulkanVideoOperation {
#[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
}
value
}
#[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
impl From<VulkanVideoOperation> for glib::Value {
#[inline]
fn from(v: VulkanVideoOperation) -> Self {
skip_assert_initialized!();
ToValue::to_value(&v)
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstVulkanWindowError")]
pub enum VulkanWindowError {
#[doc(alias = "GST_VULKAN_WINDOW_ERROR_FAILED")]
Failed,
#[doc(alias = "GST_VULKAN_WINDOW_ERROR_OLD_LIBS")]
OldLibs,
#[doc(alias = "GST_VULKAN_WINDOW_ERROR_RESOURCE_UNAVAILABLE")]
ResourceUnavailable,
#[doc(hidden)]
__Unknown(i32),
}
impl VulkanWindowError {
#[doc(alias = "gst_vulkan_window_error_quark")]
pub fn quark() -> glib::Quark {
assert_initialized_main_thread!();
unsafe { from_glib(ffi::gst_vulkan_window_error_quark()) }
}
}
#[doc(hidden)]
impl IntoGlib for VulkanWindowError {
type GlibType = ffi::GstVulkanWindowError;
#[inline]
fn into_glib(self) -> ffi::GstVulkanWindowError {
match self {
Self::Failed => ffi::GST_VULKAN_WINDOW_ERROR_FAILED,
Self::OldLibs => ffi::GST_VULKAN_WINDOW_ERROR_OLD_LIBS,
Self::ResourceUnavailable => ffi::GST_VULKAN_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
Self::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVulkanWindowError> for VulkanWindowError {
#[inline]
unsafe fn from_glib(value: ffi::GstVulkanWindowError) -> Self {
skip_assert_initialized!();
match value {
ffi::GST_VULKAN_WINDOW_ERROR_FAILED => Self::Failed,
ffi::GST_VULKAN_WINDOW_ERROR_OLD_LIBS => Self::OldLibs,
ffi::GST_VULKAN_WINDOW_ERROR_RESOURCE_UNAVAILABLE => Self::ResourceUnavailable,
value => Self::__Unknown(value),
}
}
}
impl glib::error::ErrorDomain for VulkanWindowError {
#[inline]
fn domain() -> glib::Quark {
skip_assert_initialized!();
static QUARK: ::std::sync::OnceLock<glib::ffi::GQuark> = ::std::sync::OnceLock::new();
let quark = *QUARK.get_or_init(|| unsafe {
glib::ffi::g_quark_from_static_string(
b"gst-gl-window-error-quark\0".as_ptr() as *const _
)
});
unsafe { from_glib(quark) }
}
#[inline]
fn code(self) -> i32 {
self.into_glib()
}
#[inline]
#[allow(clippy::match_single_binding)]
fn from(code: i32) -> Option<Self> {
skip_assert_initialized!();
match unsafe { from_glib(code) } {
Self::__Unknown(_) => Some(Self::Failed),
value => Some(value),
}
}
}
impl StaticType for VulkanWindowError {
#[inline]
#[doc(alias = "gst_vulkan_window_error_get_type")]
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_vulkan_window_error_get_type()) }
}
}
impl glib::HasParamSpec for VulkanWindowError {
type ParamSpec = glib::ParamSpecEnum;
type SetValue = Self;
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
fn param_spec_builder() -> Self::BuilderFn {
Self::ParamSpec::builder_with_default
}
}
impl glib::value::ValueType for VulkanWindowError {
type Type = Self;
}
unsafe impl<'a> glib::value::FromValue<'a> for VulkanWindowError {
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_enum(value.to_glib_none().0))
}
}
impl ToValue for VulkanWindowError {
#[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
}
value
}
#[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
impl From<VulkanWindowError> for glib::Value {
#[inline]
fn from(v: VulkanWindowError) -> Self {
skip_assert_initialized!();
ToValue::to_value(&v)
}
}

View file

@ -0,0 +1,209 @@
// 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)
}
}
bitflags! {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[doc(alias = "GstVulkanFormatFlags")]
pub struct VulkanFormatFlags: u32 {
#[doc(alias = "GST_VULKAN_FORMAT_FLAG_YUV")]
const YUV = ffi::GST_VULKAN_FORMAT_FLAG_YUV as _;
#[doc(alias = "GST_VULKAN_FORMAT_FLAG_RGB")]
const RGB = ffi::GST_VULKAN_FORMAT_FLAG_RGB as _;
#[doc(alias = "GST_VULKAN_FORMAT_FLAG_ALPHA")]
const ALPHA = ffi::GST_VULKAN_FORMAT_FLAG_ALPHA as _;
#[doc(alias = "GST_VULKAN_FORMAT_FLAG_LE")]
const LE = ffi::GST_VULKAN_FORMAT_FLAG_LE as _;
#[doc(alias = "GST_VULKAN_FORMAT_FLAG_COMPLEX")]
const COMPLEX = ffi::GST_VULKAN_FORMAT_FLAG_COMPLEX as _;
}
}
#[doc(hidden)]
impl IntoGlib for VulkanFormatFlags {
type GlibType = ffi::GstVulkanFormatFlags;
#[inline]
fn into_glib(self) -> ffi::GstVulkanFormatFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVulkanFormatFlags> for VulkanFormatFlags {
#[inline]
unsafe fn from_glib(value: ffi::GstVulkanFormatFlags) -> Self {
skip_assert_initialized!();
Self::from_bits_truncate(value)
}
}
impl StaticType for VulkanFormatFlags {
#[inline]
#[doc(alias = "gst_vulkan_format_flags_get_type")]
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_vulkan_format_flags_get_type()) }
}
}
impl glib::HasParamSpec for VulkanFormatFlags {
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 VulkanFormatFlags {
type Type = Self;
}
unsafe impl<'a> glib::value::FromValue<'a> for VulkanFormatFlags {
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 VulkanFormatFlags {
#[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<VulkanFormatFlags> for glib::Value {
#[inline]
fn from(v: VulkanFormatFlags) -> Self {
skip_assert_initialized!();
ToValue::to_value(&v)
}
}

View file

@ -0,0 +1,189 @@
// 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, VulkanHandle, VulkanImageMemory, VulkanImageView};
use glib::{prelude::*, translate::*};
#[doc(alias = "gst_is_vulkan_buffer_memory")]
pub fn is_vulkan_buffer_memory(mem: &gst::Memory) -> bool {
assert_initialized_main_thread!();
unsafe { from_glib(ffi::gst_is_vulkan_buffer_memory(mem.to_glib_none().0)) }
}
#[doc(alias = "gst_is_vulkan_image_memory")]
pub fn is_vulkan_image_memory(mem: &gst::Memory) -> bool {
assert_initialized_main_thread!();
unsafe { from_glib(ffi::gst_is_vulkan_image_memory(mem.to_glib_none().0)) }
}
#[doc(alias = "gst_is_vulkan_memory")]
pub fn is_vulkan_memory(mem: &gst::Memory) -> bool {
assert_initialized_main_thread!();
unsafe { from_glib(ffi::gst_is_vulkan_memory(mem.to_glib_none().0)) }
}
#[doc(alias = "gst_vulkan_create_shader")]
pub fn vulkan_create_shader(
device: &impl IsA<VulkanDevice>,
code: &str,
size: usize,
) -> Result<VulkanHandle, glib::Error> {
skip_assert_initialized!();
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::gst_vulkan_create_shader(
device.as_ref().to_glib_none().0,
code.to_glib_none().0,
size,
&mut error,
);
if error.is_null() {
Ok(from_glib_full(ret))
} else {
Err(from_glib_full(error))
}
}
}
//#[doc(alias = "gst_vulkan_ensure_element_data")]
//pub fn vulkan_ensure_element_data(element: &impl IsA<gst::Element>, display_ptr: impl IsA<VulkanDisplay>, instance_ptr: impl IsA<VulkanInstance>) -> bool {
// unsafe { TODO: call ffi:gst_vulkan_ensure_element_data() }
//}
#[doc(alias = "gst_vulkan_format_from_video_info")]
pub fn vulkan_format_from_video_info(v_info: &gst_video::VideoInfo, plane: u32) -> vulkan::Format {
assert_initialized_main_thread!();
unsafe { ffi::gst_vulkan_format_from_video_info(mut_override(v_info.to_glib_none().0), plane) }
}
//#[cfg(feature = "v1_24")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
//#[doc(alias = "gst_vulkan_format_from_video_info_2")]
//pub fn vulkan_format_from_video_info_2(physical_device: &impl IsA<VulkanPhysicalDevice>, info: &mut gst_video::VideoInfo, tiling: vulkan::ImageTiling, no_multiplane: bool, requested_usage: vulkan::ImageUsageFlags, fmts: /*Unimplemented*/FixedArray TypeId { ns_id: 8, id: 38 }; 4) -> Option<(i32, vulkan::ImageUsageFlags)> {
// unsafe { TODO: call ffi:gst_vulkan_format_from_video_info_2() }
//}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_format_get_aspect")]
pub fn vulkan_format_get_aspect(format: vulkan::Format) -> u32 {
assert_initialized_main_thread!();
unsafe { ffi::gst_vulkan_format_get_aspect(format) }
}
//#[doc(alias = "gst_vulkan_format_get_info")]
//pub fn vulkan_format_get_info(format: vulkan::Format) -> /*Ignored*/Option<VulkanFormatInfo> {
// unsafe { TODO: call ffi:gst_vulkan_format_get_info() }
//}
//#[cfg(feature = "v1_26")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
//#[doc(alias = "gst_vulkan_format_get_map")]
//pub fn vulkan_format_get_map(format: gst_video::VideoFormat) -> /*Ignored*/Option<VulkanFormatMap> {
// unsafe { TODO: call ffi:gst_vulkan_format_get_map() }
//}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_format_to_video_format")]
pub fn vulkan_format_to_video_format(vk_format: vulkan::Format) -> gst_video::VideoFormat {
assert_initialized_main_thread!();
unsafe { from_glib(ffi::gst_vulkan_format_to_video_format(vk_format)) }
}
#[doc(alias = "gst_vulkan_get_or_create_image_view")]
pub fn vulkan_get_or_create_image_view(image: &mut VulkanImageMemory) -> VulkanImageView {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_vulkan_get_or_create_image_view(
image.to_glib_none_mut().0,
))
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_get_or_create_image_view_with_info")]
pub fn vulkan_get_or_create_image_view_with_info(
image: &mut VulkanImageMemory,
create_info: &vulkan::ImageViewCreateInfo,
) -> Option<VulkanImageView> {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_vulkan_get_or_create_image_view_with_info(
image.to_glib_none_mut().0,
create_info,
))
}
}
#[doc(alias = "gst_vulkan_global_context_query")]
pub fn vulkan_global_context_query(element: &impl IsA<gst::Element>, context_type: &str) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_vulkan_global_context_query(
element.as_ref().to_glib_none().0,
context_type.to_glib_none().0,
);
}
}
#[doc(alias = "gst_vulkan_local_context_query")]
pub fn vulkan_local_context_query(
element: &impl IsA<gst::Element>,
context_type: &str,
) -> gst::Query {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_vulkan_local_context_query(
element.as_ref().to_glib_none().0,
context_type.to_glib_none().0,
))
}
}
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_vulkan_present_mode_to_string")]
pub fn vulkan_present_mode_to_string(present_mode: vulkan::PresentModeKHR) -> glib::GString {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::gst_vulkan_present_mode_to_string(present_mode)) }
}
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_vulkan_result_to_string")]
pub fn vulkan_result_to_string(result: vulkan::Result) -> glib::GString {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::gst_vulkan_result_to_string(result)) }
}
#[doc(alias = "gst_vulkan_run_query")]
pub fn vulkan_run_query(
element: &impl IsA<gst::Element>,
query: &gst::Query,
direction: gst::PadDirection,
) -> bool {
assert_initialized_main_thread!();
unsafe {
from_glib(ffi::gst_vulkan_run_query(
element.as_ref().to_glib_none().0,
query.to_glib_none().0,
direction.into_glib(),
))
}
}
#[doc(alias = "gst_vulkan_sample_count_flags_to_string")]
pub fn vulkan_sample_count_flags_to_string(
sample_count_bits: vulkan::SampleCountFlags,
) -> glib::GString {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_vulkan_sample_count_flags_to_string(
sample_count_bits,
))
}
}

View file

@ -0,0 +1,132 @@
// 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;
mod vulkan_fence_cache;
pub use self::vulkan_fence_cache::VulkanFenceCache;
mod vulkan_full_screen_quad;
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;
mod vulkan_memory_allocator;
pub use self::vulkan_memory_allocator::VulkanMemoryAllocator;
#[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_trash_fence_list;
pub use self::vulkan_trash_fence_list::VulkanTrashFenceList;
mod vulkan_trash_list;
pub use self::vulkan_trash_list::VulkanTrashList;
mod vulkan_video_filter;
pub use self::vulkan_video_filter::VulkanVideoFilter;
mod vulkan_window;
pub use self::vulkan_window::VulkanWindow;
mod vulkan_fence;
pub use self::vulkan_fence::VulkanFence;
mod vulkan_handle;
pub use self::vulkan_handle::VulkanHandle;
mod vulkan_trash;
pub use self::vulkan_trash::VulkanTrash;
mod enums;
pub use self::enums::VulkanBarrierFlags;
pub use self::enums::VulkanBarrierType;
pub use self::enums::VulkanError;
pub use self::enums::VulkanFormatScaling;
pub use self::enums::VulkanHandleType;
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub use self::enums::VulkanVideoOperation;
pub use self::enums::VulkanWindowError;
mod flags;
pub use self::flags::VulkanDisplayType;
pub use self::flags::VulkanFormatFlags;
pub(crate) mod functions;
mod constants;
pub use self::constants::CAPS_FEATURE_MEMORY_VULKAN_BUFFER;
pub use self::constants::CAPS_FEATURE_MEMORY_VULKAN_IMAGE;
pub use self::constants::VULKAN_BUFFER_MEMORY_ALLOCATOR_NAME;
pub use self::constants::VULKAN_DEVICE_CONTEXT_TYPE_STR;
pub use self::constants::VULKAN_DISPLAY_CONTEXT_TYPE_STR;
pub use self::constants::VULKAN_IMAGE_MEMORY_ALLOCATOR_NAME;
pub use self::constants::VULKAN_INSTANCE_CONTEXT_TYPE_STR;
pub use self::constants::VULKAN_MEMORY_ALLOCATOR_NAME;
pub use self::constants::VULKAN_QUEUE_CONTEXT_TYPE_STR;
pub use self::constants::VULKAN_SWAPPER_VIDEO_FORMATS;
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;
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_trash_list::VulkanTrashListExt;
pub use super::vulkan_video_filter::VulkanVideoFilterExt;
pub use super::vulkan_window::VulkanWindowExt;
}

View file

@ -0,0 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 876968b635c3)
from gir-files (https://github.com/gtk-rs/gir-files @ 3ede86d6a218)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 83be677e7578)

View 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 {}

View file

@ -0,0 +1,34 @@
// 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()
}
}
}
unsafe impl Send for VulkanBufferPool {}
unsafe impl Sync for VulkanBufferPool {}

View 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, 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,
))
}
}
#[doc(alias = "gst_vulkan_command_pool_lock")]
fn lock(&self) {
unsafe {
ffi::gst_vulkan_command_pool_lock(self.as_ref().to_glib_none().0);
}
}
#[doc(alias = "gst_vulkan_command_pool_unlock")]
fn unlock(&self) {
unsafe {
ffi::gst_vulkan_command_pool_unlock(self.as_ref().to_glib_none().0);
}
}
}
impl<O: IsA<VulkanCommandPool>> VulkanCommandPoolExt for O {}

View 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, VulkanDescriptorPool, VulkanDescriptorSet, VulkanHandle, 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;
#[doc(alias = "gst_vulkan_descriptor_cache_new")]
pub fn new(
pool: &impl IsA<VulkanDescriptorPool>,
layouts: &[&VulkanHandle],
) -> VulkanDescriptorCache {
skip_assert_initialized!();
let n_layouts = layouts.len() as _;
unsafe {
from_glib_full(ffi::gst_vulkan_descriptor_cache_new(
pool.as_ref().to_glib_none().0,
n_layouts,
layouts.to_glib_none().0,
))
}
}
}
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 {}

View file

@ -0,0 +1,78 @@
// 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, VulkanDevice, VulkanHandle};
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: vulkan::DescriptorPool,
max_sets: usize,
) -> VulkanDescriptorPool {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gst_vulkan_descriptor_pool_new_wrapped(
device.as_ref().to_glib_none().0,
pool,
max_sets,
))
}
}
}
unsafe impl Send for VulkanDescriptorPool {}
unsafe impl Sync for VulkanDescriptorPool {}
pub trait VulkanDescriptorPoolExt: IsA<VulkanDescriptorPool> + 'static {
#[doc(alias = "gst_vulkan_descriptor_pool_create")]
fn create(&self, layouts: &[&VulkanHandle]) -> Result<VulkanDescriptorSet, glib::Error> {
let n_layouts = layouts.len() as _;
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::gst_vulkan_descriptor_pool_create(
self.as_ref().to_glib_none().0,
n_layouts,
layouts.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_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 {}

View file

@ -0,0 +1,260 @@
// 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) -> vulkan::PhysicalDevice {
unsafe { ffi::gst_vulkan_device_get_physical_device(self.as_ref().to_glib_none().0) }
}
//#[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: vulkan::QueueFlagBits) -> Option<VulkanQueue> {
unsafe {
from_glib_full(ffi::gst_vulkan_device_select_queue(
self.as_ref().to_glib_none().0,
expected_flags,
))
}
}
#[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 {}

View 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 {}

View 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 {}

View 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
use crate::{ffi, VulkanDevice, VulkanHandlePool};
use glib::{prelude::*, translate::*};
glib::wrapper! {
#[doc(alias = "GstVulkanFenceCache")]
pub struct VulkanFenceCache(Object<ffi::GstVulkanFenceCache, ffi::GstVulkanFenceCacheClass>) @extends VulkanHandlePool, gst::Object;
match fn {
type_ => || ffi::gst_vulkan_fence_cache_get_type(),
}
}
impl VulkanFenceCache {
pub const NONE: Option<&'static VulkanFenceCache> = None;
#[doc(alias = "gst_vulkan_fence_cache_new")]
pub fn new(device: &impl IsA<VulkanDevice>) -> VulkanFenceCache {
skip_assert_initialized!();
unsafe {
from_glib_none(ffi::gst_vulkan_fence_cache_new(
device.as_ref().to_glib_none().0,
))
}
}
}
unsafe impl Send for VulkanFenceCache {}
unsafe impl Sync for VulkanFenceCache {}

View file

@ -0,0 +1,309 @@
// 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))
}
}
}
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[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(),
);
}
}
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[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,
))
}
}
#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[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))
}
}
}
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_vulkan_full_screen_quad_set_blend_factors")]
fn set_blend_factors(
&self,
src_blend_factor: vulkan::BlendFactor,
dst_blend_factor: vulkan::BlendFactor,
src_alpha_blend_factor: vulkan::BlendFactor,
dst_alpha_blend_factor: vulkan::BlendFactor,
) {
unsafe {
ffi::gst_vulkan_full_screen_quad_set_blend_factors(
self.as_ref().to_glib_none().0,
src_blend_factor,
dst_blend_factor,
src_alpha_blend_factor,
dst_alpha_blend_factor,
);
}
}
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_vulkan_full_screen_quad_set_blend_operation")]
fn set_blend_operation(
&self,
colour_blend_op: vulkan::BlendOp,
alpha_blend_op: vulkan::BlendOp,
) {
unsafe {
ffi::gst_vulkan_full_screen_quad_set_blend_operation(
self.as_ref().to_glib_none().0,
colour_blend_op,
alpha_blend_op,
);
}
}
#[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: &mut VulkanHandle, frag: &mut VulkanHandle) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_full_screen_quad_set_shaders(
self.as_ref().to_glib_none().0,
vert.to_glib_none_mut().0,
frag.to_glib_none_mut().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 {}

View file

@ -0,0 +1,115 @@
// 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, VulkanHandleType, VulkanHandleTypedef, VulkanInstance,
};
use glib::{prelude::*, translate::*};
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_: VulkanHandleType,
handle: VulkanHandleTypedef,
notify: P,
) -> VulkanHandle {
skip_assert_initialized!();
let mut notify_data: P = notify;
unsafe extern "C" fn notify_func<P: FnMut(&VulkanHandle)>(
handle: *mut ffi::GstVulkanHandle,
user_data: glib::ffi::gpointer,
) {
let handle = from_glib_borrow(handle);
let callback = user_data as *mut P;
(*callback)(&handle)
}
let notify = Some(notify_func::<P> as _);
let super_callback0: &mut P = &mut notify_data;
unsafe {
from_glib_full(ffi::gst_vulkan_handle_new_wrapped(
device.as_ref().to_glib_none().0,
type_.into_glib(),
handle,
notify,
super_callback0 as *mut _ as *mut _,
))
}
}
//#[doc(alias = "gst_vulkan_handle_free_descriptor_set_layout")]
//pub fn free_descriptor_set_layout(&mut 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(&mut 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(&mut 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(&mut 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(&mut 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(&mut 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(&mut self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gst_vulkan_handle_free_shader() }
//}
#[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,
))
}
}
//#[doc(alias = "gst_vulkan_handle_set_context")]
//pub fn set_context(element: &impl IsA<gst::Element>, context: &gst::Context, display: impl IsA<VulkanDisplay>, instance: impl IsA<VulkanInstance>) -> bool {
// unsafe { TODO: call ffi:gst_vulkan_handle_set_context() }
//}
}
unsafe impl Send for VulkanHandle {}
unsafe impl Sync for VulkanHandle {}

View 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 {}

View file

@ -0,0 +1,34 @@
// 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()
}
}
}
unsafe impl Send for VulkanImageBufferPool {}
unsafe impl Sync for VulkanImageBufferPool {}

View 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 {}

View file

@ -0,0 +1,348 @@
// 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::{
object::ObjectType as _,
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 {
#[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))
}
}
}
#[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))
}
}
}
#[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)
}
#[doc(alias = "create-device")]
fn connect_create_device<F: Fn(&Self) -> VulkanDevice + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn create_device_trampoline<
P: IsA<VulkanInstance>,
F: Fn(&P) -> VulkanDevice + Send + Sync + 'static,
>(
this: *mut ffi::GstVulkanInstance,
f: glib::ffi::gpointer,
) -> *mut ffi::GstVulkanDevice {
let f: &F = &*(f as *const F);
f(VulkanInstance::from_glib_borrow(this).unsafe_cast_ref()).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 {}

View 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 = "GstVulkanMemoryAllocator")]
pub struct VulkanMemoryAllocator(Object<ffi::GstVulkanMemoryAllocator, ffi::GstVulkanMemoryAllocatorClass>) @extends gst::Allocator, gst::Object;
match fn {
type_ => || ffi::gst_vulkan_memory_allocator_get_type(),
}
}
impl VulkanMemoryAllocator {
pub const NONE: Option<&'static VulkanMemoryAllocator> = None;
}
unsafe impl Send for VulkanMemoryAllocator {}
unsafe impl Sync for VulkanMemoryAllocator {}

View file

@ -0,0 +1,214 @@
// 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, VulkanQueue};
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: vulkan::ImageLayout,
new_queue: Option<&impl IsA<VulkanQueue>>,
) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_operation_add_frame_barrier(
self.as_ref().to_glib_none().0,
frame.to_glib_none().0,
src_stage,
dst_stage,
new_access,
new_layout,
new_queue.map(|p| p.as_ref()).to_glib_none().0,
))
}
}
#[doc(alias = "gst_vulkan_operation_begin")]
fn begin(&self) -> Result<(), 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() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "gst_vulkan_operation_begin_query")]
fn begin_query(&self, id: u32) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_operation_begin_query(
self.as_ref().to_glib_none().0,
id,
))
}
}
#[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")]
fn end(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_operation_end(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_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: vulkan::ImageLayout,
new_queue: Option<&impl IsA<VulkanQueue>>,
) {
unsafe {
ffi::gst_vulkan_operation_update_frame(
self.as_ref().to_glib_none().0,
frame.to_glib_none().0,
dst_stage,
new_access,
new_layout,
new_queue.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
#[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 {}

View file

@ -0,0 +1,109 @@
// 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_: vulkan::PhysicalDeviceType) -> glib::GString {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::gst_vulkan_physical_device_type_to_string(type_)) }
}
}
unsafe impl Send for VulkanPhysicalDevice {}
unsafe impl Sync for VulkanPhysicalDevice {}
pub trait VulkanPhysicalDeviceExt: IsA<VulkanPhysicalDevice> + 'static {
#[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) -> vulkan::PhysicalDevice {
unsafe { ffi::gst_vulkan_physical_device_get_handle(self.as_ref().to_glib_none().0) }
}
#[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 {}

View file

@ -0,0 +1,94 @@
// 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: vulkan::QueueFlags) -> glib::GString {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_vulkan_queue_flags_to_string(queue_bits)) }
}
#[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,
))
}
}
#[doc(alias = "gst_vulkan_queue_submit_lock")]
fn submit_lock(&self) {
unsafe {
ffi::gst_vulkan_queue_submit_lock(self.as_ref().to_glib_none().0);
}
}
#[doc(alias = "gst_vulkan_queue_submit_unlock")]
fn submit_unlock(&self) {
unsafe {
ffi::gst_vulkan_queue_submit_unlock(self.as_ref().to_glib_none().0);
}
}
}
impl<O: IsA<VulkanQueue>> VulkanQueueExt for O {}

View file

@ -0,0 +1,195 @@
// 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_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 = "pixel-aspect-ratio")]
fn pixel_aspect_ratio(&self) -> gst::Fraction {
ObjectExt::property(self.as_ref(), "pixel-aspect-ratio")
}
#[doc(alias = "pixel-aspect-ratio")]
fn set_pixel_aspect_ratio(&self, pixel_aspect_ratio: gst::Fraction) {
ObjectExt::set_property(self.as_ref(), "pixel-aspect-ratio", pixel_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),
)
}
}
#[doc(alias = "pixel-aspect-ratio")]
fn connect_pixel_aspect_ratio_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_pixel_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::pixel-aspect-ratio".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_pixel_aspect_ratio_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<VulkanSwapper>> VulkanSwapperExt for O {}

View 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, 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: vulkan::Semaphore,
) -> VulkanTrash {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_vulkan_trash_new_free_semaphore(
fence.to_glib_none_mut().0,
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 {}

View file

@ -0,0 +1,35 @@
// 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, VulkanHandlePool, VulkanTrashList};
use glib::{prelude::*, translate::*};
glib::wrapper! {
#[doc(alias = "GstVulkanTrashFenceList")]
pub struct VulkanTrashFenceList(Object<ffi::GstVulkanTrashFenceList, ffi::GstVulkanTrashFenceListClass>) @extends VulkanTrashList, VulkanHandlePool, gst::Object;
match fn {
type_ => || ffi::gst_vulkan_trash_fence_list_get_type(),
}
}
impl VulkanTrashFenceList {
#[doc(alias = "gst_vulkan_trash_fence_list_new")]
pub fn new() -> VulkanTrashFenceList {
assert_initialized_main_thread!();
unsafe {
VulkanTrashList::from_glib_full(ffi::gst_vulkan_trash_fence_list_new()).unsafe_cast()
}
}
}
impl Default for VulkanTrashFenceList {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for VulkanTrashFenceList {}
unsafe impl Sync for VulkanTrashFenceList {}

View file

@ -0,0 +1,82 @@
// 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, VulkanHandlePool, VulkanTrash};
use glib::{prelude::*, translate::*};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "GstVulkanTrashList")]
pub struct VulkanTrashList(Object<ffi::GstVulkanTrashList, ffi::GstVulkanTrashListClass>) @extends VulkanHandlePool, gst::Object;
match fn {
type_ => || ffi::gst_vulkan_trash_list_get_type(),
}
}
impl VulkanTrashList {
pub const NONE: Option<&'static VulkanTrashList> = None;
}
unsafe impl Send for VulkanTrashList {}
unsafe impl Sync for VulkanTrashList {}
pub trait VulkanTrashListExt: IsA<VulkanTrashList> + 'static {
#[doc(alias = "gst_vulkan_trash_list_acquire")]
fn acquire<P: FnOnce(&VulkanDevice) + Send + Sync + 'static>(
&self,
fence: &mut VulkanFence,
notify: P,
) -> VulkanTrash {
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_list_acquire(
self.as_ref().to_glib_none().0,
fence.to_glib_none_mut().0,
notify,
Box_::into_raw(super_callback0) as *mut _,
))
}
}
#[doc(alias = "gst_vulkan_trash_list_add")]
fn add(&self, trash: &mut VulkanTrash) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_trash_list_add(
self.as_ref().to_glib_none().0,
trash.to_glib_none_mut().0,
))
}
}
#[doc(alias = "gst_vulkan_trash_list_gc")]
fn gc(&self) {
unsafe {
ffi::gst_vulkan_trash_list_gc(self.as_ref().to_glib_none().0);
}
}
#[doc(alias = "gst_vulkan_trash_list_wait")]
fn wait(&self, timeout: u64) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_trash_list_wait(
self.as_ref().to_glib_none().0,
timeout,
))
}
}
}
impl<O: IsA<VulkanTrashList>> VulkanTrashListExt for O {}

View 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 {}

View file

@ -0,0 +1,358 @@
// 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<vulkan::SurfaceKHR, glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let ret =
ffi::gst_vulkan_window_get_surface(self.as_ref().to_glib_none().0, &mut error);
if error.is_null() {
Ok(ret)
} else {
Err(from_glib_full(error))
}
}
}
#[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 {}

View file

@ -0,0 +1,167 @@
#[cfg(feature = "v1_24")]
use glib::translate::*;
use gst::BufferPoolConfigRef;
#[cfg(feature = "v1_24")]
use crate::ffi;
/// Configuration for [`super::VulkanBufferPool`]
pub trait VulkanBufferPoolConfig {
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_buffer_pool_config_set_allocation_params")]
#[doc(alias = "config_set_allocation_params")]
fn set_allocation_params(
&mut self,
usage: vulkan::BufferUsageFlags,
mem_properties: vulkan::MemoryPropertyFlags,
);
}
impl VulkanBufferPoolConfig for BufferPoolConfigRef {
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_buffer_pool_config_set_allocation_params")]
#[doc(alias = "config_set_allocation_params")]
fn set_allocation_params(
&mut self,
usage: vulkan::BufferUsageFlags,
mem_properties: vulkan::MemoryPropertyFlags,
) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_vulkan_buffer_pool_config_set_allocation_params(
self.as_mut_ptr(),
usage,
mem_properties,
);
}
}
}
/// Configuration for [`super::VulkanImageBufferPool`]
pub trait VulkanImageBufferPoolConfig {
#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[doc(alias = "gst_vulkan_image_buffer_pool_config_get_allocation_params")]
#[doc(alias = "config_get_allocation_params")]
fn get_allocation_params(
&self,
) -> (
vulkan::ImageUsageFlags,
vulkan::MemoryPropertyFlags,
vulkan::ImageLayout,
u64,
);
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_allocation_params")]
#[doc(alias = "config_set_allocation_params")]
fn set_allocation_params(
&mut self,
usage: vulkan::ImageUsageFlags,
mem_properties: vulkan::MemoryPropertyFlags,
initial_layout: vulkan::ImageLayout,
initial_access: u64,
);
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_decode_caps")]
#[doc(alias = "config_set_decode_caps")]
fn set_decode_caps(&mut self, caps: &gst::Caps);
#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_encode_caps")]
#[doc(alias = "config_set_encode_caps")]
fn set_encode_caps(&mut self, caps: &gst::Caps);
}
impl VulkanImageBufferPoolConfig for BufferPoolConfigRef {
#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[doc(alias = "gst_vulkan_image_buffer_pool_config_get_allocation_params")]
#[doc(alias = "config_get_allocation_params")]
fn get_allocation_params(
&self,
) -> (
vulkan::ImageUsageFlags,
vulkan::MemoryPropertyFlags,
vulkan::ImageLayout,
u64,
) {
assert_initialized_main_thread!();
unsafe {
let mut usage = std::mem::MaybeUninit::uninit();
let mut mem_props = std::mem::MaybeUninit::uninit();
let mut initial_layout = std::mem::MaybeUninit::uninit();
let mut initial_access = std::mem::MaybeUninit::uninit();
ffi::gst_vulkan_image_buffer_pool_config_get_allocation_params(
// TODO: Mut ptr?
self.as_mut_ptr(),
usage.as_mut_ptr(),
mem_props.as_mut_ptr(),
initial_layout.as_mut_ptr(),
initial_access.as_mut_ptr(),
);
(
usage.assume_init(),
mem_props.assume_init(),
initial_layout.assume_init(),
initial_access.assume_init(),
)
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_allocation_params")]
#[doc(alias = "config_set_allocation_params")]
fn set_allocation_params(
&mut self,
usage: vulkan::ImageUsageFlags,
mem_properties: vulkan::MemoryPropertyFlags,
initial_layout: vulkan::ImageLayout,
initial_access: u64,
) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_vulkan_image_buffer_pool_config_set_allocation_params(
self.as_mut_ptr(),
usage,
mem_properties,
initial_layout,
initial_access,
);
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_decode_caps")]
#[doc(alias = "config_set_decode_caps")]
fn set_decode_caps(&mut self, caps: &gst::Caps) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_vulkan_image_buffer_pool_config_set_decode_caps(
self.as_mut_ptr(),
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")]
#[doc(alias = "config_set_encode_caps")]
fn set_encode_caps(&mut self, caps: &gst::Caps) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_vulkan_image_buffer_pool_config_set_encode_caps(
self.as_mut_ptr(),
caps.to_glib_none().0,
);
}
}
}

View file

@ -0,0 +1,10 @@
// 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_FEATURES_MEMORY_VULKAN_BUFFER: Lazy<CapsFeatures> =
Lazy::new(|| CapsFeatures::new([crate::CAPS_FEATURE_MEMORY_VULKAN_BUFFER]));
pub static CAPS_FEATURES_MEMORY_VULKAN_IMAGE: Lazy<CapsFeatures> =
Lazy::new(|| CapsFeatures::new([crate::CAPS_FEATURE_MEMORY_VULKAN_IMAGE]));

View file

@ -0,0 +1,134 @@
use gst::ContextRef;
use glib::{prelude::*, translate::*};
use crate::{ffi, VulkanDevice, VulkanDisplay, VulkanInstance, VulkanQueue};
pub trait ContextVulkanExt {
#[doc(alias = "get_vulkan_device")]
#[doc(alias = "gst_context_get_vulkan_device")]
fn vulkan_device(&self) -> Option<VulkanDevice>;
#[doc(alias = "get_vulkan_display")]
#[doc(alias = "gst_context_get_vulkan_display")]
fn vulkan_display(&self) -> Option<VulkanDisplay>;
#[doc(alias = "get_vulkan_instance")]
#[doc(alias = "gst_context_get_vulkan_instance")]
fn vulkan_instance(&self) -> Option<VulkanInstance>;
#[doc(alias = "get_vulkan_queue")]
#[doc(alias = "gst_context_get_vulkan_queue")]
fn vulkan_queue(&self) -> Option<VulkanQueue>;
#[doc(alias = "gst_context_set_vulkan_device")]
fn set_vulkan_device(&self, device: Option<&impl IsA<VulkanDevice>>);
#[doc(alias = "gst_context_set_vulkan_display")]
fn set_vulkan_display(&self, display: Option<&impl IsA<VulkanDisplay>>);
#[doc(alias = "gst_context_set_vulkan_instance")]
fn set_vulkan_instance(&self, instance: Option<&impl IsA<VulkanInstance>>);
#[doc(alias = "gst_context_set_vulkan_queue")]
fn set_vulkan_queue(&self, queue: Option<&impl IsA<VulkanQueue>>);
}
impl ContextVulkanExt for ContextRef {
fn vulkan_device(&self) -> Option<VulkanDevice> {
assert_initialized_main_thread!();
unsafe {
let mut device = std::ptr::null_mut();
let ret = from_glib(ffi::gst_context_get_vulkan_device(
self.as_mut_ptr(),
&mut device,
));
if ret {
Some(from_glib_full(device))
} else {
None
}
}
}
fn vulkan_display(&self) -> Option<VulkanDisplay> {
assert_initialized_main_thread!();
unsafe {
let mut display = std::ptr::null_mut();
let ret = from_glib(ffi::gst_context_get_vulkan_display(
self.as_mut_ptr(),
&mut display,
));
if ret {
Some(from_glib_full(display))
} else {
None
}
}
}
fn vulkan_instance(&self) -> Option<VulkanInstance> {
assert_initialized_main_thread!();
unsafe {
let mut instance = std::ptr::null_mut();
let ret = from_glib(ffi::gst_context_get_vulkan_instance(
self.as_mut_ptr(),
&mut instance,
));
if ret {
Some(from_glib_full(instance))
} else {
None
}
}
}
fn vulkan_queue(&self) -> Option<VulkanQueue> {
assert_initialized_main_thread!();
unsafe {
let mut queue = std::ptr::null_mut();
let ret = from_glib(ffi::gst_context_get_vulkan_queue(
self.as_mut_ptr(),
&mut queue,
));
if ret {
Some(from_glib_full(queue))
} else {
None
}
}
}
fn set_vulkan_device(&self, device: Option<&impl IsA<VulkanDevice>>) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_context_set_vulkan_device(
self.as_mut_ptr(),
device.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
fn set_vulkan_display(&self, display: Option<&impl IsA<VulkanDisplay>>) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_context_set_vulkan_display(
self.as_mut_ptr(),
display.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
fn set_vulkan_instance(&self, instance: Option<&impl IsA<VulkanInstance>>) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_context_set_vulkan_instance(
self.as_mut_ptr(),
instance.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
fn set_vulkan_queue(&self, queue: Option<&impl IsA<VulkanQueue>>) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_context_set_vulkan_queue(
self.as_mut_ptr(),
queue.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
}

View file

@ -0,0 +1,3 @@
// Take a look at the license at the top of the repository in the LICENSE file.
pub use crate::auto::functions::*;

View file

@ -0,0 +1,75 @@
// 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 glib;
pub use gst;
pub use gst_base;
pub use gst_video;
pub use gstreamer_vulkan_sys as ffi;
macro_rules! assert_initialized_main_thread {
() => {
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
gst::assert_initialized();
}
};
}
macro_rules! skip_assert_initialized {
() => {};
}
#[allow(
clippy::match_same_arms,
clippy::too_many_arguments,
clippy::type_complexity,
clippy::unreadable_literal,
unused_imports
)]
mod auto;
pub use crate::auto::*;
mod buffer_pool_config;
pub use crate::buffer_pool_config::*;
mod caps_features;
pub use crate::caps_features::*;
mod context;
pub use crate::context::*;
mod vulkan_buffer_memory;
pub use crate::vulkan_buffer_memory::*;
mod vulkan_command_buffer;
pub use crate::vulkan_command_buffer::*;
mod vulkan_descriptor_set;
pub use crate::vulkan_descriptor_set::*;
mod vulkan_handle;
pub use crate::vulkan_handle::*;
mod vulkan_image_memory;
pub use crate::vulkan_image_memory::*;
mod vulkan_image_view;
pub use crate::vulkan_image_view::*;
mod vulkan_memory;
pub use crate::vulkan_memory::*;
mod vulkan_swapper;
pub use crate::vulkan_swapper::*;
pub mod functions;
pub use crate::functions::*;
// 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 crate::{
auto::traits::*,
buffer_pool_config::{VulkanBufferPoolConfig, VulkanImageBufferPoolConfig},
context::ContextVulkanExt,
vulkan_swapper::VulkanSwapperExtManual,
};
}
pub mod subclass;

View 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;
}

View file

@ -0,0 +1,11 @@
use gst_base::subclass::prelude::*;
use crate::VulkanVideoFilter;
pub trait VulkanVideoFilterImpl: VulkanVideoFilterImplExt + BaseTransformImpl {}
pub trait VulkanVideoFilterImplExt: ObjectSubclass {}
impl<T: VulkanVideoFilterImpl> VulkanVideoFilterImplExt for T {}
unsafe impl<T: VulkanVideoFilterImpl> IsSubclassable<T> for VulkanVideoFilter {}

View file

@ -0,0 +1,88 @@
use std::fmt;
use ffi::GstVulkanBufferMemory;
use glib::prelude::*;
use glib::translate::*;
use gst::{Memory, MemoryRef};
use crate::{ffi, VulkanDevice, VulkanMemory, VulkanMemoryRef};
gst::memory_object_wrapper!(
VulkanBufferMemory,
VulkanBufferMemoryRef,
GstVulkanBufferMemory,
|mem: &MemoryRef| { unsafe { from_glib(ffi::gst_is_vulkan_buffer_memory(mem.as_mut_ptr())) } },
VulkanMemory,
VulkanMemoryRef,
Memory,
MemoryRef
);
impl fmt::Debug for VulkanBufferMemory {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
VulkanBufferMemoryRef::fmt(self, f)
}
}
impl fmt::Debug for VulkanBufferMemoryRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("VulkanMemoryRef")
.field("memory", self as &VulkanMemoryRef)
// TODO: Print some FFI fields manually?
// .field("ffi", &self.0)
.finish_non_exhaustive()
}
}
impl VulkanBufferMemory {
#[doc(alias = "gst_vulkan_buffer_memory_alloc")]
pub fn alloc(
device: &impl IsA<VulkanDevice>,
size: usize,
usage: vulkan::BufferUsageFlags,
mem_prop_flags: vulkan::MemoryPropertyFlags,
) -> gst::Memory {
skip_assert_initialized!();
Self::init_once();
unsafe {
from_glib_full(ffi::gst_vulkan_buffer_memory_alloc(
device.as_ref().to_glib_none().0,
size,
usage,
mem_prop_flags,
))
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_buffer_memory_alloc_with_buffer_info")]
pub fn alloc_with_buffer_info(
device: &impl IsA<VulkanDevice>,
buffer_info: &vulkan::BufferCreateInfo,
mem_prop_flags: vulkan::MemoryPropertyFlags,
) -> gst::Memory {
skip_assert_initialized!();
Self::init_once();
unsafe {
from_glib_full(ffi::gst_vulkan_buffer_memory_alloc_with_buffer_info(
device.as_ref().to_glib_none().0,
buffer_info,
mem_prop_flags,
))
}
}
#[doc(alias = "gst_vulkan_buffer_memory_init_once")]
fn init_once() {
assert_initialized_main_thread!();
unsafe {
ffi::gst_vulkan_buffer_memory_init_once();
}
}
//#[doc(alias = "gst_vulkan_buffer_memory_wrapped")]
//pub fn wrapped(device: &impl IsA<VulkanDevice>, buffer: vulkan::Buffer, usage: vulkan::BufferUsageFlags, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> gst::Memory {
// unsafe { TODO: call ffi:gst_vulkan_buffer_memory_wrapped() }
//}
}

View file

@ -0,0 +1,53 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use std::fmt;
use glib::translate::*;
use crate::ffi;
gst::mini_object_wrapper!(
VulkanCommandBuffer,
VulkanCommandBufferRef,
ffi::GstVulkanCommandBuffer,
|| ffi::gst_vulkan_command_buffer_get_type()
);
impl fmt::Debug for VulkanCommandBuffer {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
VulkanCommandBufferRef::fmt(self, f)
}
}
impl fmt::Debug for VulkanCommandBufferRef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("VulkanCommandBuffer")
.field("inner", &self.0)
.finish()
// .finish_non_exhaustive()
}
}
impl VulkanCommandBuffer {
#[doc(alias = "gst_vulkan_command_buffer_new_wrapped")]
pub fn new_wrapped(
cmd: vulkan::CommandBuffer,
level: vulkan::CommandBufferLevel,
) -> VulkanCommandBuffer {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_vulkan_command_buffer_new_wrapped(cmd, level)) }
}
}
impl VulkanCommandBufferRef {
pub fn cmd(&self) -> vulkan::CommandBuffer {
self.0.cmd
}
// TODO: pool getter
pub fn level(&self) -> vulkan::CommandBufferLevel {
self.0.level
}
}

View file

@ -0,0 +1,74 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use std::fmt;
use glib::{prelude::*, translate::*};
use crate::{ffi, VulkanDescriptorCache, VulkanDescriptorPool, VulkanHandle};
gst::mini_object_wrapper!(
VulkanDescriptorSet,
VulkanDescriptorSetRef,
ffi::GstVulkanDescriptorSet,
|| ffi::gst_vulkan_descriptor_set_get_type()
);
impl fmt::Debug for VulkanDescriptorSet {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
VulkanDescriptorSetRef::fmt(self, f)
}
}
impl fmt::Debug for VulkanDescriptorSetRef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("VulkanDescriptorSet")
.field("set", &self.set())
.field("set", &self.set())
.field("pool", &unsafe { self.pool() })
.field("cache", &unsafe { self.cache() })
.field("layouts", &unsafe { self.layouts() })
.finish_non_exhaustive()
}
}
impl VulkanDescriptorSet {
#[doc(alias = "gst_vulkan_descriptor_set_new_wrapped")]
pub fn new_wrapped(
pool: &impl IsA<VulkanDescriptorPool>,
set: vulkan::DescriptorSet,
layouts: &[&VulkanHandle],
) -> VulkanDescriptorSet {
skip_assert_initialized!();
let n_layouts = layouts.len() as _;
unsafe {
from_glib_full(ffi::gst_vulkan_descriptor_set_new_wrapped(
pool.as_ref().to_glib_none().0,
set,
n_layouts,
layouts.to_glib_none().0,
))
}
}
}
impl VulkanDescriptorSetRef {
pub fn set(&self) -> vulkan::DescriptorSet {
self.0.set
}
pub unsafe fn pool(&self) -> VulkanDescriptorPool {
// from_glib_borrow(self.0.pool)
from_glib_none(self.0.pool)
}
pub unsafe fn cache(&self) -> VulkanDescriptorCache {
// from_glib_borrow(self.0.cache)
from_glib_none(self.0.cache)
}
pub unsafe fn layouts(&self) -> &[*mut ffi::GstVulkanHandle] {
let layouts = std::slice::from_raw_parts(self.0.layouts, self.0.n_layouts as usize);
// from_glib_none(layouts)
layouts
}
}

View file

@ -0,0 +1,73 @@
use ffi::{GstVulkanHandle, GstVulkanHandleTypedef};
use glib::translate::*;
use crate::{ffi, VulkanHandle};
// TODO: ffi has this as a mut ptr to c_void, while it should apparently be a c_void as-is?
// TODO: Upstream now switched to an alias:
// <alias name="VulkanHandleTypedef" c:type="GstVulkanHandleTypedef">
// <type name="guint64" c:type="uint64_t"/>
// </alias>
pub type VulkanHandleTypedef = GstVulkanHandleTypedef;
// (was <record name="VulkanHandleTypedef" c:type="GstVulkanHandleTypedef" disguised="1" version="1.18"/> before)
// pub struct VulkanHandleTypedef(GstVulkanHandleTypedef);
// impl<'a> ToGlibPtr<'a, GstVulkanHandleTypedef> for VulkanHandleTypedef {
// type Storage = &'a Self;
// fn to_glib_none(&'a self) -> Stash<'a, GstVulkanHandleTypedef, Self> {
// Stash(self.0, self)
// }
// }
// impl<'a> ToGlibContainerFromSlice<'a, *const *mut GstVulkanHandle> for &'a VulkanHandle {
// type Storage = &'a [Self];
// fn to_glib_none_from_slice(t: Self::Storage) -> (*const *mut GstVulkanHandle, Self::Storage) {
// skip_assert_initialized!();
// assert_eq!(
// std::mem::size_of::<Self>(),
// std::mem::size_of::<*mut GstVulkanHandle>()
// );
// let t_ptrs: &[*mut GstVulkanHandle] = unsafe { std::mem::transmute(t) };
// (t_ptrs.as_ptr(), t)
// }
// fn to_glib_container_from_slice(
// _t: Self::Storage,
// ) -> (*const *mut GstVulkanHandle, Self::Storage) {
// skip_assert_initialized!();
// unimplemented!("Consumer can't free *const pointer")
// }
// fn to_glib_full_from_slice(_t: &[Self]) -> *const *mut GstVulkanHandle {
// skip_assert_initialized!();
// unimplemented!("Consumer can't free *const pointer")
// }
// }
impl<'a> ToGlibContainerFromSlice<'a, *mut *mut GstVulkanHandle> for &'a VulkanHandle {
type Storage = &'a [Self];
fn to_glib_none_from_slice(t: Self::Storage) -> (*mut *mut GstVulkanHandle, Self::Storage) {
skip_assert_initialized!();
assert_eq!(
std::mem::size_of::<Self>(),
std::mem::size_of::<*mut GstVulkanHandle>()
);
let t_ptrs: &[*mut GstVulkanHandle] = unsafe { std::mem::transmute(t) };
(t_ptrs.as_ptr().cast_mut(), t)
}
fn to_glib_container_from_slice(
_t: Self::Storage,
) -> (*mut *mut GstVulkanHandle, Self::Storage) {
skip_assert_initialized!();
unimplemented!("Consumer can't free *mut pointer")
}
fn to_glib_full_from_slice(_t: &[Self]) -> *mut *mut GstVulkanHandle {
skip_assert_initialized!();
unimplemented!("Consumer can't free *mut pointer")
}
}

View file

@ -0,0 +1,149 @@
use std::fmt;
use ffi::GstVulkanImageMemory;
use glib::prelude::*;
use glib::translate::*;
use gst::{Memory, MemoryRef};
use crate::{ffi, VulkanDevice, VulkanImageView, VulkanMemory, VulkanMemoryRef};
gst::memory_object_wrapper!(
VulkanImageMemory,
VulkanImageMemoryRef,
GstVulkanImageMemory,
|mem: &MemoryRef| { unsafe { from_glib(ffi::gst_is_vulkan_image_memory(mem.as_mut_ptr())) } },
VulkanMemory,
VulkanMemoryRef,
Memory,
MemoryRef
);
impl fmt::Debug for VulkanImageMemory {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
VulkanImageMemoryRef::fmt(self, f)
}
}
impl fmt::Debug for VulkanImageMemoryRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("VulkanMemoryRef")
.field("memory", self as &VulkanMemoryRef)
.field("width", &self.width())
.field("height", &self.height())
// TODO: Print some FFI fields manually?
// .field("ffi", &self.0)
.finish_non_exhaustive()
}
}
impl VulkanImageMemory {
#[doc(alias = "gst_vulkan_image_memory_alloc")]
pub fn alloc(
device: &impl IsA<VulkanDevice>,
format: vulkan::Format,
width: usize,
height: usize,
tiling: vulkan::ImageTiling,
usage: vulkan::ImageUsageFlags,
mem_prop_flags: vulkan::MemoryPropertyFlags,
) -> gst::Memory {
skip_assert_initialized!();
Self::init_once();
unsafe {
from_glib_full(ffi::gst_vulkan_image_memory_alloc(
device.as_ref().to_glib_none().0,
format,
width,
height,
tiling,
usage,
mem_prop_flags,
))
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_image_memory_alloc_with_image_info")]
pub fn alloc_with_image_info(
device: &impl IsA<VulkanDevice>,
// _vk_image_mem_new_alloc_with_image_info actually overwrites fields in this struct
image_info: &mut vulkan::ImageCreateInfo,
mem_prop_flags: vulkan::MemoryPropertyFlags,
) -> gst::Memory {
skip_assert_initialized!();
Self::init_once();
unsafe {
from_glib_full(ffi::gst_vulkan_image_memory_alloc_with_image_info(
device.as_ref().to_glib_none().0,
image_info,
mem_prop_flags,
))
}
}
#[doc(alias = "gst_vulkan_image_memory_init_once")]
fn init_once() {
assert_initialized_main_thread!();
unsafe {
ffi::gst_vulkan_image_memory_init_once();
}
}
//#[doc(alias = "gst_vulkan_image_memory_wrapped")]
//pub fn wrapped(device: &impl IsA<VulkanDevice>, image: vulkan::Image, format: vulkan::Format, width: usize, height: usize, tiling: vulkan::ImageTiling, usage: vulkan::ImageUsageFlags, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> gst::Memory {
// unsafe { TODO: call ffi:gst_vulkan_image_memory_wrapped() }
//}
}
impl VulkanImageMemoryRef {
#[doc(alias = "gst_vulkan_image_memory_add_view")]
pub fn add_view(&mut self, view: &VulkanImageView) {
unsafe {
ffi::gst_vulkan_image_memory_add_view(&mut self.0, view.to_glib_none().0);
}
}
#[doc(alias = "gst_vulkan_image_memory_find_view")]
pub fn find_view<P: FnMut(&VulkanImageView) -> bool>(
// TODO: Mut?
&mut self,
find_func: P,
) -> Option<VulkanImageView> {
let find_func_data: P = find_func;
unsafe extern "C" fn find_func_func<P: FnMut(&VulkanImageView) -> bool>(
view: *mut ffi::GstVulkanImageView,
user_data: glib::ffi::gpointer,
) -> glib::ffi::gboolean {
let view = from_glib_borrow(view);
let callback: *mut P = user_data as *const _ as usize as *mut P;
(*callback)(&view).into_glib()
}
let find_func = Some(find_func_func::<P> as _);
let super_callback0: &P = &find_func_data;
unsafe {
from_glib_full(ffi::gst_vulkan_image_memory_find_view(
&mut self.0,
find_func,
super_callback0 as *const _ as usize as *mut _,
))
}
}
#[doc(alias = "gst_vulkan_image_memory_get_height")]
#[doc(alias = "get_height")]
pub fn height(&self) -> u32 {
unsafe { ffi::gst_vulkan_image_memory_get_height(mut_override(&self.0)) }
}
#[doc(alias = "gst_vulkan_image_memory_get_width")]
#[doc(alias = "get_width")]
pub fn width(&self) -> u32 {
unsafe { ffi::gst_vulkan_image_memory_get_width(mut_override(&self.0)) }
}
//#[doc(alias = "gst_vulkan_image_memory_init")]
//pub fn init(&mut self, allocator: &impl IsA<gst::Allocator>, parent: &gst::Memory, device: &impl IsA<VulkanDevice>, format: vulkan::Format, usage: vulkan::ImageUsageFlags, params: &mut gst::AllocationParams, size: usize, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> bool {
// unsafe { TODO: call ffi:gst_vulkan_image_memory_init() }
//}
}

View file

@ -0,0 +1,65 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use std::fmt;
use glib::translate::*;
use crate::{ffi, VulkanDevice, VulkanImageMemory};
gst::mini_object_wrapper!(
VulkanImageView,
VulkanImageViewRef,
ffi::GstVulkanImageView,
|| ffi::gst_vulkan_image_view_get_type()
);
impl fmt::Debug for VulkanImageView {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
VulkanImageViewRef::fmt(self, f)
}
}
impl fmt::Debug for VulkanImageViewRef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("VulkanImageView")
.field("device", &unsafe { self.device() })
.field("image", &unsafe { self.image() })
.field("view", &self.view())
.field("create_info", &self.create_info())
.finish_non_exhaustive()
}
}
impl VulkanImageView {
#[doc(alias = "gst_vulkan_image_view_new")]
// TODO: Mut?
pub fn new(image: &mut VulkanImageMemory, create_info: &vulkan::ImageViewCreateInfo) -> Self {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_vulkan_image_view_new(
image.to_glib_none_mut().0,
create_info,
))
}
}
}
impl VulkanImageViewRef {
pub unsafe fn device(&self) -> VulkanDevice {
// from_glib_borrow(self.0.device)
from_glib_none(self.0.device)
}
pub unsafe fn image(&self) -> VulkanImageMemory {
// from_glib_borrow(self.0.image)
from_glib_none(self.0.image)
}
pub fn view(&self) -> vulkan::ImageView {
self.0.view
}
pub fn create_info(&self) -> &vulkan::ImageViewCreateInfo {
&self.0.create_info
}
}

View file

@ -0,0 +1,100 @@
use std::fmt;
use ffi::GstVulkanMemory;
use glib::prelude::*;
use glib::translate::*;
use gst::{Memory, MemoryRef};
use crate::{ffi, VulkanDevice};
gst::memory_object_wrapper!(
VulkanMemory,
VulkanMemoryRef,
GstVulkanMemory,
|mem: &MemoryRef| { unsafe { from_glib(ffi::gst_is_vulkan_memory(mem.as_mut_ptr())) } },
Memory,
MemoryRef
);
impl fmt::Debug for VulkanMemory {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
VulkanMemoryRef::fmt(self, f)
}
}
impl fmt::Debug for VulkanMemoryRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("VulkanMemoryRef")
.field("memory", self as &MemoryRef)
// TODO: Print some FFI fields manually?
// .field("ffi", &self.0)
.finish_non_exhaustive()
}
}
impl VulkanMemory {
#[doc(alias = "gst_vulkan_memory_alloc")]
pub fn alloc(
device: &impl IsA<VulkanDevice>,
memory_type_index: u32,
params: &gst::AllocationParams,
size: usize,
mem_prop_flags: vulkan::MemoryPropertyFlags,
) -> gst::Memory {
skip_assert_initialized!();
Self::init_once();
unsafe {
from_glib_full(ffi::gst_vulkan_memory_alloc(
device.as_ref().to_glib_none().0,
memory_type_index,
mut_override(params.to_glib_none().0),
size,
mem_prop_flags,
))
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_memory_find_memory_type_index_with_requirements")]
pub fn find_memory_type_index_with_requirements(
device: &impl IsA<VulkanDevice>,
req: &vulkan::MemoryRequirements,
properties: vulkan::MemoryPropertyFlags,
) -> Result<u32, glib::BoolError> {
skip_assert_initialized!();
let mut type_index = std::mem::MaybeUninit::uninit();
unsafe {
glib::result_from_gboolean!(
ffi::gst_vulkan_memory_find_memory_type_index_with_requirements(
device.as_ref().to_glib_none().0,
req,
properties,
type_index.as_mut_ptr(),
),
"Failed to find appropriate memory type index for requirements"
)
.map(|()| type_index.assume_init())
}
}
#[doc(alias = "gst_vulkan_memory_heap_flags_to_string")]
pub fn heap_flags_to_string(prop_bits: vulkan::MemoryHeapFlags) -> glib::GString {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_vulkan_memory_heap_flags_to_string(prop_bits)) }
}
#[doc(alias = "gst_vulkan_memory_init_once")]
fn init_once() {
assert_initialized_main_thread!();
unsafe {
ffi::gst_vulkan_memory_init_once();
}
}
#[doc(alias = "gst_vulkan_memory_property_flags_to_string")]
pub fn property_flags_to_string(prop_bits: vulkan::MemoryPropertyFlags) -> glib::GString {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_vulkan_memory_property_flags_to_string(prop_bits)) }
}
}

View file

@ -0,0 +1,62 @@
use glib::prelude::*;
use glib::translate::*;
use gst_video::VideoRectangle;
use crate::{ffi, VulkanSwapper};
// TODO: Should we take Option<&mut T> or &mut Option<T>? EDIT: ToGlibPtrMut is only implemented for Option<&mut T>, not Option<T>.
pub trait VulkanSwapperExtManual: 'static {
#[doc(alias = "gst_vulkan_swapper_get_surface_rectangles")]
fn get_surface_rectangles(
&self,
input_image: Option<&mut VideoRectangle>,
surface_location: Option<&mut VideoRectangle>,
display_rect: Option<&mut VideoRectangle>,
);
// TODO: Stick to the autogenerated variant, initialize all with ::uninitialized() and give the caller all three variants regardless?
#[doc(alias = "gst_vulkan_swapper_get_surface_rectangles")]
fn get_surface_rectangles_all(
&self,
) -> (
// TODO: Maybe nice and return a struct with named fields?
// (That might be another reason _not_ to provide this method)
VideoRectangle,
VideoRectangle,
VideoRectangle,
);
}
impl<O: IsA<VulkanSwapper>> VulkanSwapperExtManual for O {
fn get_surface_rectangles(
&self,
mut input_image: Option<&mut VideoRectangle>,
mut surface_location: Option<&mut VideoRectangle>,
mut display_rect: Option<&mut VideoRectangle>,
) {
unsafe {
ffi::gst_vulkan_swapper_get_surface_rectangles(
self.as_ref().to_glib_none().0,
input_image.to_glib_none_mut().0,
surface_location.to_glib_none_mut().0,
display_rect.to_glib_none_mut().0,
)
}
}
fn get_surface_rectangles_all(&self) -> (VideoRectangle, VideoRectangle, VideoRectangle) {
unsafe {
let mut input_image = VideoRectangle::uninitialized();
let mut surface_location = VideoRectangle::uninitialized();
let mut display_rect = VideoRectangle::uninitialized();
ffi::gst_vulkan_swapper_get_surface_rectangles(
self.as_ref().to_glib_none().0,
input_image.to_glib_none_mut().0,
surface_location.to_glib_none_mut().0,
display_rect.to_glib_none_mut().0,
);
(input_image, surface_location, display_rect)
}
}
}

View file

@ -0,0 +1,83 @@
[package]
authors = ["Marijn Suijten <marijns95@gmail.com>"]
build = "build.rs"
description = "FFI bindings to libgstvulkan-1.0"
documentation = "https://gstreamer.freedesktop.org/documentation/rust/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.system-deps.gstreamer_vulkan_1_0]
name = "gstreamer-vulkan-1.0"
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.25"
[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
all-features = true
[lib]
name = "gstreamer_vulkan_sys"
[dependencies]
libc = "0.2"
[dependencies.vulkan]
package = "gtk-rs-vulkan"
path = "../../gtk-rs-vulkan"
[dependencies.glib-sys]
workspace = true
[dependencies.gstreamer-sys]
workspace = true
[dependencies.gstreamer-base-sys]
workspace = true
[dependencies.gstreamer-video-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"]

View file

@ -0,0 +1,23 @@
[options]
girs_directories = ["../../gir-files", "../../gst-gir-files"]
library = "GstVulkan"
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",
# "Vulkan",
]
[external_libraries]
gstreamer="Gst"
gstreamer-base="GstBase"
gstreamer-video="GstVideo"

View 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);
}
}

View file

@ -0,0 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 876968b635c3)
from gir-files (https://github.com/gtk-rs/gir-files @ 3ede86d6a218)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 83be677e7578)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,773 @@
// 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)] = &[
(
"GstVulkanBarrierBufferInfo",
Layout {
size: size_of::<GstVulkanBarrierBufferInfo>(),
alignment: align_of::<GstVulkanBarrierBufferInfo>(),
},
),
(
"GstVulkanBarrierFlags",
Layout {
size: size_of::<GstVulkanBarrierFlags>(),
alignment: align_of::<GstVulkanBarrierFlags>(),
},
),
(
"GstVulkanBarrierImageInfo",
Layout {
size: size_of::<GstVulkanBarrierImageInfo>(),
alignment: align_of::<GstVulkanBarrierImageInfo>(),
},
),
(
"GstVulkanBarrierMemoryInfo",
Layout {
size: size_of::<GstVulkanBarrierMemoryInfo>(),
alignment: align_of::<GstVulkanBarrierMemoryInfo>(),
},
),
(
"GstVulkanBarrierType",
Layout {
size: size_of::<GstVulkanBarrierType>(),
alignment: align_of::<GstVulkanBarrierType>(),
},
),
(
"GstVulkanBufferMemory",
Layout {
size: size_of::<GstVulkanBufferMemory>(),
alignment: align_of::<GstVulkanBufferMemory>(),
},
),
(
"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>(),
},
),
(
"GstVulkanCommandBuffer",
Layout {
size: size_of::<GstVulkanCommandBuffer>(),
alignment: align_of::<GstVulkanCommandBuffer>(),
},
),
(
"GstVulkanCommandPool",
Layout {
size: size_of::<GstVulkanCommandPool>(),
alignment: align_of::<GstVulkanCommandPool>(),
},
),
(
"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>(),
},
),
(
"GstVulkanDescriptorPool",
Layout {
size: size_of::<GstVulkanDescriptorPool>(),
alignment: align_of::<GstVulkanDescriptorPool>(),
},
),
(
"GstVulkanDescriptorPoolClass",
Layout {
size: size_of::<GstVulkanDescriptorPoolClass>(),
alignment: align_of::<GstVulkanDescriptorPoolClass>(),
},
),
(
"GstVulkanDescriptorSet",
Layout {
size: size_of::<GstVulkanDescriptorSet>(),
alignment: align_of::<GstVulkanDescriptorSet>(),
},
),
(
"GstVulkanDevice",
Layout {
size: size_of::<GstVulkanDevice>(),
alignment: align_of::<GstVulkanDevice>(),
},
),
(
"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>(),
},
),
(
"GstVulkanFence",
Layout {
size: size_of::<GstVulkanFence>(),
alignment: align_of::<GstVulkanFence>(),
},
),
(
"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>(),
},
),
(
"GstVulkanFormatInfo",
Layout {
size: size_of::<GstVulkanFormatInfo>(),
alignment: align_of::<GstVulkanFormatInfo>(),
},
),
(
"GstVulkanFormatMap",
Layout {
size: size_of::<GstVulkanFormatMap>(),
alignment: align_of::<GstVulkanFormatMap>(),
},
),
(
"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>(),
},
),
(
"GstVulkanImageMemory",
Layout {
size: size_of::<GstVulkanImageMemory>(),
alignment: align_of::<GstVulkanImageMemory>(),
},
),
(
"GstVulkanImageMemoryAllocator",
Layout {
size: size_of::<GstVulkanImageMemoryAllocator>(),
alignment: align_of::<GstVulkanImageMemoryAllocator>(),
},
),
(
"GstVulkanImageMemoryAllocatorClass",
Layout {
size: size_of::<GstVulkanImageMemoryAllocatorClass>(),
alignment: align_of::<GstVulkanImageMemoryAllocatorClass>(),
},
),
(
"GstVulkanImageView",
Layout {
size: size_of::<GstVulkanImageView>(),
alignment: align_of::<GstVulkanImageView>(),
},
),
(
"GstVulkanInstance",
Layout {
size: size_of::<GstVulkanInstance>(),
alignment: align_of::<GstVulkanInstance>(),
},
),
(
"GstVulkanInstanceClass",
Layout {
size: size_of::<GstVulkanInstanceClass>(),
alignment: align_of::<GstVulkanInstanceClass>(),
},
),
(
"GstVulkanMemory",
Layout {
size: size_of::<GstVulkanMemory>(),
alignment: align_of::<GstVulkanMemory>(),
},
),
(
"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>(),
},
),
(
"GstVulkanPhysicalDevice",
Layout {
size: size_of::<GstVulkanPhysicalDevice>(),
alignment: align_of::<GstVulkanPhysicalDevice>(),
},
),
(
"GstVulkanPhysicalDeviceClass",
Layout {
size: size_of::<GstVulkanPhysicalDeviceClass>(),
alignment: align_of::<GstVulkanPhysicalDeviceClass>(),
},
),
(
"GstVulkanQueue",
Layout {
size: size_of::<GstVulkanQueue>(),
alignment: align_of::<GstVulkanQueue>(),
},
),
(
"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>(),
},
),
(
"GstVulkanVideoCapabilities",
Layout {
size: size_of::<GstVulkanVideoCapabilities>(),
alignment: align_of::<GstVulkanVideoCapabilities>(),
},
),
(
"GstVulkanVideoFilter",
Layout {
size: size_of::<GstVulkanVideoFilter>(),
alignment: align_of::<GstVulkanVideoFilter>(),
},
),
(
"GstVulkanVideoFilterClass",
Layout {
size: size_of::<GstVulkanVideoFilterClass>(),
alignment: align_of::<GstVulkanVideoFilterClass>(),
},
),
(
"GstVulkanVideoOperation",
Layout {
size: size_of::<GstVulkanVideoOperation>(),
alignment: align_of::<GstVulkanVideoOperation>(),
},
),
(
"GstVulkanVideoProfile",
Layout {
size: size_of::<GstVulkanVideoProfile>(),
alignment: align_of::<GstVulkanVideoProfile>(),
},
),
(
"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_VIDEO_OPERATION_DECODE", "0"),
("(gint) GST_VULKAN_VIDEO_OPERATION_ENCODE", "1"),
("(gint) GST_VULKAN_VIDEO_OPERATION_UNKNOWN", "2"),
("(gint) GST_VULKAN_WINDOW_ERROR_FAILED", "0"),
("(gint) GST_VULKAN_WINDOW_ERROR_OLD_LIBS", "1"),
("(gint) GST_VULKAN_WINDOW_ERROR_RESOURCE_UNAVAILABLE", "2"),
];

View file

@ -0,0 +1,86 @@
// 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_VIDEO_OPERATION_DECODE);
PRINT_CONSTANT((gint) GST_VULKAN_VIDEO_OPERATION_ENCODE);
PRINT_CONSTANT((gint) GST_VULKAN_VIDEO_OPERATION_UNKNOWN);
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;
}

View 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 <stdalign.h>
#include <stdio.h>
int main() {
printf("%s;%zu;%zu\n", "GstVulkanBarrierBufferInfo", sizeof(GstVulkanBarrierBufferInfo), alignof(GstVulkanBarrierBufferInfo));
printf("%s;%zu;%zu\n", "GstVulkanBarrierFlags", sizeof(GstVulkanBarrierFlags), alignof(GstVulkanBarrierFlags));
printf("%s;%zu;%zu\n", "GstVulkanBarrierImageInfo", sizeof(GstVulkanBarrierImageInfo), alignof(GstVulkanBarrierImageInfo));
printf("%s;%zu;%zu\n", "GstVulkanBarrierMemoryInfo", sizeof(GstVulkanBarrierMemoryInfo), alignof(GstVulkanBarrierMemoryInfo));
printf("%s;%zu;%zu\n", "GstVulkanBarrierType", sizeof(GstVulkanBarrierType), alignof(GstVulkanBarrierType));
printf("%s;%zu;%zu\n", "GstVulkanBufferMemory", sizeof(GstVulkanBufferMemory), alignof(GstVulkanBufferMemory));
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", "GstVulkanCommandBuffer", sizeof(GstVulkanCommandBuffer), alignof(GstVulkanCommandBuffer));
printf("%s;%zu;%zu\n", "GstVulkanCommandPool", sizeof(GstVulkanCommandPool), alignof(GstVulkanCommandPool));
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", "GstVulkanDescriptorPool", sizeof(GstVulkanDescriptorPool), alignof(GstVulkanDescriptorPool));
printf("%s;%zu;%zu\n", "GstVulkanDescriptorPoolClass", sizeof(GstVulkanDescriptorPoolClass), alignof(GstVulkanDescriptorPoolClass));
printf("%s;%zu;%zu\n", "GstVulkanDescriptorSet", sizeof(GstVulkanDescriptorSet), alignof(GstVulkanDescriptorSet));
printf("%s;%zu;%zu\n", "GstVulkanDevice", sizeof(GstVulkanDevice), alignof(GstVulkanDevice));
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", "GstVulkanFence", sizeof(GstVulkanFence), alignof(GstVulkanFence));
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", "GstVulkanFormatInfo", sizeof(GstVulkanFormatInfo), alignof(GstVulkanFormatInfo));
printf("%s;%zu;%zu\n", "GstVulkanFormatMap", sizeof(GstVulkanFormatMap), alignof(GstVulkanFormatMap));
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", "GstVulkanImageMemory", sizeof(GstVulkanImageMemory), alignof(GstVulkanImageMemory));
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", "GstVulkanImageView", sizeof(GstVulkanImageView), alignof(GstVulkanImageView));
printf("%s;%zu;%zu\n", "GstVulkanInstance", sizeof(GstVulkanInstance), alignof(GstVulkanInstance));
printf("%s;%zu;%zu\n", "GstVulkanInstanceClass", sizeof(GstVulkanInstanceClass), alignof(GstVulkanInstanceClass));
printf("%s;%zu;%zu\n", "GstVulkanMemory", sizeof(GstVulkanMemory), alignof(GstVulkanMemory));
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", "GstVulkanPhysicalDevice", sizeof(GstVulkanPhysicalDevice), alignof(GstVulkanPhysicalDevice));
printf("%s;%zu;%zu\n", "GstVulkanPhysicalDeviceClass", sizeof(GstVulkanPhysicalDeviceClass), alignof(GstVulkanPhysicalDeviceClass));
printf("%s;%zu;%zu\n", "GstVulkanQueue", sizeof(GstVulkanQueue), alignof(GstVulkanQueue));
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", "GstVulkanVideoCapabilities", sizeof(GstVulkanVideoCapabilities), alignof(GstVulkanVideoCapabilities));
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", "GstVulkanVideoOperation", sizeof(GstVulkanVideoOperation), alignof(GstVulkanVideoOperation));
printf("%s;%zu;%zu\n", "GstVulkanVideoProfile", sizeof(GstVulkanVideoProfile), alignof(GstVulkanVideoProfile));
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;
}

View 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>

View file

@ -0,0 +1,35 @@
[package]
name = "gstreamer-vulkan-wayland"
authors = [
"Marijn Suijten <marijns95@gmail.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", "vulkan", "video", "gnome"]
version.workspace = true
categories.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
[dependencies]
glib.workspace = true
gst-vulkan.workspace = true
gst.workspace = true
gstreamer-vulkan-wayland-sys.workspace = true
libc = "0.2"
[features]
default = []
v1_20 = ["gst/v1_20", "gst-vulkan/v1_20", "gstreamer-vulkan-wayland-sys/v1_20"]
v1_22 = ["gst/v1_22", "gst-vulkan/v1_22", "gstreamer-vulkan-wayland-sys/v1_22", "v1_20"]
v1_24 = ["gst/v1_24", "gst-vulkan/v1_24", "gstreamer-vulkan-wayland-sys/v1_24", "v1_22"]
v1_26 = ["gst/v1_26", "gst-vulkan/v1_26", "gstreamer-vulkan-wayland-sys/v1_26", "v1_24"]
[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]

View file

@ -0,0 +1,34 @@
[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
external_libraries = [
"GstVulkan",
]
generate = [
]
manual = [
"GstVulkan.VulkanDisplay",
]
[[object]]
name = "GstVulkanWayland.VulkanDisplayWayland"
status = "generate"
[[object.function]]
name = "new"
[object.function.return]
nullable_return_is_error = "Failed to crate new Wayland Vulkan display"
[[object.function]]
name = "with_display"
# Display argument is raw pointer
manual = true

View 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;

View file

@ -0,0 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 876968b635c3)
from gir-files (https://github.com/gtk-rs/gir-files @ 3ede86d6a218)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 83be677e7578)

View 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_vulkan::VulkanDisplay;
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 crate new Wayland Vulkan 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 {}

View file

@ -0,0 +1,28 @@
// Copyright (C) 2021 Marijn Suijten <marijns95@gmail.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(all(not(doctest), doc), feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
pub use gst_vulkan;
pub use gstreamer_vulkan_wayland_sys as ffi;
macro_rules! assert_initialized_main_thread {
() => {
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
gst::assert_initialized();
}
};
}
#[allow(clippy::use_self)]
mod auto;
pub use auto::*;
mod vulkan_display_wayland;
pub use vulkan_display_wayland::*;

View file

@ -0,0 +1,25 @@
// Copyright (C) 2021 Marijn Suijten <marijns95@gmail.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 crate::ffi;
use crate::VulkanDisplayWayland;
use glib::ffi::gpointer;
use glib::translate::*;
use libc::uintptr_t;
impl VulkanDisplayWayland {
#[doc(alias = "gst_vulkan_display_wayland_new_with_display")]
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"))
}
}

View file

@ -0,0 +1,73 @@
[package]
authors = ["Marijn Suijten <marijns95@gmail.com>"]
build = "build.rs"
description = "FFI bindings to libgstvulkan-1.0 (Wayland support)"
documentation = "https://gstreamer.freedesktop.org/documentation/rust/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.18"
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0.v1_20]
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.25"
[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
all-features = true
[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"]

View file

@ -0,0 +1,20 @@
[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",
]
[external_libraries]
gstreamer-vulkan="GstVulkan"

View 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);
}
}

View file

@ -0,0 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 876968b635c3)
from gir-files (https://github.com/gtk-rs/gir-files @ 3ede86d6a218)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 83be677e7578)

View 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;
}

View 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)] = &[];

View 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;
}

View 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;
}

View 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>

View file

@ -0,0 +1,35 @@
[package]
name = "gstreamer-vulkan-xcb"
authors = [
"Marijn Suijten <marijns95@gmail.com>",
]
description = "Rust bindings for GStreamer Vulkan library (XCB support)"
license = "MIT OR Apache-2.0"
readme = "README.md"
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_vulkan_xcb/"
keywords = ["gstreamer", "multimedia", "vulkan", "video", "gnome"]
version.workspace = true
categories.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
[dependencies]
glib.workspace = true
gst-vulkan.workspace = true
gst.workspace = true
gstreamer-vulkan-xcb-sys.workspace = true
libc = "0.2"
[features]
default = []
v1_20 = ["gst/v1_20", "gst-vulkan/v1_20", "gstreamer-vulkan-xcb-sys/v1_20"]
v1_22 = ["gst/v1_22", "gst-vulkan/v1_22", "gstreamer-vulkan-xcb-sys/v1_22", "v1_20"]
v1_24 = ["gst/v1_24", "gst-vulkan/v1_24", "gstreamer-vulkan-xcb-sys/v1_24", "v1_22"]
v1_26 = ["gst/v1_26", "gst-vulkan/v1_26", "gstreamer-vulkan-xcb-sys/v1_26", "v1_24"]
[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]

View file

@ -0,0 +1,29 @@
[options]
girs_directories = ["../../gir-files", "../../gst-gir-files"]
library = "GstVulkanXCB"
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
external_libraries = [
"GstVulkan",
]
generate = [
]
manual = [
"GstVulkan.VulkanDisplay",
]
[[object]]
name = "GstVulkanXCB.VulkanDisplayXCB"
status = "generate"
[[object.function]]
name = "new"
[object.function.return]
nullable_return_is_error = "Failed to crate new XCB Vulkan display"

View 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_xcb;
pub use self::vulkan_display_xcb::VulkanDisplayXCB;

View file

@ -0,0 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 876968b635c3)
from gir-files (https://github.com/gtk-rs/gir-files @ 3ede86d6a218)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 83be677e7578)

View file

@ -0,0 +1,30 @@
// 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 = "GstVulkanDisplayXCB")]
pub struct VulkanDisplayXCB(Object<ffi::GstVulkanDisplayXCB, ffi::GstVulkanDisplayXCBClass>) @extends gst_vulkan::VulkanDisplay;
match fn {
type_ => || ffi::gst_vulkan_display_xcb_get_type(),
}
}
impl VulkanDisplayXCB {
#[doc(alias = "gst_vulkan_display_xcb_new")]
pub fn new(name: Option<&str>) -> Result<VulkanDisplayXCB, glib::BoolError> {
assert_initialized_main_thread!();
unsafe {
Option::<_>::from_glib_full(ffi::gst_vulkan_display_xcb_new(name.to_glib_none().0))
.ok_or_else(|| glib::bool_error!("Failed to crate new XCB Vulkan display"))
}
}
}
unsafe impl Send for VulkanDisplayXCB {}
unsafe impl Sync for VulkanDisplayXCB {}

View file

@ -0,0 +1,25 @@
// Copyright (C) 2021 Marijn Suijten <marijns95@gmail.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(all(not(doctest), doc), feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
pub use gst_vulkan;
pub use gstreamer_vulkan_xcb_sys as ffi;
macro_rules! assert_initialized_main_thread {
() => {
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
gst::assert_initialized();
}
};
}
#[allow(clippy::use_self)]
mod auto;
pub use auto::*;

View file

@ -0,0 +1,73 @@
[package]
authors = ["Marijn Suijten <marijns95@gmail.com>"]
build = "build.rs"
description = "FFI bindings to libgstvulkan-1.0 (XCB support)"
documentation = "https://gstreamer.freedesktop.org/documentation/rust/stable/latest/docs/gstreamer_vulkan_xcb_sys/"
keywords = ["ffi", "gstreamer", "gnome", "multimedia"]
license = "MIT"
name = "gstreamer-vulkan-xcb-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_xcb_1_0]
name = "gstreamer-vulkan-xcb-1.0"
version = "1.18"
[package.metadata.system-deps.gstreamer_vulkan_xcb_1_0.v1_20]
version = "1.20"
[package.metadata.system-deps.gstreamer_vulkan_xcb_1_0.v1_22]
version = "1.22"
[package.metadata.system-deps.gstreamer_vulkan_xcb_1_0.v1_24]
version = "1.24"
[package.metadata.system-deps.gstreamer_vulkan_xcb_1_0.v1_26]
version = "1.25"
[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
all-features = true
[lib]
name = "gstreamer_vulkan_xcb_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"]

View file

@ -0,0 +1,20 @@
[options]
girs_directories = ["../../../gir-files", "../../../gst-gir-files"]
library = "GstVulkanXCB"
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",
]
[external_libraries]
gstreamer-vulkan="GstVulkan"

View 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);
}
}

Some files were not shown because too many files have changed in this diff Show more