mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-06-10 10:19:25 +00:00
Compare commits
127 commits
Author | SHA1 | Date | |
---|---|---|---|
d8b7356f3d | |||
bc96d439d0 | |||
e6ed67cbc5 | |||
8a3ea1192d | |||
b045708353 | |||
c545154472 | |||
b20ea25147 | |||
4ebec84f5e | |||
10aff0d66e | |||
9d3ec9da53 | |||
413a6baa8c | |||
9e2c6268cb | |||
4cda565a39 | |||
805cd6c591 | |||
a0e58ec359 | |||
9f151466b7 | |||
1b537c17c8 | |||
c3619b45aa | |||
f59029b57c | |||
b468280353 | |||
0ef80c4fe7 | |||
455996c60b | |||
83fe420466 | |||
5af4a262b8 | |||
b8dbfc66ca | |||
b15e0e1633 | |||
a430291725 | |||
0ee36ea4b5 | |||
a7a0bf226d | |||
19ea814a09 | |||
2a9d0d035f | |||
1e293e5cb8 | |||
fe1fe5b114 | |||
238768f525 | |||
2f99c4c560 | |||
9fca740851 | |||
9490735655 | |||
81b20b9329 | |||
ba4bd5c631 | |||
4b79dddc14 | |||
01b32ce143 | |||
873aeff133 | |||
87cc9fe6e4 | |||
bac0828260 | |||
200d8b1c0c | |||
dc04a53207 | |||
0bb334e14c | |||
46226106b4 | |||
b7b5352353 | |||
88a6977777 | |||
cb560e59a3 | |||
241338f43c | |||
5c8a989029 | |||
57050f66c6 | |||
63654c67da | |||
70a15e8dbe | |||
953e3747f2 | |||
e117010bc0 | |||
694d1fd39b | |||
db03c8edd1 | |||
ea25c9262b | |||
0d872ae6f8 | |||
7433ea79c9 | |||
46be4a0b1e | |||
43c82da25a | |||
da1f53f4c7 | |||
0524435190 | |||
917c458a86 | |||
5eaa0ca46d | |||
5400979e28 | |||
c43c08804a | |||
a7ebe45ff3 | |||
2b53c55ee6 | |||
04c840a1d9 | |||
6111663e26 | |||
7cea7ba6f1 | |||
e2e38d9494 | |||
676e41064b | |||
4524af89ee | |||
e5830c2ea9 | |||
d7fe0709a5 | |||
983e8b3308 | |||
6aff1773bd | |||
ebc06257b5 | |||
86d02890ca | |||
29c82cd54d | |||
c05563d22e | |||
9e80250b49 | |||
0b027c853b | |||
3246f4fb5b | |||
82f6accc31 | |||
ffad1188b9 | |||
353e3d1611 | |||
b5cb4ae831 | |||
14576fdf26 | |||
70045a36fb | |||
28451435a4 | |||
fcc7ab6b88 | |||
18a02f6d34 | |||
c5111ddcc2 | |||
d5917be045 | |||
4e6ddf6663 | |||
ab0a29b765 | |||
8062a8748f | |||
28fe70f479 | |||
c8b98dde8c | |||
b47aba1837 | |||
28931e2f09 | |||
1649e268c5 | |||
d575cd1f95 | |||
ac275fe10e | |||
b10f395c2c | |||
22796cee0c | |||
7f9dd58718 | |||
798ee29b98 | |||
040a194700 | |||
b69fee9abe | |||
a87a844604 | |||
5d19b26974 | |||
2613c57739 | |||
f82b9cc197 | |||
12c9ada9e0 | |||
a784ea2d0b | |||
90e6108ed7 | |||
77b2800caf | |||
c4636fc0cd | |||
6a1441203d |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,2 @@
|
|||
target/
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
|
|
|
@ -56,7 +56,7 @@ variables:
|
|||
# latest release must be at the top
|
||||
# (only relevant on main branch)
|
||||
RELEASES:
|
||||
0.21=0.21
|
||||
0.22=0.22
|
||||
|
||||
stages:
|
||||
- "trigger"
|
||||
|
@ -73,6 +73,7 @@ trigger:
|
|||
stage: 'trigger'
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
tags: [ 'placeholder-job' ]
|
||||
script:
|
||||
- echo "Trigger job done, now running the pipeline."
|
||||
rules:
|
||||
|
@ -141,6 +142,7 @@ trigger:
|
|||
libpango1.0-dev libcairo2-dev libjson-glib-dev libgdk-pixbuf-2.0-dev
|
||||
libtiff-dev libpng-dev libjpeg-dev libepoxy-dev libsass-dev sassc
|
||||
libcsound64-dev llvm clang nasm libsodium-dev libwebp-dev
|
||||
libflac-dev
|
||||
FDO_DISTRIBUTION_EXEC: >-
|
||||
bash ci/install-gst.sh &&
|
||||
bash ci/install-dav1d.sh &&
|
||||
|
@ -311,6 +313,7 @@ test nightly sys:
|
|||
rustfmt:
|
||||
extends: .img-stable
|
||||
stage: "lint"
|
||||
tags: [ 'placeholder-job' ]
|
||||
script:
|
||||
- cargo fmt --version
|
||||
- cargo fmt -- --color=always --check
|
||||
|
@ -321,6 +324,7 @@ rustfmt:
|
|||
check commits:
|
||||
extends: .img-stable
|
||||
stage: "lint"
|
||||
tags: [ 'placeholder-job' ]
|
||||
script:
|
||||
- ci-fairy check-commits --textwidth 0 --no-signed-off-by
|
||||
needs:
|
||||
|
@ -330,6 +334,7 @@ check commits:
|
|||
typos:
|
||||
extends: .img-stable
|
||||
stage: "lint"
|
||||
tags: [ 'placeholder-job' ]
|
||||
script:
|
||||
- typos
|
||||
needs:
|
||||
|
@ -366,6 +371,7 @@ gir-checks:
|
|||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
extends: .img-stable
|
||||
stage: 'extras'
|
||||
tags: [ 'placeholder-job' ]
|
||||
needs:
|
||||
- job: 'build-stable'
|
||||
artifacts: false
|
||||
|
@ -508,7 +514,6 @@ pages:
|
|||
# We also don't need a CONTEXT_DIR var as its also
|
||||
# hardcoded to be windows-docker/
|
||||
DOCKERFILE: 'ci/windows-docker/Dockerfile'
|
||||
GST_UPSTREAM_BRANCH: 'main'
|
||||
tags:
|
||||
- 'windows'
|
||||
- 'shell'
|
||||
|
|
716
Cargo.lock
generated
716
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
19
Cargo.toml
19
Cargo.toml
|
@ -107,7 +107,7 @@ members = [
|
|||
exclude = ["gir"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.22.0"
|
||||
version = "0.23.0"
|
||||
categories = ["api-bindings", "multimedia"]
|
||||
repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
|
||||
homepage = "https://gstreamer.freedesktop.org"
|
||||
|
@ -123,15 +123,32 @@ gobject-sys = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master"
|
|||
cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" }
|
||||
pango = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" }
|
||||
pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" }
|
||||
gstreamer-allocators-sys = { path = "gstreamer-allocators/sys" }
|
||||
gstreamer-analytics-sys = { path = "gstreamer-analytics/sys" }
|
||||
gstreamer-app-sys = { path = "gstreamer-app/sys" }
|
||||
gstreamer-audio-sys = { path = "./gstreamer-audio/sys"}
|
||||
gstreamer-base-sys = { path = "./gstreamer-base/sys"}
|
||||
gstreamer-check-sys = { path = "./gstreamer-check/sys" }
|
||||
gstreamer-controller-sys = { path = "./gstreamer-controller/sys" }
|
||||
gstreamer-editing-services-sys = { path = "./gstreamer-editing-services/sys"}
|
||||
gstreamer-gl-egl-sys = { path = "./gstreamer-gl/egl/sys"}
|
||||
gstreamer-gl-wayland-sys = { path = "./gstreamer-gl/wayland/sys"}
|
||||
gstreamer-gl-x11-sys = { path = "./gstreamer-gl/x11/sys"}
|
||||
gstreamer-gl-sys = { path = "./gstreamer-gl/sys"}
|
||||
gstreamer-mpegts-sys = { path = "./gstreamer-mpegts/sys"}
|
||||
gstreamer-net-sys = { path = "./gstreamer-net/sys"}
|
||||
gstreamer-pbutils-sys = { path = "./gstreamer-pbutils/sys"}
|
||||
gstreamer-play-sys = { path = "./gstreamer-play/sys" }
|
||||
gstreamer-player-sys = { path = "./gstreamer-player/sys" }
|
||||
gstreamer-rtp-sys = { path = "./gstreamer-rtp/sys" }
|
||||
gstreamer-rtsp-sys = { path = "./gstreamer-rtsp/sys"}
|
||||
gstreamer-rtsp-server-sys = { path = "./gstreamer-rtsp-server/sys" }
|
||||
gstreamer-sdp-sys = { path = "./gstreamer-sdp/sys"}
|
||||
gstreamer-tag-sys = { path = "./gstreamer-tag/sys" }
|
||||
gstreamer-sys = { path = "./gstreamer/sys"}
|
||||
gstreamer-validate-sys = { path = "./gstreamer-validate/sys" }
|
||||
gstreamer-video-sys = { path = "./gstreamer-video/sys"}
|
||||
gstreamer-webrtc-sys = { path = "./gstreamer-webrtc/sys" }
|
||||
ges = { package = "gstreamer-editing-services", path = "./gstreamer-editing-services" }
|
||||
gst = { package = "gstreamer", path = "./gstreamer" }
|
||||
gst-allocators = { package = "gstreamer-allocators", path = "./gstreamer-allocators" }
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
variables:
|
||||
GST_RS_IMG_TAG: "2024-02-07.0"
|
||||
GST_RS_STABLE: "1.75.0"
|
||||
GST_RS_IMG_TAG: "2024-05-10.0"
|
||||
GST_RS_STABLE: "1.78.0"
|
||||
GST_RS_MSRV: "1.70.0"
|
||||
# The branch we use to build GStreamer from in the docker images
|
||||
# Ex. main, 1.24, my-test-branch
|
||||
GST_UPSTREAM_BRANCH: 'main'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
set -e
|
||||
|
||||
RELEASE=1.1.0
|
||||
RELEASE=1.4.1
|
||||
|
||||
git clone https://code.videolan.org/videolan/dav1d.git --branch $RELEASE
|
||||
cd dav1d
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
set -e
|
||||
|
||||
DEFAULT_BRANCH="$GST_UPSTREAM_BRANCH"
|
||||
|
||||
pip3 install meson==1.1.1 --break-system-packages
|
||||
|
||||
# gstreamer-rs already has a 'gstreamer' directory so don't clone there
|
||||
|
@ -9,7 +11,7 @@ pushd .
|
|||
cd ..
|
||||
git clone https://gitlab.freedesktop.org/gstreamer/gstreamer.git \
|
||||
--depth 1 \
|
||||
--branch main
|
||||
--branch "$DEFAULT_BRANCH"
|
||||
|
||||
cd gstreamer
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ source ./ci/env.sh
|
|||
set -e
|
||||
export CARGO_HOME='/usr/local/cargo'
|
||||
|
||||
RUSTUP_VERSION=1.26.0
|
||||
RUSTUP_VERSION=1.27.1
|
||||
RUST_VERSION=$1
|
||||
RUST_IMAGE_FULL=$2
|
||||
RUST_ARCH="x86_64-unknown-linux-gnu"
|
||||
|
@ -28,7 +28,7 @@ if [ "$RUST_IMAGE_FULL" = "1" ]; then
|
|||
|
||||
cargo install --locked --force cargo-deny
|
||||
cargo install --locked --force cargo-outdated
|
||||
cargo install --locked --force typos-cli
|
||||
cargo install --locked --force typos-cli --version "1.19.0"
|
||||
|
||||
# Coverage tools
|
||||
rustup component add llvm-tools-preview
|
||||
|
|
|
@ -16,7 +16,7 @@ for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
|
|||
echo "Building and testing $crate with $FEATURES"
|
||||
|
||||
cargo build --locked --color=always --manifest-path "$crate/Cargo.toml" $FEATURES
|
||||
G_DEBUG=fatal_warnings cargo test --color=always --manifest-path "$crate/Cargo.toml" $FEATURES
|
||||
RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test --color=always --manifest-path "$crate/Cargo.toml" $FEATURES
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -11,13 +11,10 @@ get_features() {
|
|||
crate=$1
|
||||
case "$crate" in
|
||||
gstreamer-audio|gstreamer-editing-services|gstreamer-gl|gstreamer-pbutils|gstreamer-rtp|gstreamer-rtsp|gstreamer-video|gstreamer)
|
||||
echo "--features=serde,v1_24"
|
||||
;;
|
||||
gstreamer-analytics)
|
||||
echo ""
|
||||
echo "--features=serde,v1_26"
|
||||
;;
|
||||
*)
|
||||
echo "--features=v1_24"
|
||||
echo "--features=v1_26"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -13,11 +13,14 @@ for crate in gstreamer*/sys gstreamer-gl/*/sys; do
|
|||
done
|
||||
|
||||
for crate in gstreamer/sys \
|
||||
gstreamer-allocators/sys \
|
||||
gstreamer-analytics/sys \
|
||||
gstreamer-app/sys \
|
||||
gstreamer-audio/sys \
|
||||
gstreamer-base/sys \
|
||||
gstreamer-check/sys \
|
||||
gstreamer-controller/sys \
|
||||
gstreamer-editing-services/sys \
|
||||
gstreamer-gl/sys \
|
||||
gstreamer-gl/egl/sys \
|
||||
gstreamer-gl/wayland/sys \
|
||||
|
@ -25,13 +28,16 @@ for crate in gstreamer/sys \
|
|||
gstreamer-mpegts/sys \
|
||||
gstreamer-net/sys \
|
||||
gstreamer-pbutils/sys \
|
||||
gstreamer-play/sys \
|
||||
gstreamer-player/sys \
|
||||
gstreamer-rtp/sys \
|
||||
gstreamer-rtsp-server/sys \
|
||||
gstreamer-rtsp/sys \
|
||||
gstreamer-sdp/sys \
|
||||
gstreamer-tag/sys \
|
||||
gstreamer-validate/sys \
|
||||
gstreamer-video/sys \
|
||||
gstreamer-webrtc/sys; do
|
||||
echo "Testing $crate with --all-features)"
|
||||
cargo test --locked --color=always --manifest-path $crate/Cargo.toml --all-features
|
||||
RUST_BACKTRACE=1 cargo test --locked --color=always --manifest-path $crate/Cargo.toml --all-features
|
||||
done
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
# 'gstreamer-gl/egl',
|
||||
# 'gstreamer-gl/wayland',
|
||||
# 'gstreamer-gl/x11',
|
||||
# only has sys
|
||||
# 'gstreamer-mpegts',
|
||||
'gstreamer-mpegts',
|
||||
'gstreamer-mpegts/sys',
|
||||
'gstreamer-net',
|
||||
'gstreamer-pbutils',
|
||||
|
@ -26,8 +25,7 @@
|
|||
'gstreamer-rtsp',
|
||||
'gstreamer-rtsp-server',
|
||||
'gstreamer-sdp',
|
||||
# only has sys
|
||||
# 'gstreamer-tag',
|
||||
'gstreamer-tag',
|
||||
'gstreamer-tag/sys',
|
||||
'gstreamer-video',
|
||||
'gstreamer-webrtc',
|
||||
|
@ -78,6 +76,7 @@ foreach($features in $features_matrix) {
|
|||
}
|
||||
|
||||
$env:G_DEBUG="fatal_warnings"
|
||||
$env:RUST_BACKTRACE="1"
|
||||
cargo test --no-fail-fast --color=always --manifest-path $crate/Cargo.toml $env:LocalFeatures
|
||||
|
||||
if (!$?) {
|
||||
|
|
|
@ -4,7 +4,7 @@ FROM "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2023-07-17.0-ma
|
|||
|
||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
ARG DEFAULT_BRANCH="main"
|
||||
ARG DEFAULT_BRANCH="1.24"
|
||||
ARG RUST_VERSION="invalid"
|
||||
|
||||
RUN choco install -y pkgconfiglite nasm llvm openssl
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
|
||||
|
||||
# Download gstreamer and all its subprojects
|
||||
git clone -b 1.1.0 --depth 1 https://code.videolan.org/videolan/dav1d.git C:\dav1d
|
||||
git clone -b 1.4.1 --depth 1 https://code.videolan.org/videolan/dav1d.git C:\dav1d
|
||||
if (!$?) {
|
||||
Write-Host "Failed to clone dav1d"
|
||||
Exit 1
|
||||
|
|
|
@ -45,7 +45,7 @@ data-encoding = "2.0"
|
|||
once_cell = "1"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows = { version = "0.52", features=["Win32_Graphics_Direct3D11",
|
||||
windows = { version = "0.56", features=["Win32_Graphics_Direct3D11",
|
||||
"Win32_Foundation", "Win32_Graphics_Direct3D", "Win32_Graphics_Dxgi",
|
||||
"Win32_Graphics_Dxgi_Common", "Win32_Graphics_Direct2D",
|
||||
"Win32_Graphics_Direct2D_Common", "Win32_Graphics_DirectWrite",
|
||||
|
@ -204,3 +204,6 @@ required-features = ["cairo-rs", "gst-video/v1_18"]
|
|||
[[bin]]
|
||||
name = "d3d11videosink"
|
||||
required-features = ["windows"]
|
||||
|
||||
[[bin]]
|
||||
name = "audio_multichannel_interleave"
|
||||
|
|
153
examples/src/bin/audio_multichannel_interleave.rs
Normal file
153
examples/src/bin/audio_multichannel_interleave.rs
Normal file
|
@ -0,0 +1,153 @@
|
|||
// 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);
|
||||
}
|
|
@ -194,7 +194,7 @@ fn main() -> Result<()> {
|
|||
let mut metrics = DWRITE_TEXT_METRICS::default();
|
||||
layout.GetMetrics(&mut metrics).unwrap();
|
||||
layout
|
||||
.GetFontSize2(0, &mut font_size, Some(&mut range))
|
||||
.GetFontSize(0, &mut font_size, Some(&mut range))
|
||||
.unwrap();
|
||||
|
||||
if metrics.widthIncludingTrailingWhitespace >= desc.Width as f32 {
|
||||
|
|
|
@ -36,14 +36,14 @@ fn example_main() {
|
|||
// For flags handling
|
||||
// With flags, one can configure playbin's behavior such as whether it
|
||||
// should play back contained video streams, or if it should render subtitles.
|
||||
// let flags = playbin.get_property("flags").unwrap();
|
||||
// let flags_class = FlagsClass::new(flags.type_()).unwrap();
|
||||
// let flags = playbin.property_value("flags");
|
||||
// let flags_class = FlagsClass::with_type(flags.type_()).unwrap();
|
||||
// let flags = flags_class.builder_with_value(flags).unwrap()
|
||||
// .unset_by_nick("text")
|
||||
// .unset_by_nick("video")
|
||||
// .build()
|
||||
// .unwrap();
|
||||
// playbin.set_property_from_value("flags", &flags).unwrap();
|
||||
// playbin.set_property_from_value("flags", &flags);
|
||||
|
||||
// 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.
|
||||
|
|
|
@ -138,7 +138,11 @@ mod auth {
|
|||
if let Some(authorization) = auth_credentials.authorization() {
|
||||
if let Some(user) = self.external_auth(authorization) {
|
||||
// Update context token with authenticated username
|
||||
ctx.set_token(gst_rtsp_server::RTSPToken::new(&[("user", &user)]));
|
||||
ctx.set_token(
|
||||
gst_rtsp_server::RTSPToken::builder()
|
||||
.field("user", user)
|
||||
.build(),
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
// 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.
|
||||
|
||||
use std::{env, ptr};
|
||||
use std::env;
|
||||
|
||||
use anyhow::Error;
|
||||
use derive_more::{Display, Error};
|
||||
use glib::translate::*;
|
||||
use gst_rtsp_server::prelude::*;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
|
@ -45,10 +44,9 @@ fn main_loop() -> Result<(), Error> {
|
|||
// Here we configure a method of authentication that we want the
|
||||
// server to require from clients.
|
||||
let auth = gst_rtsp_server::RTSPAuth::new();
|
||||
let token = gst_rtsp_server::RTSPToken::new(&[(
|
||||
gst_rtsp_server::RTSP_TOKEN_MEDIA_FACTORY_ROLE,
|
||||
&"user",
|
||||
)]);
|
||||
let token = gst_rtsp_server::RTSPToken::builder()
|
||||
.field(gst_rtsp_server::RTSP_TOKEN_MEDIA_FACTORY_ROLE, "user")
|
||||
.build();
|
||||
let basic = gst_rtsp_server::RTSPAuth::make_basic("user", "password");
|
||||
// For proper authentication, we want to use encryption. And there's no
|
||||
// encryption without a certificate!
|
||||
|
@ -78,24 +76,14 @@ fn main_loop() -> Result<(), Error> {
|
|||
W535W8UBbEg=-----END PRIVATE KEY-----",
|
||||
)?;
|
||||
|
||||
// Bindable versions were added in b1f515178a363df0322d7adbd5754e1f6e2083c9
|
||||
// This declares that the user "user" (once authenticated) has a role that
|
||||
// allows them to access and construct media factories.
|
||||
unsafe {
|
||||
gst_rtsp_server::ffi::gst_rtsp_media_factory_add_role(
|
||||
factory.to_glib_none().0,
|
||||
"user".to_glib_none().0,
|
||||
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>(),
|
||||
);
|
||||
}
|
||||
factory.add_role_from_structure(
|
||||
&gst::Structure::builder("user")
|
||||
.field(gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_ACCESS, true)
|
||||
.field(gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_CONSTRUCT, true)
|
||||
.build(),
|
||||
);
|
||||
|
||||
auth.set_tls_certificate(Some(&cert));
|
||||
auth.add_basic(basic.as_str(), &token);
|
||||
|
|
|
@ -19,10 +19,6 @@ mod examples_common;
|
|||
#[display(fmt = "Could not get mount points")]
|
||||
struct NoMountPoints;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Usage: {_0} LAUNCH_LINE")]
|
||||
struct UsageError(#[error(not(source))] String);
|
||||
|
||||
fn main_loop() -> Result<(), Error> {
|
||||
let main_loop = glib::MainLoop::new(None, false);
|
||||
let server = server::Server::default();
|
||||
|
|
2
gir
2
gir
|
@ -1 +1 @@
|
|||
Subproject commit 5975266da3b0fa1195e53213502a8c9bc5d9b1ac
|
||||
Subproject commit 5f72cf0d9b9968e64b1e707c74aafd0bb7b46bce
|
|
@ -1 +1 @@
|
|||
Subproject commit fe8258109e602dcb000890197b62f832006c715a
|
||||
Subproject commit 6cd7b656acd61172ab7f125a7059e4d0ecfc9637
|
|
@ -1 +1 @@
|
|||
Subproject commit 63e90a30193bf8d228057c4570a50a0a2b40f2bd
|
||||
Subproject commit c988e03b5e99349efb8ffb6f502879ad4ddbc248
|
|
@ -15,7 +15,7 @@ rust-version.workspace = true
|
|||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
ffi = { package = "gstreamer-allocators-sys", path = "sys" }
|
||||
gstreamer-allocators-sys.workspace = true
|
||||
glib.workspace = true
|
||||
gst.workspace = true
|
||||
once_cell = "1"
|
||||
|
@ -25,11 +25,12 @@ gir-format-check = "0.1"
|
|||
|
||||
[features]
|
||||
default = []
|
||||
v1_16 = ["gst/v1_16", "ffi/v1_16"]
|
||||
v1_18 = ["gst/v1_18", "ffi/v1_18", "v1_16"]
|
||||
v1_20 = ["gst/v1_20", "ffi/v1_20", "v1_18"]
|
||||
v1_22 = ["gst/v1_22", "ffi/v1_22", "v1_20"]
|
||||
v1_24 = ["gst/v1_24", "ffi/v1_24", "v1_22"]
|
||||
v1_16 = ["gst/v1_16", "gstreamer-allocators-sys/v1_16"]
|
||||
v1_18 = ["gst/v1_18", "gstreamer-allocators-sys/v1_18", "v1_16"]
|
||||
v1_20 = ["gst/v1_20", "gstreamer-allocators-sys/v1_20", "v1_18"]
|
||||
v1_22 = ["gst/v1_22", "gstreamer-allocators-sys/v1_22", "v1_20"]
|
||||
v1_24 = ["gst/v1_24", "gstreamer-allocators-sys/v1_24", "v1_22"]
|
||||
v1_26 = ["gst/v1_26", "gstreamer-allocators-sys/v1_26", "v1_24"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::GStr;
|
||||
|
||||
#[doc(alias = "GST_ALLOCATOR_DMABUF")]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::FdAllocator;
|
||||
use crate::{ffi, FdAllocator};
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
glib::wrapper! {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{bitflags::bitflags, translate::*};
|
||||
|
||||
bitflags! {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::prelude::*;
|
||||
|
||||
glib::wrapper! {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::FdAllocator;
|
||||
use crate::{ffi, FdAllocator};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstShmAllocator")]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 5975266da3b0)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ fe8258109e60)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 63e90a30193b)
|
||||
Generated by gir (https://github.com/gtk-rs/gir @ 5f72cf0d9b99)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ c988e03b5e99)
|
||||
|
|
|
@ -9,7 +9,7 @@ use gst::{Memory, MemoryRef};
|
|||
#[cfg(feature = "v1_16")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
|
||||
use crate::FdMemoryFlags;
|
||||
use crate::{DmaBufAllocator, FdMemory, FdMemoryRef};
|
||||
use crate::{ffi, DmaBufAllocator, FdMemory, FdMemoryRef};
|
||||
|
||||
gst::memory_object_wrapper!(
|
||||
DmaBufMemory,
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{fmt, mem, os::unix::prelude::IntoRawFd};
|
|||
use glib::{prelude::*, translate::*};
|
||||
use gst::{Memory, MemoryRef};
|
||||
|
||||
use crate::{DRMDumbAllocator, DmaBufMemory};
|
||||
use crate::{ffi, DRMDumbAllocator, DmaBufMemory};
|
||||
|
||||
gst::memory_object_wrapper!(
|
||||
DRMDumbMemory,
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{fmt, os::unix::prelude::RawFd};
|
|||
use glib::{prelude::*, translate::*};
|
||||
use gst::{Memory, MemoryRef};
|
||||
|
||||
use crate::{FdAllocator, FdMemoryFlags};
|
||||
use crate::{ffi, FdAllocator, FdMemoryFlags};
|
||||
|
||||
gst::memory_object_wrapper!(
|
||||
FdMemory,
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#![allow(clippy::missing_safety_doc)]
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
pub use ffi;
|
||||
pub use glib;
|
||||
pub use gst;
|
||||
pub use gstreamer_allocators_sys as ffi;
|
||||
|
||||
macro_rules! assert_initialized_main_thread {
|
||||
() => {
|
||||
|
@ -56,6 +56,8 @@ pub use phys_memory::*;
|
|||
pub mod prelude {
|
||||
#[doc(hidden)]
|
||||
pub use gst::prelude::*;
|
||||
|
||||
pub use crate::auto::traits::*;
|
||||
}
|
||||
|
||||
pub mod subclass;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::fmt;
|
||||
|
||||
use crate::ffi;
|
||||
use glib::translate::*;
|
||||
use gst::{Memory, MemoryRef};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use glib::translate::*;
|
||||
|
||||
use crate::ShmAllocator;
|
||||
use crate::{ffi, ShmAllocator};
|
||||
|
||||
impl ShmAllocator {
|
||||
#[doc(alias = "gst_shm_allocator_get")]
|
||||
|
|
|
@ -23,6 +23,7 @@ v1_18 = ["v1_16"]
|
|||
v1_20 = ["v1_18"]
|
||||
v1_22 = ["v1_20"]
|
||||
v1_24 = ["v1_22"]
|
||||
v1_26 = ["v1_24"]
|
||||
|
||||
[lib]
|
||||
name = "gstreamer_allocators_sys"
|
||||
|
@ -77,4 +78,7 @@ version = "1.20"
|
|||
version = "1.22"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_allocators_1_0.v1_24]
|
||||
version = "1.23"
|
||||
version = "1.24"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_allocators_1_0.v1_26]
|
||||
version = "1.25"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 5975266da3b0)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ fe8258109e60)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 63e90a30193b)
|
||||
Generated by gir (https://github.com/gtk-rs/gir @ 5f72cf0d9b99)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ c988e03b5e99)
|
||||
|
|
|
@ -19,8 +19,11 @@ use gstreamer_sys as gst;
|
|||
#[allow(unused_imports)]
|
||||
use libc::{
|
||||
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
|
||||
intptr_t, size_t, ssize_t, uintptr_t, FILE,
|
||||
intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE,
|
||||
};
|
||||
#[cfg(unix)]
|
||||
#[allow(unused_imports)]
|
||||
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use glib::{gboolean, gconstpointer, gpointer, GType};
|
||||
|
|
|
@ -15,7 +15,7 @@ rust-version.workspace = true
|
|||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
ffi = { package = "gstreamer-analytics-sys", path = "sys" }
|
||||
gstreamer-analytics-sys.workspace = true
|
||||
glib.workspace = true
|
||||
gst.workspace = true
|
||||
|
||||
|
@ -24,6 +24,7 @@ gir-format-check = "0.1"
|
|||
|
||||
[features]
|
||||
default = []
|
||||
v1_26 = ["gst/v1_26", "gstreamer-analytics-sys/v1_26"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{bitflags::bitflags, translate::*};
|
||||
|
||||
bitflags! {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 5975266da3b0)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ fe8258109e60)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 63e90a30193b)
|
||||
Generated by gir (https://github.com/gtk-rs/gir @ 5f72cf0d9b99)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ c988e03b5e99)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use glib::translate::*;
|
||||
|
||||
use crate::relation_meta::*;
|
||||
use crate::{ffi, relation_meta::*};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum AnalyticsClassificationMtd {}
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#![allow(clippy::missing_safety_doc)]
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
pub use ffi;
|
||||
pub use glib;
|
||||
pub use gst;
|
||||
pub use gstreamer_analytics_sys as ffi;
|
||||
|
||||
macro_rules! skip_assert_initialized {
|
||||
() => {};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use glib::translate::*;
|
||||
|
||||
use crate::relation_meta::*;
|
||||
use crate::{ffi, relation_meta::*};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum AnalyticsODMtd {}
|
||||
|
@ -60,13 +60,13 @@ impl<'a> AnalyticsRelationMetaODExt
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
#[derive(Clone, Copy, Default, Debug)]
|
||||
pub struct AnalyticsODLocation {
|
||||
x: i32,
|
||||
y: i32,
|
||||
w: i32,
|
||||
h: i32,
|
||||
loc_conf_lvl: f32,
|
||||
pub x: i32,
|
||||
pub y: i32,
|
||||
pub w: i32,
|
||||
pub h: i32,
|
||||
pub loc_conf_lvl: f32,
|
||||
}
|
||||
|
||||
unsafe impl AnalyticsMtd for AnalyticsODMtd {
|
||||
|
@ -82,11 +82,15 @@ unsafe fn from(t: ffi::GstAnalyticsMtd) -> ffi::GstAnalyticsODMtd {
|
|||
|
||||
impl<'a> AnalyticsMtdRef<'a, AnalyticsODMtd> {
|
||||
#[doc(alias = "gst_analytics_od_mtd_get_obj_type")]
|
||||
pub fn obj_type(&self) -> glib::Quark {
|
||||
pub fn obj_type(&self) -> Option<glib::Quark> {
|
||||
unsafe {
|
||||
let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self));
|
||||
let type_ = ffi::gst_analytics_od_mtd_get_obj_type(&mut mtd);
|
||||
glib::Quark::from_glib(type_)
|
||||
if type_ == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(glib::Quark::from_glib(type_))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +147,7 @@ mod tests {
|
|||
.add_od_mtd(glib::Quark::from_str("blb"), 0, 1, 10, 20, 0.8)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(od.obj_type(), glib::Quark::from_str("blb"));
|
||||
assert_eq!(od.obj_type().unwrap(), glib::Quark::from_str("blb"));
|
||||
|
||||
let loc = od.location().unwrap();
|
||||
|
||||
|
@ -159,7 +163,7 @@ mod tests {
|
|||
let meta2 = buf.meta::<AnalyticsRelationMeta>().unwrap();
|
||||
let od2 = meta2.mtd::<AnalyticsODMtd>(0).unwrap();
|
||||
|
||||
assert_eq!(od2.obj_type(), glib::Quark::from_str("blb"));
|
||||
assert_eq!(od2.obj_type().unwrap(), glib::Quark::from_str("blb"));
|
||||
let loc = od2.location().unwrap();
|
||||
|
||||
assert_eq!(loc.x, 0);
|
||||
|
|
|
@ -4,7 +4,7 @@ use glib::translate::*;
|
|||
use gst::prelude::*;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::RelTypes;
|
||||
use crate::{ffi, RelTypes};
|
||||
|
||||
#[repr(transparent)]
|
||||
#[doc(alias = "GstAnalyticsRelationMeta")]
|
||||
|
@ -652,13 +652,13 @@ mod tests {
|
|||
assert_eq!(meta.len(), meta.iter::<AnalyticsAnyMtd>().count());
|
||||
assert_eq!(meta.len(), meta.iter::<AnalyticsODMtd>().count());
|
||||
for mtd in meta.iter::<AnalyticsODMtd>() {
|
||||
assert_eq!(mtd.obj_type(), glib::Quark::from_str("blb"))
|
||||
assert_eq!(mtd.obj_type().unwrap(), glib::Quark::from_str("blb"))
|
||||
}
|
||||
|
||||
assert_eq!(meta.len(), meta.iter::<AnalyticsAnyMtd>().count());
|
||||
for mtd in meta.iter::<AnalyticsAnyMtd>() {
|
||||
if let Ok(mtd) = mtd.downcast::<AnalyticsODMtd>() {
|
||||
assert_eq!(mtd.obj_type(), glib::Quark::from_str("blb"))
|
||||
assert_eq!(mtd.obj_type().unwrap(), glib::Quark::from_str("blb"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -689,7 +689,7 @@ mod tests {
|
|||
0
|
||||
);
|
||||
for mtd in meta.iter_direct_related::<AnalyticsODMtd>(od1_id, crate::RelTypes::IS_PART_OF) {
|
||||
assert_eq!(mtd.obj_type(), glib::Quark::from_str("blb"))
|
||||
assert_eq!(mtd.obj_type().unwrap(), glib::Quark::from_str("blb"))
|
||||
}
|
||||
|
||||
let mut meta = buf.make_mut().meta_mut::<AnalyticsRelationMeta>().unwrap();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use glib::translate::*;
|
||||
|
||||
use crate::relation_meta::*;
|
||||
use crate::{ffi, relation_meta::*};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum AnalyticsTrackingMtd {}
|
||||
|
|
|
@ -52,6 +52,10 @@ rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
|
|||
|
||||
[package.metadata.system-deps.gstreamer_analytics_1_0]
|
||||
name = "gstreamer-analytics-1.0"
|
||||
version = "1.23"
|
||||
version = "1.24"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_analytics_1_0.v1_26]
|
||||
version = "1.25"
|
||||
|
||||
[features]
|
||||
v1_26 = []
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 5975266da3b0)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ fe8258109e60)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 63e90a30193b)
|
||||
Generated by gir (https://github.com/gtk-rs/gir @ 5f72cf0d9b99)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ c988e03b5e99)
|
||||
|
|
|
@ -18,8 +18,11 @@ use gstreamer_sys as gst;
|
|||
#[allow(unused_imports)]
|
||||
use libc::{
|
||||
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
|
||||
intptr_t, size_t, ssize_t, uintptr_t, FILE,
|
||||
intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE,
|
||||
};
|
||||
#[cfg(unix)]
|
||||
#[allow(unused_imports)]
|
||||
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use glib::{gboolean, gconstpointer, gpointer, GType};
|
||||
|
@ -28,7 +31,6 @@ use glib::{gboolean, gconstpointer, gpointer, GType};
|
|||
pub type GstAnalyticsMtdType = uintptr_t;
|
||||
|
||||
// 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_ANALYTICS_MTD_TYPE_ANY: c_int = 0;
|
||||
|
||||
|
@ -95,7 +97,6 @@ impl ::std::fmt::Debug for GstAnalyticsMtdImpl {
|
|||
f.debug_struct(&format!("GstAnalyticsMtdImpl @ {self:p}"))
|
||||
.field("name", &self.name)
|
||||
.field("mtd_meta_transform", &self.mtd_meta_transform)
|
||||
.field("_reserved", &self._reserved)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,6 +268,5 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
|
|||
("(guint) GST_ANALYTICS_REL_TYPE_LAST", "16"),
|
||||
("(guint) GST_ANALYTICS_REL_TYPE_NONE", "0"),
|
||||
("(guint) GST_ANALYTICS_REL_TYPE_RELATE_TO", "8"),
|
||||
("GST_AN_RELATION_META_TAG", "GST-ANALYSIS-RELATION-META-TAG"),
|
||||
("GST_INF_RELATION_SPAN", "-1"),
|
||||
];
|
||||
|
|
|
@ -36,7 +36,6 @@ int main() {
|
|||
PRINT_CONSTANT((guint) GST_ANALYTICS_REL_TYPE_LAST);
|
||||
PRINT_CONSTANT((guint) GST_ANALYTICS_REL_TYPE_NONE);
|
||||
PRINT_CONSTANT((guint) GST_ANALYTICS_REL_TYPE_RELATE_TO);
|
||||
PRINT_CONSTANT(GST_AN_RELATION_META_TAG);
|
||||
PRINT_CONSTANT(GST_INF_RELATION_SPAN);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ rust-version.workspace = true
|
|||
futures-core = "0.3"
|
||||
futures-sink = "0.3"
|
||||
libc = "0.2"
|
||||
ffi = { package = "gstreamer-app-sys", path = "sys" }
|
||||
gstreamer-app-sys.workspace = true
|
||||
glib.workspace = true
|
||||
gst.workspace = true
|
||||
gst-base.workspace = true
|
||||
|
@ -29,11 +29,12 @@ gir-format-check = "0.1"
|
|||
|
||||
[features]
|
||||
default = []
|
||||
v1_16 = ["gst/v1_16", "gst-base/v1_16", "ffi/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", "ffi/v1_20", "v1_18"]
|
||||
v1_22 = ["gst/v1_22", "gst-base/v1_22", "ffi/v1_22", "v1_20"]
|
||||
v1_24 = ["gst/v1_24", "gst-base/v1_24", "ffi/v1_24", "v1_22"]
|
||||
v1_16 = ["gst/v1_16", "gst-base/v1_16", "gstreamer-app-sys/v1_16"]
|
||||
v1_18 = ["gst/v1_18", "gst-base/v1_18", "gstreamer-app-sys/v1_18", "v1_16"]
|
||||
v1_20 = ["gst/v1_20", "gst-base/v1_20", "gstreamer-app-sys/v1_20", "v1_18"]
|
||||
v1_22 = ["gst/v1_22", "gst-base/v1_22", "gstreamer-app-sys/v1_22", "v1_20"]
|
||||
v1_24 = ["gst/v1_24", "gst-base/v1_24", "gstreamer-app-sys/v1_24", "v1_22"]
|
||||
v1_26 = ["gst/v1_26", "gst-base/v1_26", "gstreamer-app-sys/v1_26", "v1_24"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -4,17 +4,17 @@ use std::{
|
|||
mem, panic,
|
||||
pin::Pin,
|
||||
ptr,
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, Mutex,
|
||||
},
|
||||
sync::{Arc, Mutex},
|
||||
task::{Context, Poll, Waker},
|
||||
};
|
||||
|
||||
#[cfg(not(panic = "abort"))]
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use futures_core::Stream;
|
||||
use glib::{ffi::gpointer, prelude::*, translate::*};
|
||||
|
||||
use crate::AppSink;
|
||||
use crate::{ffi, AppSink};
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub struct AppSinkCallbacks {
|
||||
|
@ -28,6 +28,7 @@ pub struct AppSinkCallbacks {
|
|||
new_event: Option<Box<dyn FnMut(&AppSink) -> bool + Send + 'static>>,
|
||||
propose_allocation:
|
||||
Option<Box<dyn FnMut(&AppSink, &mut gst::query::Allocation) -> bool + Send + 'static>>,
|
||||
#[cfg(not(panic = "abort"))]
|
||||
panicked: AtomicBool,
|
||||
callbacks: ffi::GstAppSinkCallbacks,
|
||||
}
|
||||
|
@ -71,6 +72,14 @@ impl AppSinkCallbacksBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
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<
|
||||
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
|
||||
>(
|
||||
|
@ -83,6 +92,19 @@ impl AppSinkCallbacksBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
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<
|
||||
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
|
||||
>(
|
||||
|
@ -95,6 +117,19 @@ impl AppSinkCallbacksBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
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_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
pub fn new_event<F: FnMut(&AppSink) -> bool + Send + 'static>(self, new_event: F) -> Self {
|
||||
|
@ -104,6 +139,19 @@ impl AppSinkCallbacksBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
#[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_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
pub fn propose_allocation<
|
||||
|
@ -118,6 +166,21 @@ impl AppSinkCallbacksBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
#[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"]
|
||||
pub fn build(self) -> AppSinkCallbacks {
|
||||
let have_eos = self.eos.is_some();
|
||||
|
@ -132,6 +195,7 @@ impl AppSinkCallbacksBuilder {
|
|||
new_sample: self.new_sample,
|
||||
new_event: self.new_event,
|
||||
propose_allocation: self.propose_allocation,
|
||||
#[cfg(not(panic = "abort"))]
|
||||
panicked: AtomicBool::new(false),
|
||||
callbacks: ffi::GstAppSinkCallbacks {
|
||||
eos: if have_eos { Some(trampoline_eos) } else { None },
|
||||
|
@ -165,6 +229,7 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp
|
|||
let callbacks = callbacks as *mut AppSinkCallbacks;
|
||||
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||
|
||||
#[cfg(not(panic = "abort"))]
|
||||
if (*callbacks).panicked.load(Ordering::Relaxed) {
|
||||
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
|
||||
|
@ -176,12 +241,19 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp
|
|||
match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => {
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
#[cfg(panic = "abort")]
|
||||
{
|
||||
unreachable!("{err:?}");
|
||||
}
|
||||
#[cfg(not(panic = "abort"))]
|
||||
{
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,6 +266,7 @@ unsafe extern "C" fn trampoline_new_preroll(
|
|||
let callbacks = callbacks as *mut AppSinkCallbacks;
|
||||
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||
|
||||
#[cfg(not(panic = "abort"))]
|
||||
if (*callbacks).panicked.load(Ordering::Relaxed) {
|
||||
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
|
||||
|
@ -205,14 +278,21 @@ unsafe extern "C" fn trampoline_new_preroll(
|
|||
match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => {
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
#[cfg(panic = "abort")]
|
||||
{
|
||||
unreachable!("{err:?}");
|
||||
}
|
||||
#[cfg(not(panic = "abort"))]
|
||||
{
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
|
||||
gst::FlowReturn::Error
|
||||
gst::FlowReturn::Error
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -229,6 +309,7 @@ unsafe extern "C" fn trampoline_new_sample(
|
|||
let callbacks = callbacks as *mut AppSinkCallbacks;
|
||||
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||
|
||||
#[cfg(not(panic = "abort"))]
|
||||
if (*callbacks).panicked.load(Ordering::Relaxed) {
|
||||
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
|
||||
|
@ -240,14 +321,21 @@ unsafe extern "C" fn trampoline_new_sample(
|
|||
match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => {
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
#[cfg(panic = "abort")]
|
||||
{
|
||||
unreachable!("{err:?}");
|
||||
}
|
||||
#[cfg(not(panic = "abort"))]
|
||||
{
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
|
||||
gst::FlowReturn::Error
|
||||
gst::FlowReturn::Error
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -264,6 +352,7 @@ unsafe extern "C" fn trampoline_new_event(
|
|||
let callbacks = callbacks as *mut AppSinkCallbacks;
|
||||
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||
|
||||
#[cfg(not(panic = "abort"))]
|
||||
if (*callbacks).panicked.load(Ordering::Relaxed) {
|
||||
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
|
||||
|
@ -275,14 +364,21 @@ unsafe extern "C" fn trampoline_new_event(
|
|||
match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => {
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
#[cfg(panic = "abort")]
|
||||
{
|
||||
unreachable!("{err:?}");
|
||||
}
|
||||
#[cfg(not(panic = "abort"))]
|
||||
{
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
|
||||
false
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -300,6 +396,7 @@ unsafe extern "C" fn trampoline_propose_allocation(
|
|||
let callbacks = callbacks as *mut AppSinkCallbacks;
|
||||
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||
|
||||
#[cfg(not(panic = "abort"))]
|
||||
if (*callbacks).panicked.load(Ordering::Relaxed) {
|
||||
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
|
||||
|
@ -317,14 +414,20 @@ unsafe extern "C" fn trampoline_propose_allocation(
|
|||
match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => {
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
|
||||
false
|
||||
#[cfg(panic = "abort")]
|
||||
{
|
||||
unreachable!("{err:?}");
|
||||
}
|
||||
#[cfg(not(panic = "abort"))]
|
||||
{
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -4,13 +4,13 @@ use std::{
|
|||
mem, panic,
|
||||
pin::Pin,
|
||||
ptr,
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, Mutex,
|
||||
},
|
||||
sync::{Arc, Mutex},
|
||||
task::{Context, Poll, Waker},
|
||||
};
|
||||
|
||||
#[cfg(not(panic = "abort"))]
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use futures_sink::Sink;
|
||||
use glib::{
|
||||
ffi::{gboolean, gpointer},
|
||||
|
@ -18,13 +18,14 @@ use glib::{
|
|||
translate::*,
|
||||
};
|
||||
|
||||
use crate::AppSrc;
|
||||
use crate::{ffi, AppSrc};
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub struct AppSrcCallbacks {
|
||||
need_data: Option<Box<dyn FnMut(&AppSrc, u32) + Send + 'static>>,
|
||||
enough_data: Option<Box<dyn Fn(&AppSrc) + Send + Sync + 'static>>,
|
||||
seek_data: Option<Box<dyn Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>>,
|
||||
#[cfg(not(panic = "abort"))]
|
||||
panicked: AtomicBool,
|
||||
callbacks: ffi::GstAppSrcCallbacks,
|
||||
}
|
||||
|
@ -60,6 +61,17 @@ impl AppSrcCallbacksBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
Self {
|
||||
enough_data: Some(Box::new(enough_data)),
|
||||
|
@ -67,6 +79,17 @@ impl AppSrcCallbacksBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
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>(
|
||||
self,
|
||||
seek_data: F,
|
||||
|
@ -77,6 +100,17 @@ impl AppSrcCallbacksBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
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"]
|
||||
pub fn build(self) -> AppSrcCallbacks {
|
||||
let have_need_data = self.need_data.is_some();
|
||||
|
@ -87,6 +121,7 @@ impl AppSrcCallbacksBuilder {
|
|||
need_data: self.need_data,
|
||||
enough_data: self.enough_data,
|
||||
seek_data: self.seek_data,
|
||||
#[cfg(not(panic = "abort"))]
|
||||
panicked: AtomicBool::new(false),
|
||||
callbacks: ffi::GstAppSrcCallbacks {
|
||||
need_data: if have_need_data {
|
||||
|
@ -123,6 +158,7 @@ unsafe extern "C" fn trampoline_need_data(
|
|||
let callbacks = callbacks as *mut AppSrcCallbacks;
|
||||
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
|
||||
|
||||
#[cfg(not(panic = "abort"))]
|
||||
if (*callbacks).panicked.load(Ordering::Relaxed) {
|
||||
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
|
||||
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
|
||||
|
@ -134,12 +170,19 @@ unsafe extern "C" fn trampoline_need_data(
|
|||
match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => {
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
#[cfg(panic = "abort")]
|
||||
{
|
||||
unreachable!("{err:?}");
|
||||
}
|
||||
#[cfg(not(panic = "abort"))]
|
||||
{
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,6 +192,7 @@ unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbac
|
|||
let callbacks = callbacks as *const AppSrcCallbacks;
|
||||
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
|
||||
|
||||
#[cfg(not(panic = "abort"))]
|
||||
if (*callbacks).panicked.load(Ordering::Relaxed) {
|
||||
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
|
||||
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
|
||||
|
@ -160,12 +204,19 @@ unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbac
|
|||
match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => {
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
#[cfg(panic = "abort")]
|
||||
{
|
||||
unreachable!("{err:?}");
|
||||
}
|
||||
#[cfg(not(panic = "abort"))]
|
||||
{
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -179,6 +230,7 @@ unsafe extern "C" fn trampoline_seek_data(
|
|||
let callbacks = callbacks as *const AppSrcCallbacks;
|
||||
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
|
||||
|
||||
#[cfg(not(panic = "abort"))]
|
||||
if (*callbacks).panicked.load(Ordering::Relaxed) {
|
||||
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
|
||||
gst::subclass::post_panic_error_message(element.upcast_ref(), element.upcast_ref(), None);
|
||||
|
@ -190,14 +242,21 @@ unsafe extern "C" fn trampoline_seek_data(
|
|||
match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => {
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
#[cfg(panic = "abort")]
|
||||
{
|
||||
unreachable!("{err:?}");
|
||||
}
|
||||
#[cfg(not(panic = "abort"))]
|
||||
{
|
||||
(*callbacks).panicked.store(true, Ordering::Relaxed);
|
||||
gst::subclass::post_panic_error_message(
|
||||
element.upcast_ref(),
|
||||
element.upcast_ref(),
|
||||
Some(err),
|
||||
);
|
||||
|
||||
false
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
|
@ -38,12 +39,14 @@ impl AppSink {
|
|||
|
||||
#[doc(alias = "gst_app_sink_get_drop")]
|
||||
#[doc(alias = "get_drop")]
|
||||
#[doc(alias = "drop")]
|
||||
pub fn is_drop(&self) -> bool {
|
||||
unsafe { from_glib(ffi::gst_app_sink_get_drop(self.to_glib_none().0)) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_app_sink_get_max_buffers")]
|
||||
#[doc(alias = "get_max_buffers")]
|
||||
#[doc(alias = "max-buffers")]
|
||||
pub fn max_buffers(&self) -> u32 {
|
||||
unsafe { ffi::gst_app_sink_get_max_buffers(self.to_glib_none().0) }
|
||||
}
|
||||
|
@ -52,6 +55,7 @@ impl AppSink {
|
|||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
#[doc(alias = "gst_app_sink_get_max_bytes")]
|
||||
#[doc(alias = "get_max_bytes")]
|
||||
#[doc(alias = "max-bytes")]
|
||||
pub fn max_bytes(&self) -> u64 {
|
||||
unsafe { ffi::gst_app_sink_get_max_bytes(self.to_glib_none().0) }
|
||||
}
|
||||
|
@ -60,12 +64,14 @@ impl AppSink {
|
|||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
#[doc(alias = "gst_app_sink_get_max_time")]
|
||||
#[doc(alias = "get_max_time")]
|
||||
#[doc(alias = "max-time")]
|
||||
pub fn max_time(&self) -> Option<gst::ClockTime> {
|
||||
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 = "get_wait_on_eos")]
|
||||
#[doc(alias = "wait-on-eos")]
|
||||
pub fn is_wait_on_eos(&self) -> bool {
|
||||
unsafe { from_glib(ffi::gst_app_sink_get_wait_on_eos(self.to_glib_none().0)) }
|
||||
}
|
||||
|
@ -117,6 +123,7 @@ impl AppSink {
|
|||
//}
|
||||
|
||||
#[doc(alias = "gst_app_sink_set_caps")]
|
||||
#[doc(alias = "caps")]
|
||||
pub fn set_caps(&self, caps: Option<&gst::Caps>) {
|
||||
unsafe {
|
||||
ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
|
||||
|
@ -124,6 +131,7 @@ impl AppSink {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_app_sink_set_drop")]
|
||||
#[doc(alias = "drop")]
|
||||
pub fn set_drop(&self, drop: bool) {
|
||||
unsafe {
|
||||
ffi::gst_app_sink_set_drop(self.to_glib_none().0, drop.into_glib());
|
||||
|
@ -131,6 +139,7 @@ impl AppSink {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_app_sink_set_max_buffers")]
|
||||
#[doc(alias = "max-buffers")]
|
||||
pub fn set_max_buffers(&self, max: u32) {
|
||||
unsafe {
|
||||
ffi::gst_app_sink_set_max_buffers(self.to_glib_none().0, max);
|
||||
|
@ -140,6 +149,7 @@ impl AppSink {
|
|||
#[cfg(feature = "v1_24")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
#[doc(alias = "gst_app_sink_set_max_bytes")]
|
||||
#[doc(alias = "max-bytes")]
|
||||
pub fn set_max_bytes(&self, max: u64) {
|
||||
unsafe {
|
||||
ffi::gst_app_sink_set_max_bytes(self.to_glib_none().0, max);
|
||||
|
@ -149,6 +159,7 @@ impl AppSink {
|
|||
#[cfg(feature = "v1_24")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
|
||||
#[doc(alias = "gst_app_sink_set_max_time")]
|
||||
#[doc(alias = "max-time")]
|
||||
pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) {
|
||||
unsafe {
|
||||
ffi::gst_app_sink_set_max_time(self.to_glib_none().0, max.into().into_glib());
|
||||
|
@ -156,6 +167,7 @@ impl AppSink {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_app_sink_set_wait_on_eos")]
|
||||
#[doc(alias = "wait-on-eos")]
|
||||
pub fn set_wait_on_eos(&self, wait: bool) {
|
||||
unsafe {
|
||||
ffi::gst_app_sink_set_wait_on_eos(self.to_glib_none().0, wait.into_glib());
|
||||
|
@ -233,7 +245,7 @@ impl AppSink {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::buffer-list\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_buffer_list_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -259,7 +271,7 @@ impl AppSink {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::caps\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_caps_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -285,7 +297,7 @@ impl AppSink {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::drop\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_drop_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -311,7 +323,7 @@ impl AppSink {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::eos\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_eos_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -339,7 +351,7 @@ impl AppSink {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::max-buffers\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_max_buffers_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -369,7 +381,7 @@ impl AppSink {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::max-bytes\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_max_bytes_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -397,7 +409,7 @@ impl AppSink {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::max-time\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_max_time_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -425,7 +437,7 @@ impl AppSink {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::wait-on-eos\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_wait_on_eos_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#[cfg(feature = "v1_20")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
use crate::AppLeakyType;
|
||||
use crate::AppStreamType;
|
||||
use crate::{ffi, AppStreamType};
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
|
@ -39,12 +39,14 @@ impl AppSrc {
|
|||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_app_src_get_current_level_buffers")]
|
||||
#[doc(alias = "get_current_level_buffers")]
|
||||
#[doc(alias = "current-level-buffers")]
|
||||
pub fn current_level_buffers(&self) -> u64 {
|
||||
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 = "get_current_level_bytes")]
|
||||
#[doc(alias = "current-level-bytes")]
|
||||
pub fn current_level_bytes(&self) -> u64 {
|
||||
unsafe { ffi::gst_app_src_get_current_level_bytes(self.to_glib_none().0) }
|
||||
}
|
||||
|
@ -53,6 +55,7 @@ impl AppSrc {
|
|||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_app_src_get_current_level_time")]
|
||||
#[doc(alias = "get_current_level_time")]
|
||||
#[doc(alias = "current-level-time")]
|
||||
pub fn current_level_time(&self) -> Option<gst::ClockTime> {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_app_src_get_current_level_time(
|
||||
|
@ -71,6 +74,7 @@ impl AppSrc {
|
|||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_app_src_get_leaky_type")]
|
||||
#[doc(alias = "get_leaky_type")]
|
||||
#[doc(alias = "leaky-type")]
|
||||
pub fn leaky_type(&self) -> AppLeakyType {
|
||||
unsafe { from_glib(ffi::gst_app_src_get_leaky_type(self.to_glib_none().0)) }
|
||||
}
|
||||
|
@ -79,12 +83,14 @@ impl AppSrc {
|
|||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_app_src_get_max_buffers")]
|
||||
#[doc(alias = "get_max_buffers")]
|
||||
#[doc(alias = "max-buffers")]
|
||||
pub fn max_buffers(&self) -> u64 {
|
||||
unsafe { ffi::gst_app_src_get_max_buffers(self.to_glib_none().0) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_app_src_get_max_bytes")]
|
||||
#[doc(alias = "get_max_bytes")]
|
||||
#[doc(alias = "max-bytes")]
|
||||
pub fn max_bytes(&self) -> u64 {
|
||||
unsafe { ffi::gst_app_src_get_max_bytes(self.to_glib_none().0) }
|
||||
}
|
||||
|
@ -93,6 +99,7 @@ impl AppSrc {
|
|||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_app_src_get_max_time")]
|
||||
#[doc(alias = "get_max_time")]
|
||||
#[doc(alias = "max-time")]
|
||||
pub fn max_time(&self) -> Option<gst::ClockTime> {
|
||||
unsafe { from_glib(ffi::gst_app_src_get_max_time(self.to_glib_none().0)) }
|
||||
}
|
||||
|
@ -105,6 +112,7 @@ impl AppSrc {
|
|||
|
||||
#[doc(alias = "gst_app_src_get_stream_type")]
|
||||
#[doc(alias = "get_stream_type")]
|
||||
#[doc(alias = "stream-type")]
|
||||
pub fn stream_type(&self) -> AppStreamType {
|
||||
unsafe { from_glib(ffi::gst_app_src_get_stream_type(self.to_glib_none().0)) }
|
||||
}
|
||||
|
@ -148,6 +156,7 @@ impl AppSrc {
|
|||
//}
|
||||
|
||||
#[doc(alias = "gst_app_src_set_caps")]
|
||||
#[doc(alias = "caps")]
|
||||
pub fn set_caps(&self, caps: Option<&gst::Caps>) {
|
||||
unsafe {
|
||||
ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
|
||||
|
@ -155,6 +164,7 @@ impl AppSrc {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_app_src_set_duration")]
|
||||
#[doc(alias = "duration")]
|
||||
pub fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) {
|
||||
unsafe {
|
||||
ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.into().into_glib());
|
||||
|
@ -164,6 +174,7 @@ impl AppSrc {
|
|||
#[cfg(feature = "v1_20")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_app_src_set_leaky_type")]
|
||||
#[doc(alias = "leaky-type")]
|
||||
pub fn set_leaky_type(&self, leaky: AppLeakyType) {
|
||||
unsafe {
|
||||
ffi::gst_app_src_set_leaky_type(self.to_glib_none().0, leaky.into_glib());
|
||||
|
@ -173,6 +184,7 @@ impl AppSrc {
|
|||
#[cfg(feature = "v1_20")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_app_src_set_max_buffers")]
|
||||
#[doc(alias = "max-buffers")]
|
||||
pub fn set_max_buffers(&self, max: u64) {
|
||||
unsafe {
|
||||
ffi::gst_app_src_set_max_buffers(self.to_glib_none().0, max);
|
||||
|
@ -180,6 +192,7 @@ impl AppSrc {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_app_src_set_max_bytes")]
|
||||
#[doc(alias = "max-bytes")]
|
||||
pub fn set_max_bytes(&self, max: u64) {
|
||||
unsafe {
|
||||
ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max);
|
||||
|
@ -189,6 +202,7 @@ impl AppSrc {
|
|||
#[cfg(feature = "v1_20")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_app_src_set_max_time")]
|
||||
#[doc(alias = "max-time")]
|
||||
pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) {
|
||||
unsafe {
|
||||
ffi::gst_app_src_set_max_time(self.to_glib_none().0, max.into().into_glib());
|
||||
|
@ -196,6 +210,7 @@ impl AppSrc {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_app_src_set_size")]
|
||||
#[doc(alias = "size")]
|
||||
pub fn set_size(&self, size: i64) {
|
||||
unsafe {
|
||||
ffi::gst_app_src_set_size(self.to_glib_none().0, size);
|
||||
|
@ -203,6 +218,7 @@ impl AppSrc {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_app_src_set_stream_type")]
|
||||
#[doc(alias = "stream-type")]
|
||||
pub fn set_stream_type(&self, type_: AppStreamType) {
|
||||
unsafe {
|
||||
ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.into_glib());
|
||||
|
@ -297,7 +313,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::block\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_block_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -323,7 +339,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::caps\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_caps_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -353,7 +369,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::current-level-buffers\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_current_level_buffers_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -381,7 +397,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::current-level-bytes\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_current_level_bytes_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -411,7 +427,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::current-level-time\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_current_level_time_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -437,7 +453,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::duration\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_duration_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -463,7 +479,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::format\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_format_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -493,7 +509,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::handle-segment-change\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_handle_segment_change_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -519,7 +535,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::is-live\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_is_live_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -549,7 +565,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::leaky-type\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_leaky_type_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -579,7 +595,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::max-buffers\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_max_buffers_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -605,7 +621,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::max-bytes\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_max_bytes_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -633,7 +649,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::max-latency\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_max_latency_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -661,7 +677,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::max-time\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_max_time_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -689,7 +705,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::min-latency\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_min_latency_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -717,7 +733,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::min-percent\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_min_percent_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -743,7 +759,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::size\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_size_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -771,7 +787,7 @@ impl AppSrc {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::stream-type\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_stream_type_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
#[cfg(feature = "v1_20")]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 5975266da3b0)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ fe8258109e60)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 63e90a30193b)
|
||||
Generated by gir (https://github.com/gtk-rs/gir @ 5f72cf0d9b99)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ c988e03b5e99)
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
#![allow(clippy::missing_safety_doc)]
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
pub use ffi;
|
||||
pub use glib;
|
||||
pub use gst;
|
||||
pub use gst_base;
|
||||
pub use gstreamer_app_sys as ffi;
|
||||
|
||||
macro_rules! assert_initialized_main_thread {
|
||||
() => {
|
||||
|
|
|
@ -23,6 +23,7 @@ v1_18 = ["v1_16"]
|
|||
v1_20 = ["v1_18"]
|
||||
v1_22 = ["v1_20"]
|
||||
v1_24 = ["v1_22"]
|
||||
v1_26 = ["v1_24"]
|
||||
|
||||
[lib]
|
||||
name = "gstreamer_app_sys"
|
||||
|
@ -77,4 +78,7 @@ version = "1.20"
|
|||
version = "1.22"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_app_1_0.v1_24]
|
||||
version = "1.23"
|
||||
version = "1.24"
|
||||
|
||||
[package.metadata.system-deps.gstreamer_app_1_0.v1_26]
|
||||
version = "1.25"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 5975266da3b0)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ fe8258109e60)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 63e90a30193b)
|
||||
Generated by gir (https://github.com/gtk-rs/gir @ 5f72cf0d9b99)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ c988e03b5e99)
|
||||
|
|
|
@ -19,8 +19,11 @@ use gstreamer_sys as gst;
|
|||
#[allow(unused_imports)]
|
||||
use libc::{
|
||||
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
|
||||
intptr_t, size_t, ssize_t, uintptr_t, FILE,
|
||||
intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE,
|
||||
};
|
||||
#[cfg(unix)]
|
||||
#[allow(unused_imports)]
|
||||
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use glib::{gboolean, gconstpointer, gpointer, GType};
|
||||
|
|
|
@ -16,7 +16,7 @@ rust-version.workspace = true
|
|||
[dependencies]
|
||||
libc = "0.2"
|
||||
cfg-if = "1.0"
|
||||
ffi = { package = "gstreamer-audio-sys", path = "sys" }
|
||||
gstreamer-audio-sys.workspace = true
|
||||
glib.workspace = true
|
||||
gst.workspace = true
|
||||
gst-base.workspace = true
|
||||
|
@ -25,17 +25,18 @@ smallvec = "1.0"
|
|||
once_cell = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
itertools = "0.12"
|
||||
itertools = "0.13"
|
||||
serde_json = "1.0"
|
||||
gir-format-check = "0.1"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
v1_16 = ["gst/v1_16", "gst-base/v1_16", "ffi/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", "ffi/v1_20", "v1_18"]
|
||||
v1_22 = ["gst/v1_22", "gst-base/v1_22", "ffi/v1_22", "v1_20"]
|
||||
v1_24 = ["gst/v1_24", "gst-base/v1_24", "ffi/v1_24", "v1_22"]
|
||||
v1_16 = ["gst/v1_16", "gst-base/v1_16", "gstreamer-audio-sys/v1_16"]
|
||||
v1_18 = ["gst/v1_18", "gst-base/v1_18", "gstreamer-audio-sys/v1_18", "v1_16"]
|
||||
v1_20 = ["gst/v1_20", "gst-base/v1_20", "gstreamer-audio-sys/v1_20", "v1_18"]
|
||||
v1_22 = ["gst/v1_22", "gst-base/v1_22", "gstreamer-audio-sys/v1_22", "v1_20"]
|
||||
v1_24 = ["gst/v1_24", "gst-base/v1_24", "gstreamer-audio-sys/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"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
|
|
|
@ -327,6 +327,10 @@ status = "generate"
|
|||
# Platform dependant
|
||||
manual = true
|
||||
|
||||
[[object.member]]
|
||||
name = "last"
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "to_string"
|
||||
# This has an Unknown field that may return NULL or "UNKNOWN"
|
||||
|
|
|
@ -8,7 +8,7 @@ use glib::signal::{connect_raw, SignalHandlerId};
|
|||
use glib::translate::*;
|
||||
use gst::prelude::*;
|
||||
|
||||
use crate::auto::{AudioAggregator, AudioAggregatorPad};
|
||||
use crate::{ffi, AudioAggregator, AudioAggregatorPad};
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
|
|
|
@ -6,7 +6,7 @@ use glib::{
|
|||
translate::*,
|
||||
};
|
||||
|
||||
use crate::auto::AudioAggregatorConvertPad;
|
||||
use crate::{ffi, AudioAggregatorConvertPad};
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use glib::{object::IsA, translate::*};
|
||||
use glib::translate::*;
|
||||
use gst::prelude::*;
|
||||
|
||||
use crate::auto::AudioAggregatorPad;
|
||||
use crate::{ffi, AudioAggregatorPad};
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use std::{fmt, marker::PhantomData, mem, ops, ptr, slice};
|
||||
|
||||
use crate::ffi;
|
||||
use glib::translate::*;
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use std::{mem, slice};
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{prelude::*, translate::*, value::FromValue, Type};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||
|
|
|
@ -73,6 +73,30 @@ 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 {
|
||||
pub fn new() -> Self {
|
||||
Self(gst::Structure::new_empty("GstAudioConverter"))
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::{mem, ptr};
|
|||
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
use crate::{AudioDecoder, AudioInfo};
|
||||
use crate::{ffi, AudioDecoder, AudioInfo};
|
||||
|
||||
extern "C" {
|
||||
fn _gst_audio_decoder_error(
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::{mem, ptr};
|
|||
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
use crate::AudioEncoder;
|
||||
use crate::{ffi, AudioEncoder};
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use glib::{prelude::*, translate::*};
|
||||
use gst_base::prelude::*;
|
||||
|
||||
use crate::{AudioFilter, AudioInfo};
|
||||
use crate::{ffi, AudioFilter, AudioInfo};
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use std::str;
|
||||
|
||||
use crate::ffi;
|
||||
use glib::translate::{from_glib, IntoGlib};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
|
@ -364,7 +365,8 @@ mod tests {
|
|||
fn test_display() {
|
||||
gst::init().unwrap();
|
||||
|
||||
format!("{}", crate::AudioFormat::S16be);
|
||||
assert_eq!(format!("{}", crate::AudioFormat::S16be), "S16BE");
|
||||
assert_eq!(format!("{:?}", crate::AudioFormat::S16be), "S16be");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use std::{cmp::Ordering, fmt, marker::PhantomData, str};
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{
|
||||
prelude::*,
|
||||
translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut},
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use std::{fmt, marker::PhantomData, mem, ptr, slice};
|
||||
|
||||
use crate::ffi;
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_full, from_glib_none, IntoGlib, ToGlibPtr, ToGlibPtrMut,
|
||||
};
|
||||
|
@ -96,6 +97,17 @@ impl<'a> AudioInfoBuilder<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
Self {
|
||||
flags: Some(flags),
|
||||
|
@ -103,12 +115,28 @@ impl<'a> AudioInfoBuilder<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
Self {
|
||||
layout: Some(layout),
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn layout_if_some(self, layout: Option<crate::AudioLayout>) -> Self {
|
||||
if let Some(layout) = layout {
|
||||
self.layout(layout)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AudioInfo {
|
||||
|
|
|
@ -14,6 +14,8 @@ use glib::translate::{from_glib, IntoGlib};
|
|||
use glib::translate::{from_glib_none, ToGlibPtr};
|
||||
use gst::prelude::*;
|
||||
|
||||
use crate::ffi;
|
||||
|
||||
#[repr(transparent)]
|
||||
#[doc(alias = "GstAudioClippingMeta")]
|
||||
pub struct AudioClippingMeta(ffi::GstAudioClippingMeta);
|
||||
|
@ -294,6 +296,17 @@ 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)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
@ -319,6 +332,8 @@ mod tests {
|
|||
let cmeta = buffer.meta::<AudioClippingMeta>().unwrap();
|
||||
assert_eq!(cmeta.start().try_into(), Ok(Some(start)));
|
||||
assert_eq!(cmeta.end().try_into(), Ok(Some(stop)));
|
||||
|
||||
assert!(cmeta.has_tag::<tags::Audio>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@ use std::fmt;
|
|||
use glib::translate::*;
|
||||
use gst::Caps;
|
||||
|
||||
use crate::{ffi::GstAudioRingBufferSpec, AudioInfo, AudioRingBufferFormatType};
|
||||
use crate::{ffi, AudioInfo, AudioRingBufferFormatType};
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct AudioRingBufferSpec(pub(crate) GstAudioRingBufferSpec);
|
||||
#[doc(alias = "GstAudioRingBufferSpec")]
|
||||
pub struct AudioRingBufferSpec(pub(crate) ffi::GstAudioRingBufferSpec);
|
||||
|
||||
impl AudioRingBufferSpec {
|
||||
#[doc(alias = "get_type")]
|
||||
|
|
|
@ -18,7 +18,7 @@ impl AudioStreamAlign {
|
|||
let mut out_timestamp = mem::MaybeUninit::uninit();
|
||||
let mut out_duration = mem::MaybeUninit::uninit();
|
||||
let mut out_sample_position = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_audio_stream_align_process(
|
||||
let ret = from_glib(crate::ffi::gst_audio_stream_align_process(
|
||||
self.to_glib_none_mut().0,
|
||||
discont.into_glib(),
|
||||
timestamp.into_glib(),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
|
@ -87,7 +88,7 @@ pub trait AudioAggregatorExt: IsA<AudioAggregator> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::alignment-threshold\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_alignment_threshold_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -116,7 +117,7 @@ pub trait AudioAggregatorExt: IsA<AudioAggregator> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::discont-wait\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_discont_wait_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -145,7 +146,7 @@ pub trait AudioAggregatorExt: IsA<AudioAggregator> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::output-buffer-duration\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_output_buffer_duration_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::AudioAggregatorPad;
|
||||
use crate::{ffi, AudioAggregatorPad};
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
|
@ -66,7 +66,7 @@ pub trait AudioAggregatorConvertPadExt:
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::converter-config\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_converter_config_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::prelude::*;
|
||||
#[cfg(feature = "v1_20")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
|
||||
|
@ -73,7 +74,7 @@ pub trait AudioAggregatorPadExt: IsA<AudioAggregatorPad> + sealed::Sealed + 'sta
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::qos-messages\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_qos_messages_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
|
@ -39,6 +40,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
|
||||
#[doc(alias = "gst_audio_base_sink_get_alignment_threshold")]
|
||||
#[doc(alias = "get_alignment_threshold")]
|
||||
#[doc(alias = "alignment-threshold")]
|
||||
fn alignment_threshold(&self) -> gst::ClockTime {
|
||||
unsafe {
|
||||
try_from_glib(ffi::gst_audio_base_sink_get_alignment_threshold(
|
||||
|
@ -50,6 +52,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
|
||||
#[doc(alias = "gst_audio_base_sink_get_discont_wait")]
|
||||
#[doc(alias = "get_discont_wait")]
|
||||
#[doc(alias = "discont-wait")]
|
||||
fn discont_wait(&self) -> gst::ClockTime {
|
||||
unsafe {
|
||||
try_from_glib(ffi::gst_audio_base_sink_get_discont_wait(
|
||||
|
@ -61,12 +64,14 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
|
||||
#[doc(alias = "gst_audio_base_sink_get_drift_tolerance")]
|
||||
#[doc(alias = "get_drift_tolerance")]
|
||||
#[doc(alias = "drift-tolerance")]
|
||||
fn drift_tolerance(&self) -> i64 {
|
||||
unsafe { ffi::gst_audio_base_sink_get_drift_tolerance(self.as_ref().to_glib_none().0) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_audio_base_sink_get_provide_clock")]
|
||||
#[doc(alias = "get_provide_clock")]
|
||||
#[doc(alias = "provide-clock")]
|
||||
fn is_provide_clock(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_audio_base_sink_get_provide_clock(
|
||||
|
@ -77,6 +82,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
|
||||
//#[doc(alias = "gst_audio_base_sink_get_slave_method")]
|
||||
//#[doc(alias = "get_slave_method")]
|
||||
//#[doc(alias = "slave-method")]
|
||||
//fn slave_method(&self) -> /*Ignored*/AudioBaseSinkSlaveMethod {
|
||||
// unsafe { TODO: call ffi:gst_audio_base_sink_get_slave_method() }
|
||||
//}
|
||||
|
@ -89,6 +95,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_audio_base_sink_set_alignment_threshold")]
|
||||
#[doc(alias = "alignment-threshold")]
|
||||
fn set_alignment_threshold(&self, alignment_threshold: gst::ClockTime) {
|
||||
unsafe {
|
||||
ffi::gst_audio_base_sink_set_alignment_threshold(
|
||||
|
@ -104,6 +111,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
//}
|
||||
|
||||
#[doc(alias = "gst_audio_base_sink_set_discont_wait")]
|
||||
#[doc(alias = "discont-wait")]
|
||||
fn set_discont_wait(&self, discont_wait: gst::ClockTime) {
|
||||
unsafe {
|
||||
ffi::gst_audio_base_sink_set_discont_wait(
|
||||
|
@ -114,6 +122,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_audio_base_sink_set_drift_tolerance")]
|
||||
#[doc(alias = "drift-tolerance")]
|
||||
fn set_drift_tolerance(&self, drift_tolerance: i64) {
|
||||
unsafe {
|
||||
ffi::gst_audio_base_sink_set_drift_tolerance(
|
||||
|
@ -124,6 +133,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_audio_base_sink_set_provide_clock")]
|
||||
#[doc(alias = "provide-clock")]
|
||||
fn set_provide_clock(&self, provide: bool) {
|
||||
unsafe {
|
||||
ffi::gst_audio_base_sink_set_provide_clock(
|
||||
|
@ -134,6 +144,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
//#[doc(alias = "gst_audio_base_sink_set_slave_method")]
|
||||
//#[doc(alias = "slave-method")]
|
||||
//fn set_slave_method(&self, method: /*Ignored*/AudioBaseSinkSlaveMethod) {
|
||||
// unsafe { TODO: call ffi:gst_audio_base_sink_set_slave_method() }
|
||||
//}
|
||||
|
@ -189,7 +200,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::alignment-threshold\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_alignment_threshold_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -218,7 +229,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::buffer-time\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_buffer_time_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -247,7 +258,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::can-activate-pull\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_can_activate_pull_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -276,7 +287,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::discont-wait\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_discont_wait_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -305,7 +316,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::drift-tolerance\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_drift_tolerance_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -334,7 +345,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::latency-time\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_latency_time_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -363,7 +374,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::provide-clock\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_provide_clock_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -392,7 +403,7 @@ pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::slave-method\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_slave_method_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
|
@ -39,6 +40,7 @@ pub trait AudioBaseSrcExt: IsA<AudioBaseSrc> + sealed::Sealed + 'static {
|
|||
|
||||
#[doc(alias = "gst_audio_base_src_get_provide_clock")]
|
||||
#[doc(alias = "get_provide_clock")]
|
||||
#[doc(alias = "provide-clock")]
|
||||
fn is_provide_clock(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_audio_base_src_get_provide_clock(
|
||||
|
@ -49,11 +51,13 @@ pub trait AudioBaseSrcExt: IsA<AudioBaseSrc> + sealed::Sealed + 'static {
|
|||
|
||||
//#[doc(alias = "gst_audio_base_src_get_slave_method")]
|
||||
//#[doc(alias = "get_slave_method")]
|
||||
//#[doc(alias = "slave-method")]
|
||||
//fn slave_method(&self) -> /*Ignored*/AudioBaseSrcSlaveMethod {
|
||||
// unsafe { TODO: call ffi:gst_audio_base_src_get_slave_method() }
|
||||
//}
|
||||
|
||||
#[doc(alias = "gst_audio_base_src_set_provide_clock")]
|
||||
#[doc(alias = "provide-clock")]
|
||||
fn set_provide_clock(&self, provide: bool) {
|
||||
unsafe {
|
||||
ffi::gst_audio_base_src_set_provide_clock(
|
||||
|
@ -64,6 +68,7 @@ pub trait AudioBaseSrcExt: IsA<AudioBaseSrc> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
//#[doc(alias = "gst_audio_base_src_set_slave_method")]
|
||||
//#[doc(alias = "slave-method")]
|
||||
//fn set_slave_method(&self, method: /*Ignored*/AudioBaseSrcSlaveMethod) {
|
||||
// unsafe { TODO: call ffi:gst_audio_base_src_set_slave_method() }
|
||||
//}
|
||||
|
@ -119,7 +124,7 @@ pub trait AudioBaseSrcExt: IsA<AudioBaseSrc> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::actual-buffer-time\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_actual_buffer_time_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -148,7 +153,7 @@ pub trait AudioBaseSrcExt: IsA<AudioBaseSrc> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::actual-latency-time\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_actual_latency_time_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -177,7 +182,7 @@ pub trait AudioBaseSrcExt: IsA<AudioBaseSrc> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::buffer-time\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_buffer_time_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -206,7 +211,7 @@ pub trait AudioBaseSrcExt: IsA<AudioBaseSrc> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::latency-time\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_latency_time_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -235,7 +240,7 @@ pub trait AudioBaseSrcExt: IsA<AudioBaseSrc> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::provide-clock\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_provide_clock_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -264,7 +269,7 @@ pub trait AudioBaseSrcExt: IsA<AudioBaseSrc> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::slave-method\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_slave_method_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::AudioInfo;
|
||||
use crate::{ffi, AudioInfo};
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
|
@ -125,12 +125,14 @@ pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
|
|||
|
||||
#[doc(alias = "gst_audio_decoder_get_max_errors")]
|
||||
#[doc(alias = "get_max_errors")]
|
||||
#[doc(alias = "max-errors")]
|
||||
fn max_errors(&self) -> i32 {
|
||||
unsafe { ffi::gst_audio_decoder_get_max_errors(self.as_ref().to_glib_none().0) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_audio_decoder_get_min_latency")]
|
||||
#[doc(alias = "get_min_latency")]
|
||||
#[doc(alias = "min-latency")]
|
||||
fn min_latency(&self) -> gst::ClockTime {
|
||||
unsafe {
|
||||
try_from_glib(ffi::gst_audio_decoder_get_min_latency(
|
||||
|
@ -167,6 +169,7 @@ pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
|
|||
|
||||
#[doc(alias = "gst_audio_decoder_get_plc")]
|
||||
#[doc(alias = "get_plc")]
|
||||
#[doc(alias = "plc")]
|
||||
fn is_plc(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_audio_decoder_get_plc(
|
||||
|
@ -256,6 +259,7 @@ pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_audio_decoder_set_max_errors")]
|
||||
#[doc(alias = "max-errors")]
|
||||
fn set_max_errors(&self, num: i32) {
|
||||
unsafe {
|
||||
ffi::gst_audio_decoder_set_max_errors(self.as_ref().to_glib_none().0, num);
|
||||
|
@ -263,6 +267,7 @@ pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_audio_decoder_set_min_latency")]
|
||||
#[doc(alias = "min-latency")]
|
||||
fn set_min_latency(&self, num: gst::ClockTime) {
|
||||
unsafe {
|
||||
ffi::gst_audio_decoder_set_min_latency(self.as_ref().to_glib_none().0, num.into_glib());
|
||||
|
@ -280,6 +285,7 @@ pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_audio_decoder_set_plc")]
|
||||
#[doc(alias = "plc")]
|
||||
fn set_plc(&self, enabled: bool) {
|
||||
unsafe {
|
||||
ffi::gst_audio_decoder_set_plc(self.as_ref().to_glib_none().0, enabled.into_glib());
|
||||
|
@ -294,6 +300,7 @@ pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_audio_decoder_set_tolerance")]
|
||||
#[doc(alias = "tolerance")]
|
||||
fn set_tolerance(&self, tolerance: gst::ClockTime) {
|
||||
unsafe {
|
||||
ffi::gst_audio_decoder_set_tolerance(
|
||||
|
@ -336,7 +343,7 @@ pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::max-errors\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_max_errors_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -365,7 +372,7 @@ pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::min-latency\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_min_latency_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -391,7 +398,7 @@ pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::plc\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_plc_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -420,7 +427,7 @@ pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::tolerance\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_tolerance_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::AudioInfo;
|
||||
use crate::{ffi, AudioInfo};
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
|
@ -108,6 +108,7 @@ pub trait AudioEncoderExt: IsA<AudioEncoder> + sealed::Sealed + 'static {
|
|||
|
||||
#[doc(alias = "gst_audio_encoder_get_hard_resync")]
|
||||
#[doc(alias = "get_hard_resync")]
|
||||
#[doc(alias = "hard-resync")]
|
||||
fn is_hard_resync(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_audio_encoder_get_hard_resync(
|
||||
|
@ -142,6 +143,7 @@ pub trait AudioEncoderExt: IsA<AudioEncoder> + sealed::Sealed + 'static {
|
|||
|
||||
#[doc(alias = "gst_audio_encoder_get_mark_granule")]
|
||||
#[doc(alias = "get_mark_granule")]
|
||||
#[doc(alias = "mark-granule")]
|
||||
fn is_mark_granule(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_audio_encoder_get_mark_granule(
|
||||
|
@ -152,6 +154,7 @@ pub trait AudioEncoderExt: IsA<AudioEncoder> + sealed::Sealed + 'static {
|
|||
|
||||
#[doc(alias = "gst_audio_encoder_get_perfect_timestamp")]
|
||||
#[doc(alias = "get_perfect_timestamp")]
|
||||
#[doc(alias = "perfect-timestamp")]
|
||||
fn is_perfect_timestamp(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_audio_encoder_get_perfect_timestamp(
|
||||
|
@ -245,6 +248,7 @@ pub trait AudioEncoderExt: IsA<AudioEncoder> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_audio_encoder_set_hard_resync")]
|
||||
#[doc(alias = "hard-resync")]
|
||||
fn set_hard_resync(&self, enabled: bool) {
|
||||
unsafe {
|
||||
ffi::gst_audio_encoder_set_hard_resync(
|
||||
|
@ -283,6 +287,7 @@ pub trait AudioEncoderExt: IsA<AudioEncoder> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_audio_encoder_set_perfect_timestamp")]
|
||||
#[doc(alias = "perfect-timestamp")]
|
||||
fn set_perfect_timestamp(&self, enabled: bool) {
|
||||
unsafe {
|
||||
ffi::gst_audio_encoder_set_perfect_timestamp(
|
||||
|
@ -293,6 +298,7 @@ pub trait AudioEncoderExt: IsA<AudioEncoder> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_audio_encoder_set_tolerance")]
|
||||
#[doc(alias = "tolerance")]
|
||||
fn set_tolerance(&self, tolerance: gst::ClockTime) {
|
||||
unsafe {
|
||||
ffi::gst_audio_encoder_set_tolerance(
|
||||
|
@ -323,7 +329,7 @@ pub trait AudioEncoderExt: IsA<AudioEncoder> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::hard-resync\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_hard_resync_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -352,7 +358,7 @@ pub trait AudioEncoderExt: IsA<AudioEncoder> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::mark-granule\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_mark_granule_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -381,7 +387,7 @@ pub trait AudioEncoderExt: IsA<AudioEncoder> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::perfect-timestamp\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_perfect_timestamp_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -410,7 +416,7 @@ pub trait AudioEncoderExt: IsA<AudioEncoder> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::tolerance\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_tolerance_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstAudioFilter")]
|
||||
pub struct AudioFilter(Object<ffi::GstAudioFilter, ffi::GstAudioFilterClass>) @extends gst_base::BaseTransform, gst::Element, gst::Object;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::AudioBaseSink;
|
||||
use crate::{ffi, AudioBaseSink};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstAudioSink")]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::AudioBaseSrc;
|
||||
use crate::{ffi, AudioBaseSrc};
|
||||
|
||||
glib::wrapper! {
|
||||
#[doc(alias = "GstAudioSrc")]
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::translate::*;
|
||||
|
||||
glib::wrapper! {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{prelude::*, translate::*};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::ffi;
|
||||
use glib::{bitflags::bitflags, prelude::*, translate::*};
|
||||
|
||||
bitflags! {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::StreamVolumeFormat;
|
||||
use crate::{ffi, StreamVolumeFormat};
|
||||
use glib::{
|
||||
prelude::*,
|
||||
signal::{connect_raw, SignalHandlerId},
|
||||
|
@ -41,6 +41,7 @@ mod sealed {
|
|||
pub trait StreamVolumeExt: IsA<StreamVolume> + sealed::Sealed + 'static {
|
||||
#[doc(alias = "gst_stream_volume_get_mute")]
|
||||
#[doc(alias = "get_mute")]
|
||||
#[doc(alias = "mute")]
|
||||
fn is_muted(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_stream_volume_get_mute(
|
||||
|
@ -58,6 +59,7 @@ pub trait StreamVolumeExt: IsA<StreamVolume> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_stream_volume_set_mute")]
|
||||
#[doc(alias = "mute")]
|
||||
fn set_mute(&self, mute: bool) {
|
||||
unsafe {
|
||||
ffi::gst_stream_volume_set_mute(self.as_ref().to_glib_none().0, mute.into_glib());
|
||||
|
@ -65,6 +67,7 @@ pub trait StreamVolumeExt: IsA<StreamVolume> + sealed::Sealed + 'static {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_stream_volume_set_volume")]
|
||||
#[doc(alias = "volume")]
|
||||
fn set_volume(&self, format: StreamVolumeFormat, val: f64) {
|
||||
unsafe {
|
||||
ffi::gst_stream_volume_set_volume(
|
||||
|
@ -93,7 +96,7 @@ pub trait StreamVolumeExt: IsA<StreamVolume> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::mute\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_mute_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -119,7 +122,7 @@ pub trait StreamVolumeExt: IsA<StreamVolume> + sealed::Sealed + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::volume\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_volume_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 5975266da3b0)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ fe8258109e60)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 63e90a30193b)
|
||||
Generated by gir (https://github.com/gtk-rs/gir @ 5f72cf0d9b99)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 6cd7b656acd6)
|
||||
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ c988e03b5e99)
|
||||
|
|
|
@ -90,6 +90,14 @@ impl<T> AudioCapsBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn format_if_some(self, format: Option<AudioFormat>) -> Self {
|
||||
if let Some(format) = format {
|
||||
self.format(format)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn format_list(self, formats: impl IntoIterator<Item = AudioFormat>) -> Self {
|
||||
Self {
|
||||
builder: self.builder.field(
|
||||
|
@ -99,12 +107,31 @@ impl<T> AudioCapsBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn format_list_if_some(
|
||||
self,
|
||||
formats: Option<impl IntoIterator<Item = AudioFormat>>,
|
||||
) -> Self {
|
||||
if let Some(formats) = formats {
|
||||
self.format_list(formats)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rate(self, rate: i32) -> Self {
|
||||
Self {
|
||||
builder: self.builder.field(glib::gstr!("rate"), rate),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rate_if_some(self, rate: Option<i32>) -> Self {
|
||||
if let Some(rate) = rate {
|
||||
self.rate(rate)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rate_range(self, rates: impl RangeBounds<i32>) -> Self {
|
||||
let (start, end) = range_bounds_i32_start_end(rates);
|
||||
let gst_rates = gst::IntRange::<i32>::new(start, end);
|
||||
|
@ -113,6 +140,14 @@ impl<T> AudioCapsBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn rate_range_if_some(self, rates: Option<impl RangeBounds<i32>>) -> Self {
|
||||
if let Some(rates) = rates {
|
||||
self.rate_range(rates)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rate_list(self, rates: impl IntoIterator<Item = i32>) -> Self {
|
||||
Self {
|
||||
builder: self
|
||||
|
@ -121,12 +156,28 @@ impl<T> AudioCapsBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn rate_list_if_some(self, rates: Option<impl IntoIterator<Item = i32>>) -> Self {
|
||||
if let Some(rates) = rates {
|
||||
self.rate_list(rates)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn channels(self, channels: i32) -> Self {
|
||||
Self {
|
||||
builder: self.builder.field(glib::gstr!("channels"), channels),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn channels_if_some(self, channels: Option<i32>) -> Self {
|
||||
if let Some(channels) = channels {
|
||||
self.channels(channels)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn channels_range(self, channels: impl RangeBounds<i32>) -> Self {
|
||||
let (start, end) = range_bounds_i32_start_end(channels);
|
||||
let gst_channels: gst::IntRange<i32> = gst::IntRange::new(start, end);
|
||||
|
@ -135,6 +186,14 @@ impl<T> AudioCapsBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn channels_range_if_some(self, channels: Option<impl RangeBounds<i32>>) -> Self {
|
||||
if let Some(channels) = channels {
|
||||
self.channels_range(channels)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn channels_list(self, channels: impl IntoIterator<Item = i32>) -> Self {
|
||||
Self {
|
||||
builder: self
|
||||
|
@ -143,6 +202,14 @@ impl<T> AudioCapsBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn channels_list_if_some(self, channels: Option<impl IntoIterator<Item = i32>>) -> Self {
|
||||
if let Some(channels) = channels {
|
||||
self.channels_list(channels)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn layout(self, layout: AudioLayout) -> Self {
|
||||
Self {
|
||||
builder: self
|
||||
|
@ -151,6 +218,14 @@ impl<T> AudioCapsBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn layout_if_some(self, layout: Option<AudioLayout>) -> Self {
|
||||
if let Some(layout) = layout {
|
||||
self.layout(layout)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn layout_list(self, layouts: impl IntoIterator<Item = AudioLayout>) -> Self {
|
||||
Self {
|
||||
builder: self.builder.field(
|
||||
|
@ -160,6 +235,17 @@ impl<T> AudioCapsBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn layout_list_if_some(
|
||||
self,
|
||||
layouts: Option<impl IntoIterator<Item = AudioLayout>>,
|
||||
) -> Self {
|
||||
if let Some(layouts) = layouts {
|
||||
self.layout_list(layouts)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn channel_mask(self, channel_mask: u64) -> Self {
|
||||
Self {
|
||||
builder: self
|
||||
|
@ -168,6 +254,14 @@ impl<T> AudioCapsBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn channel_mask_if_some(self, channel_mask: Option<u64>) -> Self {
|
||||
if let Some(channel_mask) = channel_mask {
|
||||
self.channel_mask(channel_mask)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fallback_channel_mask(self) -> Self {
|
||||
let channels = self.builder.structure().get::<i32>(glib::gstr!("channels"));
|
||||
match channels {
|
||||
|
@ -187,6 +281,14 @@ impl<T> AudioCapsBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn field_if_some(self, name: &str, value: Option<impl Into<glib::Value> + Send>) -> Self {
|
||||
if let Some(value) = value {
|
||||
self.field(name, value)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn build(self) -> gst::Caps {
|
||||
self.builder.build()
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use std::i32;
|
||||
|
||||
use crate::ffi;
|
||||
use glib::translate::{from_glib_full, IntoGlibPtr, ToGlibPtr};
|
||||
|
||||
#[doc(alias = "gst_audio_buffer_clip")]
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue