Compare commits

...

243 commits
0.22.1 ... main

Author SHA1 Message Date
Sebastian Dröge
6a04bad125 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1550>
2024-09-28 12:17:06 +03:00
Sebastian Dröge
192844c173 rtsp-server: media: Take pipeline by reference instead of value
And remove <1.18 workaround if building for 1.18 or newer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1548>
2024-09-23 13:00:45 +03:00
Daniel Stone
7b51a7c77b ci: Only use as many cores as we're supposed to
Instead of spawning 64 compiler instances on a 64-core machine that's
being shared with 7 other jobs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1545>
2024-09-20 14:40:27 +03:00
eri
b5bf829876 genrate gir without link attribute
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1514>
2024-09-19 11:46:18 +00:00
Jan Alexander Steffens (heftig)
90f9406377 gst: Fix range in Percent::ppm doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1533>
2024-09-18 17:49:05 +02:00
François Laignel
73544718b4 gst: fix typo in format doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1532>
2024-09-18 11:52:37 +02:00
Sebastian Dröge
ce92502d61 video: Add #[must_use] attribute to VideoTimeCode::add_interval()
It doesn't change the original value but returns the new result.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1529>
2024-09-16 11:24:54 +03:00
Arun Raghavan
bd37999166 gstreamer: Add tests for pad probes taking and dropping data
This is quite similar to the HANDLED case, so reuse that code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1528>
2024-09-12 12:36:52 -04:00
Arun Raghavan
6a87d4a66a ci: Update CI image with current gstreamer commits
This is needed so that the fix from
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7493
can be used while testing recent changes to the pad probe API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1528>
2024-09-12 10:27:17 -04:00
Arun Raghavan
6849e4b4c3 gstreamer: Use new pad probe take_*() API in tests
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
f14efbd70c gstreamer: Set data to null if it's consumed
When the probe has HANDLED the data, we're expecting the caller to no
longer access it. Let's explicitly protect against that by setting the
data to NULL on return.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
224215a844 gstreamer: Add some setters for Message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
700004b8ce gstreamer: Add some setters for Event
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
6035bffbab gstreamer: Add a MessageViewMut for mutable message access
This isn't very generally useful, but there are special cases where
accessing the structure, or adding details is handy.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/474
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
d16b28fc2f gstreamer: Add an EventViewMut accessor
Should make mutable access to events less verbose.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/474
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
f62c8658e4 gstreamer: Add API to take an event and buffers in a pad probe
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
François Laignel
88a52d9ea1 gst: anticipate GQuark to GstIdStr lifetime changes
GStreamer fixes a memory leak due to GQuarks by switching to GstIdStr.
The consequence is that strings previously backed by a GQuark returned by a
function will now get their lifetime bound to that of its owner, while the
GQuark version ensured static lifetime.

Because some functions return a string with the assumption that they are static
and because we can't alter the API for existing versions of the bindings, this
MR temporarily forces affected strings as GQuarks, thus gaining static lifetime
regardless of the GStreamer version actually being used.

For newer versions of the bindings, the API will be fixed and GQuarks will be
removed in favor a leakless solution.

See: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1519>
2024-09-11 09:19:35 +00:00
François Laignel
96ec17b1e9 structure: fix doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1519>
2024-09-11 09:19:35 +00:00
François Laignel
1b578b6113 tags: fix index() lifetime bind
The signature for `TagListRef::index` didn't bind the lifetime of the returned
`TagValue` to `&self`. This causes the following code to compile:

```rust
 1 let title = {
 2     let mut tags = TagList::new();
 3     {
 4         let tags = tags.get_mut().unwrap();
 5         tags.add::<Title>(&"some title", TagMergeMode::Append);
 6     }
 7
 8     let title = tags.index::<Title>(0).unwrap();
 9     assert_eq!(title.get(), "some title");
10
11     title
12 };
13
14 assert_eq!(title.get(), "some title");
```

... but it panics at runtime on the last `title.get()`:

```
Invalid tag type: WrongValueType(ValueTypeMismatchError
    { actual: <invalid>, requested: gchararray })
```

Indeed, the `title` `TagValue` is freed with the `tags` on line 12.

This commit fixes the function signature so the returned `TagValue` can't
outlive its `TagListRef`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1518>
2024-09-10 19:40:33 +00:00
L. E. Segovia
7eaf47d7b5 Add workaround for linking against macOS SDK's relocatable dylibs
See https://github.com/rust-lang/cargo/issues/5077#issuecomment-1284482987
and https://github.com/rust-lang/rust/issues/127100

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1516>
2024-09-10 16:48:29 +00:00
Sebastian Dröge
5c39500308 ci: Ignore derive_more 1.0 update until MSRV can be updated to 1.75+
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1512>
2024-09-10 05:56:53 +00:00
Sebastian Dröge
299601f7e3 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1512>
2024-09-10 05:56:53 +00:00
Piotr Brzeziński
9bb441880d Remove unused imports in example/tutorial macOS code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1512>
2024-09-10 05:56:53 +00:00
Sebastian Dröge
c818778ad7 examples: Update to cocoa 0.26
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1512>
2024-09-10 05:56:53 +00:00
Sebastian Dröge
628f040e2d Fix new 1.81 clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1515>
2024-09-05 21:52:35 +03:00
Sebastian Dröge
b9d34e1c21 ci: Update to Rust 1.81
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1515>
2024-09-05 21:36:38 +03:00
Sebastian Dröge
ed6aac91bd Remove deprecated API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1513>
2024-08-28 09:44:55 +03:00
Sebastian Dröge
497f15acd3 Update CHANGELOG.md for 0.23.1 2024-08-27 20:42:18 +03:00
Sebastian Dröge
be7b3e3522 deny: Remove toml_edit override 2024-08-27 20:31:50 +03:00
Sebastian Dröge
2f9f70bd67 Update Cargo.lock 2024-08-27 20:31:33 +03:00
Jordan Petridis
78c490ef17 ci: Update the .cargo/config file
```
warning: `/builds/alatiera/gstreamer-rs/.cargo/config` is deprecated in favor of `config.toml`
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1504>
2024-08-21 16:54:22 +00:00
Jordan Petridis
e8797c95e7 ci: Add a default retry policy for jobs
Automatically retry if it's a system failure or similar

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1503>
2024-08-21 17:30:10 +03:00
Jordan Petridis
a8234a67d2 ci: Use gstreamer runners for jobs that recursively clone submodules
Seems like the placeholder runner is having issues with git-lfs atm.

```
Could not pull
Errors logged to '/builds/alatiera/gstreamer-rs/.git/modules/gir-files/lfs/logs/20240820T212811.645856902.log'.
Use `git lfs logs last` to view the log.
fatal: run_command returned non-zero status for gir-files
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1503>
2024-08-21 17:30:10 +03:00
Jordan Petridis
9b5b1d4650 ci: Avoid cloning the submodules when they are not needed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1503>
2024-08-21 17:30:10 +03:00
Jordan Petridis
4ee374e60c ci: Pin the windows jobs to gstreamer runners for now
There seem to be some seemingly random failures if the
jobs get scheduled on the hyper-v isolation runners,
and they need to be debugged further.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1503>
2024-08-21 17:30:10 +03:00
Nirbheek Chauhan
c5dfc87953 ci: Bump linux image tag, and make a separate tag for windows
It is fairly common to rebuild only the linux or windows image. This
avoids needless rebuilds and then (v slow) downloads into the docker
cache of runners.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1500>
2024-08-19 21:10:07 +05:30
Nirbheek Chauhan
57aa8e09ea ci: Use debian's gtk package instead of building our own
GTK 4.14 needs a newer glib, but we cannot build and use our own
because the system glib ends up taking precedence because cargo-c
doesn't set RPATHs for the plugins it builds.

The oldest GTK that supports glib 2.74 is GTK 4.10, and Debian 12
ships GTK 4.8, so let's just use the system GTK.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1500>
2024-08-19 21:09:54 +05:30
Nirbheek Chauhan
4cf22e91cf ci: Don't pip install tomli on Debian anymore
It ships Python 3.11 which ships with a toml module.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1500>
2024-08-19 20:48:07 +05:30
Sebastian Dröge
7959e37204 ci: Disable GTK Vulkan backend
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1499>
2024-08-19 13:17:30 +03:00
Nirbheek Chauhan
ebe7f5f663 ci: Force fallback for glib when building gstreamer
Also canonicalize some argument passing in install-gst.sh

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1499>
2024-08-19 13:16:20 +05:30
Sebastian Dröge
63935bb680 ci: Update image version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1499>
2024-08-19 10:05:42 +03:00
Sebastian Dröge
c463c07871 examples: glupload: Fix compilation with Rust < 1.72 on Windows
The event proxy on Windows is only `Sync` if the contained `Sender` is,
but until Rust 1.72 it was not.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1499>
2024-08-19 10:02:36 +03:00
Sebastian Dröge
09bc0a2836 examples: d3d11videosink: Fix compiler warning about unused closure parameter
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1499>
2024-08-19 09:58:16 +03:00
Nirbheek Chauhan
44479cf42a ci: Rely on the monorepo's gtk subproject support
The monorepo now ensures that the gtk subproject keeps building on
windows and macOS via its own CI.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1499>
2024-08-17 16:03:54 +05:30
Jordan Petridis
ec66403c24 ci: Remove the manual trigger for the rust msrv windows job
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1499>
2024-08-16 20:09:23 +03:00
Jordan Petridis
c7694a4a91 ci: Fix rust version check in the windows build
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1499>
2024-08-16 20:08:04 +03:00
Jordan Petridis
b829c41cdc ci: Add comments to the windows dockerfile about build-args
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:43:09 +03:00
Jordan Petridis
75ed9b668f ci: Update ci-templates ref
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Sebastian Dröge
ae120b300f ci: Remove unnecessary --force from cargo install
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Sebastian Dröge
6c5ceca804 ci: Fix version checks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Sebastian Dröge
6674f8d23a ci: Update to Rust 1.80.1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Sebastian Dröge
326e5861f3 ci: Don't use --locked for cargo-outdated / grcov with 1.80 / nightly
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Sebastian Dröge
57f407fa89 ci: Also use cargo-c 0.10.3 for Rust 1.80
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Sebastian Dröge
c9412e663b ci: Update to cargo-c 0.9.26 and 0.10.3 when building for nightly
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Sebastian Dröge
99f598a45a ci: Update to dav1d 1.4.3
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Sebastian Dröge
ce9c1729b8 ci: Update to meson 1.5.1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Sebastian Dröge
a145ce6ab1 Ignore a new 1.80 clippy warning
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Sebastian Dröge
30d247fd5c ci: Update to Rust 1.80
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Jordan Petridis
2061a4e310 ci/windows-docker: Move rustup install into a ps1 script
We will need this in order to be able to add conditionals
depending on the rustc version, like we do on the linux
script.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1491>
2024-08-13 15:41:44 +03:00
Jordan Petridis
80d1066a20 ci: Generate html and cobertura coverage with a single command
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1497>
2024-08-12 19:37:34 +03:00
Albert Sjolund
4d6c30cdb6 utils: streamproducer: wrap atomic operations
In order to support more platforms, especially MIPS,
add a small wrapper for necessary atomic(u64) instructions.
It exposes the necessary functions, and falls back to
mutex if needed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1471>
2024-08-12 14:54:29 +02:00
Sebastian Dröge
4306c9a2c9 deny: Update for new configuration format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1496>
2024-08-07 18:16:07 +03:00
Sebastian Dröge
bc96a99576 Regenerate with latest gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1496>
2024-08-07 18:16:07 +03:00
Sebastian Dröge
0bd9fbd615 Update gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1496>
2024-08-07 18:16:07 +03:00
Sebastian Dröge
f8d1d813c5 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1496>
2024-08-07 18:16:07 +03:00
Sebastian Dröge
73d9793f5b Fix new 1.80 clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1496>
2024-08-07 18:16:07 +03:00
Guillaume Desmottes
3dab797c32 utils: streamproducer: fix set_forward_events() doc
The events are forwarded from the appsink to the appsrcs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1489>
2024-08-05 04:37:06 +00:00
Piotr Brzeziński
7be6a9fef4 gstreamer: bufferlist: Fix remove() range end being off by one
The end index was being calculated the same way as the start one, which is incorrect.
It should be +1'd when range is inclusive and left as-is if it's exclusive, not the other way around.
Fixed and added a simple test to verify correctness.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1490>
2024-07-30 14:19:42 +02:00
Guillaume Desmottes
2ae1e4a511 gstreamer: format: Percent: add getters
We had constructor from the percent/ppm/ratio values but not getters
to get those values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1488>
2024-07-26 09:30:18 +02:00
Sebastian Dröge
658b8c2231 gstreamer: meta: Pass an empty tag array instead of NULL to gst_meta_register_custom()
NULL gives a critical warning but an empty, NULL-terminated array gives
the desired result.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/516

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1483>
2024-07-18 13:04:42 +03:00
Sebastian Dröge
0f5c0e935c Update CHANGELOG.md for 0.23.0 release
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1482>
2024-07-17 16:52:53 +03:00
Sebastian Dröge
c8853734c0 ci: Deploy 0.23 docs 2024-07-11 20:01:33 +03:00
Sebastian Dröge
b290d52639 Update versions to 0.24.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1481>
2024-07-11 17:49:18 +03:00
Sebastian Dröge
0ed46425f6 Regenerate with latest gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1481>
2024-07-11 17:48:59 +03:00
Sebastian Dröge
3521eb920c Update gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1481>
2024-07-11 17:48:44 +03:00
Sebastian Dröge
efb8d85bd0 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1481>
2024-07-11 17:48:19 +03:00
Sebastian Dröge
7dc7f3c0cd ges: Implement UriClipAsset::new() manually
The proper finish function is only available since 1.16 so work around
this for the time being.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1480>
2024-07-08 10:32:10 +03:00
Sebastian Dröge
48436458bb examples: Update to windows 0.58
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1480>
2024-07-08 09:41:51 +03:00
Sebastian Dröge
9b76ef35cf Regenerate with latest gir / gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1480>
2024-07-08 09:37:34 +03:00
Sebastian Dröge
c55daa88ca Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1480>
2024-07-08 09:37:13 +03:00
Sebastian Dröge
a5c044dda4 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1480>
2024-07-08 09:36:49 +03:00
Sebastian Dröge
e45dbc8fd9 ci: Update image version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1480>
2024-07-08 09:34:54 +03:00
Sebastian Dröge
f4d3f01d25 Update gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1480>
2024-07-08 09:33:31 +03:00
Sebastian Dröge
cae7285013 Update gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1480>
2024-07-08 09:33:18 +03:00
Sebastian Dröge
94313e67c5 gstreamer: Unconditionally use gst_parse_context_copy()
It's available since 1.12.1 and the minimum supported version for the
bindings is 1.14 nowadays.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1478>
2024-07-06 11:21:31 +00:00
Sebastian Dröge
a871f71515 gstreamer: Use obj = x instead of obj: x in debug log macros
And deprecate the old usage. This gives better tooling support, and
especially allows rustfmt to format the macro body correctly.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/513

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1477>
2024-07-06 14:08:03 +03:00
Thibault Saunier
426d95bc6a ges: Add setters to FrameCompositionMeta
Some elements might need to modify them

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1475>
2024-07-03 06:26:57 -04:00
Tomasz Andrzejak
207694ca6c Add libmysofa-dev to CI image
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1473>
2024-07-02 00:32:14 +02:00
Sebastian Dröge
adf3e9236a gstreamer: childproxy: Include child property name in error message when lookup fails
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1472>
2024-06-28 12:20:47 +03:00
Sebastian Dröge
7a5096b1e4 gstreamer: clock: Manually implement bindings for calibration related function
The rate is using two clock times in C but this is really just a u64.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1470>
2024-06-21 16:34:27 +03:00
Marijn Suijten
cfb0fe6a17 examples: Add Windows support to glupload
WGL does not have the concept of a `Display` connection, presumably
because there's always only one compositor active.  All interop
and sharing is happening from the `Context` afterwards.

After all `glutin` doesn't have a pointer inside `RawDisplay::Wgl`,
and upstream `gstreamer` code creates a dummy display on Win32.

WINRT is not taken into account & tested yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1468>
2024-06-20 21:36:42 +02:00
Sebastian Dröge
f3d7e18bcd Update to system-deps 7
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1469>
2024-06-20 20:58:27 +03:00
Sebastian Dröge
cd9f38135f Update gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1469>
2024-06-20 20:57:58 +03:00
Sebastian Dröge
53ede03b3b Update CHANGELOG.md for 0.22.6
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1467>
2024-06-19 20:51:31 +03:00
Sebastian Dröge
45ec7cedd9 Use Option::is_some_and(...) instead of Option::map_or(false, ...)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1466>
2024-06-19 11:17:58 +03:00
Sebastian Dröge
84ea10dc73 Update Minimum Supported Rust Version to 1.71.1
Because cea608-types actually wants 1.71.1 and not just 1.71.0.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1465>
2024-06-18 10:36:18 +03:00
Sebastian Dröge
a978f6d942 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1464>
2024-06-18 08:52:15 +03:00
Sebastian Dröge
87c16d8f9f Update Minimum Supported Rust Version to 1.71
cea608-types that is needed by gst-plugins-rs requires 1.71 now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1464>
2024-06-18 08:51:35 +03:00
Sebastian Dröge
5ea912d702 Update to new clone macro syntax
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1463>
2024-06-17 17:41:21 +03:00
Sebastian Dröge
0be8b364f8 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1462>
2024-06-17 08:38:13 +03:00
Sebastian Dröge
c21da79eac examples: Update to windows 0.57
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1462>
2024-06-17 08:37:46 +03:00
François Laignel
8527c0e39e Add new setters for collection Value setters in Builders
E.g. (also applies to `property`):

* `field_from_iter()`,
* `field_if_not_empty()`.

Use a macro to factorize implementation & documentation of `field` / `property`
convenience setters.

Also:

* add some `*_if_not_empty` for some iterator based setters.
* add `*_if` for predicate based setters.

Related to https://github.com/gtk-rs/gtk-rs-core/pull/1377

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1431>
2024-06-14 17:00:36 +02:00
Sebastian Dröge
e4e5cfd63b ci: Update to Rust 1.79
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1461>
2024-06-14 08:08:54 +03:00
Sebastian Dröge
f99c519a00 Fix various new 1.79 clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1461>
2024-06-14 08:08:27 +03:00
Sebastian Dröge
6bab9de772 gstreamer: Actually re-export ByteSliceExt trait from prelude instead of the Dump struct
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1460>
2024-06-12 19:35:55 +03:00
Sebastian Dröge
6a8e8055b9 ci: Rebuild image for GStreamer update to fix tests
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1459>
2024-06-12 07:48:10 +03:00
Sebastian Dröge
1970a043d4 pbutils: Add missing/install plugins API bindings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1458>
2024-06-11 11:13:44 +03:00
Sebastian Dröge
7c87874c28 gstreamer: Add bindings for generic message details API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1457>
2024-06-11 10:18:08 +03:00
Sebastian Dröge
b59a92b29e Regenerate with latest gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1457>
2024-06-11 08:29:32 +03:00
Sebastian Dröge
e1a387229c Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1457>
2024-06-11 08:29:32 +03:00
Sebastian Dröge
3888f65e4d Update gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1457>
2024-06-11 08:29:32 +03:00
Sebastian Dröge
50b941ecfc Update gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1457>
2024-06-11 08:29:32 +03:00
Sebastian Dröge
60302732f3 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1457>
2024-06-11 07:18:03 +03:00
Sebastian Dröge
259066e5b1 ci: Update to meson 1.4.1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1457>
2024-06-11 07:17:24 +03:00
Sebastian Dröge
c593ae5cfc ci: Update to dav1d 1.4.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1457>
2024-06-11 07:16:24 +03:00
Sebastian Dröge
ea16222625 ci: Update image version to update GStreamer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1457>
2024-06-11 07:16:11 +03:00
Sebastian Dröge
d8b7356f3d Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1455>
2024-06-07 19:27:03 +03:00
Bilal Elmoussaoui
bc96d439d0 Adapt to removed alias config for enum members
As it does the same thing as ignore

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1452>
2024-06-07 10:15:53 +00:00
Bilal Elmoussaoui
e6ed67cbc5 Regenerate with properties annotations supports
Removes some duplicated getters/setters

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1452>
2024-06-07 10:15:53 +00:00
Bilal Elmoussaoui
8a3ea1192d Update gir submodule
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1452>
2024-06-07 10:15:53 +00:00
Matthew Waters
b045708353 ci: run tests with RUST_BACKTRACE=1
Produces backtraces which would allow some initial debugging on hard to
find issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1454>
2024-06-06 11:55:37 +00:00
Tim-Philipp Müller
c545154472 log: fix panic when using a log id with a formatted log message
Would panic because of a missing NUL terminator:

thread '<unnamed>' panicked at .. glib/src/gstring.rs:61:9:
assertion failed: !bytes.is_empty() && bytes[bytes.len() - 1] == 0

 3: glib::gstring::GStr::from_utf8_with_nul_unchecked
 4: gstreamer::log::DebugCategory::log_id_unfiltered_internal
      at gstreamer-rs/gstreamer/src/log.rs:465
 5: gstreamer::log::DebugCategory::log_id_unfiltered
      at gstreamer-rs/gstreamer/src/log.rs:425

Also enable logging on the category, so the logging code paths
are actually run here in the tests.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1451>
2024-06-02 17:32:26 +03:00
Bilal Elmoussaoui
b20ea25147 gst-audio: Add missing doc alias
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1450>
2024-06-02 11:20:55 +02:00
Bilal Elmoussaoui
4ebec84f5e Adapt to no longer renamed ffi crates
Allows us to set all the crates in the main workspace file, so changing
their versions or branch is much simpler and reduce the amount of noise
in the diff

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1450>
2024-06-02 11:20:55 +02:00
Bilal Elmoussaoui
10aff0d66e Regenerate with latest gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1450>
2024-06-01 15:14:58 +02:00
Bilal Elmoussaoui
9d3ec9da53 Update gir submodule
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1450>
2024-06-01 15:13:26 +02:00
Sebastian Dröge
413a6baa8c Update CHANGELOG.md for 0.22.5 2024-05-23 16:06:42 +03:00
Sebastian Dröge
9e2c6268cb gstreamer: Use usize instead of u32 for various indices
This affects buffers, caps, caps features, structures and tag lists and
makes it easier to use them with other Rust APIs that use usize-based
indicing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1445>
2024-05-22 08:15:08 +00:00
Tim-Philipp Müller
4cda565a39 gstreamer: bufferlist: add another test for foreach_mut
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1446>
2024-05-22 06:59:40 +00:00
Sebastian Dröge
805cd6c591 gstreamer: bufferlist: Change remove function to take a range instead of index + length
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1444>
2024-05-21 08:21:17 +03:00
Sebastian Dröge
a0e58ec359 gstreamer: bufferlist: Check index/length when removing a buffer
Out of range values give assertions in the C function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1444>
2024-05-21 08:19:30 +03:00
Sebastian Dröge
9f151466b7 gstreamer: bufferlist: Check for out of range indices before trying to get buffer
Passing an index bigger than the length will cause an assertion in the C
function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1444>
2024-05-21 08:11:41 +03:00
Sebastian Dröge
1b537c17c8 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1443>
2024-05-20 14:06:30 +03:00
Sebastian Dröge
c3619b45aa Update to itertools 0.13
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1443>
2024-05-20 14:03:58 +03:00
Seungha Yang
f59029b57c event: Fix leak in SelectStreamsBuilder
gst_event_new_select_streams() does not take ownership of GList

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1442>
2024-05-16 14:30:52 +00:00
Sebastian Dröge
b468280353 Improve code generation with panic=abort around panic handling code
None of that can ever be called in that case but the compiler can't know
that in more complicated cases like these. Handling it explicitly allows
no handling code to be generated at all here, like would already happen
everywhere else.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1441>
2024-05-16 16:38:15 +03:00
Mathieu Duponchelle
0ef80c4fe7 streamproducer: expose set_forward_preroll() API
This is useful to decide whether the preroll sample should be forwarded
to consumers when prerolling or only once it is time to render it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1439>
2024-05-10 22:46:16 +00:00
Sebastian Dröge
455996c60b rtsp-server: Fix compilation after from_glib_ptr_borrow() API improvements
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1440>
2024-05-10 10:35:19 +03:00
Sebastian Dröge
83fe420466 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1440>
2024-05-10 10:09:10 +03:00
Sebastian Dröge
5af4a262b8 Regenerate with latest GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1440>
2024-05-10 10:09:10 +03:00
Sebastian Dröge
b8dbfc66ca pbutils: Remove unnecessary nullable override and add override for new API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1440>
2024-05-10 10:09:10 +03:00
Sebastian Dröge
b15e0e1633 Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1440>
2024-05-10 10:09:10 +03:00
Sebastian Dröge
a430291725 Update gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1440>
2024-05-10 10:09:10 +03:00
Sebastian Dröge
0ee36ea4b5 ci: Update to rustup 1.27.1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1440>
2024-05-10 10:09:07 +03:00
Sebastian Dröge
a7a0bf226d ci: Update image version to rebuild it
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1440>
2024-05-10 10:09:07 +03:00
Naglis Jonaitis
19ea814a09 examples: Update playbin flag handling snippet
Closes #512

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1438>
2024-05-09 11:45:00 +03:00
Sebastian Dröge
2a9d0d035f Fix various new 1.78 clippy warnings
Quite a bit of API was accidentally not exported but apparently nobody
was using it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1437>
2024-05-02 18:13:27 +03:00
Sebastian Dröge
1e293e5cb8 ci: Update to Rust 1.78.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1437>
2024-05-02 16:34:15 +03:00
Sebastian Dröge
fe1fe5b114 gstreamer: Use a reference to a pointer of correct mutability for from_glib_ptr_borrow()
This hopefully makes it easier to use and harder to get the returned
lifetime wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1436>
2024-04-30 15:39:15 +03:00
Sebastian Dröge
238768f525 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:36:37 +03:00
Sebastian Dröge
2f99c4c560 rtp: Only use glib::translate if 1.24 APIs are enabled
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:36:37 +03:00
Sebastian Dröge
9fca740851 ci: Run Linux clippy build with 1.26 APIs enabled
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:36:37 +03:00
Sebastian Dröge
9490735655 ci: Enable gstreamer-mpegts and gstreamer-tag on Windows
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:36:37 +03:00
Sebastian Dröge
81b20b9329 ci: Enable allocators, analytics, play, rtp and validate sys tests
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:36:37 +03:00
Sebastian Dröge
ba4bd5c631 Add 1.26 version features and update 1.24 requirement from 1.23 to 1.24
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:36:37 +03:00
Sebastian Dröge
4b79dddc14 video: Remove some unnecessary #[cfg] attributes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:36:37 +03:00
Sebastian Dröge
01b32ce143 video: Add double click mouse event
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:36:37 +03:00
Sebastian Dröge
873aeff133 Regenerate with latest GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:36:37 +03:00
Sebastian Dröge
87cc9fe6e4 Fix or update various overrides in Gir.toml
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:36:37 +03:00
Sebastian Dröge
bac0828260 ci: Rebuild image to get latest GStreamer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:29:04 +03:00
Sebastian Dröge
200d8b1c0c Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1435>
2024-04-30 12:29:04 +03:00
François Laignel
dc04a53207 ci: test gstreamer-editing-services/sys
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1434>
2024-04-30 09:52:14 +02:00
François Laignel
0bb334e14c regen
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1434>
2024-04-30 09:52:12 +02:00
François Laignel
46226106b4 ges: ignore deprecated PitiviFormatter & PitiviFormatterClass
... they cause ABI tests failures and should be ignored.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1425#note_2380648

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1434>
2024-04-30 09:51:35 +02:00
Nick Steel
b7b5352353 log: Log trait adapter around the GStreamer debug system
Allows usage of normal `log` crate macros, and for other crates
using those macros to have their log messages go to the GStreamer
debug logs.

This implementation is based on the one found in Servo.

Fixes #187

DebugCategoryLogger is optional via 'log' feature
check category above threshold
skip_assert_initialized for constructor and helper

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1426>
2024-04-29 16:16:47 +01:00
Jordan Petridis
88a6977777 ci: Bump the image tag to rebuild
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1433>
2024-04-28 10:40:00 +03:00
Jordan Petridis
cb560e59a3 ci: Move GST_UPSTREAM_BRANCH into the images_template.yml
Used for determining which version of gstreamer we will build
in the docker images. Move it along ther other variables so
it will be easier to update.

Also change ci/install-gst.sh to avoid hardoding the version
and instead use the variable like the windows build does.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1433>
2024-04-28 10:29:37 +03:00
Sebastian Dröge
241338f43c audio: video: Improve Display trait impl test for AudioFormat and Video a bit
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1432>
2024-04-27 16:10:49 +00:00
Sebastian Dröge
5c8a989029 video: Remove nonsensical test
Printing an unknown video format returns NULL, and with latest git main
this actually causes a critical warning in addition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1432>
2024-04-27 16:10:49 +00:00
Sebastian Dröge
57050f66c6 Regenerate with latest gir / gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1429>
2024-04-27 11:31:11 +03:00
Sebastian Dröge
63654c67da Update gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1429>
2024-04-27 11:30:29 +03:00
Sebastian Dröge
70a15e8dbe Update gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1429>
2024-04-27 11:30:25 +03:00
François Laignel
953e3747f2 Pad: allow building a Pad with an automatically generated name
For convenience, the `Pad` builder checks a name is provided when a wildcard-
named template is used. For `GhostPad`s, the builder tries to assign the name of
the target `Pad` making sure the provided `name` conforms to the `PadTemplate`.

This commit adds a function to optionally keep the `gst::Object` automatically
generated unique `Pad` name (such as `ghostpad4`) and reorganises name handling
so it is processed when `build` is invoked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1428>
2024-04-26 09:57:28 +00:00
Sebastian Dröge
e117010bc0 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1427>
2024-04-25 12:05:49 +03:00
Sebastian Dröge
694d1fd39b examples: Update to windows 0.56
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1427>
2024-04-25 12:05:49 +03:00
François Laignel
db03c8edd1 Add field_if_some setter for builder ClockTime fields
Optional `ClockTime` fields already implemented their setters in such a way
that they could accept either `Option<ClockTime>` or `ClockTime`. This commit
adds `field_if_some()` setter variants for builder `ClockTime` builder fields
for consistency with other builder fields.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1424>
2024-04-17 17:15:41 +02:00
François Laignel
ea25c9262b Add field_if_some setter for builders
This commit adds `_if_some()` variants for builder field setters.
The variants aim at improving usability when setting optional fields.
E.g. currently, we need to write something like:

```rust
let opt_value = ...;
let mut sb = gst::Structure::builder("test")
    .field("mandatory_field", "mandatory");

if let Some(value) = opt_value
    sb = sb.field("optional_field", value);
}

let s = sb.build();
```

With `_if_some()`, this can be written like this:

```rust
let opt_value = ...;
let s = gst::Structure::builder("test")
    .field("mandatory_field", "mandatory")
    .field_if_some("optional_field", opt_value)
    .build();
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1424>
2024-04-17 17:15:39 +02:00
Sebastian Dröge
0d872ae6f8 ci: Update to Rust 1.77.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1422>
2024-04-10 09:00:24 +03:00
Sebastian Dröge
7433ea79c9 ci: Update image version to get a working libvpx on Windows 2024-04-09 12:19:14 +03:00
Sebastian Dröge
46be4a0b1e examples: Use safe RTSPMediaFactory role API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1421>
2024-04-09 06:27:14 +00:00
Sebastian Dröge
43c82da25a rtsp-server: Add builder API for RTSPToken for consistency with Structure
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1421>
2024-04-09 06:27:14 +00:00
Sebastian Dröge
da1f53f4c7 ci: tag linter and sanity check jobs as a "placeholder" jobs
They hardly use any resources and almost finish immediately.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1420>
2024-04-09 09:09:51 +03:00
Sebastian Dröge
0524435190 Update CHANGELOG.md for 0.22.4 2024-04-08 16:11:10 +03:00
Sebastian Dröge
917c458a86 ci: Rebuild image to get the flac plugin included on Windows too
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1418>
2024-04-08 08:58:28 +03:00
Sebastian Dröge
5eaa0ca46d Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1418>
2024-04-08 08:58:10 +03:00
Jordan Petridis
5400979e28 ci: Pin typos-cli to 1.19.0
New version includes false positives

https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1417#note_2358711

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1417>
2024-04-05 12:02:47 +03:00
Jordan Petridis
c43c08804a typos.toml: Ignore anc and sys/tests
The tests are autogenerated

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1417>
2024-04-05 11:59:08 +03:00
Jordan Petridis
a7ebe45ff3 ci: Add libflac in the debian image
So we can build flac elements.

Related: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1401
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1417>
2024-04-04 15:37:42 +03:00
Sebastian Dröge
2b53c55ee6 ci: Update to Rust 1.77.1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1416>
2024-03-29 09:52:23 +02:00
Sebastian Dröge
04c840a1d9 mpegts: Always re-export the contents of the auto module
Pre-1.20 it currently has nothing to re-export and would cause clippy
warnings, but like this it won't be forgotten to update the conditions
if new API is added that is available from older versions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1414>
2024-03-24 11:21:45 +02:00
Piotr Brzeziński
6111663e26 audio: Implement From/ToValue in Audio/VideoConverterConfig
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1408>
2024-03-22 17:16:48 +00:00
Piotr Brzeziński
7cea7ba6f1 examples: Add audiomixer example with mixing 4 stereo tracks into 8ch output
Will be useful to show how to create and set the mix-matrix via our bindings.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1408>
2024-03-22 17:16:48 +00:00
Philippe Normand
e2e38d9494 Fix build warnings after update to Rust 1.77
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1413>
2024-03-21 15:44:46 +00:00
Philippe Normand
676e41064b Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1413>
2024-03-21 13:41:23 +00:00
Philippe Normand
4524af89ee ci: Update to Rust 1.77
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1413>
2024-03-21 13:40:49 +00:00
Philippe Normand
e5830c2ea9 ci: Update to dav1d >= 1.3.0
This is going to be needed for:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1507

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1413>
2024-03-21 13:40:29 +00:00
Sebastian Dröge
d7fe0709a5 ci: Rebuild image to get fixes for the Windows gst-plugins-rs CI
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1412>
2024-03-20 10:49:09 +02:00
Sebastian Dröge
983e8b3308 Update CHANGELOG.md for 0.22.3 2024-03-19 18:13:28 +02:00
Olivier Crête
6aff1773bd video_meta: Rename transformation to scale
This transformation is really only for scaling for now, so let's
make it clearer in the bindings.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1397>
2024-03-19 14:44:57 +00:00
Sebastian Dröge
ebc06257b5 ci: Rebuild image to pull in the GES fixes
And follow the 1.24 branch of GStreamer for now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1410>
2024-03-19 09:57:38 +02:00
Sebastian Dröge
86d02890ca Regenerate with latest gir / gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1410>
2024-03-19 09:57:38 +02:00
Sebastian Dröge
29c82cd54d Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1410>
2024-03-19 09:57:38 +02:00
Michiel Westerbeek
c05563d22e ges: framepositioner: Make positioning properties doubles
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1410>
2024-03-19 09:57:37 +02:00
Sebastian Dröge
9e80250b49 Use 0.19 branches of gir / gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1410>
2024-03-19 09:57:37 +02:00
Sebastian Dröge
0b027c853b Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1410>
2024-03-19 09:57:37 +02:00
Olivier Crête
3246f4fb5b analytics: Allow empty object type
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1407>
2024-03-13 13:52:37 +00:00
François Laignel
82f6accc31 webrtc: SessionDescription: access the inner SDPMessage as & or &mut
`WebRTCSessionDescription` owns its `SDPMessage`. The `sdp()` accessor used to
return a copy of the `SDPMessage` which prevented the user from getting a ref
and by extension from getting a mutable ref for in-place modification.

This commit makes the accessor return a reference to the inner `SDPMessage` and
adds a mutable accessor.

Previous behaviour (getting an owned copy of the `SDPMessage`) is available by
calling `to_owned()` on the reference returned by `sdp()`.

Users who wish to change the type of `WebRTCSessionDescription` can call
`set_type()`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1406>
2024-03-11 13:03:26 +01:00
François Laignel
ffad1188b9 net: fix faillible PtpClock::new()
`PtpClock::new()` can fail in which case it panicked due to an assertion
failure. This commit makes it return a `Result` instead.

Also sets the `name` argument optional, similar to what is done for `NtpClock`.

See also: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6251

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1405>
2024-03-01 17:39:39 +01:00
Dave Patrick Caberto
353e3d1611 fraction: refer to numer and denom more consistently
This also lessens the tendency to confuse num with number.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1404>
2024-03-01 18:30:19 +08:00
Dave Patrick Caberto
b5cb4ae831 fraction: add const new_raw and from_integer methods
These are direct counterparts to their respective Rational32 constructors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1404>
2024-03-01 18:28:39 +08:00
Sebastian Dröge
14576fdf26 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1403>
2024-02-29 11:32:12 +02:00
Sebastian Dröge
70045a36fb examples: Update to windows 0.54
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1403>
2024-02-29 11:31:26 +02:00
Sebastian Dröge
28451435a4 Update CHANGELOG.md for 0.22.2 2024-02-26 14:50:48 +02:00
Sebastian Dröge
fcc7ab6b88 Update CHANGELOG.md for 0.22.1 2024-02-26 14:08:30 +02:00
Sebastian Dröge
18a02f6d34 gstreamer: Update serde flags tests for new ObjectFlags
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1401>
2024-02-26 11:29:19 +00:00
Sebastian Dröge
c5111ddcc2 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1401>
2024-02-26 11:29:19 +00:00
Sebastian Dröge
d5917be045 Regenerate with latest GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1401>
2024-02-26 11:29:19 +00:00
Sebastian Dröge
4e6ddf6663 rtp: Add bindings for new RTPBaseDepayload::extensions() property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1401>
2024-02-26 11:29:19 +00:00
Sebastian Dröge
ab0a29b765 Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1401>
2024-02-26 11:29:19 +00:00
Guillaume Desmottes
8062a8748f ci: rebuild images to update GStreamer
Pick GStreamer 1.23.90 as it requires to build the new uriplaylistbin
version, see https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1471

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1400>
2024-02-26 09:09:00 +01:00
Sebastian Dröge
28fe70f479 rtpheaderextension: Don't pass a mutable output buffer reference to write()
The extension is only supposed to use it for potentially reading metas
from it, and `GstRTPBasePay` is currently passing the same buffer as the
one that owns the data so we currently end up with the possibility to
e.g. resize the buffer which would invalidate the data.

This change prevents at least the biggest problems, but would still
allow getting an immutable and mutable reference to the same data with a
bit of effort.

See also https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/375

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1399>
2024-02-22 12:17:13 +02:00
Sebastian Dröge
c8b98dde8c gstreamer: bus: Handle all previously queued messages too in the BusStream
Before the stream was created, some messages might've been queued on the
bus. For more similar behaviour with the bus watch, first pop all the
queued messages before handling new messages.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1398>
2024-02-21 12:09:14 +02:00
Olivier Crête
b47aba1837 video_meta: Add a safe wrapper for the VIDEO_TRANSFORM of metas
With a test

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1388>
2024-02-16 14:28:26 -05:00
Olivier Crête
28931e2f09 meta: Make a generic transform method with a specific trait for each transform
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1388>
2024-02-16 14:28:26 -05:00
Sebastian Dröge
1649e268c5 rtp: Add gst::Object as parent class to the various types
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1396>
2024-02-16 19:49:16 +02:00
Sebastian Dröge
d575cd1f95 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1395>
2024-02-16 14:24:32 +02:00
Sebastian Dröge
ac275fe10e Remove Cargo.lock from .gitignore
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1395>
2024-02-16 14:24:32 +02:00
Olivier Crête
b10f395c2c meta: Add modules containing the tags
Export the tags as both quark or string

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1387>
2024-02-16 08:59:36 +00:00
Benjamin Gaignard
22796cee0c meta: Add is_registered function for CustomMeta
Test if a Meta type is already registered.
It is useful to know if a custom metadata type has already
been registed to avoid registererd twice and get asserts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1391>
2024-02-13 08:21:38 +00:00
Sebastian Dröge
7f9dd58718 video: Add AncillaryMeta bindings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1393>
2024-02-12 16:54:19 +02:00
Sebastian Dröge
798ee29b98 structure: Call _full() serialize function for GST_SERIALIZE_FLAG_STRICT
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1393>
2024-02-12 16:10:24 +02:00
Sebastian Dröge
040a194700 tags: Add new ContainerSpecificTrackId tag
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1393>
2024-02-12 16:09:28 +02:00
Sebastian Dröge
b69fee9abe Regenerate with new GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1393>
2024-02-12 16:06:44 +02:00
Sebastian Dröge
a87a844604 ci: Rebuild image to get new GStreamer version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1393>
2024-02-12 16:05:41 +02:00
Sebastian Dröge
5d19b26974 Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1393>
2024-02-12 16:05:14 +02:00
Benjamin Gaignard
2613c57739 analytics: Make AnalyticsODLocation members public
Get access to AnalyticsODLocation structure members outside
the module is useful if other elements need them.
For example it can be used to draw objects location.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1389>
2024-02-09 15:35:32 +00:00
Sebastian Dröge
f82b9cc197 meta: Add support for 1.24 Meta clear function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1390>
2024-02-09 10:25:32 +02:00
Sebastian Dröge
12c9ada9e0 meta: Fix MetaRefMut::upcast_mut() to return a mutable reference
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1390>
2024-02-09 10:24:40 +02:00
Sebastian Dröge
a784ea2d0b ci: Update to Rust 1.76
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1386>
2024-02-08 17:46:08 +02:00
Sebastian Dröge
90e6108ed7 gstreamer-tag: Reduce number of keywords 2024-02-08 15:37:44 +02:00
Sebastian Dröge
77b2800caf Publish docs for 0.22 release 2024-02-08 15:24:21 +02:00
Sebastian Dröge
c4636fc0cd Update Cargo.lock 2024-02-08 15:01:11 +02:00
Sebastian Dröge
6a1441203d Update versions to 0.23.0 2024-02-08 14:47:20 +02:00
788 changed files with 11548 additions and 3780 deletions

1
.gitignore vendored
View file

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

View file

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

936
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -107,12 +107,12 @@ members = [
exclude = ["gir"]
[workspace.package]
version = "0.22.0"
version = "0.24.0"
categories = ["api-bindings", "multimedia"]
repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
homepage = "https://gstreamer.freedesktop.org"
edition = "2021"
rust-version = "1.70"
rust-version = "1.71.1"
[workspace.dependencies]
gio = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "master" }
@ -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" }

View file

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

View file

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

View file

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

View file

@ -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"
@ -26,26 +26,34 @@ if [ "$RUST_IMAGE_FULL" = "1" ]; then
rustup component add clippy-preview
rustup component add rustfmt
cargo install --locked --force cargo-deny
cargo install --locked --force cargo-outdated
cargo install --locked --force typos-cli
cargo install --locked cargo-deny
if [ "$RUST_VERSION" = "1.71.1" ]; then
cargo install --locked cargo-outdated
else
# Don't use --locked because time-0.3.30 does not build with 1.80 or newer
cargo install cargo-outdated
fi
cargo install --locked typos-cli --version "1.19.0"
# Coverage tools
rustup component add llvm-tools-preview
cargo install --locked --force grcov
if [ "$RUST_VERSION" = "1.71.1" ]; then
cargo install --locked grcov
else
# Don't use --locked because time-0.3.30 does not build with 1.80 or newer
cargo install grcov
fi
fi
if [ "$RUST_VERSION" = "nightly" ]; then
# FIXME: Don't build cargo-c with --locked for now because otherwise a
# version of ahash is used that doesn't build on nightly anymore
cargo install cargo-c --version 0.9.22+cargo-0.72
if [ "$RUST_VERSION" = "1.71.1" ]; then
cargo install --locked cargo-c --version 0.9.26+cargo-0.74
else
cargo install --locked cargo-c --version 0.9.22+cargo-0.72
cargo install --locked cargo-c --version 0.10.3+cargo-0.81
fi
if [ "$RUST_VERSION" = "nightly" ]; then
rustup component add rustfmt --toolchain nightly
# Documentation tools
cargo install --locked --force rustdoc-stripper
cargo install --locked rustdoc-stripper
fi

View file

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

View file

@ -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
}

View file

@ -5,19 +5,25 @@ set -ex
rustc --version
cargo --version
cpus=$(nproc || sysctl -n hw.ncpu)
CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$cpus}"
for crate in gstreamer*/sys gstreamer-gl/*/sys; do
if [ -e "$crate/Cargo.toml" ]; then
echo "Building $crate with --all-features"
cargo build --locked --color=always --manifest-path "$crate/Cargo.toml" --all-features
cargo build $CARGO_FLAGS --locked --color=always --manifest-path "$crate/Cargo.toml" --all-features
fi
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 +31,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 $CARGO_FLAGS --locked --color=always --manifest-path $crate/Cargo.toml --all-features
done

View file

@ -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',
@ -56,7 +54,7 @@ foreach($features in $features_matrix) {
if ($env:LocalFeatures -and ($env:LocalFeatures -ne '--no-default-features')) {
if ($crate -eq 'examples') {
# FIXME: We can do --all-features for examples once we have gtk3 installed in the image
$env:LocalFeatures = "--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18,windows"
$env:LocalFeatures = "--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18,windows,gl"
}
if ($crate -eq 'tutorials') {
@ -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 (!$?) {

View file

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

View file

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

View file

@ -1,7 +1,7 @@
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
# 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.3 --depth 1 https://code.videolan.org/videolan/dav1d.git C:\dav1d
if (!$?) {
Write-Host "Failed to clone dav1d"
Exit 1

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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

View file

@ -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 {
@ -304,7 +304,7 @@ fn main() -> Result<()> {
// Add pad probe to calculate framerate
let sinkpad = videosink.static_pad("sink").unwrap();
let overlay_context_weak = Arc::downgrade(&overlay_context);
sinkpad.add_probe(gst::PadProbeType::BUFFER, move |_, probe_info| {
sinkpad.add_probe(gst::PadProbeType::BUFFER, move |_pad, _probe_info| {
let overlay_context = overlay_context_weak.upgrade().unwrap();
let mut context = overlay_context.lock().unwrap();
context.timestamp_queue.push_back(SystemTime::now());

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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.

View file

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

View file

@ -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);

View file

@ -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();

View file

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

View file

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

View file

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

View file

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

View file

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

2
gir

@ -1 +1 @@
Subproject commit 5975266da3b0fa1195e53213502a8c9bc5d9b1ac
Subproject commit a11b11f2e403d615edd94497b6fe5b3c5283145b

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

@ -1 +1 @@
Subproject commit 63e90a30193bf8d228057c4570a50a0a2b40f2bd
Subproject commit db97a3ad67f5d3e46d88ddfb498344cbd3e08731

View file

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

View file

@ -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")]

View file

@ -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! {

View file

@ -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! {

View file

@ -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! {

View file

@ -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! {

View file

@ -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! {

View file

@ -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")]

View file

@ -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 @ a11b11f2e403)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5)

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
[build-dependencies]
system-deps = "6"
system-deps = "7"
[dependencies]
libc = "0.2"
@ -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"

View file

@ -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 @ a11b11f2e403)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5)

View file

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

View file

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

View file

@ -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! {

View file

@ -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 @ a11b11f2e403)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5)

View file

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

View file

@ -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 {
() => {};

View file

@ -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);

View file

@ -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")]
@ -484,7 +484,7 @@ macro_rules! define_mtd_iter {
meta,
state: std::ptr::null_mut(),
mtd_type: T::mtd_type(),
an_meta_id: std::u32::MAX,
an_meta_id: u32::MAX,
rel_type: RelTypes::ANY.into_glib(),
phantom: PhantomData,
}
@ -513,7 +513,7 @@ macro_rules! define_mtd_iter {
unsafe {
let mut mtd = ffi::GstAnalyticsMtd::unsafe_from(&**self.meta);
let ret = {
if self.an_meta_id == std::u32::MAX {
if self.an_meta_id == u32::MAX {
ffi::gst_analytics_relation_meta_iterate(
self.meta.as_mut_ptr(),
&mut self.state,
@ -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();

View file

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

View file

@ -1,5 +1,5 @@
[build-dependencies]
system-deps = "6"
system-deps = "7"
[dependencies]
libc = "0.2"
@ -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 = []

View file

@ -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 @ a11b11f2e403)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5)

View file

@ -15,10 +15,14 @@
use glib_sys as glib;
use gstreamer_sys as gst;
#[cfg(unix)]
#[allow(unused_imports)]
use libc::{
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
#[allow(unused_imports)]
use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE};
#[allow(unused_imports)]
use std::ffi::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, uintptr_t, FILE,
};
#[allow(unused_imports)]
@ -28,7 +32,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 +98,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()
}
}
@ -117,6 +119,7 @@ impl ::std::fmt::Debug for GstAnalyticsODMtd {
}
#[repr(C)]
#[allow(dead_code)]
pub struct _GstAnalyticsRelationMeta {
_data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
@ -156,7 +159,6 @@ impl ::std::fmt::Debug for GstAnalyticsTrackingMtd {
}
}
#[link(name = "gstanalytics-1.0")]
extern "C" {
//=========================================================================

View file

@ -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"),
];

View file

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

View file

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

View file

@ -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,22 @@ impl AppSinkCallbacksBuilder {
}
}
pub fn eos_if<F: FnMut(&AppSink) + Send + 'static>(self, eos: F, predicate: bool) -> Self {
if predicate {
self.eos(eos)
} else {
self
}
}
pub fn eos_if_some<F: FnMut(&AppSink) + Send + 'static>(self, eos: Option<F>) -> Self {
if let Some(eos) = eos {
self.eos(eos)
} else {
self
}
}
pub fn new_preroll<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
@ -83,6 +100,33 @@ impl AppSinkCallbacksBuilder {
}
}
pub fn new_preroll_if<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
self,
new_preroll: F,
predicate: bool,
) -> Self {
if predicate {
self.new_preroll(new_preroll)
} else {
self
}
}
pub fn new_preroll_if_some<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
self,
new_preroll: Option<F>,
) -> Self {
if let Some(new_preroll) = new_preroll {
self.new_preroll(new_preroll)
} else {
self
}
}
pub fn new_sample<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
@ -95,6 +139,33 @@ impl AppSinkCallbacksBuilder {
}
}
pub fn new_sample_if<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
self,
new_sample: F,
predicate: bool,
) -> Self {
if predicate {
self.new_sample(new_sample)
} else {
self
}
}
pub fn new_sample_if_some<
F: FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
self,
new_sample: Option<F>,
) -> Self {
if let Some(new_sample) = new_sample {
self.new_sample(new_sample)
} else {
self
}
}
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
pub fn new_event<F: FnMut(&AppSink) -> bool + Send + 'static>(self, new_event: F) -> Self {
@ -104,6 +175,33 @@ impl AppSinkCallbacksBuilder {
}
}
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
pub fn new_event_if<F: FnMut(&AppSink) -> bool + Send + 'static>(
self,
new_event: F,
predicate: bool,
) -> Self {
if predicate {
self.new_event(new_event)
} else {
self
}
}
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
pub fn new_event_if_some<F: FnMut(&AppSink) -> bool + Send + 'static>(
self,
new_event: Option<F>,
) -> Self {
if let Some(new_event) = new_event {
self.new_event(new_event)
} else {
self
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub fn propose_allocation<
@ -118,6 +216,37 @@ impl AppSinkCallbacksBuilder {
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub fn propose_allocation_if<
F: FnMut(&AppSink, &mut gst::query::Allocation) -> bool + Send + 'static,
>(
self,
propose_allocation: F,
predicate: bool,
) -> Self {
if predicate {
self.propose_allocation(propose_allocation)
} else {
self
}
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub fn propose_allocation_if_some<
F: FnMut(&AppSink, &mut gst::query::Allocation) -> bool + Send + 'static,
>(
self,
propose_allocation: Option<F>,
) -> Self {
if let Some(propose_allocation) = propose_allocation {
self.propose_allocation(propose_allocation)
} else {
self
}
}
#[must_use = "Building the callbacks without using them has no effect"]
pub fn build(self) -> AppSinkCallbacks {
let have_eos = self.eos.is_some();
@ -132,6 +261,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 +295,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,6 +307,12 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp
match result {
Ok(result) => result,
Err(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(),
@ -185,6 +322,7 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp
}
}
}
}
}
unsafe extern "C" fn trampoline_new_preroll(
@ -194,6 +332,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,6 +344,12 @@ unsafe extern "C" fn trampoline_new_preroll(
match result {
Ok(result) => result,
Err(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(),
@ -215,6 +360,7 @@ unsafe extern "C" fn trampoline_new_preroll(
gst::FlowReturn::Error
}
}
}
} else {
gst::FlowReturn::Error
};
@ -229,6 +375,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,6 +387,12 @@ unsafe extern "C" fn trampoline_new_sample(
match result {
Ok(result) => result,
Err(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(),
@ -250,6 +403,7 @@ unsafe extern "C" fn trampoline_new_sample(
gst::FlowReturn::Error
}
}
}
} else {
gst::FlowReturn::Error
};
@ -264,6 +418,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,6 +430,12 @@ unsafe extern "C" fn trampoline_new_event(
match result {
Ok(result) => result,
Err(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(),
@ -285,6 +446,7 @@ unsafe extern "C" fn trampoline_new_event(
false
}
}
}
} else {
false
};
@ -300,6 +462,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,16 +480,22 @@ unsafe extern "C" fn trampoline_propose_allocation(
match result {
Ok(result) => result,
Err(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
}
}
}
} else {
false
};
@ -652,7 +821,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::async\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_async_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -680,7 +849,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::blocksize\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_blocksize_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -708,7 +877,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::enable-last-sample\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_enable_last_sample_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -736,7 +905,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::last-sample\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_last_sample_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -764,7 +933,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::max-bitrate\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_max_bitrate_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -792,7 +961,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::max-lateness\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_max_lateness_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -822,7 +991,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::processing-deadline\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_processing_deadline_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -848,7 +1017,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::qos\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_qos_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -876,7 +1045,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::render-delay\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_render_delay_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -904,7 +1073,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::stats\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_stats_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -930,7 +1099,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::sync\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_sync_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -958,7 +1127,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::throttle-time\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_throttle_time_trampoline::<F> as *const (),
)),
Box::into_raw(f),
@ -986,7 +1155,7 @@ impl AppSink {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::ts-offset\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_ts_offset_trampoline::<F> as *const (),
)),
Box::into_raw(f),

View file

@ -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,29 @@ impl AppSrcCallbacksBuilder {
}
}
pub fn need_data_if<F: FnMut(&AppSrc, u32) + Send + 'static>(
self,
need_data: F,
predicate: bool,
) -> Self {
if predicate {
self.need_data(need_data)
} else {
self
}
}
pub fn need_data_if_some<F: FnMut(&AppSrc, u32) + Send + 'static>(
self,
need_data: Option<F>,
) -> Self {
if let Some(need_data) = need_data {
self.need_data(need_data)
} else {
self
}
}
pub fn enough_data<F: Fn(&AppSrc) + Send + Sync + 'static>(self, enough_data: F) -> Self {
Self {
enough_data: Some(Box::new(enough_data)),
@ -67,6 +91,29 @@ impl AppSrcCallbacksBuilder {
}
}
pub fn enough_data_if<F: Fn(&AppSrc) + Send + Sync + 'static>(
self,
enough_data: F,
predicate: bool,
) -> Self {
if predicate {
self.enough_data(enough_data)
} else {
self
}
}
pub fn enough_data_if_some<F: Fn(&AppSrc) + Send + Sync + 'static>(
self,
enough_data: Option<F>,
) -> Self {
if let Some(enough_data) = enough_data {
self.enough_data(enough_data)
} else {
self
}
}
pub fn seek_data<F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>(
self,
seek_data: F,
@ -77,6 +124,29 @@ impl AppSrcCallbacksBuilder {
}
}
pub fn seek_data_if<F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>(
self,
seek_data: F,
predicate: bool,
) -> Self {
if predicate {
self.seek_data(seek_data)
} else {
self
}
}
pub fn seek_data_if_some<F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>(
self,
seek_data: Option<F>,
) -> Self {
if let Some(seek_data) = seek_data {
self.seek_data(seek_data)
} else {
self
}
}
#[must_use = "Building the callbacks without using them has no effect"]
pub fn build(self) -> AppSrcCallbacks {
let have_need_data = self.need_data.is_some();
@ -87,6 +157,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 +194,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,6 +206,12 @@ unsafe extern "C" fn trampoline_need_data(
match result {
Ok(result) => result,
Err(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(),
@ -143,12 +221,14 @@ unsafe extern "C" fn trampoline_need_data(
}
}
}
}
}
unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbacks: gpointer) {
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,6 +240,12 @@ unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbac
match result {
Ok(result) => result,
Err(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(),
@ -169,6 +255,7 @@ unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbac
}
}
}
}
}
unsafe extern "C" fn trampoline_seek_data(
@ -179,6 +266,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,6 +278,12 @@ unsafe extern "C" fn trampoline_seek_data(
match result {
Ok(result) => result,
Err(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(),
@ -200,6 +294,7 @@ unsafe extern "C" fn trampoline_seek_data(
false
}
}
}
} else {
false
};
@ -329,7 +424,7 @@ impl AppSrc {
glib::signal::connect_raw(
self.as_ptr() as *mut _,
b"notify::do-timestamp\0".as_ptr() as *const _,
Some(mem::transmute::<_, unsafe extern "C" fn()>(
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_do_timestamp_trampoline::<F> as *const (),
)),
Box::into_raw(f),

View file

@ -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),

View file

@ -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),

View file

@ -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")]

View file

@ -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 @ a11b11f2e403)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5)

View file

@ -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 {
() => {

View file

@ -1,5 +1,5 @@
[build-dependencies]
system-deps = "6"
system-deps = "7"
[dependencies]
libc = "0.2"
@ -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"

View file

@ -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 @ a11b11f2e403)
from gir-files (https://github.com/gtk-rs/gir-files @ 62da9eb7c4bd)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ db97a3ad67f5)

View file

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

View file

@ -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]

View file

@ -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"

View file

@ -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 {}
@ -68,7 +68,7 @@ pub trait AudioAggregatorExtManual: sealed::Sealed + IsA<AudioAggregator> + 'sta
connect_raw(
self.as_ptr() as *mut _,
b"notify::output-buffer-duration-fraction\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
Some(transmute::<*const (), unsafe extern "C" fn()>(
notify_output_buffer_duration_fraction_trampoline::<Self, F> as *const (),
)),
Box::into_raw(f),

View file

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

View file

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

View file

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

View file

@ -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)]

View file

@ -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"))

View file

@ -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(

View file

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

View file

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

View file

@ -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]

View file

@ -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},

View file

@ -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,29 @@ impl<'a> AudioInfoBuilder<'a> {
}
}
pub fn positions_if(
self,
positions: &'a [crate::AudioChannelPosition],
predicate: bool,
) -> AudioInfoBuilder<'a> {
if predicate {
self.positions(positions)
} else {
self
}
}
pub fn positions_if_some(
self,
positions: Option<&'a [crate::AudioChannelPosition]>,
) -> AudioInfoBuilder<'a> {
if let Some(positions) = positions {
self.positions(positions)
} else {
self
}
}
pub fn flags(self, flags: crate::AudioFlags) -> Self {
Self {
flags: Some(flags),
@ -103,12 +127,44 @@ impl<'a> AudioInfoBuilder<'a> {
}
}
pub fn flags_if(self, flags: crate::AudioFlags, predicate: bool) -> Self {
if predicate {
self.flags(flags)
} else {
self
}
}
pub fn flags_if_some(self, flags: Option<crate::AudioFlags>) -> Self {
if let Some(flags) = flags {
self.flags(flags)
} else {
self
}
}
pub fn layout(self, layout: crate::AudioLayout) -> Self {
Self {
layout: Some(layout),
..self
}
}
pub fn layout_if(self, layout: crate::AudioLayout, predicate: bool) -> Self {
if predicate {
self.layout(layout)
} else {
self
}
}
pub fn layout_if_some(self, layout: Option<crate::AudioLayout>) -> Self {
if let Some(layout) = layout {
self.layout(layout)
} else {
self
}
}
}
impl AudioInfo {

View file

@ -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>());
}
}

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