Compare commits

..

19 commits
main ... 0.22.1

Author SHA1 Message Date
Sebastian Dröge
02c6b9128c Update CHANGELOG.md for 0.22.1 2024-02-13 12:28:34 +02:00
Sebastian Dröge
e99c8ce828 Update version to 0.22.1 2024-02-13 12:25:58 +02:00
Sebastian Dröge
bff4241a75 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-13 12:05:20 +02:00
Sebastian Dröge
729e064873 video: Add AncillaryMeta bindings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-12 18:10:11 +02:00
Sebastian Dröge
b08ed23989 structure: Call _full() serialize function for GST_SERIALIZE_FLAG_STRICT
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-12 18:10:05 +02:00
Sebastian Dröge
36269458f2 tags: Add new ContainerSpecificTrackId tag
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-12 18:09:56 +02:00
Sebastian Dröge
aa4e0d10c8 Regenerate with new GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-12 18:09:47 +02:00
Sebastian Dröge
49e764fef9 ci: Rebuild image to get new GStreamer version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-12 18:09:22 +02:00
Sebastian Dröge
1e65757ef3 Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-12 18:09:14 +02:00
Benjamin Gaignard
067c12269e analytics: Make AnalyticsODLocation members public
Get access to AnalyticsODLocation structure members outside
the module is useful if other elements need them.
For example it can be used to draw objects location.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-12 18:09:05 +02:00
Sebastian Dröge
a9354a3715 meta: Add support for 1.24 Meta clear function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-12 18:08:59 +02:00
Sebastian Dröge
e0eab9d19b meta: Fix MetaRefMut::upcast_mut() to return a mutable reference
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-12 18:08:53 +02:00
Sebastian Dröge
abbfd490d9 ci: Update to Rust 1.76
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1394>
2024-02-12 18:08:47 +02:00
Sebastian Dröge
98691e8958 gstreamer-tag: Reduce number of keywords 2024-02-08 15:37:32 +02:00
Sebastian Dröge
bc3bdebf96 Update Cargo.lock 2024-02-08 15:00:17 +02:00
Sebastian Dröge
6e360451b7 Regenerate with 0.19.0 gir / gir-files 2024-02-08 14:58:54 +02:00
Sebastian Dröge
f005c5ea3d Update Cargo.lock 2024-02-08 14:58:00 +02:00
Sebastian Dröge
7d33653fb9 Update to 0.19.0 branches of gir / gir-files 2024-02-08 14:57:17 +02:00
Sebastian Dröge
b13bfe3617 Update dependency versions for gtk-rs-core and the local crates 2024-02-08 14:47:49 +02:00
786 changed files with 3782 additions and 11145 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
target/ target/
**/*.rs.bk **/*.rs.bk
Cargo.lock

View file

@ -11,16 +11,13 @@
# - setting it to the current date and the version suffix to 0 # - setting it to the current date and the version suffix to 0
# - incrementing the version suffix # - incrementing the version suffix
# #
# Same for GST_RS_IMG_WINDOWS_TAG. There's a separate tag for it to cater for
# image-only updates that only affect Windows or only Linux.
#
# After each update commit your changes and push to your personal repo. # After each update commit your changes and push to your personal repo.
# After review and ci approval merge the branch as usual. # After review and ci approval merge the branch as usual.
# #
# Updating the nightly image should be done by simply running a scheduled ci # Updating the nightly image should be done by simply running a scheduled ci
# pipeline on the upstream repo with the $UPDATE_NIGHTLY variable defined. # pipeline on the upstream repo with the $UPDATE_NIGHTLY variable defined.
.templates_sha: &templates_sha 6a40df92957c8ce9ee741aaccc5daaaf70545b1e .templates_sha: &templates_sha b2e24205598dc1d80b5f2c88cf7618051e30e9fd
include: include:
- project: 'freedesktop/ci-templates' - project: 'freedesktop/ci-templates'
@ -42,23 +39,15 @@ workflow:
default: default:
interruptible: true interruptible: true
# Auto-retry jobs in case of infra failures
retry:
max: 1
when:
- 'runner_system_failure'
- 'stuck_or_timeout_failure'
- 'scheduler_failure'
- 'api_failure'
variables: variables:
FDO_UPSTREAM_REPO: gstreamer/gstreamer-rs FDO_UPSTREAM_REPO: gstreamer/gstreamer-rs
# DIY CI-templates like setup for windows # DIY CI-templates like setup for windows
WINDOWS_RUST_MINIMUM_IMAGE: "$CI_REGISTRY_IMAGE/windows:$GST_RS_IMG_WINDOWS_TAG-main-$GST_RS_MSRV" WINDOWS_RUST_MINIMUM_IMAGE: "$CI_REGISTRY_IMAGE/windows:$GST_RS_IMG_TAG-main-$GST_RS_MSRV"
WINDOWS_RUST_MINIMUM_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/windows:$GST_RS_IMG_WINDOWS_TAG-main-$GST_RS_MSRV" WINDOWS_RUST_MINIMUM_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/windows:$GST_RS_IMG_TAG-main-$GST_RS_MSRV"
WINDOWS_RUST_STABLE_IMAGE: "$CI_REGISTRY_IMAGE/windows:$GST_RS_IMG_WINDOWS_TAG-main-$GST_RS_STABLE" WINDOWS_RUST_STABLE_IMAGE: "$CI_REGISTRY_IMAGE/windows:$GST_RS_IMG_TAG-main-$GST_RS_STABLE"
WINDOWS_RUST_STABLE_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/windows:$GST_RS_IMG_WINDOWS_TAG-main-$GST_RS_STABLE" WINDOWS_RUST_STABLE_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/windows:$GST_RS_IMG_TAG-main-$GST_RS_STABLE"
RUST_DOCS_FLAGS: "--cfg docsrs --extern-html-root-url=muldiv=https://docs.rs/muldiv/1.0.0/muldiv/ -Z unstable-options --generate-link-to-definition" RUST_DOCS_FLAGS: "--cfg docsrs --extern-html-root-url=muldiv=https://docs.rs/muldiv/1.0.0/muldiv/ -Z unstable-options --generate-link-to-definition"
NAMESPACE: gstreamer NAMESPACE: gstreamer
@ -67,7 +56,7 @@ variables:
# latest release must be at the top # latest release must be at the top
# (only relevant on main branch) # (only relevant on main branch)
RELEASES: RELEASES:
0.23=0.23 0.21=0.21
stages: stages:
- "trigger" - "trigger"
@ -84,8 +73,6 @@ trigger:
stage: 'trigger' stage: 'trigger'
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
GIT_SUBMODULE_STRATEGY: "none"
tags: [ 'placeholder-job' ]
script: script:
- echo "Trigger job done, now running the pipeline." - echo "Trigger job done, now running the pipeline."
rules: rules:
@ -107,7 +94,7 @@ trigger:
FDO_DISTRIBUTION_VERSION: 'bookworm-slim' FDO_DISTRIBUTION_VERSION: 'bookworm-slim'
before_script: before_script:
- source ./ci/env.sh - source ./ci/env.sh
- mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config.toml - mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config
.debian:12-base: .debian:12-base:
extends: .debian:12 extends: .debian:12
@ -154,11 +141,11 @@ trigger:
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
FDO_DISTRIBUTION_EXEC: >- FDO_DISTRIBUTION_EXEC: >-
bash ci/install-gst.sh && bash ci/install-gst.sh &&
bash ci/install-dav1d.sh && bash ci/install-dav1d.sh &&
pip3 install --break-system-packages git+http://gitlab.freedesktop.org/freedesktop/ci-templates pip3 install --break-system-packages git+http://gitlab.freedesktop.org/freedesktop/ci-templates &&
pip3 install --break-system-packages tomli
.build-final-image: .build-final-image:
extends: extends:
@ -324,9 +311,6 @@ test nightly sys:
rustfmt: rustfmt:
extends: .img-stable extends: .img-stable
stage: "lint" stage: "lint"
tags: [ 'placeholder-job' ]
variables:
GIT_SUBMODULE_STRATEGY: "none"
script: script:
- cargo fmt --version - cargo fmt --version
- cargo fmt -- --color=always --check - cargo fmt -- --color=always --check
@ -337,9 +321,6 @@ rustfmt:
check commits: check commits:
extends: .img-stable extends: .img-stable
stage: "lint" stage: "lint"
tags: [ 'placeholder-job' ]
variables:
GIT_SUBMODULE_STRATEGY: "none"
script: script:
- ci-fairy check-commits --textwidth 0 --no-signed-off-by - ci-fairy check-commits --textwidth 0 --no-signed-off-by
needs: needs:
@ -349,9 +330,6 @@ check commits:
typos: typos:
extends: .img-stable extends: .img-stable
stage: "lint" stage: "lint"
tags: [ 'placeholder-job' ]
variables:
GIT_SUBMODULE_STRATEGY: "none"
script: script:
- typos - typos
needs: needs:
@ -388,8 +366,6 @@ gir-checks:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
extends: .img-stable extends: .img-stable
stage: 'extras' stage: 'extras'
tags:
- "gstreamer"
needs: needs:
- job: 'build-stable' - job: 'build-stable'
artifacts: false artifacts: false
@ -400,8 +376,6 @@ gir-checks:
outdated: outdated:
extends: .img-stable extends: .img-stable
stage: 'extras' stage: 'extras'
variables:
GIT_SUBMODULE_STRATEGY: "none"
needs: needs:
- job: 'build-stable' - job: 'build-stable'
artifacts: false artifacts: false
@ -409,8 +383,7 @@ outdated:
- if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_PIPELINE_SOURCE == "schedule"
script: script:
- cargo update --color=always - cargo update --color=always
# Ignore derive_more until we can depend on Rust 1.75 or newer - cargo outdated --color=always --root-deps-only --exit-code 1 -v
- cargo outdated --color=always --root-deps-only --exit-code 1 -v --ignore derive_more
coverage: coverage:
allow_failure: true allow_failure: true
@ -429,26 +402,25 @@ coverage:
LLVM_PROFILE_FILE: "gstreamer-rs-%p-%m.profraw" LLVM_PROFILE_FILE: "gstreamer-rs-%p-%m.profraw"
script: script:
- *cargo_test - *cargo_test
# generate html and cobertura report for gitlab integration # generate html report
- mkdir -p coverage - grcov . --binary-path ./target/debug/ -s . -t html --branch --ignore-not-existing --ignore "*target*" --ignore "*/sys/*" --ignore "examples/*" --ignore "tutorials/*" --ignore "*/build.rs" -o ./coverage/
- grcov . --binary-path ./target/debug/ -s . -t html,cobertura --branch --ignore-not-existing --ignore "*target*" --ignore "*/sys/*" --ignore "examples/*" --ignore "tutorials/*" --ignore "*/build.rs" -o ./coverage/ # generate cobertura report for gitlab integration
- grcov . --binary-path ./target/debug/ -s . -t cobertura --branch --ignore-not-existing --ignore "*target*" --ignore "*/sys/*" --ignore "examples/*" --ignore "tutorials/*" --ignore "*/build.rs" -o coverage.xml
# output coverage summary for gitlab parsing. # output coverage summary for gitlab parsing.
# TODO: use grcov once https://github.com/mozilla/grcov/issues/556 is fixed # TODO: use grcov once https://github.com/mozilla/grcov/issues/556 is fixed
- grep % coverage/html/index.html | head -1 ; true - grep % coverage/index.html | head -1 ; true
artifacts: artifacts:
paths: paths:
- 'coverage' - 'coverage'
reports: reports:
coverage_report: coverage_report:
coverage_format: cobertura coverage_format: cobertura
path: "coverage/cobertura.xml" path: coverage.xml
doc-stripping: doc-stripping:
variables: variables:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
extends: .img-nightly extends: .img-nightly
tags:
- "gstreamer"
stage: 'extras' stage: 'extras'
needs: needs:
- job: 'build-nightly' - job: 'build-nightly'
@ -463,8 +435,6 @@ regen-check:
variables: variables:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
extends: .img-nightly extends: .img-nightly
tags:
- "gstreamer"
stage: 'extras' stage: 'extras'
needs: needs:
- job: 'build-nightly' - job: 'build-nightly'
@ -479,8 +449,6 @@ docs:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
extends: .img-nightly extends: .img-nightly
stage: 'extras' stage: 'extras'
tags:
- "gstreamer"
needs: needs:
- job: 'build-nightly' - job: 'build-nightly'
artifacts: false artifacts: false
@ -540,11 +508,11 @@ pages:
# We also don't need a CONTEXT_DIR var as its also # We also don't need a CONTEXT_DIR var as its also
# hardcoded to be windows-docker/ # hardcoded to be windows-docker/
DOCKERFILE: 'ci/windows-docker/Dockerfile' DOCKERFILE: 'ci/windows-docker/Dockerfile'
GST_UPSTREAM_BRANCH: 'main'
tags: tags:
- 'windows' - 'windows'
- 'shell' - 'shell'
- '2022' - '2022'
- "gstreamer-windows"
script: script:
# We need to pass an array and to resolve the env vars, so we can't use a variable: # We need to pass an array and to resolve the env vars, so we can't use a variable:
- $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH", "--build-arg", "RUST_VERSION=$RUST_VERSION") - $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH", "--build-arg", "RUST_VERSION=$RUST_VERSION")
@ -565,6 +533,7 @@ windows rust docker stable:
windows rust docker msrv: windows rust docker msrv:
extends: '.windows rust docker build' extends: '.windows rust docker build'
when: 'manual'
variables: variables:
RUST_IMAGE: !reference [variables, "WINDOWS_RUST_MINIMUM_IMAGE"] RUST_IMAGE: !reference [variables, "WINDOWS_RUST_MINIMUM_IMAGE"]
RUST_UPSTREAM_IMAGE: !reference [variables, "WINDOWS_RUST_MINIMUM_UPSTREAM_IMAGE"] RUST_UPSTREAM_IMAGE: !reference [variables, "WINDOWS_RUST_MINIMUM_UPSTREAM_IMAGE"]
@ -576,7 +545,6 @@ windows rust docker msrv:
- 'docker' - 'docker'
- 'windows' - 'windows'
- '2022' - '2022'
- "gstreamer-windows"
script: script:
# Skip -sys tests as they don't work # Skip -sys tests as they don't work
# https://github.com/gtk-rs/gtk3-rs/issues/54 # https://github.com/gtk-rs/gtk3-rs/issues/54

912
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -107,63 +107,46 @@ members = [
exclude = ["gir"] exclude = ["gir"]
[workspace.package] [workspace.package]
version = "0.24.0" version = "0.22.1"
categories = ["api-bindings", "multimedia"] categories = ["api-bindings", "multimedia"]
repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
homepage = "https://gstreamer.freedesktop.org" homepage = "https://gstreamer.freedesktop.org"
edition = "2021" edition = "2021"
rust-version = "1.71.1" rust-version = "1.70"
[workspace.dependencies] [workspace.dependencies]
gio = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" } gio = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.19", version = "0.19" }
gio-sys = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" } gio-sys = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.19", version = "0.19" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" } glib = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.19", version = "0.19" }
glib-sys = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" } glib-sys = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.19", version = "0.19" }
gobject-sys = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" } gobject-sys = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.19", version = "0.19" }
cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" } cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.19", version = "0.19" }
pango = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" } pango = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.19", version = "0.19" }
pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" } pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.19", version = "0.19" }
gstreamer-allocators-sys = { path = "gstreamer-allocators/sys" } gstreamer-audio-sys = { path = "./gstreamer-audio/sys", version = "0.22" }
gstreamer-analytics-sys = { path = "gstreamer-analytics/sys" } gstreamer-base-sys = { path = "./gstreamer-base/sys", version = "0.22" }
gstreamer-app-sys = { path = "gstreamer-app/sys" } gstreamer-gl-sys = { path = "./gstreamer-gl/sys", version = "0.22" }
gstreamer-audio-sys = { path = "./gstreamer-audio/sys"} gstreamer-net-sys = { path = "./gstreamer-net/sys", version = "0.22" }
gstreamer-base-sys = { path = "./gstreamer-base/sys"} gstreamer-pbutils-sys = { path = "./gstreamer-pbutils/sys", version = "0.22" }
gstreamer-check-sys = { path = "./gstreamer-check/sys" } gstreamer-rtsp-sys = { path = "./gstreamer-rtsp/sys", version = "0.22" }
gstreamer-controller-sys = { path = "./gstreamer-controller/sys" } gstreamer-sdp-sys = { path = "./gstreamer-sdp/sys", version = "0.22" }
gstreamer-editing-services-sys = { path = "./gstreamer-editing-services/sys"} gstreamer-sys = { path = "./gstreamer/sys", version = "0.22" }
gstreamer-gl-egl-sys = { path = "./gstreamer-gl/egl/sys"} gstreamer-video-sys = { path = "./gstreamer-video/sys", version = "0.22" }
gstreamer-gl-wayland-sys = { path = "./gstreamer-gl/wayland/sys"} ges = { package = "gstreamer-editing-services", path = "./gstreamer-editing-services", version = "0.22" }
gstreamer-gl-x11-sys = { path = "./gstreamer-gl/x11/sys"} gst = { package = "gstreamer", path = "./gstreamer", version = "0.22" }
gstreamer-gl-sys = { path = "./gstreamer-gl/sys"} gst-allocators = { package = "gstreamer-allocators", path = "./gstreamer-allocators", version = "0.22" }
gstreamer-mpegts-sys = { path = "./gstreamer-mpegts/sys"} gst-app = { package = "gstreamer-app", path = "./gstreamer-app", version = "0.22" }
gstreamer-net-sys = { path = "./gstreamer-net/sys"} gst-audio = { package = "gstreamer-audio", path = "./gstreamer-audio", version = "0.22" }
gstreamer-pbutils-sys = { path = "./gstreamer-pbutils/sys"} gst-base = { package = "gstreamer-base", path = "./gstreamer-base", version = "0.22" }
gstreamer-play-sys = { path = "./gstreamer-play/sys" } gst-check = { package = "gstreamer-check", path = "./gstreamer-check", version = "0.22" }
gstreamer-player-sys = { path = "./gstreamer-player/sys" } gst-gl = { package = "gstreamer-gl", path = "./gstreamer-gl", version = "0.22" }
gstreamer-rtp-sys = { path = "./gstreamer-rtp/sys" } gst-gl-egl = { package = "gstreamer-gl-egl", path = "./gstreamer-gl/egl", version = "0.22" }
gstreamer-rtsp-sys = { path = "./gstreamer-rtsp/sys"} gst-gl-x11 = { package = "gstreamer-gl-x11", path = "./gstreamer-gl/x11", version = "0.22" }
gstreamer-rtsp-server-sys = { path = "./gstreamer-rtsp-server/sys" } gst-net = { package = "gstreamer-net", path = "./gstreamer-net", version = "0.22" }
gstreamer-sdp-sys = { path = "./gstreamer-sdp/sys"} gst-pbutils = { package = "gstreamer-pbutils", path = "./gstreamer-pbutils", version = "0.22" }
gstreamer-tag-sys = { path = "./gstreamer-tag/sys" } gst-play = { package = "gstreamer-play", path = "./gstreamer-play", version = "0.22" }
gstreamer-sys = { path = "./gstreamer/sys"} gst-player = { package = "gstreamer-player", path = "./gstreamer-player", version = "0.22" }
gstreamer-validate-sys = { path = "./gstreamer-validate/sys" } gst-rtsp = { package = "gstreamer-rtsp", path = "./gstreamer-rtsp", version = "0.22" }
gstreamer-video-sys = { path = "./gstreamer-video/sys"} gst-rtsp-server = { package = "gstreamer-rtsp-server", path = "./gstreamer-rtsp-server", version = "0.22" }
gstreamer-webrtc-sys = { path = "./gstreamer-webrtc/sys" } gst-sdp = { package = "gstreamer-sdp", path = "./gstreamer-sdp", version = "0.22" }
ges = { package = "gstreamer-editing-services", path = "./gstreamer-editing-services" } gst-video = { package = "gstreamer-video", path = "./gstreamer-video", version = "0.22" }
gst = { package = "gstreamer", path = "./gstreamer" }
gst-allocators = { package = "gstreamer-allocators", path = "./gstreamer-allocators" }
gst-app = { package = "gstreamer-app", path = "./gstreamer-app" }
gst-audio = { package = "gstreamer-audio", path = "./gstreamer-audio" }
gst-base = { package = "gstreamer-base", path = "./gstreamer-base" }
gst-check = { package = "gstreamer-check", path = "./gstreamer-check" }
gst-gl = { package = "gstreamer-gl", path = "./gstreamer-gl" }
gst-gl-egl = { package = "gstreamer-gl-egl", path = "./gstreamer-gl/egl" }
gst-gl-x11 = { package = "gstreamer-gl-x11", path = "./gstreamer-gl/x11" }
gst-net = { package = "gstreamer-net", path = "./gstreamer-net" }
gst-pbutils = { package = "gstreamer-pbutils", path = "./gstreamer-pbutils" }
gst-play = { package = "gstreamer-play", path = "./gstreamer-play" }
gst-player = { package = "gstreamer-player", path = "./gstreamer-player" }
gst-rtsp = { package = "gstreamer-rtsp", path = "./gstreamer-rtsp" }
gst-rtsp-server = { package = "gstreamer-rtsp-server", path = "./gstreamer-rtsp-server" }
gst-sdp = { package = "gstreamer-sdp", path = "./gstreamer-sdp" }
gst-video = { package = "gstreamer-video", path = "./gstreamer-video" }

View file

@ -1,8 +1,4 @@
variables: variables:
GST_RS_IMG_TAG: "2024-09-12.1" GST_RS_IMG_TAG: "2024-02-12.0"
GST_RS_IMG_WINDOWS_TAG: "2024-09-12.1" GST_RS_STABLE: "1.76.0"
GST_RS_STABLE: "1.81.0" GST_RS_MSRV: "1.70.0"
GST_RS_MSRV: "1.71.1"
# The branch we use to build GStreamer from in the docker images
# Ex. main, 1.24, my-test-branch
GST_UPSTREAM_BRANCH: 'main'

View file

@ -1,6 +1,6 @@
set -e set -e
RELEASE=1.4.3 RELEASE=1.1.0
git clone https://code.videolan.org/videolan/dav1d.git --branch $RELEASE git clone https://code.videolan.org/videolan/dav1d.git --branch $RELEASE
cd dav1d cd dav1d

View file

@ -2,30 +2,27 @@
set -e set -e
DEFAULT_BRANCH="$GST_UPSTREAM_BRANCH" pip3 install meson==1.1.1 --break-system-packages
pip3 install meson==1.5.1 --break-system-packages
# gstreamer-rs already has a 'gstreamer' directory so don't clone there # gstreamer-rs already has a 'gstreamer' directory so don't clone there
pushd . pushd .
cd .. cd ..
git clone https://gitlab.freedesktop.org/gstreamer/gstreamer.git \ git clone https://gitlab.freedesktop.org/gstreamer/gstreamer.git \
--depth 1 \ --depth 1 \
--branch "$DEFAULT_BRANCH" --branch main
cd gstreamer cd gstreamer
# plugins required by tests # plugins required by tests
PLUGINS=( PLUGINS="-D gst-plugins-base:ogg=enabled \
-Dgst-plugins-base:ogg=enabled -D gst-plugins-base:vorbis=enabled \
-Dgst-plugins-base:vorbis=enabled -D gst-plugins-base:theora=enabled \
-Dgst-plugins-base:theora=enabled -D gst-plugins-good:matroska=enabled \
-Dgst-plugins-good:matroska=enabled -D gst-plugins-good:vpx=enabled \
-Dgst-plugins-good:vpx=enabled -D gst-plugins-bad:opus=enabled \
-Dgst-plugins-bad:opus=enabled -D gst-plugins-ugly:x264=enabled"
-Dgst-plugins-ugly:x264=enabled
)
echo "subproject('gtk')" >> meson.build
meson setup build \ meson setup build \
-D prefix=/usr/local \ -D prefix=/usr/local \
-D gpl=enabled \ -D gpl=enabled \
@ -36,7 +33,7 @@ meson setup build \
-D libav=disabled \ -D libav=disabled \
-D python=disabled \ -D python=disabled \
-D vaapi=disabled \ -D vaapi=disabled \
"${PLUGINS[@]}" "$@" $PLUGINS
meson compile -C build meson compile -C build
meson install -C build meson install -C build
ldconfig ldconfig

View file

@ -5,7 +5,7 @@ source ./ci/env.sh
set -e set -e
export CARGO_HOME='/usr/local/cargo' export CARGO_HOME='/usr/local/cargo'
RUSTUP_VERSION=1.27.1 RUSTUP_VERSION=1.26.0
RUST_VERSION=$1 RUST_VERSION=$1
RUST_IMAGE_FULL=$2 RUST_IMAGE_FULL=$2
RUST_ARCH="x86_64-unknown-linux-gnu" RUST_ARCH="x86_64-unknown-linux-gnu"
@ -26,34 +26,26 @@ if [ "$RUST_IMAGE_FULL" = "1" ]; then
rustup component add clippy-preview rustup component add clippy-preview
rustup component add rustfmt rustup component add rustfmt
cargo install --locked cargo-deny cargo install --locked --force cargo-deny
if [ "$RUST_VERSION" = "1.71.1" ]; then cargo install --locked --force cargo-outdated
cargo install --locked cargo-outdated cargo install --locked --force typos-cli
else
# Don't use --locked because time-0.3.30 does not build with 1.80 or newer
cargo install cargo-outdated
fi
cargo install --locked typos-cli --version "1.19.0"
# Coverage tools # Coverage tools
rustup component add llvm-tools-preview rustup component add llvm-tools-preview
if [ "$RUST_VERSION" = "1.71.1" ]; then cargo install --locked --force grcov
cargo install --locked grcov
else
# Don't use --locked because time-0.3.30 does not build with 1.80 or newer
cargo install grcov
fi
fi fi
if [ "$RUST_VERSION" = "1.71.1" ]; then if [ "$RUST_VERSION" = "nightly" ]; then
cargo install --locked cargo-c --version 0.9.26+cargo-0.74 # FIXME: Don't build cargo-c with --locked for now because otherwise a
# version of ahash is used that doesn't build on nightly anymore
cargo install cargo-c --version 0.9.22+cargo-0.72
else else
cargo install --locked cargo-c --version 0.10.3+cargo-0.81 cargo install --locked cargo-c --version 0.9.22+cargo-0.72
fi fi
if [ "$RUST_VERSION" = "nightly" ]; then if [ "$RUST_VERSION" = "nightly" ]; then
rustup component add rustfmt --toolchain nightly rustup component add rustfmt --toolchain nightly
# Documentation tools # Documentation tools
cargo install --locked rustdoc-stripper cargo install --locked --force rustdoc-stripper
fi fi

View file

@ -5,9 +5,6 @@ set -ex
rustc --version rustc --version
cargo --version cargo --version
cpus=$(nproc || sysctl -n hw.ncpu)
CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$cpus}"
for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
if [ -e "$crate/Cargo.toml" ]; then if [ -e "$crate/Cargo.toml" ]; then
if [ -n "$ALL_FEATURES" ]; then if [ -n "$ALL_FEATURES" ]; then
@ -18,8 +15,8 @@ for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
echo "Building and testing $crate with $FEATURES" echo "Building and testing $crate with $FEATURES"
cargo build $CARGO_FLAGS --locked --color=always --manifest-path "$crate/Cargo.toml" $FEATURES cargo build --locked --color=always --manifest-path "$crate/Cargo.toml" $FEATURES
RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test $CARGO_FLAGS --color=always --manifest-path "$crate/Cargo.toml" $FEATURES G_DEBUG=fatal_warnings cargo test --color=always --manifest-path "$crate/Cargo.toml" $FEATURES
fi fi
done done
@ -28,6 +25,6 @@ if [ -n "$EXAMPLES_TUTORIALS" ]; then
# List all features except windows/win32 # List all features except windows/win32
EXAMPLES_FEATURES="--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gl,gst-gl-x11,gst-gl-egl,allocators,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18" EXAMPLES_FEATURES="--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gl,gst-gl-x11,gst-gl-egl,allocators,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18"
cargo build $CARGO_FLAGS --locked --color=always --manifest-path examples/Cargo.toml --bins --examples "$EXAMPLES_FEATURES" cargo build --locked --color=always --manifest-path examples/Cargo.toml --bins --examples "$EXAMPLES_FEATURES"
cargo build $CARGO_FLAGS --locked --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features cargo build --locked --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features
fi fi

View file

@ -11,10 +11,13 @@ get_features() {
crate=$1 crate=$1
case "$crate" in case "$crate" in
gstreamer-audio|gstreamer-editing-services|gstreamer-gl|gstreamer-pbutils|gstreamer-rtp|gstreamer-rtsp|gstreamer-video|gstreamer) gstreamer-audio|gstreamer-editing-services|gstreamer-gl|gstreamer-pbutils|gstreamer-rtp|gstreamer-rtsp|gstreamer-video|gstreamer)
echo "--features=serde,v1_26" echo "--features=serde,v1_24"
;;
gstreamer-analytics)
echo ""
;; ;;
*) *)
echo "--features=v1_26" echo "--features=v1_24"
;; ;;
esac esac
} }

View file

@ -5,25 +5,19 @@ set -ex
rustc --version rustc --version
cargo --version cargo --version
cpus=$(nproc || sysctl -n hw.ncpu)
CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$cpus}"
for crate in gstreamer*/sys gstreamer-gl/*/sys; do for crate in gstreamer*/sys gstreamer-gl/*/sys; do
if [ -e "$crate/Cargo.toml" ]; then if [ -e "$crate/Cargo.toml" ]; then
echo "Building $crate with --all-features" echo "Building $crate with --all-features"
cargo build $CARGO_FLAGS --locked --color=always --manifest-path "$crate/Cargo.toml" --all-features cargo build --locked --color=always --manifest-path "$crate/Cargo.toml" --all-features
fi fi
done done
for crate in gstreamer/sys \ for crate in gstreamer/sys \
gstreamer-allocators/sys \
gstreamer-analytics/sys \
gstreamer-app/sys \ gstreamer-app/sys \
gstreamer-audio/sys \ gstreamer-audio/sys \
gstreamer-base/sys \ gstreamer-base/sys \
gstreamer-check/sys \ gstreamer-check/sys \
gstreamer-controller/sys \ gstreamer-controller/sys \
gstreamer-editing-services/sys \
gstreamer-gl/sys \ gstreamer-gl/sys \
gstreamer-gl/egl/sys \ gstreamer-gl/egl/sys \
gstreamer-gl/wayland/sys \ gstreamer-gl/wayland/sys \
@ -31,16 +25,13 @@ for crate in gstreamer/sys \
gstreamer-mpegts/sys \ gstreamer-mpegts/sys \
gstreamer-net/sys \ gstreamer-net/sys \
gstreamer-pbutils/sys \ gstreamer-pbutils/sys \
gstreamer-play/sys \
gstreamer-player/sys \ gstreamer-player/sys \
gstreamer-rtp/sys \
gstreamer-rtsp-server/sys \ gstreamer-rtsp-server/sys \
gstreamer-rtsp/sys \ gstreamer-rtsp/sys \
gstreamer-sdp/sys \ gstreamer-sdp/sys \
gstreamer-tag/sys \ gstreamer-tag/sys \
gstreamer-validate/sys \
gstreamer-video/sys \ gstreamer-video/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 test $CARGO_FLAGS --locked --color=always --manifest-path $crate/Cargo.toml --all-features cargo test --locked --color=always --manifest-path $crate/Cargo.toml --all-features
done done

View file

@ -16,7 +16,8 @@
# 'gstreamer-gl/egl', # 'gstreamer-gl/egl',
# 'gstreamer-gl/wayland', # 'gstreamer-gl/wayland',
# 'gstreamer-gl/x11', # 'gstreamer-gl/x11',
'gstreamer-mpegts', # only has sys
# 'gstreamer-mpegts',
'gstreamer-mpegts/sys', 'gstreamer-mpegts/sys',
'gstreamer-net', 'gstreamer-net',
'gstreamer-pbutils', 'gstreamer-pbutils',
@ -25,7 +26,8 @@
'gstreamer-rtsp', 'gstreamer-rtsp',
'gstreamer-rtsp-server', 'gstreamer-rtsp-server',
'gstreamer-sdp', 'gstreamer-sdp',
'gstreamer-tag', # only has sys
# 'gstreamer-tag',
'gstreamer-tag/sys', 'gstreamer-tag/sys',
'gstreamer-video', 'gstreamer-video',
'gstreamer-webrtc', 'gstreamer-webrtc',
@ -54,7 +56,7 @@ foreach($features in $features_matrix) {
if ($env:LocalFeatures -and ($env:LocalFeatures -ne '--no-default-features')) { if ($env:LocalFeatures -and ($env:LocalFeatures -ne '--no-default-features')) {
if ($crate -eq 'examples') { if ($crate -eq 'examples') {
# FIXME: We can do --all-features for examples once we have gtk3 installed in the image # FIXME: We can do --all-features for examples once we have gtk3 installed in the image
$env:LocalFeatures = "--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18,windows,gl" $env:LocalFeatures = "--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18,windows"
} }
if ($crate -eq 'tutorials') { if ($crate -eq 'tutorials') {
@ -76,7 +78,6 @@ foreach($features in $features_matrix) {
} }
$env:G_DEBUG="fatal_warnings" $env:G_DEBUG="fatal_warnings"
$env:RUST_BACKTRACE="1"
cargo test --no-fail-fast --color=always --manifest-path $crate/Cargo.toml $env:LocalFeatures cargo test --no-fail-fast --color=always --manifest-path $crate/Cargo.toml $env:LocalFeatures
if (!$?) { if (!$?) {

View file

@ -4,10 +4,7 @@ FROM "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2023-07-17.0-ma
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# These arguments are always required to be specified with --build-arg ARG DEFAULT_BRANCH="main"
# when building the image.
# See DOCKER_BUILD_ARGS in .gitlab-ci.yml for an example
ARG DEFAULT_BRANCH="invalid"
ARG RUST_VERSION="invalid" ARG RUST_VERSION="invalid"
RUN choco install -y pkgconfiglite nasm llvm openssl RUN choco install -y pkgconfiglite nasm llvm openssl
@ -16,8 +13,10 @@ RUN choco install -y pkgconfiglite nasm llvm openssl
RUN setx PATH '%PATH%;C:\Program Files\NASM;C:\gst-install\bin' RUN setx PATH '%PATH%;C:\Program Files\NASM;C:\gst-install\bin'
ENV PKG_CONFIG_PATH="C:\gst-install\lib\pkgconfig" ENV PKG_CONFIG_PATH="C:\gst-install\lib\pkgconfig"
COPY install_gst.ps1 install_dav1d.ps1 install_rust.ps1 install_cargo_utils.ps1 C:\ COPY install_gst.ps1 install_dav1d.ps1 C:\
RUN C:\install_gst.ps1 RUN C:\install_gst.ps1
RUN C:\install_dav1d.ps1 RUN C:\install_dav1d.ps1
RUN C:\install_rust.ps1
RUN C:\install_cargo_utils.ps1 RUN Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile C:\rustup-init.exe
RUN C:\rustup-init.exe -y --profile minimal --default-toolchain $env:RUST_VERSION
RUN cargo install --locked cargo-c --version 0.9.22+cargo-0.72

View file

@ -1,18 +0,0 @@
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
rustup --version
rustc --version
cargo --version
if ("$env:RUST_VERSION" -eq "1.71.1") {
cargo install --locked cargo-c --version 0.9.26+cargo-0.74
} else {
cargo install --locked cargo-c --version 0.10.3+cargo-0.81
}
if (!$?) {
Write-Host "Failed to install cargo-c"
Exit 1
}
cargo-cbuild --version

View file

@ -1,7 +1,7 @@
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
# Download gstreamer and all its subprojects # Download gstreamer and all its subprojects
git clone -b 1.4.3 --depth 1 https://code.videolan.org/videolan/dav1d.git C:\dav1d git clone -b 1.1.0 --depth 1 https://code.videolan.org/videolan/dav1d.git C:\dav1d
if (!$?) { if (!$?) {
Write-Host "Failed to clone dav1d" Write-Host "Failed to clone dav1d"
Exit 1 Exit 1

View file

@ -38,12 +38,14 @@ $MESON_ARGS = @(`
"-Dpython=disabled", ` "-Dpython=disabled", `
"-Dlibav=disabled", ` "-Dlibav=disabled", `
"-Dvaapi=disabled", ` "-Dvaapi=disabled", `
"-Dgtk=enabled", `
"-Dgst-plugins-base:pango=enabled", ` "-Dgst-plugins-base:pango=enabled", `
"-Dgst-plugins-good:cairo=enabled", ` "-Dgst-plugins-good:cairo=enabled", `
"-Dgst-plugins-good:lame=disabled" "-Dgst-plugins-good:lame=disabled"
) )
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
echo "subproject('gtk')" >> meson.build
Write-Output "Building gstreamer" Write-Output "Building gstreamer"
meson setup --vsenv $MESON_ARGS _build meson setup --vsenv $MESON_ARGS _build
if (!$?) { if (!$?) {

View file

@ -1,17 +0,0 @@
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
$rustup_url = 'https://win.rustup.rs/x86_64'
Invoke-WebRequest -Uri $rustup_url -OutFile C:\rustup-init.exe
if (!$?) {
Write-Host "Failed to download rustup"
Exit 1
}
C:\rustup-init.exe -y --profile minimal --default-toolchain $env:RUST_VERSION
if (!$?) {
Write-Host "Failed to install rust"
Exit 1
}

View file

@ -1,30 +1,34 @@
[graph]
exclude = [ exclude = [
"examples", "examples",
"tutorials", "tutorials",
] ]
[advisories] [advisories]
version = 2
db-path = "~/.cargo/advisory-db" db-path = "~/.cargo/advisory-db"
db-urls = ["https://github.com/rustsec/advisory-db"] db-urls = ["https://github.com/rustsec/advisory-db"]
vulnerability = "deny"
unmaintained = "warn"
notice = "warn"
ignore = [] ignore = []
[licenses] [licenses]
version = 2 unlicensed = "deny"
default = "deny"
copyleft = "deny"
allow-osi-fsf-free = "either"
confidence-threshold = 0.8 confidence-threshold = 0.8
allow = [
"MIT",
"Apache-2.0",
"Apache-2.0 WITH LLVM-exception",
"Unicode-DFS-2016",
]
[bans] [bans]
multiple-versions = "deny" multiple-versions = "deny"
wildcards = "allow" wildcards = "allow"
highlight = "all" highlight = "all"
# proc-macro-crate depends on an older version of toml_edit
# https://github.com/bkchr/proc-macro-crate/pull/50
[[bans.skip]]
name = "toml_edit"
version = "0.21"
[sources] [sources]
unknown-registry = "deny" unknown-registry = "deny"
unknown-git = "deny" unknown-git = "deny"

View file

@ -30,9 +30,8 @@ byte-slice-cast = "1"
cairo-rs = { workspace = true, features=["use_glib"], optional = true } cairo-rs = { workspace = true, features=["use_glib"], optional = true }
derive_more = "0.99.5" derive_more = "0.99.5"
futures = "0.3" futures = "0.3"
# Since there's nothing Windows-specific to enable on gstreamer-rs, unconditionally enable glutin's WGL backend glutin = { version = "0.31", optional = true, default-features = false }
glutin = { version = "0.31", optional = true, default-features = false, features = ["wgl"] } glutin-winit = { version = "0.4", optional = true, default-features = false }
glutin-winit = { version = "0.4", optional = true, default-features = false, features = ["wgl"] }
image = { version = "0.24", optional = true, default-features = false, features = ["png", "jpeg"] } image = { version = "0.24", optional = true, default-features = false, features = ["png", "jpeg"] }
memfd = { version = "0.6", optional = true } memfd = { version = "0.6", optional = true }
memmap2 = { version = "0.9", optional = true } memmap2 = { version = "0.9", optional = true }
@ -46,22 +45,16 @@ data-encoding = "2.0"
once_cell = "1" once_cell = "1"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
windows = { version = "0.58", features=["Win32_Graphics_Direct3D11", windows = { version = "0.52", features=["Win32_Graphics_Direct3D11",
"Win32_Foundation", "Win32_Graphics_Direct3D", "Win32_Graphics_Dxgi", "Win32_Foundation", "Win32_Graphics_Direct3D", "Win32_Graphics_Dxgi",
"Win32_Graphics_Dxgi_Common", "Win32_Graphics_Direct2D", "Win32_Graphics_Dxgi_Common", "Win32_Graphics_Direct2D",
"Win32_Graphics_Direct2D_Common", "Win32_Graphics_DirectWrite", "Win32_Graphics_Direct2D_Common", "Win32_Graphics_DirectWrite",
"Win32_Graphics_Imaging", "Win32_System_Com", "Foundation_Numerics"], optional = true } "Win32_Graphics_Imaging", "Win32_System_Com", "Foundation_Numerics"], optional = true }
[target.'cfg(target_os = "macos")'.dependencies] [target.'cfg(target_os = "macos")'.dependencies]
cocoa = "0.26" cocoa = "0.25"
objc = "0.2.7" objc = "0.2.7"
[target.'cfg(target_os = "macos")'.build-dependencies]
system-deps = "7"
[package.metadata.system-deps]
"gstreamer-1.0" = "1.14"
[build-dependencies] [build-dependencies]
gl_generator = { version = "0.14", optional = true } gl_generator = { version = "0.14", optional = true }
@ -211,10 +204,3 @@ required-features = ["cairo-rs", "gst-video/v1_18"]
[[bin]] [[bin]]
name = "d3d11videosink" name = "d3d11videosink"
required-features = ["windows"] required-features = ["windows"]
[[bin]]
name = "audio_multichannel_interleave"
[[bin]]
name = "zoom"
required-features = ["gst-video/v1_18"]

View file

@ -19,22 +19,4 @@ fn generate_gl_bindings() {}
fn main() { fn main() {
println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=build.rs");
generate_gl_bindings(); generate_gl_bindings();
// https://github.com/rust-lang/cargo/issues/5077#issuecomment-1284482987
#[cfg(all(not(docsrs), target_os = "macos"))]
match system_deps::Config::new().probe() {
Ok(deps) => {
let usr = std::path::Path::new("/usr/lib");
let usr_local = std::path::Path::new("/usr/local/lib");
for dep in deps.all_link_paths() {
if dep != &usr && dep != &usr_local {
println!("cargo:rustc-link-arg=-Wl,-rpath,{:?}", dep.as_os_str());
}
}
}
Err(s) => {
println!("cargo:warning={s}");
std::process::exit(1);
}
}
} }

View file

@ -10,6 +10,8 @@
// This is the format we request: // This is the format we request:
// Audio / Signed 16bit / 1 channel / arbitrary sample rate // Audio / Signed 16bit / 1 channel / arbitrary sample rate
use std::i16;
use anyhow::Error; use anyhow::Error;
use byte_slice_cast::*; use byte_slice_cast::*;
use derive_more::{Display, Error}; use derive_more::{Display, Error};

View file

@ -1,153 +0,0 @@
// This example demonstrates how to mix multiple audio
// streams into a single output using the audiomixer element.
// In this case, we're mixing 4 stereo streams into a single 8 channel output.
use gst::prelude::*;
use std::env;
#[path = "../examples-common.rs"]
mod examples_common;
const TRACKS: i32 = 4;
fn create_source_and_link(pipeline: &gst::Pipeline, mixer: &gst::Element, track_number: i32) {
let freq = ((track_number + 1) * 1000) as f64;
let audiosrc = gst::ElementFactory::make("audiotestsrc")
.property("freq", freq)
.property("num-buffers", 2000)
.build()
.unwrap();
let caps = gst_audio::AudioCapsBuilder::new().channels(2).build();
let capsfilter = gst::ElementFactory::make("capsfilter")
.property("caps", &caps)
.build()
.unwrap();
pipeline.add_many([&audiosrc, &capsfilter]).unwrap();
gst::Element::link_many([&audiosrc, &capsfilter]).unwrap();
let src_pad = capsfilter.static_pad("src").unwrap();
let mixer_pad = mixer.request_pad_simple("sink_%u").unwrap();
// audiomixer expects a mix-matrix set on each input pad,
// indicating which output channels our input should appear in.
// Rows => input channels, columns => output channels.
// Here each input channel will appear in exactly one output channel.
let mut mix_matrix: Vec<Vec<f32>> = vec![];
for i in 0..TRACKS {
if i == track_number {
mix_matrix.push(vec![1.0, 0.0]);
mix_matrix.push(vec![0.0, 1.0]);
} else {
mix_matrix.push(vec![0.0, 0.0]);
mix_matrix.push(vec![0.0, 0.0]);
}
}
let mut audiomixer_config = gst_audio::AudioConverterConfig::new();
audiomixer_config.set_mix_matrix(&mix_matrix);
mixer_pad.set_property("converter-config", audiomixer_config);
src_pad.link(&mixer_pad).unwrap();
}
fn example_main() {
gst::init().unwrap();
let args: Vec<_> = env::args().collect();
let output_file = if args.len() == 2 {
&args[1]
} else {
println!("Usage: audiomixer <output file>");
std::process::exit(-1);
};
let pipeline = gst::Pipeline::new();
let audiomixer = gst::ElementFactory::make("audiomixer").build().unwrap();
// Using an arbitrary layout of 4 stereo pairs.
let positions = [
gst_audio::AudioChannelPosition::FrontLeft,
gst_audio::AudioChannelPosition::FrontRight,
gst_audio::AudioChannelPosition::RearLeft,
gst_audio::AudioChannelPosition::RearRight,
gst_audio::AudioChannelPosition::SideLeft,
gst_audio::AudioChannelPosition::SideRight,
gst_audio::AudioChannelPosition::TopFrontLeft,
gst_audio::AudioChannelPosition::TopFrontRight,
];
let mask = gst_audio::AudioChannelPosition::positions_to_mask(&positions, true).unwrap();
let caps = gst_audio::AudioCapsBuilder::new()
.channels(positions.len() as i32)
.channel_mask(mask)
.build();
let capsfilter = gst::ElementFactory::make("capsfilter")
.property("caps", &caps)
.build()
.unwrap();
let audioconvert = gst::ElementFactory::make("audioconvert").build().unwrap();
let audioresample = gst::ElementFactory::make("audioresample").build().unwrap();
let wavenc = gst::ElementFactory::make("wavenc").build().unwrap();
let sink = gst::ElementFactory::make("filesink")
.property("location", output_file)
.build()
.unwrap();
pipeline
.add_many([
&audiomixer,
&capsfilter,
&audioconvert,
&audioresample,
&wavenc,
&sink,
])
.unwrap();
gst::Element::link_many([
&audiomixer,
&capsfilter,
&audioconvert,
&audioresample,
&wavenc,
&sink,
])
.unwrap();
for i in 0..TRACKS {
create_source_and_link(&pipeline, &audiomixer, i);
}
let bus = pipeline.bus().expect("Pipeline without bus");
pipeline
.set_state(gst::State::Playing)
.expect("Unable to start pipeline");
for msg in bus.iter_timed(gst::ClockTime::NONE) {
use gst::MessageView;
match msg.view() {
MessageView::Eos(..) => break,
MessageView::Error(err) => {
eprintln!(
"Error from {:?}: {} ({:?})",
msg.src().map(|s| s.path_string()),
err.error(),
err.debug()
);
break;
}
_ => (),
}
}
pipeline
.set_state(gst::State::Null)
.expect("Unable to change pipeline state to NULL");
}
fn main() {
// tutorials_common::run is only required to set up the application environment on macOS
// (but not necessary in normal Cocoa applications where this is set up automatically)
examples_common::run(example_main);
}

View file

@ -194,7 +194,7 @@ fn main() -> Result<()> {
let mut metrics = DWRITE_TEXT_METRICS::default(); let mut metrics = DWRITE_TEXT_METRICS::default();
layout.GetMetrics(&mut metrics).unwrap(); layout.GetMetrics(&mut metrics).unwrap();
layout layout
.GetFontSize(0, &mut font_size, Some(&mut range)) .GetFontSize2(0, &mut font_size, Some(&mut range))
.unwrap(); .unwrap();
if metrics.widthIncludingTrailingWhitespace >= desc.Width as f32 { if metrics.widthIncludingTrailingWhitespace >= desc.Width as f32 {
@ -304,7 +304,7 @@ fn main() -> Result<()> {
// Add pad probe to calculate framerate // Add pad probe to calculate framerate
let sinkpad = videosink.static_pad("sink").unwrap(); let sinkpad = videosink.static_pad("sink").unwrap();
let overlay_context_weak = Arc::downgrade(&overlay_context); let overlay_context_weak = Arc::downgrade(&overlay_context);
sinkpad.add_probe(gst::PadProbeType::BUFFER, move |_pad, _probe_info| { sinkpad.add_probe(gst::PadProbeType::BUFFER, move |_, probe_info| {
let overlay_context = overlay_context_weak.upgrade().unwrap(); let overlay_context = overlay_context_weak.upgrade().unwrap();
let mut context = overlay_context.lock().unwrap(); let mut context = overlay_context.lock().unwrap();
context.timestamp_queue.push_back(SystemTime::now()); context.timestamp_queue.push_back(SystemTime::now());

View file

@ -189,7 +189,7 @@ fn example_main() -> Result<(), Error> {
("Failed to insert sink"), ("Failed to insert sink"),
details: gst::Structure::builder("error-details") details: gst::Structure::builder("error-details")
.field("error", .field("error",
ErrorValue(Arc::new(Mutex::new(Some(err))))) &ErrorValue(Arc::new(Mutex::new(Some(err)))))
.build() .build()
); );
} }

View file

@ -215,7 +215,7 @@ fn example_main() -> Result<(), Error> {
("Failed to insert sink"), ("Failed to insert sink"),
details: gst::Structure::builder("error-details") details: gst::Structure::builder("error-details")
.field("error", .field("error",
ErrorValue(Arc::new(Mutex::new(Some(err))))) &ErrorValue(Arc::new(Mutex::new(Some(err)))))
.build() .build()
); );
} }

View file

@ -30,44 +30,9 @@ fn example_main() {
let main_loop = glib::MainLoop::new(None, false); let main_loop = glib::MainLoop::new(None, false);
// This creates a pipeline by parsing the gst-launch pipeline syntax. // This creates a pipeline by parsing the gst-launch pipeline syntax.
let pipeline = gst::parse::launch("audiotestsrc ! identity name=capsmut ! fakesink").unwrap(); let pipeline = gst::parse::launch("audiotestsrc ! fakesink").unwrap();
let bus = pipeline.bus().unwrap(); let bus = pipeline.bus().unwrap();
// This is a contrived example to mutate events. This would normally be code inside an element,
// which might transform caps to reflect transformation in the data
let identity = pipeline
.downcast_ref::<gst::Bin>()
.unwrap()
.by_name("capsmut")
.unwrap();
let _ = identity.static_pad("sink").unwrap().add_probe(
gst::PadProbeType::EVENT_DOWNSTREAM,
move |_, probe_info| {
let Some(e) = probe_info.event() else {
return gst::PadProbeReturn::Ok;
};
if e.type_() != gst::EventType::Caps {
return gst::PadProbeReturn::Ok;
};
let mut ev = probe_info.take_event().unwrap();
let ev_ref = ev.make_mut();
let gst::EventViewMut::Caps(caps) = ev_ref.view_mut() else {
unreachable!()
};
caps.structure_mut().set("custom-field", true);
identity
.static_pad("src")
.unwrap()
.push_event(ev_ref.to_owned());
gst::PadProbeReturn::Drop
},
);
pipeline pipeline
.set_state(gst::State::Playing) .set_state(gst::State::Playing)
.expect("Unable to set the pipeline to the `Playing` state"); .expect("Unable to set the pipeline to the `Playing` state");

View file

@ -459,7 +459,7 @@ mod video_filter {
frame: &mut VideoFrameRef<&mut gst::BufferRef>, frame: &mut VideoFrameRef<&mut gst::BufferRef>,
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
self.transform_fd_mem_ip(frame).map_err(|err| { self.transform_fd_mem_ip(frame).map_err(|err| {
gst::error!(CAT, imp = self, "Failed to transform frame`: {}", err); gst::error!(CAT, imp: self, "Failed to transform frame`: {}", err);
gst::FlowError::Error gst::FlowError::Error
})?; })?;

View file

@ -80,7 +80,7 @@ mod mirror {
gst::debug!( gst::debug!(
CAT, CAT,
imp = self, imp: self,
"Compiling fragment shader {}", "Compiling fragment shader {}",
FRAGMENT_SHADER FRAGMENT_SHADER
); );
@ -99,7 +99,7 @@ mod mirror {
gst::debug!( gst::debug!(
CAT, CAT,
imp = self, imp: self,
"Successfully compiled and linked {:?}", "Successfully compiled and linked {:?}",
shader shader
); );

View file

@ -132,10 +132,8 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
overlay.connect_closure( overlay.connect_closure(
"draw", "draw",
false, false,
glib::closure!( glib::closure!(@strong drawer => move |_overlay: &gst::Element,
#[strong] sample: &gst::Sample| {
drawer,
move |_overlay: &gst::Element, sample: &gst::Sample| {
use std::f64::consts::PI; use std::f64::consts::PI;
let drawer = drawer.lock().unwrap(); let drawer = drawer.lock().unwrap();
@ -148,8 +146,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
let bitmap = drawer.bitmap.as_ref().unwrap(); let bitmap = drawer.bitmap.as_ref().unwrap();
let render_target = drawer.render_target.as_ref().unwrap(); let render_target = drawer.render_target.as_ref().unwrap();
let global_angle = 360. let global_angle = 360. * (timestamp % (10 * gst::ClockTime::SECOND)).nseconds() as f64
* (timestamp % (10 * gst::ClockTime::SECOND)).nseconds() as f64
/ (10.0 * gst::ClockTime::SECOND.nseconds() as f64); / (10.0 * gst::ClockTime::SECOND.nseconds() as f64);
let center_x = (info.width() / 2) as f32; let center_x = (info.width() / 2) as f32;
let center_y = (info.height() / 2) as f32; let center_y = (info.height() / 2) as f32;
@ -187,10 +184,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
let matrix = Matrix3x2::rotation(angle, center_x, center_y); let matrix = Matrix3x2::rotation(angle, center_x, center_y);
render_target.SetTransform(&matrix); render_target.SetTransform(&matrix);
render_target.DrawTextLayout( render_target.DrawTextLayout(
D2D_POINT_2F { D2D_POINT_2F { x: 0f32, y: top_margin },
x: 0f32,
y: top_margin,
},
text_layout, text_layout,
&text_brush, &text_brush,
D2D1_DRAW_TEXT_OPTIONS_NONE, D2D1_DRAW_TEXT_OPTIONS_NONE,
@ -206,8 +200,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
let _ = render_target.Flush(None::<*mut u64>, None::<*mut u64>); let _ = render_target.Flush(None::<*mut u64>, None::<*mut u64>);
} }
let mut buffer = let mut buffer = gst::Buffer::with_size((info.width() * info.height() * 4) as usize).unwrap();
gst::Buffer::with_size((info.width() * info.height() * 4) as usize).unwrap();
{ {
let buffer_mut = buffer.get_mut().unwrap(); let buffer_mut = buffer.get_mut().unwrap();
let mut map = buffer_mut.map_writable().unwrap(); let mut map = buffer_mut.map_writable().unwrap();
@ -216,9 +209,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
unsafe { unsafe {
// Bitmap size is equal to the background image size. // Bitmap size is equal to the background image size.
// Copy entire memory // Copy entire memory
bitmap bitmap.CopyPixels(std::ptr::null(), info.width() * 4, dst).unwrap();
.CopyPixels(std::ptr::null(), info.width() * 4, dst)
.unwrap();
} }
} }
@ -248,9 +239,9 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
gst_video::VideoOverlayFormatFlags::PREMULTIPLIED_ALPHA, gst_video::VideoOverlayFormatFlags::PREMULTIPLIED_ALPHA,
); );
gst_video::VideoOverlayComposition::new(Some(&rect)).unwrap() gst_video::VideoOverlayComposition::new(Some(&rect))
} .unwrap()
), }),
); );
// Add a signal handler to the overlay's "caps-changed" signal. This could e.g. // Add a signal handler to the overlay's "caps-changed" signal. This could e.g.

View file

@ -119,9 +119,8 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
overlay.connect_closure( overlay.connect_closure(
"draw", "draw",
false, false,
glib::closure!( glib::closure!(@strong drawer => move |_overlay: &gst::Element,
#[strong] drawer, sample: &gst::Sample| {
move |_overlay: &gst::Element, sample: &gst::Sample| {
use std::f64::consts::PI; use std::f64::consts::PI;
let drawer = drawer.lock().unwrap(); let drawer = drawer.lock().unwrap();

View file

@ -8,6 +8,8 @@
// {audiotestsrc} - {fakesink} // {audiotestsrc} - {fakesink}
#![allow(clippy::question_mark)] #![allow(clippy::question_mark)]
use std::i16;
use byte_slice_cast::*; use byte_slice_cast::*;
use gst::prelude::*; use gst::prelude::*;

View file

@ -36,14 +36,14 @@ fn example_main() {
// For flags handling // For flags handling
// With flags, one can configure playbin's behavior such as whether it // With flags, one can configure playbin's behavior such as whether it
// should play back contained video streams, or if it should render subtitles. // should play back contained video streams, or if it should render subtitles.
// let flags = playbin.property_value("flags"); // let flags = playbin.get_property("flags").unwrap();
// let flags_class = FlagsClass::with_type(flags.type_()).unwrap(); // let flags_class = FlagsClass::new(flags.type_()).unwrap();
// let flags = flags_class.builder_with_value(flags).unwrap() // let flags = flags_class.builder_with_value(flags).unwrap()
// .unset_by_nick("text") // .unset_by_nick("text")
// .unset_by_nick("video") // .unset_by_nick("video")
// .build() // .build()
// .unwrap(); // .unwrap();
// playbin.set_property_from_value("flags", &flags); // playbin.set_property_from_value("flags", &flags).unwrap();
// The playbin also provides any kind of metadata that it found in the played stream. // The playbin also provides any kind of metadata that it found in the played stream.
// For this, the playbin provides signals notifying about changes in the metadata. // For this, the playbin provides signals notifying about changes in the metadata.

View file

@ -138,11 +138,7 @@ mod auth {
if let Some(authorization) = auth_credentials.authorization() { if let Some(authorization) = auth_credentials.authorization() {
if let Some(user) = self.external_auth(authorization) { if let Some(user) = self.external_auth(authorization) {
// Update context token with authenticated username // Update context token with authenticated username
ctx.set_token( ctx.set_token(gst_rtsp_server::RTSPToken::new(&[("user", &user)]));
gst_rtsp_server::RTSPToken::builder()
.field("user", user)
.build(),
);
return true; return true;
} }
} }

View file

@ -4,10 +4,11 @@
// send to the server. For this, the launch syntax pipeline, that is passed // send to the server. For this, the launch syntax pipeline, that is passed
// to this example's cli is spawned and the client's media is streamed into it. // to this example's cli is spawned and the client's media is streamed into it.
use std::env; use std::{env, ptr};
use anyhow::Error; use anyhow::Error;
use derive_more::{Display, Error}; use derive_more::{Display, Error};
use glib::translate::*;
use gst_rtsp_server::prelude::*; use gst_rtsp_server::prelude::*;
#[path = "../examples-common.rs"] #[path = "../examples-common.rs"]
@ -44,9 +45,10 @@ fn main_loop() -> Result<(), Error> {
// Here we configure a method of authentication that we want the // Here we configure a method of authentication that we want the
// server to require from clients. // server to require from clients.
let auth = gst_rtsp_server::RTSPAuth::new(); let auth = gst_rtsp_server::RTSPAuth::new();
let token = gst_rtsp_server::RTSPToken::builder() let token = gst_rtsp_server::RTSPToken::new(&[(
.field(gst_rtsp_server::RTSP_TOKEN_MEDIA_FACTORY_ROLE, "user") gst_rtsp_server::RTSP_TOKEN_MEDIA_FACTORY_ROLE,
.build(); &"user",
)]);
let basic = gst_rtsp_server::RTSPAuth::make_basic("user", "password"); let basic = gst_rtsp_server::RTSPAuth::make_basic("user", "password");
// For proper authentication, we want to use encryption. And there's no // For proper authentication, we want to use encryption. And there's no
// encryption without a certificate! // encryption without a certificate!
@ -76,14 +78,24 @@ fn main_loop() -> Result<(), Error> {
W535W8UBbEg=-----END PRIVATE KEY-----", W535W8UBbEg=-----END PRIVATE KEY-----",
)?; )?;
// Bindable versions were added in b1f515178a363df0322d7adbd5754e1f6e2083c9
// This declares that the user "user" (once authenticated) has a role that // This declares that the user "user" (once authenticated) has a role that
// allows them to access and construct media factories. // allows them to access and construct media factories.
factory.add_role_from_structure( unsafe {
&gst::Structure::builder("user") gst_rtsp_server::ffi::gst_rtsp_media_factory_add_role(
.field(gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_ACCESS, true) factory.to_glib_none().0,
.field(gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_CONSTRUCT, true) "user".to_glib_none().0,
.build(), gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_ACCESS
.to_glib_none()
.0,
<bool as StaticType>::static_type().into_glib() as *const u8,
true.into_glib() as *const u8,
gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_CONSTRUCT.as_ptr() as *const u8,
<bool as StaticType>::static_type().into_glib() as *const u8,
true.into_glib() as *const u8,
ptr::null_mut::<u8>(),
); );
}
auth.set_tls_certificate(Some(&cert)); auth.set_tls_certificate(Some(&cert));
auth.add_basic(basic.as_str(), &token); auth.add_basic(basic.as_str(), &token);

View file

@ -19,6 +19,10 @@ mod examples_common;
#[display(fmt = "Could not get mount points")] #[display(fmt = "Could not get mount points")]
struct NoMountPoints; struct NoMountPoints;
#[derive(Debug, Display, Error)]
#[display(fmt = "Usage: {_0} LAUNCH_LINE")]
struct UsageError(#[error(not(source))] String);
fn main_loop() -> Result<(), Error> { fn main_loop() -> Result<(), Error> {
let main_loop = glib::MainLoop::new(None, false); let main_loop = glib::MainLoop::new(None, false);
let server = server::Server::default(); let server = server::Server::default();

View file

@ -142,7 +142,7 @@ mod fir_filter {
// Drop state // Drop state
self.history.lock().unwrap().clear(); self.history.lock().unwrap().clear();
gst::info!(CAT, imp = self, "Stopped"); gst::info!(CAT, imp: self, "Stopped");
Ok(()) Ok(())
} }
@ -155,7 +155,7 @@ mod fir_filter {
// Get coefficients and return directly if we have none // Get coefficients and return directly if we have none
let coeffs = self.coeffs.lock().unwrap(); let coeffs = self.coeffs.lock().unwrap();
if coeffs.is_empty() { if coeffs.is_empty() {
gst::trace!(CAT, imp = self, "No coefficients set -- passthrough"); gst::trace!(CAT, imp: self, "No coefficients set -- passthrough");
return Ok(gst::FlowSuccess::Ok); return Ok(gst::FlowSuccess::Ok);
} }
@ -183,7 +183,7 @@ mod fir_filter {
gst::trace!( gst::trace!(
CAT, CAT,
imp = self, imp: self,
"Transforming {} samples with filter of length {}", "Transforming {} samples with filter of length {}",
samples.len(), samples.len(),
coeffs.len() coeffs.len()

View file

@ -116,7 +116,7 @@ impl BaseTransformImpl for IirFilter {
} }
let mut map = buf.map_writable().map_err(|_| { let mut map = buf.map_writable().map_err(|_| {
gst::error!(CAT, imp = self, "Failed to map buffer writable"); gst::error!(CAT, imp: self, "Failed to map buffer writable");
gst::FlowError::Error gst::FlowError::Error
})?; })?;
@ -166,7 +166,7 @@ impl AudioFilterImpl for IirFilter {
fn setup(&self, info: &gst_audio::AudioInfo) -> Result<(), gst::LoggableError> { fn setup(&self, info: &gst_audio::AudioInfo) -> Result<(), gst::LoggableError> {
self.parent_setup(info)?; self.parent_setup(info)?;
gst::debug!(CAT, imp = self, "Rate changed to {}", info.rate()); gst::debug!(CAT, imp: self, "Rate changed to {}", info.rate());
let obj = self.obj(); let obj = self.obj();
(obj.class().as_ref().set_rate)(&obj, info.rate()); (obj.class().as_ref().set_rate)(&obj, info.rate());
@ -177,7 +177,7 @@ impl AudioFilterImpl for IirFilter {
/// Wrappers for public methods and associated helper functions. /// Wrappers for public methods and associated helper functions.
impl IirFilter { impl IirFilter {
pub(super) fn set_coeffs(&self, a: Vec<f64>, b: Vec<f64>) { pub(super) fn set_coeffs(&self, a: Vec<f64>, b: Vec<f64>) {
gst::debug!(CAT, imp = self, "Setting coefficients a: {a:?}, b: {b:?}"); gst::debug!(CAT, imp: self, "Setting coefficients a: {a:?}, b: {b:?}");
*self.coeffs.lock().unwrap() = Some((a, b)); *self.coeffs.lock().unwrap() = Some((a, b));
} }
} }

View file

@ -177,6 +177,7 @@ fn example_main() {
state.clicked = false; state.clicked = false;
} }
} }
#[cfg(feature = "v1_18")]
NavigationEvent::MouseScroll { x, y, delta_y, .. } => { NavigationEvent::MouseScroll { x, y, delta_y, .. } => {
if delta_y > 0.0 { if delta_y > 0.0 {
zoom(mixer_sink_pad, x as i32, y as i32, true); zoom(mixer_sink_pad, x as i32, y as i32, true);

View file

@ -29,7 +29,7 @@ where
delegate, delegate,
}; };
use objc::{ use objc::{
msg_send, class, msg_send,
runtime::{Object, Sel}, runtime::{Object, Sel},
sel, sel_impl, sel, sel_impl,
}; };

View file

@ -11,7 +11,6 @@ use std::{
mem, mem,
num::NonZeroU32, num::NonZeroU32,
ptr, ptr,
sync::Mutex,
}; };
use anyhow::{Context, Result}; use anyhow::{Context, Result};
@ -82,7 +81,6 @@ void main() {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[allow(clippy::manual_non_exhaustive)] #[allow(clippy::manual_non_exhaustive)]
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
#[allow(clippy::missing_transmute_annotations)]
pub(crate) mod gl { pub(crate) mod gl {
pub use self::Gles2 as Gl; pub use self::Gles2 as Gl;
include!(concat!(env!("OUT_DIR"), "/test_gl_bindings.rs")); include!(concat!(env!("OUT_DIR"), "/test_gl_bindings.rs"));
@ -435,8 +433,8 @@ impl App {
println!("Using raw GL context {:?}", raw_gl_context); println!("Using raw GL context {:?}", raw_gl_context);
#[cfg(not(any(target_os = "linux", windows)))] #[cfg(not(target_os = "linux"))]
compile_error!("This example only has Linux and Windows support"); compile_error!("This example only has Linux support");
let api = App::map_gl_api(gl_config.api()); let api = App::map_gl_api(gl_config.api());
@ -450,6 +448,7 @@ impl App {
unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(egl_display as usize) } unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(egl_display as usize) }
.context("Failed to create GLDisplayEGL from raw `EGLDisplay`")? .context("Failed to create GLDisplayEGL from raw `EGLDisplay`")?
.upcast::<gst_gl::GLDisplay>(); .upcast::<gst_gl::GLDisplay>();
(egl_context as usize, gl_display, gst_gl::GLPlatform::EGL) (egl_context as usize, gl_display, gst_gl::GLPlatform::EGL)
} }
#[cfg(feature = "gst-gl-x11")] #[cfg(feature = "gst-gl-x11")]
@ -463,11 +462,6 @@ impl App {
.upcast::<gst_gl::GLDisplay>(); .upcast::<gst_gl::GLDisplay>();
(glx_context as usize, gl_display, gst_gl::GLPlatform::GLX) (glx_context as usize, gl_display, gst_gl::GLPlatform::GLX)
} }
#[cfg(windows)]
(glutin::display::RawDisplay::Wgl, glutin::context::RawContext::Wgl(wgl_context)) => {
let gl_display = gst_gl::GLDisplay::new();
(wgl_context as usize, gl_display, gst_gl::GLPlatform::WGL)
}
#[allow(unreachable_patterns)] #[allow(unreachable_patterns)]
handler => anyhow::bail!("Unsupported platform: {handler:?}."), handler => anyhow::bail!("Unsupported platform: {handler:?}."),
}; };
@ -478,9 +472,7 @@ impl App {
.context("Couldn't wrap GL context")?; .context("Couldn't wrap GL context")?;
let gl_context = shared_context.clone(); let gl_context = shared_context.clone();
// FIXME: Once MSRV is 1.72 the Mutex is not necessary anymore because let event_proxy = event_loop.create_proxy();
// std::sync::mpsc::Sender is Sync by itself
let event_proxy = Mutex::new(event_loop.create_proxy());
#[allow(clippy::single_match)] #[allow(clippy::single_match)]
bus.set_sync_handler(move |_, msg| { bus.set_sync_handler(move |_, msg| {
@ -513,7 +505,7 @@ impl App {
_ => (), _ => (),
} }
if let Err(e) = event_proxy.lock().unwrap().send_event(Message::BusEvent) { if let Err(e) = event_proxy.send_event(Message::BusEvent) {
eprintln!("Failed to send BusEvent to event proxy: {e}") eprintln!("Failed to send BusEvent to event proxy: {e}")
} }

2
gir

@ -1 +1 @@
Subproject commit a11b11f2e403d615edd94497b6fe5b3c5283145b Subproject commit 0e476ab5c1dec04355e4f516ebcce4edaa940c9e

@ -1 +1 @@
Subproject commit 62da9eb7c4bd5d6091a0eaab0d5e97a51f59fd6d Subproject commit cfc0305f903bcce1c9fb5b5055d3ae8a30912750

@ -1 +1 @@
Subproject commit db97a3ad67f5d3e46d88ddfb498344cbd3e08731 Subproject commit 39e21eeb5d1062772e57f62571b00fe5f3f379b4

View file

@ -15,7 +15,7 @@ rust-version.workspace = true
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"
gstreamer-allocators-sys.workspace = true ffi = { package = "gstreamer-allocators-sys", path = "sys", version = "0.22" }
glib.workspace = true glib.workspace = true
gst.workspace = true gst.workspace = true
once_cell = "1" once_cell = "1"
@ -25,12 +25,11 @@ gir-format-check = "0.1"
[features] [features]
default = [] default = []
v1_16 = ["gst/v1_16", "gstreamer-allocators-sys/v1_16"] v1_16 = ["gst/v1_16", "ffi/v1_16"]
v1_18 = ["gst/v1_18", "gstreamer-allocators-sys/v1_18", "v1_16"] v1_18 = ["gst/v1_18", "ffi/v1_18", "v1_16"]
v1_20 = ["gst/v1_20", "gstreamer-allocators-sys/v1_20", "v1_18"] v1_20 = ["gst/v1_20", "ffi/v1_20", "v1_18"]
v1_22 = ["gst/v1_22", "gstreamer-allocators-sys/v1_22", "v1_20"] v1_22 = ["gst/v1_22", "ffi/v1_22", "v1_20"]
v1_24 = ["gst/v1_24", "gstreamer-allocators-sys/v1_24", "v1_22"] v1_24 = ["gst/v1_24", "ffi/v1_24", "v1_22"]
v1_26 = ["gst/v1_26", "gstreamer-allocators-sys/v1_26", "v1_24"]
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true

View file

@ -3,7 +3,6 @@
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT // DO NOT EDIT
use crate::ffi;
use glib::GStr; use glib::GStr;
#[doc(alias = "GST_ALLOCATOR_DMABUF")] #[doc(alias = "GST_ALLOCATOR_DMABUF")]

View file

@ -3,7 +3,7 @@
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT // DO NOT EDIT
use crate::{ffi, FdAllocator}; use crate::FdAllocator;
use glib::{prelude::*, translate::*}; use glib::{prelude::*, translate::*};
glib::wrapper! { glib::wrapper! {

View file

@ -3,7 +3,6 @@
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT // DO NOT EDIT
use crate::ffi;
use glib::{prelude::*, translate::*}; use glib::{prelude::*, translate::*};
glib::wrapper! { glib::wrapper! {

View file

@ -3,7 +3,6 @@
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT // DO NOT EDIT
use crate::ffi;
use glib::{prelude::*, translate::*}; use glib::{prelude::*, translate::*};
glib::wrapper! { glib::wrapper! {

View file

@ -3,7 +3,6 @@
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT // DO NOT EDIT
use crate::ffi;
use glib::{bitflags::bitflags, translate::*}; use glib::{bitflags::bitflags, translate::*};
bitflags! { bitflags! {

View file

@ -3,7 +3,6 @@
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT // DO NOT EDIT
use crate::ffi;
use glib::prelude::*; use glib::prelude::*;
glib::wrapper! { glib::wrapper! {

View file

@ -3,7 +3,7 @@
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT // DO NOT EDIT
use crate::{ffi, FdAllocator}; use crate::FdAllocator;
glib::wrapper! { glib::wrapper! {
#[doc(alias = "GstShmAllocator")] #[doc(alias = "GstShmAllocator")]

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ a11b11f2e403) Generated by gir (https://github.com/gtk-rs/gir @ 0e476ab5c1de)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd) from gir-files (https://github.com/gtk-rs/gir-files @ cfc0305f903b)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5) from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 39e21eeb5d10)

View file

@ -9,7 +9,7 @@ use gst::{Memory, MemoryRef};
#[cfg(feature = "v1_16")] #[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
use crate::FdMemoryFlags; use crate::FdMemoryFlags;
use crate::{ffi, DmaBufAllocator, FdMemory, FdMemoryRef}; use crate::{DmaBufAllocator, FdMemory, FdMemoryRef};
gst::memory_object_wrapper!( gst::memory_object_wrapper!(
DmaBufMemory, DmaBufMemory,

View file

@ -3,7 +3,7 @@ use std::{fmt, mem, os::unix::prelude::IntoRawFd};
use glib::{prelude::*, translate::*}; use glib::{prelude::*, translate::*};
use gst::{Memory, MemoryRef}; use gst::{Memory, MemoryRef};
use crate::{ffi, DRMDumbAllocator, DmaBufMemory}; use crate::{DRMDumbAllocator, DmaBufMemory};
gst::memory_object_wrapper!( gst::memory_object_wrapper!(
DRMDumbMemory, DRMDumbMemory,

View file

@ -3,7 +3,7 @@ use std::{fmt, os::unix::prelude::RawFd};
use glib::{prelude::*, translate::*}; use glib::{prelude::*, translate::*};
use gst::{Memory, MemoryRef}; use gst::{Memory, MemoryRef};
use crate::{ffi, FdAllocator, FdMemoryFlags}; use crate::{FdAllocator, FdMemoryFlags};
gst::memory_object_wrapper!( gst::memory_object_wrapper!(
FdMemory, FdMemory,

View file

@ -4,9 +4,9 @@
#![allow(clippy::missing_safety_doc)] #![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi;
pub use glib; pub use glib;
pub use gst; pub use gst;
pub use gstreamer_allocators_sys as ffi;
macro_rules! assert_initialized_main_thread { macro_rules! assert_initialized_main_thread {
() => { () => {
@ -56,8 +56,6 @@ pub use phys_memory::*;
pub mod prelude { pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use gst::prelude::*; pub use gst::prelude::*;
pub use crate::auto::traits::*;
} }
pub mod subclass; pub mod subclass;

View file

@ -1,6 +1,5 @@
use std::fmt; use std::fmt;
use crate::ffi;
use glib::translate::*; use glib::translate::*;
use gst::{Memory, MemoryRef}; use gst::{Memory, MemoryRef};

View file

@ -1,6 +1,6 @@
use glib::translate::*; use glib::translate::*;
use crate::{ffi, ShmAllocator}; use crate::ShmAllocator;
impl ShmAllocator { impl ShmAllocator {
#[doc(alias = "gst_shm_allocator_get")] #[doc(alias = "gst_shm_allocator_get")]

View file

@ -1,5 +1,5 @@
[build-dependencies] [build-dependencies]
system-deps = "7" system-deps = "6"
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"
@ -23,7 +23,6 @@ v1_18 = ["v1_16"]
v1_20 = ["v1_18"] v1_20 = ["v1_18"]
v1_22 = ["v1_20"] v1_22 = ["v1_20"]
v1_24 = ["v1_22"] v1_24 = ["v1_22"]
v1_26 = ["v1_24"]
[lib] [lib]
name = "gstreamer_allocators_sys" name = "gstreamer_allocators_sys"
@ -78,7 +77,4 @@ version = "1.20"
version = "1.22" version = "1.22"
[package.metadata.system-deps.gstreamer_allocators_1_0.v1_24] [package.metadata.system-deps.gstreamer_allocators_1_0.v1_24]
version = "1.24" version = "1.23"
[package.metadata.system-deps.gstreamer_allocators_1_0.v1_26]
version = "1.25"

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ a11b11f2e403) Generated by gir (https://github.com/gtk-rs/gir @ 0e476ab5c1de)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd) from gir-files (https://github.com/gtk-rs/gir-files @ cfc0305f903b)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5) from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 39e21eeb5d10)

View file

@ -16,14 +16,10 @@ use glib_sys as glib;
use gobject_sys as gobject; use gobject_sys as gobject;
use gstreamer_sys as gst; use gstreamer_sys as gst;
#[cfg(unix)]
#[allow(unused_imports)] #[allow(unused_imports)]
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t}; use libc::{
#[allow(unused_imports)]
use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE};
#[allow(unused_imports)]
use std::ffi::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, uintptr_t, FILE,
}; };
#[allow(unused_imports)] #[allow(unused_imports)]
@ -118,7 +114,6 @@ impl ::std::fmt::Debug for GstShmAllocatorClass {
// Classes // Classes
#[repr(C)] #[repr(C)]
#[allow(dead_code)]
pub struct GstDRMDumbAllocator { pub struct GstDRMDumbAllocator {
_data: [u8; 0], _data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
@ -161,7 +156,6 @@ impl ::std::fmt::Debug for GstFdAllocator {
} }
#[repr(C)] #[repr(C)]
#[allow(dead_code)]
pub struct GstShmAllocator { pub struct GstShmAllocator {
_data: [u8; 0], _data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
@ -176,7 +170,6 @@ impl ::std::fmt::Debug for GstShmAllocator {
// Interfaces // Interfaces
#[repr(C)] #[repr(C)]
#[allow(dead_code)]
pub struct GstPhysMemoryAllocator { pub struct GstPhysMemoryAllocator {
_data: [u8; 0], _data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
@ -188,6 +181,7 @@ impl ::std::fmt::Debug for GstPhysMemoryAllocator {
} }
} }
#[link(name = "gstallocators-1.0")]
extern "C" { extern "C" {
//========================================================================= //=========================================================================

View file

@ -15,7 +15,7 @@ rust-version.workspace = true
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"
gstreamer-analytics-sys.workspace = true ffi = { package = "gstreamer-analytics-sys", path = "sys", version = "0.22" }
glib.workspace = true glib.workspace = true
gst.workspace = true gst.workspace = true
@ -24,7 +24,6 @@ gir-format-check = "0.1"
[features] [features]
default = [] default = []
v1_26 = ["gst/v1_26", "gstreamer-analytics-sys/v1_26"]
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true

View file

@ -3,7 +3,6 @@
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT // DO NOT EDIT
use crate::ffi;
use glib::{bitflags::bitflags, translate::*}; use glib::{bitflags::bitflags, translate::*};
bitflags! { bitflags! {

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ a11b11f2e403) Generated by gir (https://github.com/gtk-rs/gir @ 0e476ab5c1de)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd) from gir-files (https://github.com/gtk-rs/gir-files @ cfc0305f903b)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5) from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 39e21eeb5d10)

View file

@ -2,7 +2,7 @@
use glib::translate::*; use glib::translate::*;
use crate::{ffi, relation_meta::*}; use crate::relation_meta::*;
#[derive(Debug)] #[derive(Debug)]
pub enum AnalyticsClassificationMtd {} pub enum AnalyticsClassificationMtd {}

View file

@ -4,9 +4,9 @@
#![allow(clippy::missing_safety_doc)] #![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi;
pub use glib; pub use glib;
pub use gst; pub use gst;
pub use gstreamer_analytics_sys as ffi;
macro_rules! skip_assert_initialized { macro_rules! skip_assert_initialized {
() => {}; () => {};

View file

@ -2,7 +2,7 @@
use glib::translate::*; use glib::translate::*;
use crate::{ffi, relation_meta::*}; use crate::relation_meta::*;
#[derive(Debug)] #[derive(Debug)]
pub enum AnalyticsODMtd {} pub enum AnalyticsODMtd {}
@ -82,15 +82,11 @@ unsafe fn from(t: ffi::GstAnalyticsMtd) -> ffi::GstAnalyticsODMtd {
impl<'a> AnalyticsMtdRef<'a, AnalyticsODMtd> { impl<'a> AnalyticsMtdRef<'a, AnalyticsODMtd> {
#[doc(alias = "gst_analytics_od_mtd_get_obj_type")] #[doc(alias = "gst_analytics_od_mtd_get_obj_type")]
pub fn obj_type(&self) -> Option<glib::Quark> { pub fn obj_type(&self) -> glib::Quark {
unsafe { unsafe {
let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self));
let type_ = ffi::gst_analytics_od_mtd_get_obj_type(&mut mtd); let type_ = ffi::gst_analytics_od_mtd_get_obj_type(&mut mtd);
if type_ == 0 { glib::Quark::from_glib(type_)
None
} else {
Some(glib::Quark::from_glib(type_))
}
} }
} }
@ -147,7 +143,7 @@ mod tests {
.add_od_mtd(glib::Quark::from_str("blb"), 0, 1, 10, 20, 0.8) .add_od_mtd(glib::Quark::from_str("blb"), 0, 1, 10, 20, 0.8)
.unwrap(); .unwrap();
assert_eq!(od.obj_type().unwrap(), glib::Quark::from_str("blb")); assert_eq!(od.obj_type(), glib::Quark::from_str("blb"));
let loc = od.location().unwrap(); let loc = od.location().unwrap();
@ -163,7 +159,7 @@ mod tests {
let meta2 = buf.meta::<AnalyticsRelationMeta>().unwrap(); let meta2 = buf.meta::<AnalyticsRelationMeta>().unwrap();
let od2 = meta2.mtd::<AnalyticsODMtd>(0).unwrap(); let od2 = meta2.mtd::<AnalyticsODMtd>(0).unwrap();
assert_eq!(od2.obj_type().unwrap(), glib::Quark::from_str("blb")); assert_eq!(od2.obj_type(), glib::Quark::from_str("blb"));
let loc = od2.location().unwrap(); let loc = od2.location().unwrap();
assert_eq!(loc.x, 0); assert_eq!(loc.x, 0);

View file

@ -4,7 +4,7 @@ use glib::translate::*;
use gst::prelude::*; use gst::prelude::*;
use std::marker::PhantomData; use std::marker::PhantomData;
use crate::{ffi, RelTypes}; use crate::RelTypes;
#[repr(transparent)] #[repr(transparent)]
#[doc(alias = "GstAnalyticsRelationMeta")] #[doc(alias = "GstAnalyticsRelationMeta")]
@ -484,7 +484,7 @@ macro_rules! define_mtd_iter {
meta, meta,
state: std::ptr::null_mut(), state: std::ptr::null_mut(),
mtd_type: T::mtd_type(), mtd_type: T::mtd_type(),
an_meta_id: u32::MAX, an_meta_id: std::u32::MAX,
rel_type: RelTypes::ANY.into_glib(), rel_type: RelTypes::ANY.into_glib(),
phantom: PhantomData, phantom: PhantomData,
} }
@ -513,7 +513,7 @@ macro_rules! define_mtd_iter {
unsafe { unsafe {
let mut mtd = ffi::GstAnalyticsMtd::unsafe_from(&**self.meta); let mut mtd = ffi::GstAnalyticsMtd::unsafe_from(&**self.meta);
let ret = { let ret = {
if self.an_meta_id == u32::MAX { if self.an_meta_id == std::u32::MAX {
ffi::gst_analytics_relation_meta_iterate( ffi::gst_analytics_relation_meta_iterate(
self.meta.as_mut_ptr(), self.meta.as_mut_ptr(),
&mut self.state, &mut self.state,
@ -652,13 +652,13 @@ mod tests {
assert_eq!(meta.len(), meta.iter::<AnalyticsAnyMtd>().count()); assert_eq!(meta.len(), meta.iter::<AnalyticsAnyMtd>().count());
assert_eq!(meta.len(), meta.iter::<AnalyticsODMtd>().count()); assert_eq!(meta.len(), meta.iter::<AnalyticsODMtd>().count());
for mtd in meta.iter::<AnalyticsODMtd>() { for mtd in meta.iter::<AnalyticsODMtd>() {
assert_eq!(mtd.obj_type().unwrap(), glib::Quark::from_str("blb")) assert_eq!(mtd.obj_type(), glib::Quark::from_str("blb"))
} }
assert_eq!(meta.len(), meta.iter::<AnalyticsAnyMtd>().count()); assert_eq!(meta.len(), meta.iter::<AnalyticsAnyMtd>().count());
for mtd in meta.iter::<AnalyticsAnyMtd>() { for mtd in meta.iter::<AnalyticsAnyMtd>() {
if let Ok(mtd) = mtd.downcast::<AnalyticsODMtd>() { if let Ok(mtd) = mtd.downcast::<AnalyticsODMtd>() {
assert_eq!(mtd.obj_type().unwrap(), glib::Quark::from_str("blb")) assert_eq!(mtd.obj_type(), glib::Quark::from_str("blb"))
} }
} }
@ -689,7 +689,7 @@ mod tests {
0 0
); );
for mtd in meta.iter_direct_related::<AnalyticsODMtd>(od1_id, crate::RelTypes::IS_PART_OF) { for mtd in meta.iter_direct_related::<AnalyticsODMtd>(od1_id, crate::RelTypes::IS_PART_OF) {
assert_eq!(mtd.obj_type().unwrap(), glib::Quark::from_str("blb")) assert_eq!(mtd.obj_type(), glib::Quark::from_str("blb"))
} }
let mut meta = buf.make_mut().meta_mut::<AnalyticsRelationMeta>().unwrap(); let mut meta = buf.make_mut().meta_mut::<AnalyticsRelationMeta>().unwrap();

View file

@ -2,7 +2,7 @@
use glib::translate::*; use glib::translate::*;
use crate::{ffi, relation_meta::*}; use crate::relation_meta::*;
#[derive(Debug)] #[derive(Debug)]
pub enum AnalyticsTrackingMtd {} pub enum AnalyticsTrackingMtd {}

View file

@ -1,5 +1,5 @@
[build-dependencies] [build-dependencies]
system-deps = "7" system-deps = "6"
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"
@ -52,10 +52,6 @@ rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
[package.metadata.system-deps.gstreamer_analytics_1_0] [package.metadata.system-deps.gstreamer_analytics_1_0]
name = "gstreamer-analytics-1.0" name = "gstreamer-analytics-1.0"
version = "1.24" version = "1.23"
[package.metadata.system-deps.gstreamer_analytics_1_0.v1_26]
version = "1.25"
[features] [features]
v1_26 = []

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ a11b11f2e403) Generated by gir (https://github.com/gtk-rs/gir @ 0e476ab5c1de)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd) from gir-files (https://github.com/gtk-rs/gir-files @ cfc0305f903b)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5) from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 39e21eeb5d10)

View file

@ -15,14 +15,10 @@
use glib_sys as glib; use glib_sys as glib;
use gstreamer_sys as gst; use gstreamer_sys as gst;
#[cfg(unix)]
#[allow(unused_imports)] #[allow(unused_imports)]
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t}; use libc::{
#[allow(unused_imports)]
use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE};
#[allow(unused_imports)]
use std::ffi::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, uintptr_t, FILE,
}; };
#[allow(unused_imports)] #[allow(unused_imports)]
@ -32,6 +28,7 @@ use glib::{gboolean, gconstpointer, gpointer, GType};
pub type GstAnalyticsMtdType = uintptr_t; pub type GstAnalyticsMtdType = uintptr_t;
// Constants // Constants
pub const GST_AN_RELATION_META_TAG: &[u8] = b"GST-ANALYSIS-RELATION-META-TAG\0";
pub const GST_INF_RELATION_SPAN: c_int = -1; pub const GST_INF_RELATION_SPAN: c_int = -1;
pub const GST_ANALYTICS_MTD_TYPE_ANY: c_int = 0; pub const GST_ANALYTICS_MTD_TYPE_ANY: c_int = 0;
@ -98,6 +95,7 @@ impl ::std::fmt::Debug for GstAnalyticsMtdImpl {
f.debug_struct(&format!("GstAnalyticsMtdImpl @ {self:p}")) f.debug_struct(&format!("GstAnalyticsMtdImpl @ {self:p}"))
.field("name", &self.name) .field("name", &self.name)
.field("mtd_meta_transform", &self.mtd_meta_transform) .field("mtd_meta_transform", &self.mtd_meta_transform)
.field("_reserved", &self._reserved)
.finish() .finish()
} }
} }
@ -119,7 +117,6 @@ impl ::std::fmt::Debug for GstAnalyticsODMtd {
} }
#[repr(C)] #[repr(C)]
#[allow(dead_code)]
pub struct _GstAnalyticsRelationMeta { pub struct _GstAnalyticsRelationMeta {
_data: [u8; 0], _data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
@ -159,6 +156,7 @@ impl ::std::fmt::Debug for GstAnalyticsTrackingMtd {
} }
} }
#[link(name = "gstanalytics-1.0")]
extern "C" { extern "C" {
//========================================================================= //=========================================================================

View file

@ -268,5 +268,6 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(guint) GST_ANALYTICS_REL_TYPE_LAST", "16"), ("(guint) GST_ANALYTICS_REL_TYPE_LAST", "16"),
("(guint) GST_ANALYTICS_REL_TYPE_NONE", "0"), ("(guint) GST_ANALYTICS_REL_TYPE_NONE", "0"),
("(guint) GST_ANALYTICS_REL_TYPE_RELATE_TO", "8"), ("(guint) GST_ANALYTICS_REL_TYPE_RELATE_TO", "8"),
("GST_AN_RELATION_META_TAG", "GST-ANALYSIS-RELATION-META-TAG"),
("GST_INF_RELATION_SPAN", "-1"), ("GST_INF_RELATION_SPAN", "-1"),
]; ];

View file

@ -36,6 +36,7 @@ int main() {
PRINT_CONSTANT((guint) GST_ANALYTICS_REL_TYPE_LAST); PRINT_CONSTANT((guint) GST_ANALYTICS_REL_TYPE_LAST);
PRINT_CONSTANT((guint) GST_ANALYTICS_REL_TYPE_NONE); PRINT_CONSTANT((guint) GST_ANALYTICS_REL_TYPE_NONE);
PRINT_CONSTANT((guint) GST_ANALYTICS_REL_TYPE_RELATE_TO); PRINT_CONSTANT((guint) GST_ANALYTICS_REL_TYPE_RELATE_TO);
PRINT_CONSTANT(GST_AN_RELATION_META_TAG);
PRINT_CONSTANT(GST_INF_RELATION_SPAN); PRINT_CONSTANT(GST_INF_RELATION_SPAN);
return 0; return 0;
} }

View file

@ -17,7 +17,7 @@ rust-version.workspace = true
futures-core = "0.3" futures-core = "0.3"
futures-sink = "0.3" futures-sink = "0.3"
libc = "0.2" libc = "0.2"
gstreamer-app-sys.workspace = true ffi = { package = "gstreamer-app-sys", path = "sys", version = "0.22" }
glib.workspace = true glib.workspace = true
gst.workspace = true gst.workspace = true
gst-base.workspace = true gst-base.workspace = true
@ -29,12 +29,11 @@ gir-format-check = "0.1"
[features] [features]
default = [] default = []
v1_16 = ["gst/v1_16", "gst-base/v1_16", "gstreamer-app-sys/v1_16"] v1_16 = ["gst/v1_16", "gst-base/v1_16", "ffi/v1_16"]
v1_18 = ["gst/v1_18", "gst-base/v1_18", "gstreamer-app-sys/v1_18", "v1_16"] v1_18 = ["gst/v1_18", "gst-base/v1_18", "ffi/v1_18", "v1_16"]
v1_20 = ["gst/v1_20", "gst-base/v1_20", "gstreamer-app-sys/v1_20", "v1_18"] v1_20 = ["gst/v1_20", "gst-base/v1_20", "ffi/v1_20", "v1_18"]
v1_22 = ["gst/v1_22", "gst-base/v1_22", "gstreamer-app-sys/v1_22", "v1_20"] v1_22 = ["gst/v1_22", "gst-base/v1_22", "ffi/v1_22", "v1_20"]
v1_24 = ["gst/v1_24", "gst-base/v1_24", "gstreamer-app-sys/v1_24", "v1_22"] v1_24 = ["gst/v1_24", "gst-base/v1_24", "ffi/v1_24", "v1_22"]
v1_26 = ["gst/v1_26", "gst-base/v1_26", "gstreamer-app-sys/v1_26", "v1_24"]
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true

View file

@ -4,17 +4,17 @@ use std::{
mem, panic, mem, panic,
pin::Pin, pin::Pin,
ptr, ptr,
sync::{Arc, Mutex}, sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
},
task::{Context, Poll, Waker}, task::{Context, Poll, Waker},
}; };
#[cfg(not(panic = "abort"))]
use std::sync::atomic::{AtomicBool, Ordering};
use futures_core::Stream; use futures_core::Stream;
use glib::{ffi::gpointer, prelude::*, translate::*}; use glib::{ffi::gpointer, prelude::*, translate::*};
use crate::{ffi, AppSink}; use crate::AppSink;
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
pub struct AppSinkCallbacks { pub struct AppSinkCallbacks {
@ -28,7 +28,6 @@ pub struct AppSinkCallbacks {
new_event: Option<Box<dyn FnMut(&AppSink) -> bool + Send + 'static>>, new_event: Option<Box<dyn FnMut(&AppSink) -> bool + Send + 'static>>,
propose_allocation: propose_allocation:
Option<Box<dyn FnMut(&AppSink, &mut gst::query::Allocation) -> bool + Send + 'static>>, Option<Box<dyn FnMut(&AppSink, &mut gst::query::Allocation) -> bool + Send + 'static>>,
#[cfg(not(panic = "abort"))]
panicked: AtomicBool, panicked: AtomicBool,
callbacks: ffi::GstAppSinkCallbacks, callbacks: ffi::GstAppSinkCallbacks,
} }
@ -72,22 +71,6 @@ impl AppSinkCallbacksBuilder {
} }
} }
pub fn eos_if<F: FnMut(&AppSink) + Send + 'static>(self, eos: F, predicate: bool) -> Self {
if predicate {
self.eos(eos)
} else {
self
}
}
pub fn eos_if_some<F: FnMut(&AppSink) + Send + 'static>(self, eos: Option<F>) -> Self {
if let Some(eos) = eos {
self.eos(eos)
} else {
self
}
}
pub fn new_preroll< pub fn new_preroll<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static, F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>( >(
@ -100,33 +83,6 @@ impl AppSinkCallbacksBuilder {
} }
} }
pub fn new_preroll_if<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
self,
new_preroll: F,
predicate: bool,
) -> Self {
if predicate {
self.new_preroll(new_preroll)
} else {
self
}
}
pub fn new_preroll_if_some<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
self,
new_preroll: Option<F>,
) -> Self {
if let Some(new_preroll) = new_preroll {
self.new_preroll(new_preroll)
} else {
self
}
}
pub fn new_sample< pub fn new_sample<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static, F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>( >(
@ -139,33 +95,6 @@ impl AppSinkCallbacksBuilder {
} }
} }
pub fn new_sample_if<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
self,
new_sample: F,
predicate: bool,
) -> Self {
if predicate {
self.new_sample(new_sample)
} else {
self
}
}
pub fn new_sample_if_some<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
self,
new_sample: Option<F>,
) -> Self {
if let Some(new_sample) = new_sample {
self.new_sample(new_sample)
} else {
self
}
}
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
pub fn new_event<F: FnMut(&AppSink) -> bool + Send + 'static>(self, new_event: F) -> Self { pub fn new_event<F: FnMut(&AppSink) -> bool + Send + 'static>(self, new_event: F) -> Self {
@ -175,33 +104,6 @@ impl AppSinkCallbacksBuilder {
} }
} }
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
pub fn new_event_if<F: FnMut(&AppSink) -> bool + Send + 'static>(
self,
new_event: F,
predicate: bool,
) -> Self {
if predicate {
self.new_event(new_event)
} else {
self
}
}
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
pub fn new_event_if_some<F: FnMut(&AppSink) -> bool + Send + 'static>(
self,
new_event: Option<F>,
) -> Self {
if let Some(new_event) = new_event {
self.new_event(new_event)
} else {
self
}
}
#[cfg(feature = "v1_24")] #[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub fn propose_allocation< pub fn propose_allocation<
@ -216,37 +118,6 @@ impl AppSinkCallbacksBuilder {
} }
} }
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub fn propose_allocation_if<
F: FnMut(&AppSink, &mut gst::query::Allocation) -> bool + Send + 'static,
>(
self,
propose_allocation: F,
predicate: bool,
) -> Self {
if predicate {
self.propose_allocation(propose_allocation)
} else {
self
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub fn propose_allocation_if_some<
F: FnMut(&AppSink, &mut gst::query::Allocation) -> bool + Send + 'static,
>(
self,
propose_allocation: Option<F>,
) -> Self {
if let Some(propose_allocation) = propose_allocation {
self.propose_allocation(propose_allocation)
} else {
self
}
}
#[must_use = "Building the callbacks without using them has no effect"] #[must_use = "Building the callbacks without using them has no effect"]
pub fn build(self) -> AppSinkCallbacks { pub fn build(self) -> AppSinkCallbacks {
let have_eos = self.eos.is_some(); let have_eos = self.eos.is_some();
@ -261,7 +132,6 @@ impl AppSinkCallbacksBuilder {
new_sample: self.new_sample, new_sample: self.new_sample,
new_event: self.new_event, new_event: self.new_event,
propose_allocation: self.propose_allocation, propose_allocation: self.propose_allocation,
#[cfg(not(panic = "abort"))]
panicked: AtomicBool::new(false), panicked: AtomicBool::new(false),
callbacks: ffi::GstAppSinkCallbacks { callbacks: ffi::GstAppSinkCallbacks {
eos: if have_eos { Some(trampoline_eos) } else { None }, eos: if have_eos { Some(trampoline_eos) } else { None },
@ -295,7 +165,6 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp
let callbacks = callbacks as *mut AppSinkCallbacks; let callbacks = callbacks as *mut AppSinkCallbacks;
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
#[cfg(not(panic = "abort"))]
if (*callbacks).panicked.load(Ordering::Relaxed) { if (*callbacks).panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None); gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
@ -307,12 +176,6 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp
match result { match result {
Ok(result) => result, Ok(result) => result,
Err(err) => { Err(err) => {
#[cfg(panic = "abort")]
{
unreachable!("{err:?}");
}
#[cfg(not(panic = "abort"))]
{
(*callbacks).panicked.store(true, Ordering::Relaxed); (*callbacks).panicked.store(true, Ordering::Relaxed);
gst::subclass::post_panic_error_message( gst::subclass::post_panic_error_message(
element.upcast_ref(), element.upcast_ref(),
@ -323,7 +186,6 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp
} }
} }
} }
}
unsafe extern "C" fn trampoline_new_preroll( unsafe extern "C" fn trampoline_new_preroll(
appsink: *mut ffi::GstAppSink, appsink: *mut ffi::GstAppSink,
@ -332,7 +194,6 @@ unsafe extern "C" fn trampoline_new_preroll(
let callbacks = callbacks as *mut AppSinkCallbacks; let callbacks = callbacks as *mut AppSinkCallbacks;
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
#[cfg(not(panic = "abort"))]
if (*callbacks).panicked.load(Ordering::Relaxed) { if (*callbacks).panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None); gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
@ -344,12 +205,6 @@ unsafe extern "C" fn trampoline_new_preroll(
match result { match result {
Ok(result) => result, Ok(result) => result,
Err(err) => { Err(err) => {
#[cfg(panic = "abort")]
{
unreachable!("{err:?}");
}
#[cfg(not(panic = "abort"))]
{
(*callbacks).panicked.store(true, Ordering::Relaxed); (*callbacks).panicked.store(true, Ordering::Relaxed);
gst::subclass::post_panic_error_message( gst::subclass::post_panic_error_message(
element.upcast_ref(), element.upcast_ref(),
@ -360,7 +215,6 @@ unsafe extern "C" fn trampoline_new_preroll(
gst::FlowReturn::Error gst::FlowReturn::Error
} }
} }
}
} else { } else {
gst::FlowReturn::Error gst::FlowReturn::Error
}; };
@ -375,7 +229,6 @@ unsafe extern "C" fn trampoline_new_sample(
let callbacks = callbacks as *mut AppSinkCallbacks; let callbacks = callbacks as *mut AppSinkCallbacks;
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
#[cfg(not(panic = "abort"))]
if (*callbacks).panicked.load(Ordering::Relaxed) { if (*callbacks).panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None); gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
@ -387,12 +240,6 @@ unsafe extern "C" fn trampoline_new_sample(
match result { match result {
Ok(result) => result, Ok(result) => result,
Err(err) => { Err(err) => {
#[cfg(panic = "abort")]
{
unreachable!("{err:?}");
}
#[cfg(not(panic = "abort"))]
{
(*callbacks).panicked.store(true, Ordering::Relaxed); (*callbacks).panicked.store(true, Ordering::Relaxed);
gst::subclass::post_panic_error_message( gst::subclass::post_panic_error_message(
element.upcast_ref(), element.upcast_ref(),
@ -403,7 +250,6 @@ unsafe extern "C" fn trampoline_new_sample(
gst::FlowReturn::Error gst::FlowReturn::Error
} }
} }
}
} else { } else {
gst::FlowReturn::Error gst::FlowReturn::Error
}; };
@ -418,7 +264,6 @@ unsafe extern "C" fn trampoline_new_event(
let callbacks = callbacks as *mut AppSinkCallbacks; let callbacks = callbacks as *mut AppSinkCallbacks;
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
#[cfg(not(panic = "abort"))]
if (*callbacks).panicked.load(Ordering::Relaxed) { if (*callbacks).panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None); gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
@ -430,12 +275,6 @@ unsafe extern "C" fn trampoline_new_event(
match result { match result {
Ok(result) => result, Ok(result) => result,
Err(err) => { Err(err) => {
#[cfg(panic = "abort")]
{
unreachable!("{err:?}");
}
#[cfg(not(panic = "abort"))]
{
(*callbacks).panicked.store(true, Ordering::Relaxed); (*callbacks).panicked.store(true, Ordering::Relaxed);
gst::subclass::post_panic_error_message( gst::subclass::post_panic_error_message(
element.upcast_ref(), element.upcast_ref(),
@ -446,7 +285,6 @@ unsafe extern "C" fn trampoline_new_event(
false false
} }
} }
}
} else { } else {
false false
}; };
@ -462,7 +300,6 @@ unsafe extern "C" fn trampoline_propose_allocation(
let callbacks = callbacks as *mut AppSinkCallbacks; let callbacks = callbacks as *mut AppSinkCallbacks;
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
#[cfg(not(panic = "abort"))]
if (*callbacks).panicked.load(Ordering::Relaxed) { if (*callbacks).panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None); gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
@ -480,22 +317,16 @@ unsafe extern "C" fn trampoline_propose_allocation(
match result { match result {
Ok(result) => result, Ok(result) => result,
Err(err) => { Err(err) => {
#[cfg(panic = "abort")]
{
unreachable!("{err:?}");
}
#[cfg(not(panic = "abort"))]
{
(*callbacks).panicked.store(true, Ordering::Relaxed); (*callbacks).panicked.store(true, Ordering::Relaxed);
gst::subclass::post_panic_error_message( gst::subclass::post_panic_error_message(
element.upcast_ref(), element.upcast_ref(),
element.upcast_ref(), element.upcast_ref(),
Some(err), Some(err),
); );
false false
} }
} }
}
} else { } else {
false false
}; };
@ -821,7 +652,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::async\0".as_ptr() as *const _, b"notify::async\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_async_trampoline::<F> as *const (), notify_async_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -849,7 +680,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::blocksize\0".as_ptr() as *const _, b"notify::blocksize\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_blocksize_trampoline::<F> as *const (), notify_blocksize_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -877,7 +708,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::enable-last-sample\0".as_ptr() as *const _, b"notify::enable-last-sample\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_enable_last_sample_trampoline::<F> as *const (), notify_enable_last_sample_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -905,7 +736,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::last-sample\0".as_ptr() as *const _, b"notify::last-sample\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_last_sample_trampoline::<F> as *const (), notify_last_sample_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -933,7 +764,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::max-bitrate\0".as_ptr() as *const _, b"notify::max-bitrate\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_max_bitrate_trampoline::<F> as *const (), notify_max_bitrate_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -961,7 +792,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::max-lateness\0".as_ptr() as *const _, b"notify::max-lateness\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_max_lateness_trampoline::<F> as *const (), notify_max_lateness_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -991,7 +822,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::processing-deadline\0".as_ptr() as *const _, b"notify::processing-deadline\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_processing_deadline_trampoline::<F> as *const (), notify_processing_deadline_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -1017,7 +848,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::qos\0".as_ptr() as *const _, b"notify::qos\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_qos_trampoline::<F> as *const (), notify_qos_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -1045,7 +876,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::render-delay\0".as_ptr() as *const _, b"notify::render-delay\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_render_delay_trampoline::<F> as *const (), notify_render_delay_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -1073,7 +904,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::stats\0".as_ptr() as *const _, b"notify::stats\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_stats_trampoline::<F> as *const (), notify_stats_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -1099,7 +930,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::sync\0".as_ptr() as *const _, b"notify::sync\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_sync_trampoline::<F> as *const (), notify_sync_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -1127,7 +958,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::throttle-time\0".as_ptr() as *const _, b"notify::throttle-time\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_throttle_time_trampoline::<F> as *const (), notify_throttle_time_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),
@ -1155,7 +986,7 @@ impl AppSink {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::ts-offset\0".as_ptr() as *const _, b"notify::ts-offset\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_ts_offset_trampoline::<F> as *const (), notify_ts_offset_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),

View file

@ -4,13 +4,13 @@ use std::{
mem, panic, mem, panic,
pin::Pin, pin::Pin,
ptr, ptr,
sync::{Arc, Mutex}, sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
},
task::{Context, Poll, Waker}, task::{Context, Poll, Waker},
}; };
#[cfg(not(panic = "abort"))]
use std::sync::atomic::{AtomicBool, Ordering};
use futures_sink::Sink; use futures_sink::Sink;
use glib::{ use glib::{
ffi::{gboolean, gpointer}, ffi::{gboolean, gpointer},
@ -18,14 +18,13 @@ use glib::{
translate::*, translate::*,
}; };
use crate::{ffi, AppSrc}; use crate::AppSrc;
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
pub struct AppSrcCallbacks { pub struct AppSrcCallbacks {
need_data: Option<Box<dyn FnMut(&AppSrc, u32) + Send + 'static>>, need_data: Option<Box<dyn FnMut(&AppSrc, u32) + Send + 'static>>,
enough_data: Option<Box<dyn Fn(&AppSrc) + Send + Sync + 'static>>, enough_data: Option<Box<dyn Fn(&AppSrc) + Send + Sync + 'static>>,
seek_data: Option<Box<dyn Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>>, seek_data: Option<Box<dyn Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>>,
#[cfg(not(panic = "abort"))]
panicked: AtomicBool, panicked: AtomicBool,
callbacks: ffi::GstAppSrcCallbacks, callbacks: ffi::GstAppSrcCallbacks,
} }
@ -61,29 +60,6 @@ impl AppSrcCallbacksBuilder {
} }
} }
pub fn need_data_if<F: FnMut(&AppSrc, u32) + Send + 'static>(
self,
need_data: F,
predicate: bool,
) -> Self {
if predicate {
self.need_data(need_data)
} else {
self
}
}
pub fn need_data_if_some<F: FnMut(&AppSrc, u32) + Send + 'static>(
self,
need_data: Option<F>,
) -> Self {
if let Some(need_data) = need_data {
self.need_data(need_data)
} else {
self
}
}
pub fn enough_data<F: Fn(&AppSrc) + Send + Sync + 'static>(self, enough_data: F) -> Self { pub fn enough_data<F: Fn(&AppSrc) + Send + Sync + 'static>(self, enough_data: F) -> Self {
Self { Self {
enough_data: Some(Box::new(enough_data)), enough_data: Some(Box::new(enough_data)),
@ -91,29 +67,6 @@ impl AppSrcCallbacksBuilder {
} }
} }
pub fn enough_data_if<F: Fn(&AppSrc) + Send + Sync + 'static>(
self,
enough_data: F,
predicate: bool,
) -> Self {
if predicate {
self.enough_data(enough_data)
} else {
self
}
}
pub fn enough_data_if_some<F: Fn(&AppSrc) + Send + Sync + 'static>(
self,
enough_data: Option<F>,
) -> Self {
if let Some(enough_data) = enough_data {
self.enough_data(enough_data)
} else {
self
}
}
pub fn seek_data<F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>( pub fn seek_data<F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>(
self, self,
seek_data: F, seek_data: F,
@ -124,29 +77,6 @@ impl AppSrcCallbacksBuilder {
} }
} }
pub fn seek_data_if<F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>(
self,
seek_data: F,
predicate: bool,
) -> Self {
if predicate {
self.seek_data(seek_data)
} else {
self
}
}
pub fn seek_data_if_some<F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>(
self,
seek_data: Option<F>,
) -> Self {
if let Some(seek_data) = seek_data {
self.seek_data(seek_data)
} else {
self
}
}
#[must_use = "Building the callbacks without using them has no effect"] #[must_use = "Building the callbacks without using them has no effect"]
pub fn build(self) -> AppSrcCallbacks { pub fn build(self) -> AppSrcCallbacks {
let have_need_data = self.need_data.is_some(); let have_need_data = self.need_data.is_some();
@ -157,7 +87,6 @@ impl AppSrcCallbacksBuilder {
need_data: self.need_data, need_data: self.need_data,
enough_data: self.enough_data, enough_data: self.enough_data,
seek_data: self.seek_data, seek_data: self.seek_data,
#[cfg(not(panic = "abort"))]
panicked: AtomicBool::new(false), panicked: AtomicBool::new(false),
callbacks: ffi::GstAppSrcCallbacks { callbacks: ffi::GstAppSrcCallbacks {
need_data: if have_need_data { need_data: if have_need_data {
@ -194,7 +123,6 @@ unsafe extern "C" fn trampoline_need_data(
let callbacks = callbacks as *mut AppSrcCallbacks; let callbacks = callbacks as *mut AppSrcCallbacks;
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
#[cfg(not(panic = "abort"))]
if (*callbacks).panicked.load(Ordering::Relaxed) { if (*callbacks).panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None); gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
@ -206,12 +134,6 @@ unsafe extern "C" fn trampoline_need_data(
match result { match result {
Ok(result) => result, Ok(result) => result,
Err(err) => { Err(err) => {
#[cfg(panic = "abort")]
{
unreachable!("{err:?}");
}
#[cfg(not(panic = "abort"))]
{
(*callbacks).panicked.store(true, Ordering::Relaxed); (*callbacks).panicked.store(true, Ordering::Relaxed);
gst::subclass::post_panic_error_message( gst::subclass::post_panic_error_message(
element.upcast_ref(), element.upcast_ref(),
@ -222,13 +144,11 @@ unsafe extern "C" fn trampoline_need_data(
} }
} }
} }
}
unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbacks: gpointer) { unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbacks: gpointer) {
let callbacks = callbacks as *const AppSrcCallbacks; let callbacks = callbacks as *const AppSrcCallbacks;
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
#[cfg(not(panic = "abort"))]
if (*callbacks).panicked.load(Ordering::Relaxed) { if (*callbacks).panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None); gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
@ -240,12 +160,6 @@ unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbac
match result { match result {
Ok(result) => result, Ok(result) => result,
Err(err) => { Err(err) => {
#[cfg(panic = "abort")]
{
unreachable!("{err:?}");
}
#[cfg(not(panic = "abort"))]
{
(*callbacks).panicked.store(true, Ordering::Relaxed); (*callbacks).panicked.store(true, Ordering::Relaxed);
gst::subclass::post_panic_error_message( gst::subclass::post_panic_error_message(
element.upcast_ref(), element.upcast_ref(),
@ -256,7 +170,6 @@ unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbac
} }
} }
} }
}
unsafe extern "C" fn trampoline_seek_data( unsafe extern "C" fn trampoline_seek_data(
appsrc: *mut ffi::GstAppSrc, appsrc: *mut ffi::GstAppSrc,
@ -266,7 +179,6 @@ unsafe extern "C" fn trampoline_seek_data(
let callbacks = callbacks as *const AppSrcCallbacks; let callbacks = callbacks as *const AppSrcCallbacks;
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
#[cfg(not(panic = "abort"))]
if (*callbacks).panicked.load(Ordering::Relaxed) { if (*callbacks).panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None); gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
@ -278,12 +190,6 @@ unsafe extern "C" fn trampoline_seek_data(
match result { match result {
Ok(result) => result, Ok(result) => result,
Err(err) => { Err(err) => {
#[cfg(panic = "abort")]
{
unreachable!("{err:?}");
}
#[cfg(not(panic = "abort"))]
{
(*callbacks).panicked.store(true, Ordering::Relaxed); (*callbacks).panicked.store(true, Ordering::Relaxed);
gst::subclass::post_panic_error_message( gst::subclass::post_panic_error_message(
element.upcast_ref(), element.upcast_ref(),
@ -294,7 +200,6 @@ unsafe extern "C" fn trampoline_seek_data(
false false
} }
} }
}
} else { } else {
false false
}; };
@ -424,7 +329,7 @@ impl AppSrc {
glib::signal::connect_raw( glib::signal::connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::do-timestamp\0".as_ptr() as *const _, b"notify::do-timestamp\0".as_ptr() as *const _,
Some(mem::transmute::<*const (), unsafe extern "C" fn()>( Some(mem::transmute::<_, unsafe extern "C" fn()>(
notify_do_timestamp_trampoline::<F> as *const (), notify_do_timestamp_trampoline::<F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),

View file

@ -3,7 +3,6 @@
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT // DO NOT EDIT
use crate::ffi;
use glib::{ use glib::{
prelude::*, prelude::*,
signal::{connect_raw, SignalHandlerId}, signal::{connect_raw, SignalHandlerId},
@ -39,14 +38,12 @@ impl AppSink {
#[doc(alias = "gst_app_sink_get_drop")] #[doc(alias = "gst_app_sink_get_drop")]
#[doc(alias = "get_drop")] #[doc(alias = "get_drop")]
#[doc(alias = "drop")]
pub fn is_drop(&self) -> bool { pub fn is_drop(&self) -> bool {
unsafe { from_glib(ffi::gst_app_sink_get_drop(self.to_glib_none().0)) } unsafe { from_glib(ffi::gst_app_sink_get_drop(self.to_glib_none().0)) }
} }
#[doc(alias = "gst_app_sink_get_max_buffers")] #[doc(alias = "gst_app_sink_get_max_buffers")]
#[doc(alias = "get_max_buffers")] #[doc(alias = "get_max_buffers")]
#[doc(alias = "max-buffers")]
pub fn max_buffers(&self) -> u32 { pub fn max_buffers(&self) -> u32 {
unsafe { ffi::gst_app_sink_get_max_buffers(self.to_glib_none().0) } unsafe { ffi::gst_app_sink_get_max_buffers(self.to_glib_none().0) }
} }
@ -55,7 +52,6 @@ impl AppSink {
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_app_sink_get_max_bytes")] #[doc(alias = "gst_app_sink_get_max_bytes")]
#[doc(alias = "get_max_bytes")] #[doc(alias = "get_max_bytes")]
#[doc(alias = "max-bytes")]
pub fn max_bytes(&self) -> u64 { pub fn max_bytes(&self) -> u64 {
unsafe { ffi::gst_app_sink_get_max_bytes(self.to_glib_none().0) } unsafe { ffi::gst_app_sink_get_max_bytes(self.to_glib_none().0) }
} }
@ -64,14 +60,12 @@ impl AppSink {
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_app_sink_get_max_time")] #[doc(alias = "gst_app_sink_get_max_time")]
#[doc(alias = "get_max_time")] #[doc(alias = "get_max_time")]
#[doc(alias = "max-time")]
pub fn max_time(&self) -> Option<gst::ClockTime> { pub fn max_time(&self) -> Option<gst::ClockTime> {
unsafe { from_glib(ffi::gst_app_sink_get_max_time(self.to_glib_none().0)) } unsafe { from_glib(ffi::gst_app_sink_get_max_time(self.to_glib_none().0)) }
} }
#[doc(alias = "gst_app_sink_get_wait_on_eos")] #[doc(alias = "gst_app_sink_get_wait_on_eos")]
#[doc(alias = "get_wait_on_eos")] #[doc(alias = "get_wait_on_eos")]
#[doc(alias = "wait-on-eos")]
pub fn is_wait_on_eos(&self) -> bool { pub fn is_wait_on_eos(&self) -> bool {
unsafe { from_glib(ffi::gst_app_sink_get_wait_on_eos(self.to_glib_none().0)) } unsafe { from_glib(ffi::gst_app_sink_get_wait_on_eos(self.to_glib_none().0)) }
} }
@ -123,7 +117,6 @@ impl AppSink {
//} //}
#[doc(alias = "gst_app_sink_set_caps")] #[doc(alias = "gst_app_sink_set_caps")]
#[doc(alias = "caps")]
pub fn set_caps(&self, caps: Option<&gst::Caps>) { pub fn set_caps(&self, caps: Option<&gst::Caps>) {
unsafe { unsafe {
ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.to_glib_none().0); ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
@ -131,7 +124,6 @@ impl AppSink {
} }
#[doc(alias = "gst_app_sink_set_drop")] #[doc(alias = "gst_app_sink_set_drop")]
#[doc(alias = "drop")]
pub fn set_drop(&self, drop: bool) { pub fn set_drop(&self, drop: bool) {
unsafe { unsafe {
ffi::gst_app_sink_set_drop(self.to_glib_none().0, drop.into_glib()); ffi::gst_app_sink_set_drop(self.to_glib_none().0, drop.into_glib());
@ -139,7 +131,6 @@ impl AppSink {
} }
#[doc(alias = "gst_app_sink_set_max_buffers")] #[doc(alias = "gst_app_sink_set_max_buffers")]
#[doc(alias = "max-buffers")]
pub fn set_max_buffers(&self, max: u32) { pub fn set_max_buffers(&self, max: u32) {
unsafe { unsafe {
ffi::gst_app_sink_set_max_buffers(self.to_glib_none().0, max); ffi::gst_app_sink_set_max_buffers(self.to_glib_none().0, max);
@ -149,7 +140,6 @@ impl AppSink {
#[cfg(feature = "v1_24")] #[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_app_sink_set_max_bytes")] #[doc(alias = "gst_app_sink_set_max_bytes")]
#[doc(alias = "max-bytes")]
pub fn set_max_bytes(&self, max: u64) { pub fn set_max_bytes(&self, max: u64) {
unsafe { unsafe {
ffi::gst_app_sink_set_max_bytes(self.to_glib_none().0, max); ffi::gst_app_sink_set_max_bytes(self.to_glib_none().0, max);
@ -159,7 +149,6 @@ impl AppSink {
#[cfg(feature = "v1_24")] #[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_app_sink_set_max_time")] #[doc(alias = "gst_app_sink_set_max_time")]
#[doc(alias = "max-time")]
pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) { pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) {
unsafe { unsafe {
ffi::gst_app_sink_set_max_time(self.to_glib_none().0, max.into().into_glib()); ffi::gst_app_sink_set_max_time(self.to_glib_none().0, max.into().into_glib());
@ -167,7 +156,6 @@ impl AppSink {
} }
#[doc(alias = "gst_app_sink_set_wait_on_eos")] #[doc(alias = "gst_app_sink_set_wait_on_eos")]
#[doc(alias = "wait-on-eos")]
pub fn set_wait_on_eos(&self, wait: bool) { pub fn set_wait_on_eos(&self, wait: bool) {
unsafe { unsafe {
ffi::gst_app_sink_set_wait_on_eos(self.to_glib_none().0, wait.into_glib()); ffi::gst_app_sink_set_wait_on_eos(self.to_glib_none().0, wait.into_glib());
@ -245,7 +233,7 @@ impl AppSink {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::buffer-list\0".as_ptr() as *const _, b"notify::buffer-list\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_buffer_list_trampoline::<F> as *const (), notify_buffer_list_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -271,7 +259,7 @@ impl AppSink {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::caps\0".as_ptr() as *const _, b"notify::caps\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_caps_trampoline::<F> as *const (), notify_caps_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -297,7 +285,7 @@ impl AppSink {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::drop\0".as_ptr() as *const _, b"notify::drop\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_drop_trampoline::<F> as *const (), notify_drop_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -323,7 +311,7 @@ impl AppSink {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::eos\0".as_ptr() as *const _, b"notify::eos\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_eos_trampoline::<F> as *const (), notify_eos_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -351,7 +339,7 @@ impl AppSink {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::max-buffers\0".as_ptr() as *const _, b"notify::max-buffers\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_max_buffers_trampoline::<F> as *const (), notify_max_buffers_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -381,7 +369,7 @@ impl AppSink {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::max-bytes\0".as_ptr() as *const _, b"notify::max-bytes\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_max_bytes_trampoline::<F> as *const (), notify_max_bytes_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -409,7 +397,7 @@ impl AppSink {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::max-time\0".as_ptr() as *const _, b"notify::max-time\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_max_time_trampoline::<F> as *const (), notify_max_time_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -437,7 +425,7 @@ impl AppSink {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::wait-on-eos\0".as_ptr() as *const _, b"notify::wait-on-eos\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_wait_on_eos_trampoline::<F> as *const (), notify_wait_on_eos_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),

View file

@ -6,7 +6,7 @@
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
use crate::AppLeakyType; use crate::AppLeakyType;
use crate::{ffi, AppStreamType}; use crate::AppStreamType;
use glib::{ use glib::{
prelude::*, prelude::*,
signal::{connect_raw, SignalHandlerId}, signal::{connect_raw, SignalHandlerId},
@ -39,14 +39,12 @@ impl AppSrc {
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_get_current_level_buffers")] #[doc(alias = "gst_app_src_get_current_level_buffers")]
#[doc(alias = "get_current_level_buffers")] #[doc(alias = "get_current_level_buffers")]
#[doc(alias = "current-level-buffers")]
pub fn current_level_buffers(&self) -> u64 { pub fn current_level_buffers(&self) -> u64 {
unsafe { ffi::gst_app_src_get_current_level_buffers(self.to_glib_none().0) } unsafe { ffi::gst_app_src_get_current_level_buffers(self.to_glib_none().0) }
} }
#[doc(alias = "gst_app_src_get_current_level_bytes")] #[doc(alias = "gst_app_src_get_current_level_bytes")]
#[doc(alias = "get_current_level_bytes")] #[doc(alias = "get_current_level_bytes")]
#[doc(alias = "current-level-bytes")]
pub fn current_level_bytes(&self) -> u64 { pub fn current_level_bytes(&self) -> u64 {
unsafe { ffi::gst_app_src_get_current_level_bytes(self.to_glib_none().0) } unsafe { ffi::gst_app_src_get_current_level_bytes(self.to_glib_none().0) }
} }
@ -55,7 +53,6 @@ impl AppSrc {
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_get_current_level_time")] #[doc(alias = "gst_app_src_get_current_level_time")]
#[doc(alias = "get_current_level_time")] #[doc(alias = "get_current_level_time")]
#[doc(alias = "current-level-time")]
pub fn current_level_time(&self) -> Option<gst::ClockTime> { pub fn current_level_time(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_app_src_get_current_level_time( from_glib(ffi::gst_app_src_get_current_level_time(
@ -74,7 +71,6 @@ impl AppSrc {
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_get_leaky_type")] #[doc(alias = "gst_app_src_get_leaky_type")]
#[doc(alias = "get_leaky_type")] #[doc(alias = "get_leaky_type")]
#[doc(alias = "leaky-type")]
pub fn leaky_type(&self) -> AppLeakyType { pub fn leaky_type(&self) -> AppLeakyType {
unsafe { from_glib(ffi::gst_app_src_get_leaky_type(self.to_glib_none().0)) } unsafe { from_glib(ffi::gst_app_src_get_leaky_type(self.to_glib_none().0)) }
} }
@ -83,14 +79,12 @@ impl AppSrc {
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_get_max_buffers")] #[doc(alias = "gst_app_src_get_max_buffers")]
#[doc(alias = "get_max_buffers")] #[doc(alias = "get_max_buffers")]
#[doc(alias = "max-buffers")]
pub fn max_buffers(&self) -> u64 { pub fn max_buffers(&self) -> u64 {
unsafe { ffi::gst_app_src_get_max_buffers(self.to_glib_none().0) } unsafe { ffi::gst_app_src_get_max_buffers(self.to_glib_none().0) }
} }
#[doc(alias = "gst_app_src_get_max_bytes")] #[doc(alias = "gst_app_src_get_max_bytes")]
#[doc(alias = "get_max_bytes")] #[doc(alias = "get_max_bytes")]
#[doc(alias = "max-bytes")]
pub fn max_bytes(&self) -> u64 { pub fn max_bytes(&self) -> u64 {
unsafe { ffi::gst_app_src_get_max_bytes(self.to_glib_none().0) } unsafe { ffi::gst_app_src_get_max_bytes(self.to_glib_none().0) }
} }
@ -99,7 +93,6 @@ impl AppSrc {
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_get_max_time")] #[doc(alias = "gst_app_src_get_max_time")]
#[doc(alias = "get_max_time")] #[doc(alias = "get_max_time")]
#[doc(alias = "max-time")]
pub fn max_time(&self) -> Option<gst::ClockTime> { pub fn max_time(&self) -> Option<gst::ClockTime> {
unsafe { from_glib(ffi::gst_app_src_get_max_time(self.to_glib_none().0)) } unsafe { from_glib(ffi::gst_app_src_get_max_time(self.to_glib_none().0)) }
} }
@ -112,7 +105,6 @@ impl AppSrc {
#[doc(alias = "gst_app_src_get_stream_type")] #[doc(alias = "gst_app_src_get_stream_type")]
#[doc(alias = "get_stream_type")] #[doc(alias = "get_stream_type")]
#[doc(alias = "stream-type")]
pub fn stream_type(&self) -> AppStreamType { pub fn stream_type(&self) -> AppStreamType {
unsafe { from_glib(ffi::gst_app_src_get_stream_type(self.to_glib_none().0)) } unsafe { from_glib(ffi::gst_app_src_get_stream_type(self.to_glib_none().0)) }
} }
@ -156,7 +148,6 @@ impl AppSrc {
//} //}
#[doc(alias = "gst_app_src_set_caps")] #[doc(alias = "gst_app_src_set_caps")]
#[doc(alias = "caps")]
pub fn set_caps(&self, caps: Option<&gst::Caps>) { pub fn set_caps(&self, caps: Option<&gst::Caps>) {
unsafe { unsafe {
ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0); ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
@ -164,7 +155,6 @@ impl AppSrc {
} }
#[doc(alias = "gst_app_src_set_duration")] #[doc(alias = "gst_app_src_set_duration")]
#[doc(alias = "duration")]
pub fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) { pub fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) {
unsafe { unsafe {
ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.into().into_glib()); ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.into().into_glib());
@ -174,7 +164,6 @@ impl AppSrc {
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_set_leaky_type")] #[doc(alias = "gst_app_src_set_leaky_type")]
#[doc(alias = "leaky-type")]
pub fn set_leaky_type(&self, leaky: AppLeakyType) { pub fn set_leaky_type(&self, leaky: AppLeakyType) {
unsafe { unsafe {
ffi::gst_app_src_set_leaky_type(self.to_glib_none().0, leaky.into_glib()); ffi::gst_app_src_set_leaky_type(self.to_glib_none().0, leaky.into_glib());
@ -184,7 +173,6 @@ impl AppSrc {
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_set_max_buffers")] #[doc(alias = "gst_app_src_set_max_buffers")]
#[doc(alias = "max-buffers")]
pub fn set_max_buffers(&self, max: u64) { pub fn set_max_buffers(&self, max: u64) {
unsafe { unsafe {
ffi::gst_app_src_set_max_buffers(self.to_glib_none().0, max); ffi::gst_app_src_set_max_buffers(self.to_glib_none().0, max);
@ -192,7 +180,6 @@ impl AppSrc {
} }
#[doc(alias = "gst_app_src_set_max_bytes")] #[doc(alias = "gst_app_src_set_max_bytes")]
#[doc(alias = "max-bytes")]
pub fn set_max_bytes(&self, max: u64) { pub fn set_max_bytes(&self, max: u64) {
unsafe { unsafe {
ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max); ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max);
@ -202,7 +189,6 @@ impl AppSrc {
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_set_max_time")] #[doc(alias = "gst_app_src_set_max_time")]
#[doc(alias = "max-time")]
pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) { pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) {
unsafe { unsafe {
ffi::gst_app_src_set_max_time(self.to_glib_none().0, max.into().into_glib()); ffi::gst_app_src_set_max_time(self.to_glib_none().0, max.into().into_glib());
@ -210,7 +196,6 @@ impl AppSrc {
} }
#[doc(alias = "gst_app_src_set_size")] #[doc(alias = "gst_app_src_set_size")]
#[doc(alias = "size")]
pub fn set_size(&self, size: i64) { pub fn set_size(&self, size: i64) {
unsafe { unsafe {
ffi::gst_app_src_set_size(self.to_glib_none().0, size); ffi::gst_app_src_set_size(self.to_glib_none().0, size);
@ -218,7 +203,6 @@ impl AppSrc {
} }
#[doc(alias = "gst_app_src_set_stream_type")] #[doc(alias = "gst_app_src_set_stream_type")]
#[doc(alias = "stream-type")]
pub fn set_stream_type(&self, type_: AppStreamType) { pub fn set_stream_type(&self, type_: AppStreamType) {
unsafe { unsafe {
ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.into_glib()); ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.into_glib());
@ -313,7 +297,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::block\0".as_ptr() as *const _, b"notify::block\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_block_trampoline::<F> as *const (), notify_block_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -339,7 +323,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::caps\0".as_ptr() as *const _, b"notify::caps\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_caps_trampoline::<F> as *const (), notify_caps_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -369,7 +353,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::current-level-buffers\0".as_ptr() as *const _, b"notify::current-level-buffers\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_current_level_buffers_trampoline::<F> as *const (), notify_current_level_buffers_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -397,7 +381,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::current-level-bytes\0".as_ptr() as *const _, b"notify::current-level-bytes\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_current_level_bytes_trampoline::<F> as *const (), notify_current_level_bytes_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -427,7 +411,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::current-level-time\0".as_ptr() as *const _, b"notify::current-level-time\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_current_level_time_trampoline::<F> as *const (), notify_current_level_time_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -453,7 +437,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::duration\0".as_ptr() as *const _, b"notify::duration\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_duration_trampoline::<F> as *const (), notify_duration_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -479,7 +463,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::format\0".as_ptr() as *const _, b"notify::format\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_format_trampoline::<F> as *const (), notify_format_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -509,7 +493,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::handle-segment-change\0".as_ptr() as *const _, b"notify::handle-segment-change\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_handle_segment_change_trampoline::<F> as *const (), notify_handle_segment_change_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -535,7 +519,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::is-live\0".as_ptr() as *const _, b"notify::is-live\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_is_live_trampoline::<F> as *const (), notify_is_live_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -565,7 +549,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::leaky-type\0".as_ptr() as *const _, b"notify::leaky-type\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_leaky_type_trampoline::<F> as *const (), notify_leaky_type_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -595,7 +579,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::max-buffers\0".as_ptr() as *const _, b"notify::max-buffers\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_max_buffers_trampoline::<F> as *const (), notify_max_buffers_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -621,7 +605,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::max-bytes\0".as_ptr() as *const _, b"notify::max-bytes\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_max_bytes_trampoline::<F> as *const (), notify_max_bytes_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -649,7 +633,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::max-latency\0".as_ptr() as *const _, b"notify::max-latency\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_max_latency_trampoline::<F> as *const (), notify_max_latency_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -677,7 +661,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::max-time\0".as_ptr() as *const _, b"notify::max-time\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_max_time_trampoline::<F> as *const (), notify_max_time_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -705,7 +689,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::min-latency\0".as_ptr() as *const _, b"notify::min-latency\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_min_latency_trampoline::<F> as *const (), notify_min_latency_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -733,7 +717,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::min-percent\0".as_ptr() as *const _, b"notify::min-percent\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_min_percent_trampoline::<F> as *const (), notify_min_percent_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -759,7 +743,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::size\0".as_ptr() as *const _, b"notify::size\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_size_trampoline::<F> as *const (), notify_size_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),
@ -787,7 +771,7 @@ impl AppSrc {
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::stream-type\0".as_ptr() as *const _, b"notify::stream-type\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_stream_type_trampoline::<F> as *const (), notify_stream_type_trampoline::<F> as *const (),
)), )),
Box_::into_raw(f), Box_::into_raw(f),

View file

@ -3,7 +3,6 @@
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT // DO NOT EDIT
use crate::ffi;
use glib::{prelude::*, translate::*}; use glib::{prelude::*, translate::*};
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ a11b11f2e403) Generated by gir (https://github.com/gtk-rs/gir @ 0e476ab5c1de)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd) from gir-files (https://github.com/gtk-rs/gir-files @ cfc0305f903b)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5) from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 39e21eeb5d10)

View file

@ -4,10 +4,10 @@
#![allow(clippy::missing_safety_doc)] #![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi;
pub use glib; pub use glib;
pub use gst; pub use gst;
pub use gst_base; pub use gst_base;
pub use gstreamer_app_sys as ffi;
macro_rules! assert_initialized_main_thread { macro_rules! assert_initialized_main_thread {
() => { () => {

View file

@ -1,5 +1,5 @@
[build-dependencies] [build-dependencies]
system-deps = "7" system-deps = "6"
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"
@ -23,7 +23,6 @@ v1_18 = ["v1_16"]
v1_20 = ["v1_18"] v1_20 = ["v1_18"]
v1_22 = ["v1_20"] v1_22 = ["v1_20"]
v1_24 = ["v1_22"] v1_24 = ["v1_22"]
v1_26 = ["v1_24"]
[lib] [lib]
name = "gstreamer_app_sys" name = "gstreamer_app_sys"
@ -78,7 +77,4 @@ version = "1.20"
version = "1.22" version = "1.22"
[package.metadata.system-deps.gstreamer_app_1_0.v1_24] [package.metadata.system-deps.gstreamer_app_1_0.v1_24]
version = "1.24" version = "1.23"
[package.metadata.system-deps.gstreamer_app_1_0.v1_26]
version = "1.25"

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ a11b11f2e403) Generated by gir (https://github.com/gtk-rs/gir @ 0e476ab5c1de)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd) from gir-files (https://github.com/gtk-rs/gir-files @ cfc0305f903b)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5) from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 39e21eeb5d10)

View file

@ -16,14 +16,10 @@ use glib_sys as glib;
use gstreamer_base_sys as gst_base; use gstreamer_base_sys as gst_base;
use gstreamer_sys as gst; use gstreamer_sys as gst;
#[cfg(unix)]
#[allow(unused_imports)] #[allow(unused_imports)]
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t}; use libc::{
#[allow(unused_imports)]
use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE};
#[allow(unused_imports)]
use std::ffi::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, uintptr_t, FILE,
}; };
#[allow(unused_imports)] #[allow(unused_imports)]
@ -100,7 +96,6 @@ impl ::std::fmt::Debug for GstAppSinkClass {
} }
#[repr(C)] #[repr(C)]
#[allow(dead_code)]
pub struct _GstAppSinkPrivate { pub struct _GstAppSinkPrivate {
_data: [u8; 0], _data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
@ -160,7 +155,6 @@ impl ::std::fmt::Debug for GstAppSrcClass {
} }
#[repr(C)] #[repr(C)]
#[allow(dead_code)]
pub struct _GstAppSrcPrivate { pub struct _GstAppSrcPrivate {
_data: [u8; 0], _data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
@ -201,6 +195,7 @@ impl ::std::fmt::Debug for GstAppSrc {
} }
} }
#[link(name = "gstapp-1.0")]
extern "C" { extern "C" {
//========================================================================= //=========================================================================

View file

@ -16,7 +16,7 @@ rust-version.workspace = true
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"
cfg-if = "1.0" cfg-if = "1.0"
gstreamer-audio-sys.workspace = true ffi = { package = "gstreamer-audio-sys", path = "sys", version = "0.22" }
glib.workspace = true glib.workspace = true
gst.workspace = true gst.workspace = true
gst-base.workspace = true gst-base.workspace = true
@ -25,18 +25,17 @@ smallvec = "1.0"
once_cell = "1" once_cell = "1"
[dev-dependencies] [dev-dependencies]
itertools = "0.13" itertools = "0.12"
serde_json = "1.0" serde_json = "1.0"
gir-format-check = "0.1" gir-format-check = "0.1"
[features] [features]
default = [] default = []
v1_16 = ["gst/v1_16", "gst-base/v1_16", "gstreamer-audio-sys/v1_16"] v1_16 = ["gst/v1_16", "gst-base/v1_16", "ffi/v1_16"]
v1_18 = ["gst/v1_18", "gst-base/v1_18", "gstreamer-audio-sys/v1_18", "v1_16"] v1_18 = ["gst/v1_18", "gst-base/v1_18", "ffi/v1_18", "v1_16"]
v1_20 = ["gst/v1_20", "gst-base/v1_20", "gstreamer-audio-sys/v1_20", "v1_18"] v1_20 = ["gst/v1_20", "gst-base/v1_20", "ffi/v1_20", "v1_18"]
v1_22 = ["gst/v1_22", "gst-base/v1_22", "gstreamer-audio-sys/v1_22", "v1_20"] v1_22 = ["gst/v1_22", "gst-base/v1_22", "ffi/v1_22", "v1_20"]
v1_24 = ["gst/v1_24", "gst-base/v1_24", "gstreamer-audio-sys/v1_24", "v1_22"] v1_24 = ["gst/v1_24", "gst-base/v1_24", "ffi/v1_24", "v1_22"]
v1_26 = ["gst/v1_26", "gst-base/v1_26", "gstreamer-audio-sys/v1_26", "v1_24"]
serde = ["dep:serde", "gst/serde"] serde = ["dep:serde", "gst/serde"]
[package.metadata.docs.rs] [package.metadata.docs.rs]

View file

@ -327,10 +327,6 @@ status = "generate"
# Platform dependant # Platform dependant
manual = true manual = true
[[object.member]]
name = "last"
ignore = true
[[object.function]] [[object.function]]
name = "to_string" name = "to_string"
# This has an Unknown field that may return NULL or "UNKNOWN" # This has an Unknown field that may return NULL or "UNKNOWN"

View file

@ -8,7 +8,7 @@ use glib::signal::{connect_raw, SignalHandlerId};
use glib::translate::*; use glib::translate::*;
use gst::prelude::*; use gst::prelude::*;
use crate::{ffi, AudioAggregator, AudioAggregatorPad}; use crate::auto::{AudioAggregator, AudioAggregatorPad};
mod sealed { mod sealed {
pub trait Sealed {} pub trait Sealed {}
@ -68,7 +68,7 @@ pub trait AudioAggregatorExtManual: sealed::Sealed + IsA<AudioAggregator> + 'sta
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::output-buffer-duration-fraction\0".as_ptr() as *const _, b"notify::output-buffer-duration-fraction\0".as_ptr() as *const _,
Some(transmute::<*const (), unsafe extern "C" fn()>( Some(transmute::<_, unsafe extern "C" fn()>(
notify_output_buffer_duration_fraction_trampoline::<Self, F> as *const (), notify_output_buffer_duration_fraction_trampoline::<Self, F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),

View file

@ -6,7 +6,7 @@ use glib::{
translate::*, translate::*,
}; };
use crate::{ffi, AudioAggregatorConvertPad}; use crate::auto::AudioAggregatorConvertPad;
mod sealed { mod sealed {
pub trait Sealed {} pub trait Sealed {}
@ -52,7 +52,7 @@ pub trait AudioAggregatorConvertPadExtManual:
connect_raw( connect_raw(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
b"notify::converter-config\0".as_ptr() as *const _, b"notify::converter-config\0".as_ptr() as *const _,
Some(transmute::<*const (), unsafe extern "C" fn()>( Some(transmute::<_, unsafe extern "C" fn()>(
notify_converter_config_trampoline::<Self, F> as *const (), notify_converter_config_trampoline::<Self, F> as *const (),
)), )),
Box::into_raw(f), Box::into_raw(f),

View file

@ -1,7 +1,7 @@
use glib::translate::*; use glib::{object::IsA, translate::*};
use gst::prelude::*; use gst::prelude::*;
use crate::{ffi, AudioAggregatorPad}; use crate::auto::AudioAggregatorPad;
mod sealed { mod sealed {
pub trait Sealed {} pub trait Sealed {}

View file

@ -2,7 +2,6 @@
use std::{fmt, marker::PhantomData, mem, ops, ptr, slice}; use std::{fmt, marker::PhantomData, mem, ops, ptr, slice};
use crate::ffi;
use glib::translate::*; use glib::translate::*;
use smallvec::SmallVec; use smallvec::SmallVec;

View file

@ -2,7 +2,6 @@
use std::{mem, slice}; use std::{mem, slice};
use crate::ffi;
use glib::{prelude::*, translate::*, value::FromValue, Type}; use glib::{prelude::*, translate::*, value::FromValue, Type};
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]

View file

@ -73,30 +73,6 @@ impl From<AudioConverterConfig> for gst::Structure {
} }
} }
impl glib::value::ToValue for AudioConverterConfig {
fn to_value(&self) -> glib::Value {
self.0.to_value()
}
fn value_type(&self) -> glib::Type {
self.0.value_type()
}
}
impl glib::value::ToValueOptional for AudioConverterConfig {
fn to_value_optional(s: Option<&Self>) -> glib::Value {
skip_assert_initialized!();
s.map(|s| &s.0).to_value()
}
}
impl From<AudioConverterConfig> for glib::Value {
fn from(s: AudioConverterConfig) -> glib::Value {
skip_assert_initialized!();
s.0.into()
}
}
impl AudioConverterConfig { impl AudioConverterConfig {
pub fn new() -> Self { pub fn new() -> Self {
Self(gst::Structure::new_empty("GstAudioConverter")) Self(gst::Structure::new_empty("GstAudioConverter"))

View file

@ -4,7 +4,7 @@ use std::{mem, ptr};
use glib::{prelude::*, translate::*}; use glib::{prelude::*, translate::*};
use crate::{ffi, AudioDecoder, AudioInfo}; use crate::{AudioDecoder, AudioInfo};
extern "C" { extern "C" {
fn _gst_audio_decoder_error( fn _gst_audio_decoder_error(

View file

@ -4,7 +4,7 @@ use std::{mem, ptr};
use glib::{prelude::*, translate::*}; use glib::{prelude::*, translate::*};
use crate::{ffi, AudioEncoder}; use crate::AudioEncoder;
mod sealed { mod sealed {
pub trait Sealed {} pub trait Sealed {}

View file

@ -3,7 +3,7 @@
use glib::{prelude::*, translate::*}; use glib::{prelude::*, translate::*};
use gst_base::prelude::*; use gst_base::prelude::*;
use crate::{ffi, AudioFilter, AudioInfo}; use crate::{AudioFilter, AudioInfo};
mod sealed { mod sealed {
pub trait Sealed {} pub trait Sealed {}

View file

@ -2,7 +2,6 @@
use std::str; use std::str;
use crate::ffi;
use glib::translate::{from_glib, IntoGlib}; use glib::translate::{from_glib, IntoGlib};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
@ -365,8 +364,7 @@ mod tests {
fn test_display() { fn test_display() {
gst::init().unwrap(); gst::init().unwrap();
assert_eq!(format!("{}", crate::AudioFormat::S16be), "S16BE"); format!("{}", crate::AudioFormat::S16be);
assert_eq!(format!("{:?}", crate::AudioFormat::S16be), "S16be");
} }
#[test] #[test]

View file

@ -2,7 +2,6 @@
use std::{cmp::Ordering, fmt, marker::PhantomData, str}; use std::{cmp::Ordering, fmt, marker::PhantomData, str};
use crate::ffi;
use glib::{ use glib::{
prelude::*, prelude::*,
translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut}, translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut},

View file

@ -2,7 +2,6 @@
use std::{fmt, marker::PhantomData, mem, ptr, slice}; use std::{fmt, marker::PhantomData, mem, ptr, slice};
use crate::ffi;
use glib::translate::{ use glib::translate::{
from_glib, from_glib_full, from_glib_none, IntoGlib, ToGlibPtr, ToGlibPtrMut, from_glib, from_glib_full, from_glib_none, IntoGlib, ToGlibPtr, ToGlibPtrMut,
}; };
@ -97,29 +96,6 @@ impl<'a> AudioInfoBuilder<'a> {
} }
} }
pub fn positions_if(
self,
positions: &'a [crate::AudioChannelPosition],
predicate: bool,
) -> AudioInfoBuilder<'a> {
if predicate {
self.positions(positions)
} else {
self
}
}
pub fn positions_if_some(
self,
positions: Option<&'a [crate::AudioChannelPosition]>,
) -> AudioInfoBuilder<'a> {
if let Some(positions) = positions {
self.positions(positions)
} else {
self
}
}
pub fn flags(self, flags: crate::AudioFlags) -> Self { pub fn flags(self, flags: crate::AudioFlags) -> Self {
Self { Self {
flags: Some(flags), flags: Some(flags),
@ -127,44 +103,12 @@ impl<'a> AudioInfoBuilder<'a> {
} }
} }
pub fn flags_if(self, flags: crate::AudioFlags, predicate: bool) -> Self {
if predicate {
self.flags(flags)
} else {
self
}
}
pub fn flags_if_some(self, flags: Option<crate::AudioFlags>) -> Self {
if let Some(flags) = flags {
self.flags(flags)
} else {
self
}
}
pub fn layout(self, layout: crate::AudioLayout) -> Self { pub fn layout(self, layout: crate::AudioLayout) -> Self {
Self { Self {
layout: Some(layout), layout: Some(layout),
..self ..self
} }
} }
pub fn layout_if(self, layout: crate::AudioLayout, predicate: bool) -> Self {
if predicate {
self.layout(layout)
} else {
self
}
}
pub fn layout_if_some(self, layout: Option<crate::AudioLayout>) -> Self {
if let Some(layout) = layout {
self.layout(layout)
} else {
self
}
}
} }
impl AudioInfo { impl AudioInfo {

View file

@ -14,8 +14,6 @@ use glib::translate::{from_glib, IntoGlib};
use glib::translate::{from_glib_none, ToGlibPtr}; use glib::translate::{from_glib_none, ToGlibPtr};
use gst::prelude::*; use gst::prelude::*;
use crate::ffi;
#[repr(transparent)] #[repr(transparent)]
#[doc(alias = "GstAudioClippingMeta")] #[doc(alias = "GstAudioClippingMeta")]
pub struct AudioClippingMeta(ffi::GstAudioClippingMeta); pub struct AudioClippingMeta(ffi::GstAudioClippingMeta);
@ -296,17 +294,6 @@ impl fmt::Debug for AudioLevelMeta {
} }
} }
pub mod tags {
gst::impl_meta_tag!(Audio, crate::ffi::GST_META_TAG_AUDIO_STR);
gst::impl_meta_tag!(Channels, crate::ffi::GST_META_TAG_AUDIO_CHANNELS_STR);
gst::impl_meta_tag!(Rate, crate::ffi::GST_META_TAG_AUDIO_RATE_STR);
#[cfg(feature = "v1_24")]
gst::impl_meta_tag!(
DSDPlaneOffsets,
crate::ffi::GST_META_TAG_DSD_PLANE_OFFSETS_STR
);
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
@ -332,8 +319,6 @@ mod tests {
let cmeta = buffer.meta::<AudioClippingMeta>().unwrap(); let cmeta = buffer.meta::<AudioClippingMeta>().unwrap();
assert_eq!(cmeta.start().try_into(), Ok(Some(start))); assert_eq!(cmeta.start().try_into(), Ok(Some(start)));
assert_eq!(cmeta.end().try_into(), Ok(Some(stop))); assert_eq!(cmeta.end().try_into(), Ok(Some(stop)));
assert!(cmeta.has_tag::<tags::Audio>());
} }
} }

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