Add initial GStreamer-vulkan bindings

Very basic, all autogenerated things.
This commit is contained in:
Matthew Waters 2024-05-31 22:50:53 +10:00 committed by Hanna Weiß
parent ccca1db3fb
commit 2258de9623
No known key found for this signature in database
109 changed files with 8728 additions and 5 deletions

View file

@ -142,7 +142,7 @@ trigger:
stage: container-base stage: container-base
variables: variables:
FDO_DISTRIBUTION_PACKAGES: >- FDO_DISTRIBUTION_PACKAGES: >-
build-essential cmake curl python3-setuptools libglib2.0-dev libxml2-dev build-essential cmake curl glslc python3-setuptools libglib2.0-dev libxml2-dev
libdrm-dev libegl1-mesa-dev libgl1-mesa-dev libgbm-dev libgles2-mesa-dev libdrm-dev libegl1-mesa-dev libgl1-mesa-dev libgbm-dev libgles2-mesa-dev
libgl1-mesa-dri libegl-dev libgl-dev libgles-dev libglx-dev libgl1-mesa-dri libegl-dev libgl-dev libgles-dev libglx-dev
libssl-dev git wget ca-certificates ninja-build python3-pip flex bison libssl-dev git wget ca-certificates ninja-build python3-pip flex bison
@ -151,13 +151,13 @@ trigger:
libgraphene-1.0-dev libjpeg-dev libwayland-dev wayland-protocols libgraphene-1.0-dev libjpeg-dev libwayland-dev wayland-protocols
python3-gi libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev python3-gi libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev
libswscale-dev yasm libx264-dev libfontconfig-dev libfreetype-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 libxcb1-dev libxext-dev libxrender-dev libxrandr-dev libxcursor-dev
libxdamage-dev libxfixes-dev libxinerama-dev libgudev-1.0-dev libxdamage-dev libxfixes-dev libxinerama-dev libgudev-1.0-dev
libpango1.0-dev libcairo2-dev libjson-glib-dev libgdk-pixbuf-2.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 libtiff-dev libpng-dev libjpeg-dev libepoxy-dev libsass-dev sassc
libcsound64-dev llvm clang nasm libsodium-dev libwebp-dev libcsound64-dev llvm clang nasm libsodium-dev libwebp-dev
libflac-dev libmysofa-dev libgtk-4-dev libdav1d-dev libclang-dev libflac-dev libmysofa-dev libgtk-4-dev libdav1d-dev libclang-dev libvulkan-dev
FDO_DISTRIBUTION_EXEC: >- FDO_DISTRIBUTION_EXEC: >-
bash ci/install-gst.sh && bash ci/install-gst.sh &&
bash ci/install-vvdec.sh && bash ci/install-vvdec.sh &&

92
Cargo.lock generated
View file

@ -60,6 +60,15 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
[[package]]
name = "ash"
version = "0.38.0+1.3.281"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
dependencies = [
"libloading",
]
[[package]] [[package]]
name = "async-channel" name = "async-channel"
version = "2.5.0" version = "2.5.0"
@ -535,6 +544,9 @@ dependencies = [
"gstreamer-rtsp-server", "gstreamer-rtsp-server",
"gstreamer-sdp", "gstreamer-sdp",
"gstreamer-video", "gstreamer-video",
"gstreamer-vulkan",
"gstreamer-vulkan-wayland",
"gstreamer-vulkan-xcb",
"image", "image",
"memfd", "memfd",
"memmap2", "memmap2",
@ -1611,6 +1623,86 @@ dependencies = [
"tempfile", "tempfile",
] ]
[[package]]
name = "gstreamer-vulkan"
version = "0.23.0"
dependencies = [
"gir-format-check",
"glib",
"gstreamer",
"gstreamer-base",
"gstreamer-video",
"gstreamer-vulkan-sys",
"libc",
"once_cell",
"serde",
"serde_json",
]
[[package]]
name = "gstreamer-vulkan-sys"
version = "0.23.0"
dependencies = [
"ash",
"glib-sys",
"gobject-sys",
"gstreamer-base-sys",
"gstreamer-sys",
"gstreamer-video-sys",
"libc",
"shell-words",
"system-deps",
"tempfile",
]
[[package]]
name = "gstreamer-vulkan-wayland"
version = "0.23.0"
dependencies = [
"gir-format-check",
"glib",
"gstreamer",
"gstreamer-vulkan",
"gstreamer-vulkan-wayland-sys",
"libc",
]
[[package]]
name = "gstreamer-vulkan-wayland-sys"
version = "0.23.0"
dependencies = [
"glib-sys",
"gstreamer-vulkan-sys",
"libc",
"shell-words",
"system-deps",
"tempfile",
]
[[package]]
name = "gstreamer-vulkan-xcb"
version = "0.23.0"
dependencies = [
"gir-format-check",
"glib",
"gstreamer",
"gstreamer-vulkan",
"gstreamer-vulkan-xcb-sys",
"libc",
]
[[package]]
name = "gstreamer-vulkan-xcb-sys"
version = "0.23.0"
dependencies = [
"glib-sys",
"gstreamer-vulkan-sys",
"libc",
"shell-words",
"system-deps",
"tempfile",
]
[[package]] [[package]]
name = "gstreamer-webrtc" name = "gstreamer-webrtc"
version = "0.25.0" version = "0.25.0"

View file

@ -75,6 +75,9 @@ members = [
"gstreamer-sdp/sys", "gstreamer-sdp/sys",
"gstreamer-tag/sys", "gstreamer-tag/sys",
"gstreamer-video/sys", "gstreamer-video/sys",
"gstreamer-vulkan/sys",
"gstreamer-vulkan/wayland/sys",
"gstreamer-vulkan/xcb/sys",
"gstreamer-webrtc/sys", "gstreamer-webrtc/sys",
"gstreamer-allocators/sys", "gstreamer-allocators/sys",
"gstreamer", "gstreamer",
@ -103,6 +106,9 @@ members = [
"gstreamer-tag", "gstreamer-tag",
"gstreamer-validate", "gstreamer-validate",
"gstreamer-video", "gstreamer-video",
"gstreamer-vulkan",
"gstreamer-vulkan/wayland",
"gstreamer-vulkan/xcb",
"gstreamer-webrtc", "gstreamer-webrtc",
"gstreamer-allocators", "gstreamer-allocators",
"gstreamer-utils", "gstreamer-utils",
@ -157,6 +163,9 @@ gstreamer-sys = { path = "./gstreamer/sys"}
gstreamer-validate-sys = { path = "./gstreamer-validate/sys" } gstreamer-validate-sys = { path = "./gstreamer-validate/sys" }
gstreamer-video-sys = { path = "./gstreamer-video/sys"} gstreamer-video-sys = { path = "./gstreamer-video/sys"}
gstreamer-webrtc-sys = { path = "./gstreamer-webrtc/sys" } gstreamer-webrtc-sys = { path = "./gstreamer-webrtc/sys" }
gstreamer-vulkan-sys = { path = "./gstreamer-vulkan/sys"}
gstreamer-vulkan-wayland-sys = { path = "./gstreamer-vulkan/wayland/sys"}
gstreamer-vulkan-xcb-sys = { path = "./gstreamer-vulkan/xcb/sys"}
ges = { package = "gstreamer-editing-services", path = "./gstreamer-editing-services" } ges = { package = "gstreamer-editing-services", path = "./gstreamer-editing-services" }
gst = { package = "gstreamer", path = "./gstreamer" } gst = { package = "gstreamer", path = "./gstreamer" }
gst-allocators = { package = "gstreamer-allocators", path = "./gstreamer-allocators" } gst-allocators = { package = "gstreamer-allocators", path = "./gstreamer-allocators" }
@ -177,3 +186,6 @@ gst-rtsp = { package = "gstreamer-rtsp", path = "./gstreamer-rtsp" }
gst-rtsp-server = { package = "gstreamer-rtsp-server", path = "./gstreamer-rtsp-server" } gst-rtsp-server = { package = "gstreamer-rtsp-server", path = "./gstreamer-rtsp-server" }
gst-sdp = { package = "gstreamer-sdp", path = "./gstreamer-sdp" } gst-sdp = { package = "gstreamer-sdp", path = "./gstreamer-sdp" }
gst-video = { package = "gstreamer-video", path = "./gstreamer-video" } 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" }

View file

@ -11,7 +11,7 @@ CARGO_NEXTEST_FLAGS="--profile=ci --no-tests=pass"
parent="${CI_PROJECT_DIR:-$(pwd)}" parent="${CI_PROJECT_DIR:-$(pwd)}"
for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do for crate in gstreamer* gstreamer-gl/{egl,wayland,x11} gstreamer-vulkan/{wayland,xcb}; do
if [[ "$crate" == gstreamer-d3d12* ]]; then if [[ "$crate" == gstreamer-d3d12* ]]; then
echo "Skipping $crate" echo "Skipping $crate"
continue continue

View file

@ -11,7 +11,7 @@ CARGO_NEXTEST_FLAGS="--profile=ci --no-tests=pass"
parent="${CI_PROJECT_DIR:-$(pwd)}" parent="${CI_PROJECT_DIR:-$(pwd)}"
for crate in gstreamer*/sys gstreamer-gl/*/sys; do for crate in gstreamer*/sys gstreamer-gl/*/sys gstreamer-vulkan/*/sys; do
if [[ "$crate" == gstreamer-d3d12* ]]; then if [[ "$crate" == gstreamer-d3d12* ]]; then
echo "Skipping $crate" echo "Skipping $crate"
continue continue
@ -48,6 +48,9 @@ for crate in gstreamer/sys \
gstreamer-tag/sys \ gstreamer-tag/sys \
gstreamer-validate/sys \ gstreamer-validate/sys \
gstreamer-video/sys \ gstreamer-video/sys \
gstreamer-vulkan/sys \
gstreamer-vulkan/wayland/sys \
gstreamer-vulkan/xcb/sys \
gstreamer-webrtc/sys; do gstreamer-webrtc/sys; do
echo "Testing $crate with --all-features)" 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 RUST_BACKTRACE=1 cargo nextest run $CARGO_NEXTEST_FLAGS $CARGO_FLAGS --locked --manifest-path $crate/Cargo.toml --all-features

View file

@ -0,0 +1 @@
../gstreamer/CHANGELOG.md

1
gstreamer-vulkan/COPYRIGHT Symbolic link
View file

@ -0,0 +1 @@
../COPYRIGHT

View file

@ -0,0 +1,42 @@
[package]
name = "gstreamer-vulkan"
authors = ["Matthew Waters <matthew@centricular.com>"]
description = "Rust bindings for GStreamer Vulkan library"
license = "MIT OR Apache-2.0"
readme = "README.md"
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_vulkan/"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
version.workspace = true
categories.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
[dependencies]
libc = "0.2"
ffi = { package = "gstreamer-vulkan-sys", path = "sys" }
glib.workspace = true
gst.workspace = true
gst-base.workspace = true
gst-video.workspace = true
serde = { version = "1.0", optional = true }
once_cell = "1"
[dev-dependencies]
gir-format-check = "0.1"
serde_json = "1.0"
[features]
default = ["v1_18"]
v1_18 = ["gst/v1_18", "gst-base/v1_18", "gst-video/v1_18", "ffi/v1_18"]
v1_20 = ["gst/v1_20", "gst-base/v1_20", "gst-video/v1_20", "ffi/v1_20", "v1_18"]
v1_22 = ["gst/v1_22", "gst-base/v1_22", "gst-video/v1_22", "ffi/v1_22", "v1_20"]
v1_24 = ["gst/v1_24", "gst-base/v1_24", "gst-video/v1_24", "ffi/v1_24", "v1_22"]
v1_26 = ["gst/v1_26", "gst-base/v1_26", "gst-video/v1_26", "ffi/v1_26", "v1_24"]
serde = ["dep:serde", "gst/serde", "gst-video/serde"]
[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]

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

@ -0,0 +1,118 @@
[options]
girs_directories = ["../gir-files", "../gst-gir-files"]
library = "GstVulkan"
version = "1.0"
min_cfg_version = "1.18"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
single_version_file = true
generate_display_trait = false
trust_return_value_nullability = true
external_libraries = [
"GLib",
"GObject",
"Gst",
"GstBase",
"GstVideo",
]
generate = [
#"GstVulkan.VulkanBufferMemory",
"GstVulkan.VulkanBufferMemoryAllocator",
"GstVulkan.VulkanBufferPool",
"GstVulkan.VulkanCommandBuffer",
"GstVulkan.VulkanCommandPool",
#"GstVulkan.VulkanDecoder",
"GstVulkan.VulkanDescriptorSet",
"GstVulkan.VulkanDevice",
"GstVulkan.VulkanDisplay",
"GstVulkan.VulkanDisplayType",
#"GstVulkan.VulkanEncoder",
"GstVulkan.VulkanFence",
#"GstVulkan.VulkanFullScreenQuad",
"GstVulkan.VulkanHandlePool",
"GstVulkan.VulkanImageBufferPool",
#"GstVulkan.VulkanImageMemory",
"GstVulkan.VulkanImageMemoryAllocator",
"GstVulkan.VulkanImageView",
"GstVulkan.VulkanInstance",
#"GstVulkan.VulkanMemory",
"GstVulkan.VulkanOperation",
"GstVulkan.VulkanPhysicalDevice",
"GstVulkan.VulkanQueue",
"GstVulkan.VulkanSwapper",
"GstVulkan.VulkanTrash",
"GstVulkan.VulkanVideoFilter",
"GstVulkan.VulkanWindow",
]
manual = [
"GLib.Error",
"GLib.Thread",
"GObject.Object",
"GObject.Value",
"Gst.AllocationParams",
"Gst.Allocator",
"Gst.BufferPool",
"Gst.Context",
"Gst.Element",
"Gst.FlowReturn",
"Gst.Fraction",
"Gst.Memory",
"Gst.Object",
"Gst.PadDirection",
"GstBase.BaseSrc",
"GstBase.BaseTransform",
"GstBase.PushSrc",
"GstVideo.VideoAlignment",
"GstVideo.VideoInfo",
"GstVideo.VideoMultiviewFlags",
"GstVideo.VideoMultiviewMode",
"GstVideo.VideoOverlay",
]
[[object]]
name = "Gst.Buffer"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Query"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Structure"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstVulkan.VulkanFullScreenQuad"
status = "generate"
concurrency = "none"
[[object]]
name = "GstVulkan.VulkanHandle"
status = "generate"
ref_mode = "ref"
[[object]]
name = "GstVulkan.VulkanDescriptorPool"
status = "generate"
[[object.function]]
name = "create"
ignore = true
[[object]]
name = "GstVulkan.VulkanDescriptorCache"
status = "generate"
[[object.function]]
name = "new"
ignore = true

View file

@ -0,0 +1 @@
../LICENSE-APACHE

View file

@ -0,0 +1 @@
../LICENSE-MIT

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

@ -0,0 +1,215 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-gl.svg)](https://crates.io/crates/gstreamer-gl) [![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/) (OpenGL library)
bindings for Rust. Documentation can be found
[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_gl/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications and GStreamer plugins.
The bindings are mostly autogenerated with [gir](https://github.com/gtk-rs/gir/)
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
API metadata provided by the GStreamer project.
## Table of Contents
1. [Installation](#installation)
1. [Linux/BSDs](#installation-linux)
1. [macOS](#installation-macos)
1. [Windows](#installation-windows)
1. [Getting Started](#getting-started)
1. [License](#license)
1. [Contribution](#contribution)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.14 and gst-plugins-base 1.14 installed. In addition,
some of the examples/tutorials require various GStreamer plugins to be
available, which can be found in gst-plugins-base, gst-plugins-good,
gst-plugins-bad, gst-plugins-ugly and/or gst-libav.
<a name="installation-linux"/>
### Linux/BSDs
You need to install the above mentioned packages with your distributions
package manager, or build them from source.
On Debian/Ubuntu they can be installed with
```console
$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev
```
The minimum required version of the above libraries is >= 1.14. If you
build the gstreamer-player sub-crate, or any of the examples that
depend on gstreamer-player, you must ensure that in addition to the above
packages, `libgstreamer-plugins-bad1.0-dev` is installed. See the `Cargo.toml`
files for the full details,
```console
$ apt-get install libgstreamer-plugins-bad1.0-dev
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### macOS
You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
We recommend using the official GStreamer binaries over Homebrew, especially
as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964).
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and
`gstreamer-1.0-devel-1.20.4-universal.pkg`.
After installation, you also need to set the `PATH` environment variable as
follows
```console
$ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
```
Also note that the `pkg-config` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### Homebrew
Homebrew only installs various plugins if explicitly enabled, so some extra
`--with-*` flags may be required.
```console
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav gst-rtsp-server \
gst-editing-services --with-orc --with-libogg --with-opus \
--with-pango --with-theora --with-libvorbis --with-libvpx \
--enable-gtk3
```
Make sure the version of these libraries is >= 1.14.
<a name="installation-windows"/>
### Windows
You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/)
with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
We recommend using the official GStreamer binaries over MSYS2.
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and
`gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that
matches your Rust toolchain, i.e. MinGW or MSVC.
After installation set the ``PATH` environment variable as follows:
```console
# For a UNIX-style shell:
$ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}"
# For cmd.exe:
$ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH%
```
Make sure to update the path to where you have actually installed GStreamer
and for the corresponding toolchain.
Also note that the `pkg-config.exe` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### MSYS2 / pacman
```console
$ pacman -S glib2-devel pkg-config \
mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \
mingw-w64-x86_64-gst-rtsp-server
```
Make sure the version of these libraries is >= 1.14.
Note that the version of `pkg-config` included in `MSYS2` is
[known to have problems](https://github.com/rust-lang/pkg-config-rs/issues/51#issuecomment-346300858)
compiling GStreamer, so you may need to install another version. One option
would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/).
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer/), however it is
only the Rust API reference and does not explain any of the concepts.
For getting started with GStreamer development, the best would be to follow
the [documentation](https://gstreamer.freedesktop.org/documentation/) on the
GStreamer website, especially the [Application Development
Manual](https://gstreamer.freedesktop.org/documentation/application-development/).
While being C-centric, it explains all the fundamental concepts of GStreamer
and the code examples should be relatively easily translatable to Rust. The
API is basically the same, function/struct names are the same and everything
is only more convenient (hopefully) and safer.
In addition there are
[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the
GStreamer website. Many of them were ported to Rust already and the code can
be found in the
[tutorials](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/examples)
directory.
Various GStreamer plugins written in Rust can be found in the
[gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs)
repository.
<a name="license"/>
## LICENSE
gstreamer-rs and all crates contained in here are licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)
at your option.
GStreamer itself is licensed under the Lesser General Public License version
2.1 or (at your option) any later version:
https://www.gnu.org/licenses/lgpl-2.1.html
<a name="contribution"/>
## Contribution
Any kinds of contributions are welcome as a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.

View file

@ -0,0 +1,116 @@
// 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 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)
}
}

View file

@ -0,0 +1,102 @@
// 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_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;
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
mod vulkan_operation;
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub use self::vulkan_operation::VulkanOperation;
mod vulkan_physical_device;
pub use self::vulkan_physical_device::VulkanPhysicalDevice;
mod vulkan_queue;
pub use self::vulkan_queue::VulkanQueue;
mod vulkan_swapper;
pub use self::vulkan_swapper::VulkanSwapper;
mod vulkan_video_filter;
pub use self::vulkan_video_filter::VulkanVideoFilter;
mod vulkan_window;
pub use self::vulkan_window::VulkanWindow;
mod vulkan_command_buffer;
pub use self::vulkan_command_buffer::VulkanCommandBuffer;
mod vulkan_descriptor_set;
pub use self::vulkan_descriptor_set::VulkanDescriptorSet;
mod vulkan_fence;
pub use self::vulkan_fence::VulkanFence;
mod vulkan_handle;
pub use self::vulkan_handle::VulkanHandle;
mod vulkan_image_view;
pub use self::vulkan_image_view::VulkanImageView;
mod vulkan_trash;
pub use self::vulkan_trash::VulkanTrash;
mod flags;
pub use self::flags::VulkanDisplayType;
pub(crate) mod traits {
pub use super::vulkan_command_pool::VulkanCommandPoolExt;
pub use super::vulkan_descriptor_cache::VulkanDescriptorCacheExt;
pub use super::vulkan_descriptor_pool::VulkanDescriptorPoolExt;
pub use super::vulkan_device::VulkanDeviceExt;
pub use super::vulkan_display::VulkanDisplayExt;
pub use super::vulkan_full_screen_quad::VulkanFullScreenQuadExt;
pub use super::vulkan_handle_pool::VulkanHandlePoolExt;
pub use super::vulkan_instance::VulkanInstanceExt;
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub use super::vulkan_operation::VulkanOperationExt;
pub use super::vulkan_physical_device::VulkanPhysicalDeviceExt;
pub use super::vulkan_queue::VulkanQueueExt;
pub use super::vulkan_swapper::VulkanSwapperExt;
pub use super::vulkan_video_filter::VulkanVideoFilterExt;
pub use super::vulkan_window::VulkanWindowExt;
}

View file

@ -0,0 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 5223ce91b97a)
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ d62956d67216+)

View file

@ -0,0 +1,20 @@
// 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
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,41 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
use crate::VulkanDevice;
use glib::{prelude::*, translate::*};
glib::wrapper! {
#[doc(alias = "GstVulkanBufferPool")]
pub struct VulkanBufferPool(Object<ffi::GstVulkanBufferPool, ffi::GstVulkanBufferPoolClass>) @extends gst::BufferPool, gst::Object;
match fn {
type_ => || ffi::gst_vulkan_buffer_pool_get_type(),
}
}
impl VulkanBufferPool {
pub const NONE: Option<&'static VulkanBufferPool> = None;
#[doc(alias = "gst_vulkan_buffer_pool_new")]
pub fn new(device: &impl IsA<VulkanDevice>) -> VulkanBufferPool {
skip_assert_initialized!();
unsafe {
gst::BufferPool::from_glib_full(ffi::gst_vulkan_buffer_pool_new(
device.as_ref().to_glib_none().0,
))
.unsafe_cast()
}
}
//#[cfg(feature = "v1_24")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
//#[doc(alias = "gst_vulkan_buffer_pool_config_set_allocation_params")]
//pub fn config_set_allocation_params(config: &gst::Structure, usage: /*Ignored*/&vulkan::BufferUsageFlags, mem_properties: /*Ignored*/&vulkan::MemoryPropertyFlags) {
// unsafe { TODO: call ffi:gst_vulkan_buffer_pool_config_set_allocation_params() }
//}
}
unsafe impl Send for VulkanBufferPool {}
unsafe impl Sync for VulkanBufferPool {}

View file

@ -0,0 +1,25 @@
// 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
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct VulkanCommandBuffer(Boxed<ffi::GstVulkanCommandBuffer>);
match fn {
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_vulkan_command_buffer_get_type(), ptr as *mut _) as *mut ffi::GstVulkanCommandBuffer,
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_vulkan_command_buffer_get_type(), ptr as *mut _),
type_ => || ffi::gst_vulkan_command_buffer_get_type(),
}
}
impl VulkanCommandBuffer {
//#[doc(alias = "gst_vulkan_command_buffer_new_wrapped")]
//pub fn new_wrapped(cmd: /*Ignored*/&vulkan::CommandBuffer, level: /*Ignored*/&vulkan::CommandBufferLevel) -> VulkanCommandBuffer {
// unsafe { TODO: call ffi:gst_vulkan_command_buffer_new_wrapped() }
//}
}
unsafe impl Send for VulkanCommandBuffer {}
unsafe impl Sync for VulkanCommandBuffer {}

View file

@ -0,0 +1,70 @@
// 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::{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 {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanCommandPool>> Sealed for T {}
}
pub trait VulkanCommandPoolExt: IsA<VulkanCommandPool> + sealed::Sealed + '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,48 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
use crate::{VulkanDescriptorSet, VulkanHandlePool};
use glib::{prelude::*, translate::*};
glib::wrapper! {
#[doc(alias = "GstVulkanDescriptorCache")]
pub struct VulkanDescriptorCache(Object<ffi::GstVulkanDescriptorCache, ffi::GstVulkanDescriptorCacheClass>) @extends VulkanHandlePool, gst::Object;
match fn {
type_ => || ffi::gst_vulkan_descriptor_cache_get_type(),
}
}
impl VulkanDescriptorCache {
pub const NONE: Option<&'static VulkanDescriptorCache> = None;
}
unsafe impl Send for VulkanDescriptorCache {}
unsafe impl Sync for VulkanDescriptorCache {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanDescriptorCache>> Sealed for T {}
}
pub trait VulkanDescriptorCacheExt: IsA<VulkanDescriptorCache> + sealed::Sealed + '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,53 @@
// 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::VulkanDevice;
use glib::{prelude::*, translate::*};
glib::wrapper! {
#[doc(alias = "GstVulkanDescriptorPool")]
pub struct VulkanDescriptorPool(Object<ffi::GstVulkanDescriptorPool, ffi::GstVulkanDescriptorPoolClass>) @extends gst::Object;
match fn {
type_ => || ffi::gst_vulkan_descriptor_pool_get_type(),
}
}
impl VulkanDescriptorPool {
pub const NONE: Option<&'static VulkanDescriptorPool> = None;
//#[doc(alias = "gst_vulkan_descriptor_pool_new_wrapped")]
//pub fn new_wrapped(device: &impl IsA<VulkanDevice>, pool: /*Ignored*/vulkan::DescriptorPool, max_sets: usize) -> VulkanDescriptorPool {
// unsafe { TODO: call ffi:gst_vulkan_descriptor_pool_new_wrapped() }
//}
}
unsafe impl Send for VulkanDescriptorPool {}
unsafe impl Sync for VulkanDescriptorPool {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanDescriptorPool>> Sealed for T {}
}
pub trait VulkanDescriptorPoolExt: IsA<VulkanDescriptorPool> + sealed::Sealed + 'static {
#[doc(alias = "gst_vulkan_descriptor_pool_get_device")]
#[doc(alias = "get_device")]
fn device(&self) -> VulkanDevice {
unsafe {
from_glib_full(ffi::gst_vulkan_descriptor_pool_get_device(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "gst_vulkan_descriptor_pool_get_max_sets")]
#[doc(alias = "get_max_sets")]
fn max_sets(&self) -> usize {
unsafe { ffi::gst_vulkan_descriptor_pool_get_max_sets(self.as_ref().to_glib_none().0) }
}
}
impl<O: IsA<VulkanDescriptorPool>> VulkanDescriptorPoolExt for O {}

View file

@ -0,0 +1,25 @@
// 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
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct VulkanDescriptorSet(Boxed<ffi::GstVulkanDescriptorSet>);
match fn {
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_vulkan_descriptor_set_get_type(), ptr as *mut _) as *mut ffi::GstVulkanDescriptorSet,
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_vulkan_descriptor_set_get_type(), ptr as *mut _),
type_ => || ffi::gst_vulkan_descriptor_set_get_type(),
}
}
impl VulkanDescriptorSet {
//#[doc(alias = "gst_vulkan_descriptor_set_new_wrapped")]
//pub fn new_wrapped(pool: &impl IsA<VulkanDescriptorPool>, set: /*Ignored*/&vulkan::DescriptorSet, layouts: &[VulkanHandle]) -> VulkanDescriptorSet {
// unsafe { TODO: call ffi:gst_vulkan_descriptor_set_new_wrapped() }
//}
}
unsafe impl Send for VulkanDescriptorSet {}
unsafe impl Sync for VulkanDescriptorSet {}

View file

@ -0,0 +1,270 @@
// 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::{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 {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanDevice>> Sealed for T {}
}
pub trait VulkanDeviceExt: IsA<VulkanDevice> + sealed::Sealed + '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(&self, func: Option<&mut dyn (FnMut(&VulkanDevice, &VulkanQueue) -> bool)>) {
let func_data: Option<&mut dyn (FnMut(&VulkanDevice, &VulkanQueue) -> bool)> = func;
unsafe extern "C" fn func_func(
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 Option<&mut dyn (FnMut(&VulkanDevice, &VulkanQueue) -> bool)>;
if let Some(ref mut callback) = *callback {
callback(&device, &queue)
} else {
panic!("cannot get closure...")
}
.into_glib()
}
let func = if func_data.is_some() {
Some(func_func as _)
} else {
None
};
let super_callback0: &Option<&mut dyn (FnMut(&VulkanDevice, &VulkanQueue) -> bool)> =
&func_data;
unsafe {
ffi::gst_vulkan_device_foreach_queue(
self.as_ref().to_glib_none().0,
func,
super_callback0 as *const _ 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")]
//fn physical_device(&self) -> /*Ignored*/vulkan::PhysicalDevice {
// unsafe { TODO: call ffi:gst_vulkan_device_get_physical_device() }
//}
//#[doc(alias = "gst_vulkan_device_get_proc_address")]
//#[doc(alias = "get_proc_address")]
//fn proc_address(&self, name: &str) -> /*Unimplemented*/Option<Basic: Pointer> {
// unsafe { TODO: call ffi:gst_vulkan_device_get_proc_address() }
//}
#[doc(alias = "gst_vulkan_device_get_queue")]
#[doc(alias = "get_queue")]
fn queue(&self, queue_family: u32, queue_i: u32) -> VulkanQueue {
unsafe {
from_glib_full(ffi::gst_vulkan_device_get_queue(
self.as_ref().to_glib_none().0,
queue_family,
queue_i,
))
}
}
#[doc(alias = "gst_vulkan_device_is_extension_enabled")]
fn is_extension_enabled(&self, name: &str) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_device_is_extension_enabled(
self.as_ref().to_glib_none().0,
name.to_glib_none().0,
))
}
}
#[doc(alias = "gst_vulkan_device_is_layer_enabled")]
fn is_layer_enabled(&self, name: &str) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_device_is_layer_enabled(
self.as_ref().to_glib_none().0,
name.to_glib_none().0,
))
}
}
#[doc(alias = "gst_vulkan_device_open")]
fn open(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_device_open(self.as_ref().to_glib_none().0, &mut error);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
//#[cfg(feature = "v1_24")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
//#[doc(alias = "gst_vulkan_device_queue_family_indices")]
//fn queue_family_indices(&self) -> /*Unknown conversion*//*Unimplemented*/Array TypeId { ns_id: 0, id: 7 } {
// unsafe { TODO: call ffi:gst_vulkan_device_queue_family_indices() }
//}
//#[cfg(feature = "v1_24")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
//#[doc(alias = "gst_vulkan_device_select_queue")]
//fn select_queue(&self, expected_flags: /*Ignored*/&vulkan::QueueFlagBits) -> VulkanQueue {
// unsafe { TODO: call ffi:gst_vulkan_device_select_queue() }
//}
#[doc(alias = "instance")]
fn connect_instance_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_instance_trampoline<
P: IsA<VulkanDevice>,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut ffi::GstVulkanDevice,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(VulkanDevice::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::instance\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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,128 @@
// 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::{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 {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanDisplay>> Sealed for T {}
}
pub trait VulkanDisplayExt: IsA<VulkanDisplay> + sealed::Sealed + '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::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,287 @@
// 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::{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,
))
}
}
}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanFullScreenQuad>> Sealed for T {}
}
pub trait VulkanFullScreenQuadExt: IsA<VulkanFullScreenQuad> + sealed::Sealed + '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: /*Ignored*/&vulkan::BlendFactor, dst_blend_factor: /*Ignored*/&vulkan::BlendFactor, src_alpha_blend_factor: /*Ignored*/&vulkan::BlendFactor, dst_alpha_blend_factor: /*Ignored*/&vulkan::BlendFactor) {
// unsafe { TODO: call ffi:gst_vulkan_full_screen_quad_set_blend_factors() }
//}
//#[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: /*Ignored*/&vulkan::BlendOp, alpha_blend_op: /*Ignored*/&vulkan::BlendOp) {
// unsafe { TODO: call ffi:gst_vulkan_full_screen_quad_set_blend_operation() }
//}
#[doc(alias = "gst_vulkan_full_screen_quad_set_index_buffer")]
fn set_index_buffer(&self, indices: &gst::Memory, n_indices: usize) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_full_screen_quad_set_index_buffer(
self.as_ref().to_glib_none().0,
indices.to_glib_none().0,
n_indices,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "gst_vulkan_full_screen_quad_set_info")]
fn set_info(&self, in_info: &gst_video::VideoInfo, out_info: &gst_video::VideoInfo) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_full_screen_quad_set_info(
self.as_ref().to_glib_none().0,
in_info.to_glib_none().0,
out_info.to_glib_none().0,
))
}
}
#[doc(alias = "gst_vulkan_full_screen_quad_set_input_buffer")]
fn set_input_buffer(&self, buffer: Option<&gst::Buffer>) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_full_screen_quad_set_input_buffer(
self.as_ref().to_glib_none().0,
buffer.to_glib_none().0,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "gst_vulkan_full_screen_quad_set_output_buffer")]
fn set_output_buffer(&self, buffer: Option<&gst::Buffer>) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_full_screen_quad_set_output_buffer(
self.as_ref().to_glib_none().0,
buffer.to_glib_none().0,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "gst_vulkan_full_screen_quad_set_shaders")]
fn set_shaders(&self, vert: &VulkanHandle, frag: &VulkanHandle) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_full_screen_quad_set_shaders(
self.as_ref().to_glib_none().0,
vert.to_glib_none().0,
frag.to_glib_none().0,
))
}
}
#[doc(alias = "gst_vulkan_full_screen_quad_set_uniform_buffer")]
fn set_uniform_buffer(&self, uniforms: &gst::Memory) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_full_screen_quad_set_uniform_buffer(
self.as_ref().to_glib_none().0,
uniforms.to_glib_none().0,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "gst_vulkan_full_screen_quad_set_vertex_buffer")]
fn set_vertex_buffer(&self, vertices: &gst::Memory) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_full_screen_quad_set_vertex_buffer(
self.as_ref().to_glib_none().0,
vertices.to_glib_none().0,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "gst_vulkan_full_screen_quad_submit")]
fn submit(&self, cmd: VulkanCommandBuffer, fence: &mut VulkanFence) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_full_screen_quad_submit(
self.as_ref().to_glib_none().0,
cmd.into_glib_ptr(),
fence.to_glib_none_mut().0,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
}
impl<O: IsA<VulkanFullScreenQuad>> VulkanFullScreenQuadExt for O {}

View file

@ -0,0 +1,88 @@
// 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::{VulkanDevice, VulkanDisplay, 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_: /*Ignored*/VulkanHandleType, handle: VulkanHandleTypedef, notify: P) -> VulkanHandle {
// unsafe { TODO: call ffi:gst_vulkan_handle_new_wrapped() }
//}
//#[doc(alias = "gst_vulkan_handle_free_descriptor_set_layout")]
//pub fn free_descriptor_set_layout(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gst_vulkan_handle_free_descriptor_set_layout() }
//}
//#[doc(alias = "gst_vulkan_handle_free_framebuffer")]
//pub fn free_framebuffer(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gst_vulkan_handle_free_framebuffer() }
//}
//#[doc(alias = "gst_vulkan_handle_free_pipeline")]
//pub fn free_pipeline(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gst_vulkan_handle_free_pipeline() }
//}
//#[doc(alias = "gst_vulkan_handle_free_pipeline_layout")]
//pub fn free_pipeline_layout(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gst_vulkan_handle_free_pipeline_layout() }
//}
//#[doc(alias = "gst_vulkan_handle_free_render_pass")]
//pub fn free_render_pass(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gst_vulkan_handle_free_render_pass() }
//}
//#[doc(alias = "gst_vulkan_handle_free_sampler")]
//pub fn free_sampler(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gst_vulkan_handle_free_sampler() }
//}
//#[doc(alias = "gst_vulkan_handle_free_shader")]
//pub fn free_shader(&self, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gst_vulkan_handle_free_shader() }
//}
#[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,46 @@
// 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 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 {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanHandlePool>> Sealed for T {}
}
pub trait VulkanHandlePoolExt: IsA<VulkanHandlePool> + sealed::Sealed + '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,67 @@
// 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::VulkanDevice;
use glib::{prelude::*, translate::*};
glib::wrapper! {
#[doc(alias = "GstVulkanImageBufferPool")]
pub struct VulkanImageBufferPool(Object<ffi::GstVulkanImageBufferPool, ffi::GstVulkanImageBufferPoolClass>) @extends gst::BufferPool, gst::Object;
match fn {
type_ => || ffi::gst_vulkan_image_buffer_pool_get_type(),
}
}
impl VulkanImageBufferPool {
pub const NONE: Option<&'static VulkanImageBufferPool> = None;
#[doc(alias = "gst_vulkan_image_buffer_pool_new")]
pub fn new(device: &impl IsA<VulkanDevice>) -> VulkanImageBufferPool {
skip_assert_initialized!();
unsafe {
gst::BufferPool::from_glib_full(ffi::gst_vulkan_image_buffer_pool_new(
device.as_ref().to_glib_none().0,
))
.unsafe_cast()
}
}
//#[cfg(feature = "v1_24")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
//#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_allocation_params")]
//pub fn config_set_allocation_params(config: &gst::Structure, usage: /*Ignored*/&vulkan::ImageUsageFlags, mem_properties: /*Ignored*/&vulkan::MemoryPropertyFlags, initial_layout: /*Ignored*/&vulkan::ImageLayout, initial_access: u64) {
// unsafe { TODO: call ffi:gst_vulkan_image_buffer_pool_config_set_allocation_params() }
//}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_decode_caps")]
pub fn config_set_decode_caps(config: &gst::Structure, caps: &gst::Caps) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_vulkan_image_buffer_pool_config_set_decode_caps(
config.to_glib_none().0,
caps.to_glib_none().0,
);
}
}
#[cfg(feature = "v1_26")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
#[doc(alias = "gst_vulkan_image_buffer_pool_config_set_encode_caps")]
pub fn config_set_encode_caps(config: &gst::Structure, caps: &gst::Caps) {
assert_initialized_main_thread!();
unsafe {
ffi::gst_vulkan_image_buffer_pool_config_set_encode_caps(
config.to_glib_none().0,
caps.to_glib_none().0,
);
}
}
}
unsafe impl Send for VulkanImageBufferPool {}
unsafe impl Sync for VulkanImageBufferPool {}

View file

@ -0,0 +1,20 @@
// 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
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,25 @@
// 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
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct VulkanImageView(Boxed<ffi::GstVulkanImageView>);
match fn {
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_vulkan_image_view_get_type(), ptr as *mut _) as *mut ffi::GstVulkanImageView,
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_vulkan_image_view_get_type(), ptr as *mut _),
type_ => || ffi::gst_vulkan_image_view_get_type(),
}
}
impl VulkanImageView {
//#[doc(alias = "gst_vulkan_image_view_new")]
//pub fn new(image: /*Ignored*/&mut VulkanImageMemory, create_info: /*Ignored*/&vulkan::ImageViewCreateInfo) -> VulkanImageView {
// unsafe { TODO: call ffi:gst_vulkan_image_view_new() }
//}
}
unsafe impl Send for VulkanImageView {}
unsafe impl Sync for VulkanImageView {}

View file

@ -0,0 +1,352 @@
// 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::VulkanDevice;
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "GstVulkanInstance")]
pub struct VulkanInstance(Object<ffi::GstVulkanInstance, ffi::GstVulkanInstanceClass>) @extends gst::Object;
match fn {
type_ => || ffi::gst_vulkan_instance_get_type(),
}
}
impl VulkanInstance {
pub const NONE: Option<&'static VulkanInstance> = None;
#[doc(alias = "gst_vulkan_instance_new")]
pub fn new() -> VulkanInstance {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_vulkan_instance_new()) }
}
#[doc(alias = "gst_vulkan_instance_handle_context_query")]
pub fn handle_context_query(
element: &impl IsA<gst::Element>,
query: &gst::Query,
instance: Option<&impl IsA<VulkanInstance>>,
) -> bool {
assert_initialized_main_thread!();
unsafe {
from_glib(ffi::gst_vulkan_instance_handle_context_query(
element.as_ref().to_glib_none().0,
query.to_glib_none().0,
instance.map(|p| p.as_ref()).to_glib_none().0,
))
}
}
//#[doc(alias = "gst_vulkan_instance_run_context_query")]
//pub fn run_context_query(element: &impl IsA<gst::Element>, instance: impl IsA<VulkanInstance>) -> bool {
// unsafe { TODO: call ffi:gst_vulkan_instance_run_context_query() }
//}
}
impl Default for VulkanInstance {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for VulkanInstance {}
unsafe impl Sync for VulkanInstance {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanInstance>> Sealed for T {}
}
pub trait VulkanInstanceExt: IsA<VulkanInstance> + sealed::Sealed + '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 _,
b"create-device\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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 _,
b"notify::requested-api-major\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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 _,
b"notify::requested-api-minor\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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,185 @@
// 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::VulkanCommandPool;
use glib::{prelude::*, translate::*};
glib::wrapper! {
#[doc(alias = "GstVulkanOperation")]
pub struct VulkanOperation(Object<ffi::GstVulkanOperation, ffi::GstVulkanOperationClass>) @extends gst::Object;
match fn {
type_ => || ffi::gst_vulkan_operation_get_type(),
}
}
impl VulkanOperation {
pub const NONE: Option<&'static VulkanOperation> = None;
#[doc(alias = "gst_vulkan_operation_new")]
pub fn new(cmd_pool: &impl IsA<VulkanCommandPool>) -> VulkanOperation {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gst_vulkan_operation_new(
cmd_pool.as_ref().to_glib_none().0,
))
}
}
}
unsafe impl Send for VulkanOperation {}
unsafe impl Sync for VulkanOperation {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanOperation>> Sealed for T {}
}
pub trait VulkanOperationExt: IsA<VulkanOperation> + sealed::Sealed + '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, dst_stage: u64, new_access: u64, new_layout: /*Ignored*/&vulkan::ImageLayout, new_queue: Option<&impl IsA<VulkanQueue>>) -> bool {
// unsafe { TODO: call ffi:gst_vulkan_operation_add_frame_barrier() }
//}
#[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: /*Ignored*/&vulkan::ImageLayout, new_queue: Option<&impl IsA<VulkanQueue>>) {
// unsafe { TODO: call ffi:gst_vulkan_operation_update_frame() }
//}
#[doc(alias = "gst_vulkan_operation_use_sync2")]
fn use_sync2(&self) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_operation_use_sync2(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "gst_vulkan_operation_wait")]
fn wait(&self) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_operation_wait(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "command-pool")]
fn command_pool(&self) -> Option<VulkanCommandPool> {
ObjectExt::property(self.as_ref(), "command-pool")
}
}
impl<O: IsA<VulkanOperation>> VulkanOperationExt for O {}

View file

@ -0,0 +1,113 @@
// 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::VulkanInstance;
use glib::{prelude::*, translate::*};
glib::wrapper! {
#[doc(alias = "GstVulkanPhysicalDevice")]
pub struct VulkanPhysicalDevice(Object<ffi::GstVulkanPhysicalDevice, ffi::GstVulkanPhysicalDeviceClass>) @extends gst::Object;
match fn {
type_ => || ffi::gst_vulkan_physical_device_get_type(),
}
}
impl VulkanPhysicalDevice {
pub const NONE: Option<&'static VulkanPhysicalDevice> = None;
#[doc(alias = "gst_vulkan_physical_device_new")]
pub fn new(instance: &impl IsA<VulkanInstance>, device_index: u32) -> VulkanPhysicalDevice {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gst_vulkan_physical_device_new(
instance.as_ref().to_glib_none().0,
device_index,
))
}
}
//#[doc(alias = "gst_vulkan_physical_device_type_to_string")]
//pub fn type_to_string(type_: /*Ignored*/&vulkan::PhysicalDeviceType) -> glib::GString {
// unsafe { TODO: call ffi:gst_vulkan_physical_device_type_to_string() }
//}
}
unsafe impl Send for VulkanPhysicalDevice {}
unsafe impl Sync for VulkanPhysicalDevice {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanPhysicalDevice>> Sealed for T {}
}
pub trait VulkanPhysicalDeviceExt: IsA<VulkanPhysicalDevice> + sealed::Sealed + '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) -> /*Ignored*/vulkan::PhysicalDevice {
// unsafe { TODO: call ffi:gst_vulkan_physical_device_get_handle() }
//}
#[doc(alias = "gst_vulkan_physical_device_get_instance")]
#[doc(alias = "get_instance")]
fn instance(&self) -> VulkanInstance {
unsafe {
from_glib_full(ffi::gst_vulkan_physical_device_get_instance(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "gst_vulkan_physical_device_get_layer_info")]
#[doc(alias = "get_layer_info")]
fn layer_info(&self, name: &str) -> Option<(Option<glib::GString>, u32, u32)> {
unsafe {
let mut description = std::ptr::null_mut();
let mut spec_version = std::mem::MaybeUninit::uninit();
let mut implementation_version = std::mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_vulkan_physical_device_get_layer_info(
self.as_ref().to_glib_none().0,
name.to_glib_none().0,
&mut description,
spec_version.as_mut_ptr(),
implementation_version.as_mut_ptr(),
));
if ret {
Some((
from_glib_full(description),
spec_version.assume_init(),
implementation_version.assume_init(),
))
} else {
None
}
}
}
#[doc(alias = "device-index")]
fn device_index(&self) -> u32 {
ObjectExt::property(self.as_ref(), "device-index")
}
}
impl<O: IsA<VulkanPhysicalDevice>> VulkanPhysicalDeviceExt for O {}

View file

@ -0,0 +1,98 @@
// 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::{VulkanCommandPool, VulkanDevice};
use glib::{prelude::*, translate::*};
glib::wrapper! {
#[doc(alias = "GstVulkanQueue")]
pub struct VulkanQueue(Object<ffi::GstVulkanQueue, ffi::GstVulkanQueueClass>) @extends gst::Object;
match fn {
type_ => || ffi::gst_vulkan_queue_get_type(),
}
}
impl VulkanQueue {
pub const NONE: Option<&'static VulkanQueue> = None;
//#[doc(alias = "gst_vulkan_queue_flags_to_string")]
//pub fn flags_to_string(queue_bits: /*Ignored*/&vulkan::QueueFlags) -> glib::GString {
// unsafe { TODO: call ffi:gst_vulkan_queue_flags_to_string() }
//}
#[doc(alias = "gst_vulkan_queue_handle_context_query")]
pub fn handle_context_query(
element: &impl IsA<gst::Element>,
query: &gst::Query,
queue: Option<&impl IsA<VulkanQueue>>,
) -> bool {
assert_initialized_main_thread!();
unsafe {
from_glib(ffi::gst_vulkan_queue_handle_context_query(
element.as_ref().to_glib_none().0,
query.to_glib_none().0,
queue.map(|p| p.as_ref()).to_glib_none().0,
))
}
}
//#[doc(alias = "gst_vulkan_queue_run_context_query")]
//pub fn run_context_query(element: &impl IsA<gst::Element>, queue: impl IsA<VulkanQueue>) -> bool {
// unsafe { TODO: call ffi:gst_vulkan_queue_run_context_query() }
//}
}
unsafe impl Send for VulkanQueue {}
unsafe impl Sync for VulkanQueue {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanQueue>> Sealed for T {}
}
pub trait VulkanQueueExt: IsA<VulkanQueue> + sealed::Sealed + '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,206 @@
// 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::{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 {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanSwapper>> Sealed for T {}
}
pub trait VulkanSwapperExt: IsA<VulkanSwapper> + sealed::Sealed + 'static {
#[doc(alias = "gst_vulkan_swapper_choose_queue")]
fn choose_queue(
&self,
available_queue: Option<&impl IsA<VulkanQueue>>,
) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_swapper_choose_queue(
self.as_ref().to_glib_none().0,
available_queue.map(|p| p.as_ref()).to_glib_none().0,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "gst_vulkan_swapper_get_supported_caps")]
#[doc(alias = "get_supported_caps")]
fn supported_caps(&self) -> Result<gst::Caps, glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::gst_vulkan_swapper_get_supported_caps(
self.as_ref().to_glib_none().0,
&mut error,
);
if error.is_null() {
Ok(from_glib_full(ret))
} else {
Err(from_glib_full(error))
}
}
}
//#[doc(alias = "gst_vulkan_swapper_get_surface_rectangles")]
//#[doc(alias = "get_surface_rectangles")]
//fn surface_rectangles(&self, input_image: /*Ignored*/Option<gst_video::VideoRectangle>, surface_location: /*Ignored*/Option<gst_video::VideoRectangle>, display_rect: /*Ignored*/Option<gst_video::VideoRectangle>) {
// unsafe { TODO: call ffi:gst_vulkan_swapper_get_surface_rectangles() }
//}
#[doc(alias = "gst_vulkan_swapper_render_buffer")]
fn render_buffer(&self, buffer: &gst::Buffer) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_swapper_render_buffer(
self.as_ref().to_glib_none().0,
buffer.to_glib_none().0,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "gst_vulkan_swapper_set_caps")]
fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_swapper_set_caps(
self.as_ref().to_glib_none().0,
caps.to_glib_none().0,
&mut error,
);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "force-aspect-ratio")]
fn is_force_aspect_ratio(&self) -> bool {
ObjectExt::property(self.as_ref(), "force-aspect-ratio")
}
#[doc(alias = "force-aspect-ratio")]
fn set_force_aspect_ratio(&self, force_aspect_ratio: bool) {
ObjectExt::set_property(self.as_ref(), "force-aspect-ratio", force_aspect_ratio)
}
#[doc(alias = "pixel-aspect-ratio")]
fn pixel_aspect_ratio(&self) -> Option<gst::Fraction> {
ObjectExt::property(self.as_ref(), "pixel-aspect-ratio")
}
#[doc(alias = "pixel-aspect-ratio")]
fn set_pixel_aspect_ratio(&self, pixel_aspect_ratio: Option<&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 _,
b"notify::force-aspect-ratio\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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 _,
b"notify::pixel-aspect-ratio\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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,72 @@
// 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::{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(
fence: &mut VulkanFence,
notify: Option<Box_<dyn FnOnce(&VulkanDevice) + 'static>>,
) -> VulkanTrash {
assert_initialized_main_thread!();
let notify_data: Box_<Option<Box_<dyn FnOnce(&VulkanDevice) + 'static>>> =
Box_::new(notify);
unsafe extern "C" fn notify_func(
device: *mut ffi::GstVulkanDevice,
user_data: glib::ffi::gpointer,
) {
let device = from_glib_borrow(device);
let callback =
Box_::from_raw(user_data as *mut Option<Box_<dyn FnOnce(&VulkanDevice) + 'static>>);
let callback = (*callback).expect("cannot get closure...");
callback(&device)
}
let notify = if notify_data.is_some() {
Some(notify_func as _)
} else {
None
};
let super_callback0: Box_<Option<Box_<dyn FnOnce(&VulkanDevice) + 'static>>> = notify_data;
unsafe {
from_glib_full(ffi::gst_vulkan_trash_new(
fence.to_glib_none_mut().0,
notify,
Box_::into_raw(super_callback0) as *mut _,
))
}
}
//#[doc(alias = "gst_vulkan_trash_new_free_semaphore")]
//pub fn new_free_semaphore(fence: &mut VulkanFence, semaphore: /*Ignored*/&vulkan::Semaphore) -> VulkanTrash {
// unsafe { TODO: call ffi:gst_vulkan_trash_new_free_semaphore() }
//}
//#[doc(alias = "gst_vulkan_trash_mini_object_unref")]
//pub fn mini_object_unref(device: &impl IsA<VulkanDevice>, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gst_vulkan_trash_mini_object_unref() }
//}
//#[doc(alias = "gst_vulkan_trash_object_unref")]
//pub fn object_unref(device: &impl IsA<VulkanDevice>, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
// unsafe { TODO: call ffi:gst_vulkan_trash_object_unref() }
//}
}
unsafe impl Send for VulkanTrash {}
unsafe impl Sync for VulkanTrash {}

View file

@ -0,0 +1,73 @@
// 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(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 {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanVideoFilter>> Sealed for T {}
}
pub trait VulkanVideoFilterExt: IsA<VulkanVideoFilter> + sealed::Sealed + '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,353 @@
// 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::{VulkanDevice, VulkanDisplay};
use glib::{
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 {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanWindow>> Sealed for T {}
}
pub trait VulkanWindowExt: IsA<VulkanWindow> + sealed::Sealed + 'static {
#[doc(alias = "gst_vulkan_window_close")]
fn close(&self) {
unsafe {
ffi::gst_vulkan_window_close(self.as_ref().to_glib_none().0);
}
}
#[doc(alias = "gst_vulkan_window_get_display")]
#[doc(alias = "get_display")]
fn display(&self) -> VulkanDisplay {
unsafe {
from_glib_full(ffi::gst_vulkan_window_get_display(
self.as_ref().to_glib_none().0,
))
}
}
#[doc(alias = "gst_vulkan_window_get_presentation_support")]
#[doc(alias = "get_presentation_support")]
fn is_presentation_support(
&self,
device: &impl IsA<VulkanDevice>,
queue_family_idx: u32,
) -> bool {
unsafe {
from_glib(ffi::gst_vulkan_window_get_presentation_support(
self.as_ref().to_glib_none().0,
device.as_ref().to_glib_none().0,
queue_family_idx,
))
}
}
//#[doc(alias = "gst_vulkan_window_get_surface")]
//#[doc(alias = "get_surface")]
//fn surface(&self) -> Result</*Ignored*/vulkan::SurfaceKHR, glib::Error> {
// unsafe { TODO: call ffi:gst_vulkan_window_get_surface() }
//}
#[doc(alias = "gst_vulkan_window_get_surface_dimensions")]
#[doc(alias = "get_surface_dimensions")]
fn surface_dimensions(&self) -> (u32, u32) {
unsafe {
let mut width = std::mem::MaybeUninit::uninit();
let mut height = std::mem::MaybeUninit::uninit();
ffi::gst_vulkan_window_get_surface_dimensions(
self.as_ref().to_glib_none().0,
width.as_mut_ptr(),
height.as_mut_ptr(),
);
(width.assume_init(), height.assume_init())
}
}
#[doc(alias = "gst_vulkan_window_handle_events")]
fn handle_events(&self, handle_events: bool) {
unsafe {
ffi::gst_vulkan_window_handle_events(
self.as_ref().to_glib_none().0,
handle_events.into_glib(),
);
}
}
#[doc(alias = "gst_vulkan_window_open")]
fn open(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let is_ok = ffi::gst_vulkan_window_open(self.as_ref().to_glib_none().0, &mut error);
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
if error.is_null() {
Ok(())
} else {
Err(from_glib_full(error))
}
}
}
#[doc(alias = "gst_vulkan_window_redraw")]
fn redraw(&self) {
unsafe {
ffi::gst_vulkan_window_redraw(self.as_ref().to_glib_none().0);
}
}
#[doc(alias = "gst_vulkan_window_resize")]
fn resize(&self, width: i32, height: i32) {
unsafe {
ffi::gst_vulkan_window_resize(self.as_ref().to_glib_none().0, width, height);
}
}
#[doc(alias = "gst_vulkan_window_send_key_event")]
fn send_key_event(&self, event_type: &str, key_str: &str) {
unsafe {
ffi::gst_vulkan_window_send_key_event(
self.as_ref().to_glib_none().0,
event_type.to_glib_none().0,
key_str.to_glib_none().0,
);
}
}
#[doc(alias = "gst_vulkan_window_send_mouse_event")]
fn send_mouse_event(&self, event_type: &str, button: i32, posx: f64, posy: f64) {
unsafe {
ffi::gst_vulkan_window_send_mouse_event(
self.as_ref().to_glib_none().0,
event_type.to_glib_none().0,
button,
posx,
posy,
);
}
}
//#[doc(alias = "gst_vulkan_window_set_window_handle")]
//fn set_window_handle(&self, handle: /*Unimplemented*/Basic: UIntPtr) {
// unsafe { TODO: call ffi:gst_vulkan_window_set_window_handle() }
//}
#[doc(alias = "close")]
fn connect_close<F: Fn(&Self) -> bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn close_trampoline<
P: IsA<VulkanWindow>,
F: Fn(&P) -> bool + Send + Sync + 'static,
>(
this: *mut ffi::GstVulkanWindow,
f: glib::ffi::gpointer,
) -> glib::ffi::gboolean {
let f: &F = &*(f as *const F);
f(VulkanWindow::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"close\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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 _,
b"draw\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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 libc::c_char,
key: *mut libc::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 _,
b"key-event\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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 libc::c_char,
button: libc::c_int,
x: libc::c_double,
y: libc::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 _,
b"mouse-event\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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: libc::c_uint,
p0: libc::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 _,
b"resize\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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 _,
b"notify::display\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, 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,9 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use gst::CapsFeatures;
use once_cell::sync::Lazy;
pub static CAPS_FEATURE_MEMORY_VULKAN_IMAGE: &glib::GStr =
unsafe { glib::GStr::from_utf8_with_nul_unchecked(ffi::GST_CAPS_FEATURE_MEMORY_VULKAN_IMAGE) };
pub static CAPS_FEATURES_MEMORY_VULKAN_IMAGE: Lazy<CapsFeatures> =
Lazy::new(|| CapsFeatures::new([CAPS_FEATURE_MEMORY_VULKAN_IMAGE]));

View file

@ -0,0 +1,43 @@
// Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(docsrs, feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")]
pub use ffi;
pub use glib;
pub use gst;
pub use gst_base;
pub use gst_video;
macro_rules! assert_initialized_main_thread {
() => {
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
gst::assert_initialized();
}
};
}
macro_rules! skip_assert_initialized {
() => {};
}
mod auto;
pub use crate::auto::*;
mod vulkan_device;
mod vulkan_full_screen_quad;
// Re-export all the traits in a prelude module, so that applications
// can always "use gst_vulkan::prelude::*" without getting conflicts
pub mod prelude {
#[doc(hidden)]
pub use gst_video::prelude::*;
pub use super::vulkan_device::VulkanDeviceExtManual;
pub use super::vulkan_full_screen_quad::VulkanFullScreenQuadExtManual;
pub use crate::auto::traits::*;
}
mod caps_features;
pub use caps_features::*;

View file

@ -0,0 +1,33 @@
use crate::VulkanDevice;
use glib::prelude::*;
use glib::translate::*;
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanDevice>> Sealed for T {}
}
pub trait VulkanDeviceExtManual: sealed::Sealed + IsA<VulkanDevice> + 'static {
fn create_shader<const N: usize>(
&self,
code: [u8; N],
) -> Result<crate::VulkanHandle, glib::Error> {
unsafe {
let mut error = std::ptr::null_mut();
let shader = crate::ffi::gst_vulkan_create_shader(
self.as_ref().to_glib_none().0,
code.as_ptr() as *const i8,
code.len(),
&mut error,
);
debug_assert_eq!(shader.is_null(), !error.is_null());
if error.is_null() {
Ok(crate::VulkanHandle::from_glib_full(shader))
} else {
Err(from_glib_full(error))
}
}
}
}
impl<O: IsA<VulkanDevice>> VulkanDeviceExtManual for O {}

View file

@ -0,0 +1,24 @@
use crate::VulkanFullScreenQuad;
use crate::traits::VulkanFullScreenQuadExt;
use glib::prelude::*;
use glib::translate::*;
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::VulkanFullScreenQuad>> Sealed for T {}
}
pub trait VulkanFullScreenQuadExtManual:
sealed::Sealed + IsA<VulkanFullScreenQuad> + 'static
{
fn draw_into_output(&self, outbuf: &mut gst::BufferRef) -> Result<(), glib::Error> {
let out = unsafe { gst::Buffer::from_glib_none(outbuf.as_ptr()) };
self.set_output_buffer(Some(&out))?;
let ret = self.draw();
self.set_output_buffer(None)?;
ret
}
}
impl<O: IsA<VulkanFullScreenQuad>> VulkanFullScreenQuadExtManual for O {}

View file

@ -0,0 +1 @@
../../gstreamer/CHANGELOG.md

View file

@ -0,0 +1 @@
../../COPYRIGHT

View file

@ -0,0 +1,92 @@
[build-dependencies]
system-deps = "6"
[dependencies]
libc = "0.2"
[dependencies.glib-sys]
workspace = true
[dependencies.gobject-sys]
workspace = true
[dependencies.gstreamer-sys]
workspace = true
[dependencies.gstreamer-base-sys]
workspace = true
[dependencies.gstreamer-video-sys]
workspace = true
[dependencies.ash]
version = "0.38"
[dev-dependencies]
shell-words = "1.0.0"
tempfile = "3"
[features]
v1_18 = []
v1_20 = []
v1_22 = ["v1_20"]
v1_24 = ["v1_22"]
v1_26 = ["v1_24"]
[lib]
name = "gstreamer_vulkan_sys"
[package]
authors = ["Matthew Waters <matthew@centricular.com>"]
build = "build.rs"
description = "FFI bindings to libgstvulkan-1.0"
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_vulkan_sys/"
keywords = ["ffi", "gstreamer", "gnome", "multimedia"]
license = "MIT"
name = "gstreamer-vulkan-sys"
readme = "README.md"
[package.version]
workspace = true
[package.categories]
workspace = true
[package.repository]
workspace = true
[package.homepage]
workspace = true
[package.edition]
workspace = true
[package.rust-version]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
[package.metadata.system-deps.gstreamer_vulkan_1_0]
name = "gstreamer-vulkan-1.0"
version = "1.14"
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_16]
version = "1.16"
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_18]
version = "1.18"
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_20]
version = "1.20"
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_22]
version = "1.22"
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_24]
version = "1.24"
[package.metadata.system-deps.gstreamer_vulkan_1_0.v1_26]
version = "1.25"

View file

@ -0,0 +1,40 @@
[options]
girs_directories = ["../../gir-files", "../../gst-gir-files"]
library = "GstVulkan"
version = "1.0"
min_cfg_version = "1.18"
work_mode = "sys"
single_version_file = true
extra_versions = [
"1.24",
"1.22",
"1.20",
]
ignore = [
]
external_libraries = [
"GLib",
"GObject",
]
[external_libraries]
gstreamer="Gst"
gstreamer-base="GstBase"
gstreamer-video="GstVideo"
[[object]]
name = "GstVulkan.VulkanBufferMemory"
status = "generate"
[[object.function]]
name = "get_type"
version = "1.18"
[[object]]
name = "GstVulkan.VulkanImageMemory"
status = "generate"
[[object.function]]
name = "get_type"
version = "1.18"

View file

@ -0,0 +1 @@
../../LICENSE-MIT

View file

@ -0,0 +1,31 @@
# gstreamer-sys [![crates.io](https://img.shields.io/crates/v/gstreamer-gl-sys.svg)](https://crates.io/crates/gstreamer-gl-sys) [![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/) (OpenGL library) FFI bindings for Rust.
These bindings are providing unsafe FFI API that can be used to interface with
GStreamer. Generally they are meant to be used as the building block for
higher-level abstractions like:
* Bindings for GStreamer applications and plugins: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs
* Various GStreamer plugins written in Rust: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
The bindings are autogenerated with [gir](https://github.com/gtk-rs/gir/)
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
API metadata provided by the GStreamer project.
## LICENSE
gstreamer-sys and all crates contained here are licensed under the MIT
license ([LICENSE](LICENSE) or http://opensource.org/licenses/MIT).
GStreamer itself is licensed under the Lesser General Public License version
2.1 or (at your option) any later version:
https://www.gnu.org/licenses/lgpl-2.1.html
## Contribution
Any kinds of contributions are welcome as a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in gstreamer-rs by you shall be licensed under the MIT license as above,
without any additional terms or conditions.

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 @ 5223ce91b97a)
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ d62956d67216+)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,31 @@
pub mod vulkan {
pub use ash::vk::BlendFactor as VkBlendFactor;
pub use ash::vk::BlendOp as VkBlendOp;
pub use ash::vk::Buffer as VkBuffer;
pub use ash::vk::BufferCreateInfo as VkBufferCreateInfo;
pub use ash::vk::BufferUsageFlags as VkBufferUsageFlags;
pub use ash::vk::CommandBuffer as VkCommandBuffer;
pub use ash::vk::CommandBufferLevel as VkCommandBufferLevel;
pub use ash::vk::DescriptorPool as VkDescriptorPool;
pub use ash::vk::DescriptorSet as VkDescriptorSet;
pub use ash::vk::Format as VkFormat;
pub use ash::vk::Image as VkImage;
pub use ash::vk::ImageCreateInfo as VkImageCreateInfo;
pub use ash::vk::ImageLayout as VkImageLayout;
pub use ash::vk::ImageTiling as VkImageTiling;
pub use ash::vk::ImageUsageFlags as VkImageUsageFlags;
pub use ash::vk::ImageViewCreateInfo as VkImageViewCreateInfo;
pub use ash::vk::MemoryHeapFlags as VkMemoryHeapFlags;
pub use ash::vk::MemoryPropertyFlags as VkMemoryPropertyFlags;
pub use ash::vk::MemoryRequirements as VkMemoryRequirements;
pub use ash::vk::PhysicalDevice as VkPhysicalDevice;
pub use ash::vk::PhysicalDeviceType as VkPhysicalDeviceType;
pub use ash::vk::PresentModeKHR as VkPresentModeKHR;
pub use ash::vk::Queue as VkQueue;
pub use ash::vk::QueueFlags as VkQueueFlags;
pub type VkQueueFlagBits = u32;
pub use ash::vk::Result as VkResult;
pub use ash::vk::SampleCountFlags as VkSampleCountFlags;
pub use ash::vk::Semaphore as VkSemaphore;
pub use ash::vk::SurfaceKHR as VkSurfaceKHR;
}

View file

@ -0,0 +1,633 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
#![cfg(unix)]
use gstreamer_vulkan_sys::*;
use std::env;
use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::{Command, Stdio};
use std::str;
use tempfile::Builder;
static PACKAGES: &[&str] = &["gstreamer-vulkan-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Self, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Self { args })
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {cmd:?} failed, {status}").into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<dyn Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{name} {err}").into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags");
cmd.args(packages);
cmd.stderr(Stdio::inherit());
let out = cmd.output()?;
if !out.status.success() {
let (status, stdout) = (out.status, String::from_utf8_lossy(&out.stdout));
return Err(format!("command {cmd:?} failed, {status:?}\nstdout: {stdout}").into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn summary(&self) -> String {
format!("{} passed; {} failed", self.passed, self.failed)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
fn cross_validate_constants_with_c() {
let mut c_constants: Vec<(String, String)> = Vec::new();
for l in get_c_output("constant").unwrap().lines() {
let (name, value) = l.split_once(';').expect("Missing ';' separator");
c_constants.push((name.to_owned(), value.to_owned()));
}
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}",
);
continue;
}
results.record_passed();
}
results.expect_total_success();
}
#[test]
fn cross_validate_layout_with_c() {
let mut c_layouts = Vec::new();
for l in get_c_output("layout").unwrap().lines() {
let (name, value) = l.split_once(';').expect("Missing first ';' separator");
let (size, alignment) = value.split_once(';').expect("Missing second ';' separator");
let size = size.parse().expect("Failed to parse size");
let alignment = alignment.parse().expect("Failed to parse alignment");
c_layouts.push((name.to_owned(), Layout { size, alignment }));
}
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",);
continue;
}
results.record_passed();
}
results.expect_total_success();
}
fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let tmpdir = Builder::new().prefix("abi").tempdir()?;
let exe = tmpdir.path().join(name);
let c_file = Path::new("tests").join(name).with_extension("c");
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut cmd = Command::new(exe);
cmd.stderr(Stdio::inherit());
let out = cmd.output()?;
if !out.status.success() {
let (status, stdout) = (out.status, String::from_utf8_lossy(&out.stdout));
return Err(format!("command {cmd:?} failed, {status:?}\nstdout: {stdout}").into());
}
Ok(String::from_utf8(out.stdout)?)
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
(
"GstVulkanBarrierFlags",
Layout {
size: size_of::<GstVulkanBarrierFlags>(),
alignment: align_of::<GstVulkanBarrierFlags>(),
},
),
(
"GstVulkanBarrierType",
Layout {
size: size_of::<GstVulkanBarrierType>(),
alignment: align_of::<GstVulkanBarrierType>(),
},
),
(
"GstVulkanBufferMemoryAllocator",
Layout {
size: size_of::<GstVulkanBufferMemoryAllocator>(),
alignment: align_of::<GstVulkanBufferMemoryAllocator>(),
},
),
(
"GstVulkanBufferMemoryAllocatorClass",
Layout {
size: size_of::<GstVulkanBufferMemoryAllocatorClass>(),
alignment: align_of::<GstVulkanBufferMemoryAllocatorClass>(),
},
),
(
"GstVulkanBufferPool",
Layout {
size: size_of::<GstVulkanBufferPool>(),
alignment: align_of::<GstVulkanBufferPool>(),
},
),
(
"GstVulkanBufferPoolClass",
Layout {
size: size_of::<GstVulkanBufferPoolClass>(),
alignment: align_of::<GstVulkanBufferPoolClass>(),
},
),
(
"GstVulkanCommandPoolClass",
Layout {
size: size_of::<GstVulkanCommandPoolClass>(),
alignment: align_of::<GstVulkanCommandPoolClass>(),
},
),
(
"GstVulkanDescriptorCache",
Layout {
size: size_of::<GstVulkanDescriptorCache>(),
alignment: align_of::<GstVulkanDescriptorCache>(),
},
),
(
"GstVulkanDescriptorCacheClass",
Layout {
size: size_of::<GstVulkanDescriptorCacheClass>(),
alignment: align_of::<GstVulkanDescriptorCacheClass>(),
},
),
(
"GstVulkanDescriptorPoolClass",
Layout {
size: size_of::<GstVulkanDescriptorPoolClass>(),
alignment: align_of::<GstVulkanDescriptorPoolClass>(),
},
),
(
"GstVulkanDeviceClass",
Layout {
size: size_of::<GstVulkanDeviceClass>(),
alignment: align_of::<GstVulkanDeviceClass>(),
},
),
(
"GstVulkanDisplay",
Layout {
size: size_of::<GstVulkanDisplay>(),
alignment: align_of::<GstVulkanDisplay>(),
},
),
(
"GstVulkanDisplayClass",
Layout {
size: size_of::<GstVulkanDisplayClass>(),
alignment: align_of::<GstVulkanDisplayClass>(),
},
),
(
"GstVulkanDisplayType",
Layout {
size: size_of::<GstVulkanDisplayType>(),
alignment: align_of::<GstVulkanDisplayType>(),
},
),
(
"GstVulkanEncodeQueryResult",
Layout {
size: size_of::<GstVulkanEncodeQueryResult>(),
alignment: align_of::<GstVulkanEncodeQueryResult>(),
},
),
(
"GstVulkanError",
Layout {
size: size_of::<GstVulkanError>(),
alignment: align_of::<GstVulkanError>(),
},
),
(
"GstVulkanFenceCache",
Layout {
size: size_of::<GstVulkanFenceCache>(),
alignment: align_of::<GstVulkanFenceCache>(),
},
),
(
"GstVulkanFenceCacheClass",
Layout {
size: size_of::<GstVulkanFenceCacheClass>(),
alignment: align_of::<GstVulkanFenceCacheClass>(),
},
),
(
"GstVulkanFormatFlags",
Layout {
size: size_of::<GstVulkanFormatFlags>(),
alignment: align_of::<GstVulkanFormatFlags>(),
},
),
(
"GstVulkanFormatScaling",
Layout {
size: size_of::<GstVulkanFormatScaling>(),
alignment: align_of::<GstVulkanFormatScaling>(),
},
),
(
"GstVulkanFullScreenQuad",
Layout {
size: size_of::<GstVulkanFullScreenQuad>(),
alignment: align_of::<GstVulkanFullScreenQuad>(),
},
),
(
"GstVulkanFullScreenQuadClass",
Layout {
size: size_of::<GstVulkanFullScreenQuadClass>(),
alignment: align_of::<GstVulkanFullScreenQuadClass>(),
},
),
(
"GstVulkanHandle",
Layout {
size: size_of::<GstVulkanHandle>(),
alignment: align_of::<GstVulkanHandle>(),
},
),
(
"GstVulkanHandlePool",
Layout {
size: size_of::<GstVulkanHandlePool>(),
alignment: align_of::<GstVulkanHandlePool>(),
},
),
(
"GstVulkanHandlePoolClass",
Layout {
size: size_of::<GstVulkanHandlePoolClass>(),
alignment: align_of::<GstVulkanHandlePoolClass>(),
},
),
(
"GstVulkanHandleType",
Layout {
size: size_of::<GstVulkanHandleType>(),
alignment: align_of::<GstVulkanHandleType>(),
},
),
(
"GstVulkanHandleTypedef",
Layout {
size: size_of::<GstVulkanHandleTypedef>(),
alignment: align_of::<GstVulkanHandleTypedef>(),
},
),
(
"GstVulkanImageBufferPool",
Layout {
size: size_of::<GstVulkanImageBufferPool>(),
alignment: align_of::<GstVulkanImageBufferPool>(),
},
),
(
"GstVulkanImageBufferPoolClass",
Layout {
size: size_of::<GstVulkanImageBufferPoolClass>(),
alignment: align_of::<GstVulkanImageBufferPoolClass>(),
},
),
(
"GstVulkanImageMemoryAllocator",
Layout {
size: size_of::<GstVulkanImageMemoryAllocator>(),
alignment: align_of::<GstVulkanImageMemoryAllocator>(),
},
),
(
"GstVulkanImageMemoryAllocatorClass",
Layout {
size: size_of::<GstVulkanImageMemoryAllocatorClass>(),
alignment: align_of::<GstVulkanImageMemoryAllocatorClass>(),
},
),
(
"GstVulkanInstanceClass",
Layout {
size: size_of::<GstVulkanInstanceClass>(),
alignment: align_of::<GstVulkanInstanceClass>(),
},
),
(
"GstVulkanMemoryAllocator",
Layout {
size: size_of::<GstVulkanMemoryAllocator>(),
alignment: align_of::<GstVulkanMemoryAllocator>(),
},
),
(
"GstVulkanMemoryAllocatorClass",
Layout {
size: size_of::<GstVulkanMemoryAllocatorClass>(),
alignment: align_of::<GstVulkanMemoryAllocatorClass>(),
},
),
(
"GstVulkanOperation",
Layout {
size: size_of::<GstVulkanOperation>(),
alignment: align_of::<GstVulkanOperation>(),
},
),
(
"GstVulkanOperationClass",
Layout {
size: size_of::<GstVulkanOperationClass>(),
alignment: align_of::<GstVulkanOperationClass>(),
},
),
(
"GstVulkanPhysicalDeviceClass",
Layout {
size: size_of::<GstVulkanPhysicalDeviceClass>(),
alignment: align_of::<GstVulkanPhysicalDeviceClass>(),
},
),
(
"GstVulkanQueueClass",
Layout {
size: size_of::<GstVulkanQueueClass>(),
alignment: align_of::<GstVulkanQueueClass>(),
},
),
(
"GstVulkanQueueFamilyOps",
Layout {
size: size_of::<GstVulkanQueueFamilyOps>(),
alignment: align_of::<GstVulkanQueueFamilyOps>(),
},
),
(
"GstVulkanSwapper",
Layout {
size: size_of::<GstVulkanSwapper>(),
alignment: align_of::<GstVulkanSwapper>(),
},
),
(
"GstVulkanSwapperClass",
Layout {
size: size_of::<GstVulkanSwapperClass>(),
alignment: align_of::<GstVulkanSwapperClass>(),
},
),
(
"GstVulkanTrash",
Layout {
size: size_of::<GstVulkanTrash>(),
alignment: align_of::<GstVulkanTrash>(),
},
),
(
"GstVulkanTrashFenceListClass",
Layout {
size: size_of::<GstVulkanTrashFenceListClass>(),
alignment: align_of::<GstVulkanTrashFenceListClass>(),
},
),
(
"GstVulkanTrashList",
Layout {
size: size_of::<GstVulkanTrashList>(),
alignment: align_of::<GstVulkanTrashList>(),
},
),
(
"GstVulkanTrashListClass",
Layout {
size: size_of::<GstVulkanTrashListClass>(),
alignment: align_of::<GstVulkanTrashListClass>(),
},
),
(
"GstVulkanVideoFilter",
Layout {
size: size_of::<GstVulkanVideoFilter>(),
alignment: align_of::<GstVulkanVideoFilter>(),
},
),
(
"GstVulkanVideoFilterClass",
Layout {
size: size_of::<GstVulkanVideoFilterClass>(),
alignment: align_of::<GstVulkanVideoFilterClass>(),
},
),
(
"GstVulkanVideoOperation",
Layout {
size: size_of::<GstVulkanVideoOperation>(),
alignment: align_of::<GstVulkanVideoOperation>(),
},
),
(
"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,63 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%s;%zu;%zu\n", "GstVulkanBarrierFlags", sizeof(GstVulkanBarrierFlags), alignof(GstVulkanBarrierFlags));
printf("%s;%zu;%zu\n", "GstVulkanBarrierType", sizeof(GstVulkanBarrierType), alignof(GstVulkanBarrierType));
printf("%s;%zu;%zu\n", "GstVulkanBufferMemoryAllocator", sizeof(GstVulkanBufferMemoryAllocator), alignof(GstVulkanBufferMemoryAllocator));
printf("%s;%zu;%zu\n", "GstVulkanBufferMemoryAllocatorClass", sizeof(GstVulkanBufferMemoryAllocatorClass), alignof(GstVulkanBufferMemoryAllocatorClass));
printf("%s;%zu;%zu\n", "GstVulkanBufferPool", sizeof(GstVulkanBufferPool), alignof(GstVulkanBufferPool));
printf("%s;%zu;%zu\n", "GstVulkanBufferPoolClass", sizeof(GstVulkanBufferPoolClass), alignof(GstVulkanBufferPoolClass));
printf("%s;%zu;%zu\n", "GstVulkanCommandPoolClass", sizeof(GstVulkanCommandPoolClass), alignof(GstVulkanCommandPoolClass));
printf("%s;%zu;%zu\n", "GstVulkanDescriptorCache", sizeof(GstVulkanDescriptorCache), alignof(GstVulkanDescriptorCache));
printf("%s;%zu;%zu\n", "GstVulkanDescriptorCacheClass", sizeof(GstVulkanDescriptorCacheClass), alignof(GstVulkanDescriptorCacheClass));
printf("%s;%zu;%zu\n", "GstVulkanDescriptorPoolClass", sizeof(GstVulkanDescriptorPoolClass), alignof(GstVulkanDescriptorPoolClass));
printf("%s;%zu;%zu\n", "GstVulkanDeviceClass", sizeof(GstVulkanDeviceClass), alignof(GstVulkanDeviceClass));
printf("%s;%zu;%zu\n", "GstVulkanDisplay", sizeof(GstVulkanDisplay), alignof(GstVulkanDisplay));
printf("%s;%zu;%zu\n", "GstVulkanDisplayClass", sizeof(GstVulkanDisplayClass), alignof(GstVulkanDisplayClass));
printf("%s;%zu;%zu\n", "GstVulkanDisplayType", sizeof(GstVulkanDisplayType), alignof(GstVulkanDisplayType));
printf("%s;%zu;%zu\n", "GstVulkanEncodeQueryResult", sizeof(GstVulkanEncodeQueryResult), alignof(GstVulkanEncodeQueryResult));
printf("%s;%zu;%zu\n", "GstVulkanError", sizeof(GstVulkanError), alignof(GstVulkanError));
printf("%s;%zu;%zu\n", "GstVulkanFenceCache", sizeof(GstVulkanFenceCache), alignof(GstVulkanFenceCache));
printf("%s;%zu;%zu\n", "GstVulkanFenceCacheClass", sizeof(GstVulkanFenceCacheClass), alignof(GstVulkanFenceCacheClass));
printf("%s;%zu;%zu\n", "GstVulkanFormatFlags", sizeof(GstVulkanFormatFlags), alignof(GstVulkanFormatFlags));
printf("%s;%zu;%zu\n", "GstVulkanFormatScaling", sizeof(GstVulkanFormatScaling), alignof(GstVulkanFormatScaling));
printf("%s;%zu;%zu\n", "GstVulkanFullScreenQuad", sizeof(GstVulkanFullScreenQuad), alignof(GstVulkanFullScreenQuad));
printf("%s;%zu;%zu\n", "GstVulkanFullScreenQuadClass", sizeof(GstVulkanFullScreenQuadClass), alignof(GstVulkanFullScreenQuadClass));
printf("%s;%zu;%zu\n", "GstVulkanHandle", sizeof(GstVulkanHandle), alignof(GstVulkanHandle));
printf("%s;%zu;%zu\n", "GstVulkanHandlePool", sizeof(GstVulkanHandlePool), alignof(GstVulkanHandlePool));
printf("%s;%zu;%zu\n", "GstVulkanHandlePoolClass", sizeof(GstVulkanHandlePoolClass), alignof(GstVulkanHandlePoolClass));
printf("%s;%zu;%zu\n", "GstVulkanHandleType", sizeof(GstVulkanHandleType), alignof(GstVulkanHandleType));
printf("%s;%zu;%zu\n", "GstVulkanHandleTypedef", sizeof(GstVulkanHandleTypedef), alignof(GstVulkanHandleTypedef));
printf("%s;%zu;%zu\n", "GstVulkanImageBufferPool", sizeof(GstVulkanImageBufferPool), alignof(GstVulkanImageBufferPool));
printf("%s;%zu;%zu\n", "GstVulkanImageBufferPoolClass", sizeof(GstVulkanImageBufferPoolClass), alignof(GstVulkanImageBufferPoolClass));
printf("%s;%zu;%zu\n", "GstVulkanImageMemoryAllocator", sizeof(GstVulkanImageMemoryAllocator), alignof(GstVulkanImageMemoryAllocator));
printf("%s;%zu;%zu\n", "GstVulkanImageMemoryAllocatorClass", sizeof(GstVulkanImageMemoryAllocatorClass), alignof(GstVulkanImageMemoryAllocatorClass));
printf("%s;%zu;%zu\n", "GstVulkanInstanceClass", sizeof(GstVulkanInstanceClass), alignof(GstVulkanInstanceClass));
printf("%s;%zu;%zu\n", "GstVulkanMemoryAllocator", sizeof(GstVulkanMemoryAllocator), alignof(GstVulkanMemoryAllocator));
printf("%s;%zu;%zu\n", "GstVulkanMemoryAllocatorClass", sizeof(GstVulkanMemoryAllocatorClass), alignof(GstVulkanMemoryAllocatorClass));
printf("%s;%zu;%zu\n", "GstVulkanOperation", sizeof(GstVulkanOperation), alignof(GstVulkanOperation));
printf("%s;%zu;%zu\n", "GstVulkanOperationClass", sizeof(GstVulkanOperationClass), alignof(GstVulkanOperationClass));
printf("%s;%zu;%zu\n", "GstVulkanPhysicalDeviceClass", sizeof(GstVulkanPhysicalDeviceClass), alignof(GstVulkanPhysicalDeviceClass));
printf("%s;%zu;%zu\n", "GstVulkanQueueClass", sizeof(GstVulkanQueueClass), alignof(GstVulkanQueueClass));
printf("%s;%zu;%zu\n", "GstVulkanQueueFamilyOps", sizeof(GstVulkanQueueFamilyOps), alignof(GstVulkanQueueFamilyOps));
printf("%s;%zu;%zu\n", "GstVulkanSwapper", sizeof(GstVulkanSwapper), alignof(GstVulkanSwapper));
printf("%s;%zu;%zu\n", "GstVulkanSwapperClass", sizeof(GstVulkanSwapperClass), alignof(GstVulkanSwapperClass));
printf("%s;%zu;%zu\n", "GstVulkanTrash", sizeof(GstVulkanTrash), alignof(GstVulkanTrash));
printf("%s;%zu;%zu\n", "GstVulkanTrashFenceListClass", sizeof(GstVulkanTrashFenceListClass), alignof(GstVulkanTrashFenceListClass));
printf("%s;%zu;%zu\n", "GstVulkanTrashList", sizeof(GstVulkanTrashList), alignof(GstVulkanTrashList));
printf("%s;%zu;%zu\n", "GstVulkanTrashListClass", sizeof(GstVulkanTrashListClass), alignof(GstVulkanTrashListClass));
printf("%s;%zu;%zu\n", "GstVulkanVideoFilter", sizeof(GstVulkanVideoFilter), alignof(GstVulkanVideoFilter));
printf("%s;%zu;%zu\n", "GstVulkanVideoFilterClass", sizeof(GstVulkanVideoFilterClass), alignof(GstVulkanVideoFilterClass));
printf("%s;%zu;%zu\n", "GstVulkanVideoOperation", sizeof(GstVulkanVideoOperation), alignof(GstVulkanVideoOperation));
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,8 @@
// Take a look at the license at the top of the repository in the LICENSE file.
#[test]
fn check_gir_file() {
let res = gir_format_check::check_gir_file("Gir.toml");
println!("{res}");
assert_eq!(res.nb_errors, 0);
}

View file

@ -0,0 +1 @@
../../gstreamer/CHANGELOG.md

View file

@ -0,0 +1 @@
../../COPYRIGHT

View file

@ -0,0 +1,36 @@
[package]
name = "gstreamer-vulkan-wayland"
authors = ["Matthew Waters <matthew@centricular.com>"]
description = "Rust bindings for GStreamer Vulkan library (Wayland support)"
license = "MIT OR Apache-2.0"
readme = "README.md"
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_vulkan_wayland/"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
version.workspace = true
categories.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
[dependencies]
libc = "0.2"
ffi = { package = "gstreamer-vulkan-wayland-sys", path = "sys" }
glib.workspace = true
gst.workspace = true
gst-vulkan.workspace = true
[dev-dependencies]
gir-format-check = "0.1"
[features]
default = []
v1_20 = ["gst/v1_20", "gst-vulkan/v1_20", "ffi/v1_20"]
v1_22 = ["gst/v1_22", "gst-vulkan/v1_22", "ffi/v1_22", "v1_20"]
v1_24 = ["gst/v1_24", "gst-vulkan/v1_24", "ffi/v1_24", "v1_22"]
v1_26 = ["gst/v1_26", "gst-vulkan/v1_26", "ffi/v1_26", "v1_24"]
[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]

View file

@ -0,0 +1,59 @@
[options]
girs_directories = ["../../gir-files", "../../gst-gir-files"]
library = "GstVulkanWayland"
version = "1.0"
min_cfg_version = "1.18"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
single_version_file = true
generate_display_trait = false
trust_return_value_nullability = true
external_libraries = [
"GLib",
"GObject",
"Gst",
"GstBase",
"GstVideo",
"GstVulkan",
]
generate = []
manual = [
"GLib.Error",
"GLib.Thread",
"GObject.Object",
"Gst.FlowReturn",
"Gst.Object",
"Gst.PadDirection",
]
[[object]]
name = "Gst.Buffer"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Query"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Structure"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstVulkanWayland.VulkanDisplayWayland"
status = "generate"
[[object.function]]
name = "new"
[object.function.return]
nullable_return_is_error = "Failed to create Wayland display"

View file

@ -0,0 +1 @@
../../LICENSE-APACHE

View file

@ -0,0 +1 @@
../../LICENSE-MIT

View file

@ -0,0 +1,215 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-gl-wayland.svg)](https://crates.io/crates/gstreamer-gl-wayland) [![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/) (OpenGL library, Wayland support)
bindings for Rust. Documentation can be found
[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_gl_wayland/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications and GStreamer plugins.
The bindings are mostly autogenerated with [gir](https://github.com/gtk-rs/gir/)
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
API metadata provided by the GStreamer project.
## Table of Contents
1. [Installation](#installation)
1. [Linux/BSDs](#installation-linux)
1. [macOS](#installation-macos)
1. [Windows](#installation-windows)
1. [Getting Started](#getting-started)
1. [License](#license)
1. [Contribution](#contribution)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.14 and gst-plugins-base 1.14 installed. In addition,
some of the examples/tutorials require various GStreamer plugins to be
available, which can be found in gst-plugins-base, gst-plugins-good,
gst-plugins-bad, gst-plugins-ugly and/or gst-libav.
<a name="installation-linux"/>
### Linux/BSDs
You need to install the above mentioned packages with your distributions
package manager, or build them from source.
On Debian/Ubuntu they can be installed with
```console
$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev
```
The minimum required version of the above libraries is >= 1.14. If you
build the gstreamer-player sub-crate, or any of the examples that
depend on gstreamer-player, you must ensure that in addition to the above
packages, `libgstreamer-plugins-bad1.0-dev` is installed. See the `Cargo.toml`
files for the full details,
```console
$ apt-get install libgstreamer-plugins-bad1.0-dev
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### macOS
You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
We recommend using the official GStreamer binaries over Homebrew, especially
as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964).
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and
`gstreamer-1.0-devel-1.20.4-universal.pkg`.
After installation, you also need to set the `PATH` environment variable as
follows
```console
$ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
```
Also note that the `pkg-config` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### Homebrew
Homebrew only installs various plugins if explicitly enabled, so some extra
`--with-*` flags may be required.
```console
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav gst-rtsp-server \
gst-editing-services --with-orc --with-libogg --with-opus \
--with-pango --with-theora --with-libvorbis --with-libvpx \
--enable-gtk3
```
Make sure the version of these libraries is >= 1.14.
<a name="installation-windows"/>
### Windows
You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/)
with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
We recommend using the official GStreamer binaries over MSYS2.
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and
`gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that
matches your Rust toolchain, i.e. MinGW or MSVC.
After installation set the ``PATH` environment variable as follows:
```console
# For a UNIX-style shell:
$ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}"
# For cmd.exe:
$ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH%
```
Make sure to update the path to where you have actually installed GStreamer
and for the corresponding toolchain.
Also note that the `pkg-config.exe` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### MSYS2 / pacman
```console
$ pacman -S glib2-devel pkg-config \
mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \
mingw-w64-x86_64-gst-rtsp-server
```
Make sure the version of these libraries is >= 1.14.
Note that the version of `pkg-config` included in `MSYS2` is
[known to have problems](https://github.com/rust-lang/pkg-config-rs/issues/51#issuecomment-346300858)
compiling GStreamer, so you may need to install another version. One option
would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/).
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer/), however it is
only the Rust API reference and does not explain any of the concepts.
For getting started with GStreamer development, the best would be to follow
the [documentation](https://gstreamer.freedesktop.org/documentation/) on the
GStreamer website, especially the [Application Development
Manual](https://gstreamer.freedesktop.org/documentation/application-development/).
While being C-centric, it explains all the fundamental concepts of GStreamer
and the code examples should be relatively easily translatable to Rust. The
API is basically the same, function/struct names are the same and everything
is only more convenient (hopefully) and safer.
In addition there are
[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the
GStreamer website. Many of them were ported to Rust already and the code can
be found in the
[tutorials](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/examples)
directory.
Various GStreamer plugins written in Rust can be found in the
[gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs)
repository.
<a name="license"/>
## LICENSE
gstreamer-rs and all crates contained in here are licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)
at your option.
GStreamer itself is licensed under the Lesser General Public License version
2.1 or (at your option) any later version:
https://www.gnu.org/licenses/lgpl-2.1.html
<a name="contribution"/>
## Contribution
Any kinds of contributions are welcome as a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.

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 @ 5223ce91b97a)
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ d62956d67216+)

View file

@ -0,0 +1,37 @@
// 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 glib::translate::*;
glib::wrapper! {
#[doc(alias = "GstVulkanDisplayWayland")]
pub struct VulkanDisplayWayland(Object<ffi::GstVulkanDisplayWayland, ffi::GstVulkanDisplayWaylandClass>) @extends gst::Object;
match fn {
type_ => || ffi::gst_vulkan_display_wayland_get_type(),
}
}
impl VulkanDisplayWayland {
pub const NONE: Option<&'static VulkanDisplayWayland> = None;
#[doc(alias = "gst_vulkan_display_wayland_new")]
pub fn new(name: Option<&str>) -> Result<VulkanDisplayWayland, glib::BoolError> {
assert_initialized_main_thread!();
unsafe {
Option::<_>::from_glib_full(ffi::gst_vulkan_display_wayland_new(name.to_glib_none().0))
.ok_or_else(|| glib::bool_error!("Failed to create Wayland display"))
}
}
//#[doc(alias = "gst_vulkan_display_wayland_new_with_display")]
//#[doc(alias = "new_with_display")]
//pub fn with_display(display: /*Unimplemented*/Option<Basic: Pointer>) -> VulkanDisplayWayland {
// unsafe { TODO: call ffi:gst_vulkan_display_wayland_new_with_display() }
//}
}
unsafe impl Send for VulkanDisplayWayland {}
unsafe impl Sync for VulkanDisplayWayland {}

View file

@ -0,0 +1,26 @@
// Copyright (C) 2020 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![cfg_attr(docsrs, feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
pub use ffi;
pub use gst_vulkan;
macro_rules! assert_initialized_main_thread {
() => {
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
gst::assert_initialized();
}
};
}
mod auto;
pub use auto::*;
mod vulkan_display_wayland;

View file

@ -0,0 +1,23 @@
// Copyright (C) 2024 Matthew Waters <matthew@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use glib::{ffi::gpointer, translate::*};
use libc::uintptr_t;
use crate::VulkanDisplayWayland;
impl VulkanDisplayWayland {
pub unsafe fn with_display(
display: uintptr_t,
) -> Result<VulkanDisplayWayland, glib::error::BoolError> {
from_glib_full::<_, Option<VulkanDisplayWayland>>(
ffi::gst_vulkan_display_wayland_new_with_display(display as gpointer),
)
.ok_or_else(|| glib::bool_error!("Failed to create new Wayland Vulkan display"))
}
}

View file

@ -0,0 +1 @@
../../../gstreamer/CHANGELOG.md

View file

@ -0,0 +1 @@
../../../COPYRIGHT

View file

@ -0,0 +1,73 @@
[package]
authors = ["Matthew Waters <matthew@centricular.com>"]
build = "build.rs"
description = "FFI bindings to libgstvulkan-1.0 (Wayland support)"
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_vulkan_wayland_sys/"
keywords = ["ffi", "gstreamer", "gnome", "multimedia"]
license = "MIT"
name = "gstreamer-vulkan-wayland-sys"
readme = "README.md"
[package.version]
workspace = true
[package.categories]
workspace = true
[package.repository]
workspace = true
[package.homepage]
workspace = true
[package.edition]
workspace = true
[package.rust-version]
workspace = true
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0]
name = "gstreamer-vulkan-wayland-1.0"
version = "1.20"
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0.v1_22]
version = "1.22"
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0.v1_24]
version = "1.24"
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0.v1_26]
version = "1.25"
[package.metadata.system-deps.gstreamer_vulkan_wayland_1_0.v1_20]
version = "1.20"
[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
[lib]
name = "gstreamer_vulkan_wayland_sys"
[dependencies]
libc = "0.2"
[dependencies.glib-sys]
workspace = true
[dependencies.gstreamer-vulkan-sys]
workspace = true
[build-dependencies]
system-deps = "6"
[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,24 @@
[options]
girs_directories = ["../../../gir-files", "../../../gst-gir-files"]
library = "GstVulkanWayland"
min_cfg_version = "1.18"
version = "1.0"
work_mode = "sys"
single_version_file = true
extra_versions = [
"1.24",
"1.22",
"1.20",
]
external_libraries = [
"GLib",
]
generate = [
"GstVulkanWayland.VulkanDisplayWayland",
]
[external_libraries]
gstreamer-vulkan = "GstVulkan"

View file

@ -0,0 +1 @@
../../../LICENSE-MIT

View file

@ -0,0 +1,31 @@
# gstreamer-sys [![crates.io](https://img.shields.io/crates/v/gstreamer-gl-wayland-sys.svg)](https://crates.io/crates/gstreamer-gl-wayland-sys) [![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/) (OpenGL library, Wayland support) FFI bindings for Rust.
These bindings are providing unsafe FFI API that can be used to interface with
GStreamer. Generally they are meant to be used as the building block for
higher-level abstractions like:
* Bindings for GStreamer applications and plugins: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs
* Various GStreamer plugins written in Rust: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
The bindings are autogenerated with [gir](https://github.com/gtk-rs/gir/)
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
API metadata provided by the GStreamer project.
## LICENSE
gstreamer-sys and all crates contained here are licensed under the MIT
license ([LICENSE](LICENSE) or http://opensource.org/licenses/MIT).
GStreamer itself is licensed under the Lesser General Public License version
2.1 or (at your option) any later version:
https://www.gnu.org/licenses/lgpl-2.1.html
## Contribution
Any kinds of contributions are welcome as a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in gstreamer-rs by you shall be licensed under the MIT license as above,
without any additional terms or conditions.

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 @ 5223ce91b97a)
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ d62956d67216+)

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;
#[allow(unused_imports)]
use libc::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
#[cfg(unix)]
#[allow(unused_imports)]
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
#[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()
}
}
#[link(name = "gstvulkan-1.0")]
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,8 @@
// Take a look at the license at the top of the repository in the LICENSE file.
#[test]
fn check_gir_file() {
let res = gir_format_check::check_gir_file("Gir.toml");
println!("{res}");
assert_eq!(res.nb_errors, 0);
}

View file

@ -0,0 +1 @@
../../gstreamer/CHANGELOG.md

View file

@ -0,0 +1 @@
../../COPYRIGHT

View file

@ -0,0 +1,36 @@
[package]
name = "gstreamer-vulkan-xcb"
authors = ["Matthew Waters <matthew@centricular.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", "audio", "video", "gnome"]
version.workspace = true
categories.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
rust-version.workspace = true
[dependencies]
libc = "0.2"
ffi = { package = "gstreamer-vulkan-xcb-sys", path = "sys" }
glib.workspace = true
gst.workspace = true
gst-vulkan.workspace = true
[dev-dependencies]
gir-format-check = "0.1"
[features]
default = []
v1_20 = ["gst/v1_20", "gst-vulkan/v1_20", "ffi/v1_20"]
v1_22 = ["gst/v1_22", "gst-vulkan/v1_22", "ffi/v1_22", "v1_20"]
v1_24 = ["gst/v1_24", "gst-vulkan/v1_24", "ffi/v1_24", "v1_22"]
v1_26 = ["gst/v1_26", "gst-vulkan/v1_26", "ffi/v1_26", "v1_24"]
[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]

View file

@ -0,0 +1,59 @@
[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
trust_return_value_nullability = true
external_libraries = [
"GLib",
"GObject",
"Gst",
"GstBase",
"GstVideo",
"GstVulkan",
]
generate = []
manual = [
"GLib.Error",
"GLib.Thread",
"GObject.Object",
"Gst.FlowReturn",
"Gst.Object",
"Gst.PadDirection",
]
[[object]]
name = "Gst.Buffer"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Query"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Structure"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstVulkanXCB.VulkanDisplayXCB"
status = "generate"
[[object.function]]
name = "new"
[object.function.return]
nullable_return_is_error = "Failed to create XCB display"

View file

@ -0,0 +1 @@
../../LICENSE-APACHE

View file

@ -0,0 +1 @@
../../LICENSE-MIT

View file

@ -0,0 +1,215 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-gl-x11.svg)](https://crates.io/crates/gstreamer-gl-x11) [![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/) (OpenGL library, X11 support)
bindings for Rust. Documentation can be found
[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_gl_x11/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications and GStreamer plugins.
The bindings are mostly autogenerated with [gir](https://github.com/gtk-rs/gir/)
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
API metadata provided by the GStreamer project.
## Table of Contents
1. [Installation](#installation)
1. [Linux/BSDs](#installation-linux)
1. [macOS](#installation-macos)
1. [Windows](#installation-windows)
1. [Getting Started](#getting-started)
1. [License](#license)
1. [Contribution](#contribution)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.14 and gst-plugins-base 1.14 installed. In addition,
some of the examples/tutorials require various GStreamer plugins to be
available, which can be found in gst-plugins-base, gst-plugins-good,
gst-plugins-bad, gst-plugins-ugly and/or gst-libav.
<a name="installation-linux"/>
### Linux/BSDs
You need to install the above mentioned packages with your distributions
package manager, or build them from source.
On Debian/Ubuntu they can be installed with
```console
$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev
```
The minimum required version of the above libraries is >= 1.14. If you
build the gstreamer-player sub-crate, or any of the examples that
depend on gstreamer-player, you must ensure that in addition to the above
packages, `libgstreamer-plugins-bad1.0-dev` is installed. See the `Cargo.toml`
files for the full details,
```console
$ apt-get install libgstreamer-plugins-bad1.0-dev
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### macOS
You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
We recommend using the official GStreamer binaries over Homebrew, especially
as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964).
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and
`gstreamer-1.0-devel-1.20.4-universal.pkg`.
After installation, you also need to set the `PATH` environment variable as
follows
```console
$ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
```
Also note that the `pkg-config` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### Homebrew
Homebrew only installs various plugins if explicitly enabled, so some extra
`--with-*` flags may be required.
```console
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav gst-rtsp-server \
gst-editing-services --with-orc --with-libogg --with-opus \
--with-pango --with-theora --with-libvorbis --with-libvpx \
--enable-gtk3
```
Make sure the version of these libraries is >= 1.14.
<a name="installation-windows"/>
### Windows
You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/)
with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
We recommend using the official GStreamer binaries over MSYS2.
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and
`gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that
matches your Rust toolchain, i.e. MinGW or MSVC.
After installation set the ``PATH` environment variable as follows:
```console
# For a UNIX-style shell:
$ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}"
# For cmd.exe:
$ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH%
```
Make sure to update the path to where you have actually installed GStreamer
and for the corresponding toolchain.
Also note that the `pkg-config.exe` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### MSYS2 / pacman
```console
$ pacman -S glib2-devel pkg-config \
mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \
mingw-w64-x86_64-gst-rtsp-server
```
Make sure the version of these libraries is >= 1.14.
Note that the version of `pkg-config` included in `MSYS2` is
[known to have problems](https://github.com/rust-lang/pkg-config-rs/issues/51#issuecomment-346300858)
compiling GStreamer, so you may need to install another version. One option
would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/).
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer/), however it is
only the Rust API reference and does not explain any of the concepts.
For getting started with GStreamer development, the best would be to follow
the [documentation](https://gstreamer.freedesktop.org/documentation/) on the
GStreamer website, especially the [Application Development
Manual](https://gstreamer.freedesktop.org/documentation/application-development/).
While being C-centric, it explains all the fundamental concepts of GStreamer
and the code examples should be relatively easily translatable to Rust. The
API is basically the same, function/struct names are the same and everything
is only more convenient (hopefully) and safer.
In addition there are
[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the
GStreamer website. Many of them were ported to Rust already and the code can
be found in the
[tutorials](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/examples)
directory.
Various GStreamer plugins written in Rust can be found in the
[gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs)
repository.
<a name="license"/>
## LICENSE
gstreamer-rs and all crates contained in here are licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)
at your option.
GStreamer itself is licensed under the Lesser General Public License version
2.1 or (at your option) any later version:
https://www.gnu.org/licenses/lgpl-2.1.html
<a name="contribution"/>
## Contribution
Any kinds of contributions are welcome as a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.

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 @ 5223ce91b97a)
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ d62956d67216+)

View file

@ -0,0 +1,29 @@
// 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 glib::translate::*;
glib::wrapper! {
#[doc(alias = "GstVulkanDisplayXCB")]
pub struct VulkanDisplayXCB(Object<ffi::GstVulkanDisplayXCB, ffi::GstVulkanDisplayXCBClass>) @extends gst::Object;
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 create XCB display"))
}
}
}
unsafe impl Send for VulkanDisplayXCB {}
unsafe impl Sync for VulkanDisplayXCB {}

View file

@ -0,0 +1,24 @@
// Copyright (C) 2024 Matthew Waters <matthew@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![cfg_attr(docsrs, feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
pub use ffi;
pub use gst_vulkan;
macro_rules! assert_initialized_main_thread {
() => {
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
gst::assert_initialized();
}
};
}
mod auto;
pub use auto::*;

View file

@ -0,0 +1 @@
../../../gstreamer/CHANGELOG.md

View file

@ -0,0 +1 @@
../../../COPYRIGHT

View file

@ -0,0 +1,78 @@
[package]
authors = ["Matthew Waters <matthew@centricular.com>"]
build = "build.rs"
description = "FFI bindings to libgstvulkan-1.0 (XCB support)"
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/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_18]
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]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
[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 = "6"
[dev-dependencies]
shell-words = "1.0.0"
tempfile = "3"
[features]
v1_18 = []
v1_20 = []
v1_22 = ["v1_20"]
v1_24 = ["v1_22"]
v1_26 = ["v1_24"]

View file

@ -0,0 +1,24 @@
[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",
]
generate = [
"GstVulkanXCB.VulkanDisplayXCB",
]
[external_libraries]
gstreamer-vulkan = "GstVulkan"

View file

@ -0,0 +1 @@
../../../LICENSE-MIT

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