Compare commits

...

123 commits
main ... 0.19

Author SHA1 Message Date
Sebastian Dröge
b9307ca258 gstreamer: memory: Fix assertions for copy_range/resize/share functions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1392>
2024-02-12 15:56:52 +02:00
Sebastian Dröge
8cceb92d5f Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1341>
2023-11-10 09:42:41 +02:00
Guillaume Desmottes
1915957409 gst-utils: prevent dead lock when requesting key unit
Sending the UpstreamForceKeyUnitEvent using gst_element_send_event()
internally takes the state lock. If appsink is pre-rolling we are also
holding the preroll lock.

This may result in a dead lock with the thread doing the state change as
this one takes the state lock and then the pre-roll lock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1341>
2023-11-10 09:29:52 +02:00
Sebastian Dröge
ae76c83ddf Update various dependencies
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1291>
2023-07-05 12:10:33 +03:00
Sebastian Dröge
313116e60c basetransform: Don't leak any output buffer if prepare_output_buffer fails
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1291>
2023-07-05 11:54:45 +03:00
Sebastian Dröge
8f0b85df0b basetransform: Fix memory leak when dropping buffers from the transform function
Also add a basic test for a basetransform subclass.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1291>
2023-07-05 11:54:45 +03:00
Sebastian Dröge
b439d90391 examples: Reduce dependencies of the thumbnail example
Instead of depending on libraries for every possible image format,
depend only on the JPEG and PNG libraries.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1291>
2023-07-05 11:52:47 +03:00
Sebastian Dröge
36a92bf0fc rtsp-server: Work around GstRTSPClientClass ABI breakage in 1.18
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/455

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1291>
2023-07-05 11:48:04 +03:00
Sebastian Dröge
bdf502c632 Update CHANGELOG.md for 0.19.8 2023-02-09 21:30:01 +02:00
Sebastian Dröge
350662e140 Update Cargo.lock 2023-02-09 21:27:43 +02:00
Sebastian Dröge
cc4c814095 Update versions to 0.19.8 2023-02-09 21:27:26 +02:00
Christian Meissl
0714c2ceb0 gstreamer-allocators: allow to subclass fd memory allocators
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1215>
2023-02-09 20:45:25 +02:00
Sebastian Dröge
b708208408 gstreamer: Add bindings for Message::structure_mut()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1215>
2023-02-09 20:43:09 +02:00
Sebastian Dröge
b54746cf62 gstreamer: Use obj() instead of instance() in the remaining places
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1202>
2023-01-24 16:08:45 +02:00
Sebastian Dröge
7ca1834cd6 Add 1.22 to extra_versions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1202>
2023-01-24 16:07:51 +02:00
Sebastian Dröge
4f6f7028b9 gstreamer: Mark MessageType enum as non-exhaustive
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1202>
2023-01-24 16:07:51 +02:00
Sebastian Dröge
99021c6c07 ci: Update gtk4 to 4.8.3
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1202>
2023-01-24 16:07:25 +02:00
Sebastian Dröge
37409be8bc ci: Update to meson 1.0.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1202>
2023-01-24 16:07:22 +02:00
Sebastian Dröge
7baa69563a ci: Rebuild image for 1.22.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1202>
2023-01-24 16:07:12 +02:00
Sebastian Dröge
57052b9417 Regenerate with latest gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1202>
2023-01-24 16:06:56 +02:00
Sebastian Dröge
94f7041d29 Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1202>
2023-01-24 16:06:06 +02:00
Sebastian Dröge
d4e63494dd Update gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1202>
2023-01-24 16:05:44 +02:00
Sebastian Dröge
f27a717ceb Get README.md in sync again
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/437
2023-01-23 12:01:31 +02:00
Sebastian Dröge
fb894d4490 Update Cargo.lock 2023-01-19 19:03:44 +02:00
Sebastian Dröge
455fef0734 Update CHANGELOG.md for 0.19.7 2023-01-19 19:03:29 +02:00
Sebastian Dröge
fd28a25948 Update versions to 0.19.7 2023-01-19 19:02:09 +02:00
Sebastian Dröge
ee2505388b gstreamer: Handle NULL caps when parsing the allocation query
With the next release this will be handled explicitly and setting no
caps will also be possible when creating allocation queries.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1194

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1195>
2023-01-19 16:25:15 +02:00
Sebastian Dröge
24f8b74f21 Fix version links in CHANGELOG.md 2023-01-18 16:50:50 +02:00
Sebastian Dröge
27700b86de Update Cargo.lock 2023-01-18 16:47:56 +02:00
Sebastian Dröge
085108f4a2 Update versions to 0.19.6 2023-01-18 16:47:43 +02:00
Sebastian Dröge
f50ddc134b Update CHANGELOG.md for 0.19.6 release 2023-01-18 16:47:23 +02:00
Sebastian Dröge
47a8d27a04 gstreamer: Fix memory leak in buffer pool subclassing test
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1193>
2023-01-18 16:34:46 +02:00
Sebastian Dröge
a78177aacb gstreamer: Add missing doc alias
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1193>
2023-01-18 16:34:46 +02:00
Sebastian Dröge
b7a52b0da0 gstreamer-app: Assert that GStreamer is initialized before creating instances
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1193>
2023-01-18 16:34:46 +02:00
Sebastian Dröge
80fba8f1e0 Update Cargo.lock 2022-12-27 12:52:56 +02:00
Sebastian Dröge
8ff2416988 Update CHANGELOG.md for 0.19.5 2022-12-27 12:49:55 +02:00
Sebastian Dröge
aadbeac8c1 Update versions to 0.19.5 2022-12-27 12:47:10 +02:00
Sebastian Dröge
74f4948db5 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:34:50 +02:00
Sebastian Dröge
251dc5c576 Regenerate with latest GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:31:03 +02:00
Jordan Petridis
096f39d7b3 ci/windows: Update base image
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:29:39 +02:00
Jordan Petridis
095b174ded ci: Avoid building examples with --all-features
--all-features ends up enabling the windows and trying to compile
the d3d example, which can't be built on linux.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:29:08 +02:00
Jordan Petridis
01ab46a483 ci: move tests scripts to individual files
Instead of inling bash scripts in yaml

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:29:02 +02:00
Sebastian Dröge
58ea85c52c gstreamer: Allow returning Handled from BufferList pad probes
This is handled exactly the same way as buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:28:09 +02:00
Sebastian Dröge
709c01ed65 gl: Reset video frame size/stride/offset to 0 for GL mapped frames
The memory pointers are actually the GL texture IDs, and accessing them
like raw video memory will read random memory areas.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:28:01 +02:00
Sebastian Dröge
c5672f12e1 ci: Rebuild CI images another time to get latest GStreamer version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:27:48 +02:00
Jordan Petridis
40315be230 ci/install-{gst,gtk}.sh: run ldconfig after meson install
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:27:43 +02:00
Jordan Petridis
3fb604e653 ci/install-{gst, gtk}: update meson command usage
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:27:36 +02:00
Jordan Petridis
2bcc1884cb ci/install-{gst, rust}.sh: add shebangs to the scripts
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:27:31 +02:00
Jordan Petridis
29fb694f10 ci/install-{gst, gtk}.sh: reformat to make it more readable
Split commands and strings to multiple lines

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:27:23 +02:00
Jordan Petridis
fd82f163d2 ci: Include x264 in the gst build
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:27:16 +02:00
Jordan Petridis
56007b3a4b ci: Include gpl plugins when building gst
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:27:11 +02:00
Jordan Petridis
6f55e5e8b5 ci: use a multiline string for FDO_DISTRIBUTION_PACKAGES
Makes it easier to read and change

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:27:05 +02:00
Sebastian Dröge
06bc1d7bc1 video: Update for NavigationModifierType flags value rename
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:26:43 +02:00
Sebastian Dröge
e8914592c0 ci: Rebuild the image for getting newer GStreamer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:26:29 +02:00
Sebastian Dröge
8fe05e7865 Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
2022-12-27 12:26:22 +02:00
Sebastian Dröge
913dfdcdfc Update CHANGELOG.md for 0.19.4 2022-12-16 11:43:16 +02:00
Sebastian Dröge
9520f2da0e Update versions to 0.19.4 2022-12-16 11:40:57 +02:00
Sebastian Dröge
a422ea69d7 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1168>
2022-12-16 09:57:02 +02:00
Sebastian Dröge
d6cc1e0aa1 Fix some more new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1168>
2022-12-16 09:23:34 +02:00
Sebastian Dröge
212d09aee3 ci: Update to Rust 1.66 and meson 0.64.1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1168>
2022-12-16 09:23:29 +02:00
Jordan Petridis
fe8e00f72b ci: Only check default and latest feature version build
Testing all the version makes the job slower for not that much
gain. Disable some of them for now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1168>
2022-12-16 09:23:21 +02:00
Jordan Petridis
49eadcea5e ci: Combine windows features builds
Part of gstreamer/gstreamer-rs#417

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1168>
2022-12-16 09:23:15 +02:00
Arun Raghavan
bd46e74386 audio: Add bindings for GstAudioFilter
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1168>
2022-12-16 09:23:07 +02:00
Sebastian Dröge
bb90b58547 Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1168>
2022-12-16 09:22:59 +02:00
Sebastian Dröge
c1459c1de8 Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:25:36 +02:00
Sebastian Dröge
dbd9447a26 Regenerate with latest gir / gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:25:01 +02:00
Sebastian Dröge
d68abaeef8 Update gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:24:00 +02:00
Piotr Brzeziński
eec3f18936 examples/tutorials: Use NSApp terminate() instead of sending an event
Has the same effect while being much more concise.
Unfortunately the cocoa crate doesn't (yet?) have bindings for this
function, so objc::msg_send! had to be used directly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:23:46 +02:00
Sebastian Dröge
a8dd4aa165 gstreamer: Add DebugCategory::above_threshold() to check if the category's threshold is above the given level
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:22:45 +02:00
Sebastian Dröge
2cf5347d1b gstreamer: Reduce some code duplication in the logging code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:17:35 +02:00
Jordan Petridis
846bd77ef7 ci: Fix DAG deps for contianer build jobs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:17:27 +02:00
Sebastian Dröge
8c6758f4a4 gstreamer: Add bindings for new 1.22 debug log ID API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:17:21 +02:00
Sebastian Dröge
7fcd2f0cf6 gstreamer: Directly use fields for DebugCategory getters
This allows for better optimizations as it doesn't go through an opaque
FFI function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:17:15 +02:00
Sebastian Dröge
d5e58d2dd4 gstreamer: Ignore EventType::to_sticky_ordering
This is handled manually via the `PartialOrd` impl.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:16:51 +02:00
Sebastian Dröge
2c06dce3c8 ci: Update Windows docker base image
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:16:43 +02:00
Sebastian Dröge
864ff31795 ci: Update image version to get newer GStreamer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:16:35 +02:00
Sebastian Dröge
a941148deb Update gst-gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:16:28 +02:00
Sebastian Dröge
f66d536569 Update gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1163>
2022-12-12 13:16:23 +02:00
Sebastian Dröge
da84e723ab Update Cargo.lock 2022-11-28 10:36:42 +02:00
Sebastian Dröge
2fe30fb166 Update versions to 0.19.3 2022-11-28 10:14:29 +02:00
Sebastian Dröge
7f1f7f4d67 Update CHANGELOG.md for 0.19.3 2022-11-28 10:14:29 +02:00
Sebastian Dröge
51c8a12f35 gstreamer: Add PartialEq impls between owned/borrowed miniobjects/structures
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
2022-11-27 19:54:18 +02:00
Jordan Petridis
ae5f5b7b02 ci: avoid always running build/test jobs
Introduce a trigger job with rules that will allow it to always
run when the MR is assigned to Marge and the final tests will be
run before being merge.

This means that Post-merge pipelines and MR pipelines that are
not assigned to Marge, will require a manual run of the trigger
job before the build/test will execute.

This should help easy the load on the gitlab runners.

Related to gstreamer/gstreamer-rs#417

Close gstreamer/gstreamer-rs#401

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
2022-11-27 19:53:45 +02:00
Sebastian Dröge
40143109da gstreamer: Fix sticky event ordering for instant-rate-change
The event type for instant-rate-change events was poorly chosen, leading
to them being re-sent too late and even after EOS.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3387

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
2022-11-27 19:53:39 +02:00
Sebastian Dröge
1087b63ac4 Regenerate with latest GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
2022-11-27 19:53:25 +02:00
Sebastian Dröge
be71147904 video: Remove gst_video_format_info_get_tile_sizes() bindings and bind new VideoTileInfo API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
2022-11-27 19:52:29 +02:00
Sebastian Dröge
698a67b0f8 base: Add manual bindings for new 1.22 typefind helper API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
2022-11-27 19:52:22 +02:00
Sebastian Dröge
31c13899a8 audio/video: Hide force-live property of Audio/VideoAggregator
The base class already provides a getter/setter for this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
2022-11-27 19:52:14 +02:00
Sebastian Dröge
49ba205ff7 ci: Rebuild for new GStreamer version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
2022-11-27 19:52:08 +02:00
Sebastian Dröge
fa993659db Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
2022-11-27 19:52:03 +02:00
Sebastian Dröge
048693202c gstreamer: Implement FromIterator<Caps> and Extend<Caps> for Caps
This allows easily generating new/extending existing caps from an
iterator.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1158>
2022-11-27 19:50:57 +02:00
Sebastian Dröge
056b0df294 Update CHANGELOG.md for 0.19.2 2022-11-13 19:50:21 +02:00
Sebastian Dröge
fef5611eb1 Update Cargo.lock 2022-11-13 19:46:06 +02:00
Sebastian Dröge
bfa468e87f Update versions to 0.19.2 2022-11-13 19:45:33 +02:00
Sebastian Dröge
4aa53ebaeb Update Cargo.lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 18:13:54 +02:00
Sebastian Dröge
38dfe1596d Regenerate with latest gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:38:39 +02:00
Sebastian Dröge
61cc4d704c Update gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:38:39 +02:00
Sebastian Dröge
328d0930f8 ges: Don't generate version constants in the -sys crate
They will change with every new version and make the tests fail if
running against a different version.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:35:15 +02:00
Elie Génard
250a65f02d gstreamer: Add gst::Allocator subclassing support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:34:25 +02:00
Sebastian Dröge
57d7a44137 ci: Rebuild image to get updated GStreamer version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:34:19 +02:00
Sebastian Dröge
784c44b947 gstreamer: Manually implement Allocator::register()
Due to a bug it causes use-after-free in versions < 1.20.5, so work
around that here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:34:11 +02:00
Sebastian Dröge
dc11c7312a Update GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:33:46 +02:00
Sebastian Dröge
979a15993b ci: Update to gtk 4.8.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:33:34 +02:00
Sebastian Dröge
891a768e1b ci: Update to meson 0.63.3
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:33:22 +02:00
Sebastian Dröge
0aac683ec9 ci: Update to Rust 1.65
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:33:18 +02:00
Sebastian Dröge
41c2a2d4af Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1147>
2022-11-12 17:33:04 +02:00
Sebastian Dröge
5dd56d8c43 Update Cargo.lock 2022-10-27 15:37:29 +03:00
Sebastian Dröge
59c081c230 examples: glupload: Set sync point on the GL buffer as soon as possible
And also add API for getting the GL context from a `GLBaseMemory`.
2022-10-25 10:05:04 +03:00
Sebastian Dröge
b67887c8dd examples: glupload: Fix iterating over elements inside glsinkbin
Some elements might not have a factory so handle this gracefully instead
of erroring out.
2022-10-25 10:05:03 +03:00
Sebastian Dröge
f440534c6d Fix 0.19.1 release date in the changelog 2022-10-24 12:34:05 +03:00
Sebastian Dröge
a6a168d200 Update CHANGELOG.md for 0.19.1 2022-10-24 12:32:29 +03:00
Sebastian Dröge
0db0fa7270 Update Cargo.lock 2022-10-24 11:23:10 +03:00
Sebastian Dröge
20120fda3d Update versions to 0.19.1 2022-10-24 11:23:00 +03:00
Sebastian Dröge
af58f2d913 Update Cargo.lock 2022-10-24 10:55:34 +03:00
Sebastian Dröge
f60dfebe07 Update GLib dependency to 0.16.2 2022-10-24 10:55:34 +03:00
Sebastian Dröge
d1029e374a Move from imp.instance() to imp.obj()
It's doing the same thing and is shorter.
2022-10-24 10:47:25 +03:00
François Laignel
2bec28e920 gst/log: accept non-ref obj in macros 2022-10-24 10:46:54 +03:00
Sebastian Dröge
83d5efbeb4 Add version requirement to the sys dependency of each crate too 2022-10-22 21:11:51 +03:00
Sebastian Dröge
82c60a0a93 Add missing README.md to new crates 2022-10-22 21:11:38 +03:00
Sebastian Dröge
72f7444805 Add Cargo.lock 2022-10-22 20:32:53 +03:00
Sebastian Dröge
dba98bd7c7 Add 0.19 version requirement to all dependencies from this repository 2022-10-22 20:24:47 +03:00
Sebastian Dröge
09c89aec91 Switch to 0.16 version of gtk-rs and provide a version/branch 2022-10-22 20:24:47 +03:00
Sebastian Dröge
ccd53dc17f ci: Don't run cargo update 2022-10-22 20:24:47 +03:00
398 changed files with 8866 additions and 3923 deletions

View file

@ -61,6 +61,7 @@ variables:
0.16=0.16
stages:
- "trigger"
- "container-base"
- "container-final"
- "lint"
@ -68,20 +69,34 @@ stages:
- "extras"
- "deploy"
# This is an empty job that is used to trigger the pipeline.
trigger:
image: alpine:latest
stage: 'trigger'
variables:
GIT_STRATEGY: none
script:
- echo "Trigger job done, now running the pipeline."
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
# If the MR is assigned to the Merge bot, trigger the pipeline automatically
- if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"'
# Require explicit action to trigger tests post merge
- if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == "main"'
when: 'manual'
# When the assignee isn't the merge bot, require an explicit action to trigger the pipeline
# to avoid wasting CI resources
- if: '$CI_MERGE_REQUEST_ASSIGNEES != "gstreamer-merge-bot"'
when: 'manual'
allow_failure: false
.debian:11:
needs: []
variables:
FDO_DISTRIBUTION_VERSION: 'bullseye-slim'
before_script:
- source ./ci/env.sh
- mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config
# If cargo exists assume we probably will want to update
# the lockfile
- |
if command -v cargo; then
cargo generate-lockfile --color=always
cargo update --color=always
fi
.debian:11-base:
extends: .debian:11
@ -112,7 +127,15 @@ stages:
- .fdo.container-build@debian
stage: container-base
variables:
FDO_DISTRIBUTION_PACKAGES: "build-essential curl python3-setuptools liborc-0.4-dev libglib2.0-dev libxml2-dev libgtk-3-dev libegl1-mesa libgles2-mesa libgl1-mesa-dri libgl1-mesa-glx libwayland-egl1-mesa xz-utils libssl-dev git wget ca-certificates ninja-build python3-pip flex bison libglib2.0-dev libx11-dev libx11-xcb-dev libsoup2.4-dev libvorbis-dev libogg-dev libtheora-dev libmatroska-dev libvpx-dev libopus-dev libgraphene-1.0-dev libjpeg-dev libwayland-dev python3-gi"
FDO_DISTRIBUTION_PACKAGES: >-
build-essential curl python3-setuptools liborc-0.4-dev libglib2.0-dev
libxml2-dev libgtk-3-dev libegl1-mesa libgles2-mesa libgl1-mesa-dri
libgl1-mesa-glx libwayland-egl1-mesa xz-utils libssl-dev git wget
ca-certificates ninja-build python3-pip flex bison libglib2.0-dev
libx11-dev libx11-xcb-dev libsoup2.4-dev libvorbis-dev libogg-dev
libtheora-dev libmatroska-dev libvpx-dev libopus-dev libgraphene-1.0-dev
libjpeg-dev libwayland-dev python3-gi libavcodec-dev libavformat-dev
libavutil-dev libavfilter-dev libswscale-dev yasm libx264-dev
FDO_DISTRIBUTION_EXEC: >-
bash ci/install-gst.sh &&
bash ci/install-gtk4.sh &&
@ -131,16 +154,19 @@ build-base:
- .debian:11-base
build-stable:
needs: ["build-base"]
extends:
- .build-final-image
- .debian:11-stable
build-msrv:
needs: ["build-base"]
extends:
- .build-final-image
- .debian:11-msrv
build-nightly:
needs: ["build-base"]
extends:
- .build-final-image
- .debian:11-nightly
@ -225,44 +251,7 @@ plugins-update-nightly:
UPDATE_IMG: "nightly"
.cargo_test_var: &cargo_test
- rustc --version
# First build and test all the crates with their relevant features
# Keep features in sync with below
- |
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_22"
;;
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
if [ -e $crate/Cargo.toml ]; then
if [ -n "$ALL_FEATURES" ]; then
FEATURES="$(get_features $crate)"
else
FEATURES=""
fi
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
fi
done
- |
if [ -n "$EXAMPLES_TUTORIALS" ]; then
cargo build --locked --color=always --manifest-path examples/Cargo.toml --bins --examples --all-features
cargo build --locked --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features
fi
- ./ci/run-cargo-test.sh
.cargo test:
stage: "test"
@ -274,6 +263,8 @@ test msrv:
- '.cargo test'
- .img-msrv
needs:
- job: 'trigger'
artifacts: false
- job: 'build-msrv'
artifacts: false
@ -282,6 +273,8 @@ test stable:
- '.cargo test'
- .img-stable
needs:
- job: 'trigger'
artifacts: false
- job: 'build-stable'
artifacts: false
@ -293,6 +286,8 @@ test stable all-features:
- '.cargo test'
- .img-stable
needs:
- job: 'trigger'
artifacts: false
- job: 'build-stable'
artifacts: false
@ -303,6 +298,8 @@ test nightly:
- '.cargo test'
- .img-nightly
needs:
- job: 'trigger'
artifacts: false
- job: 'build-nightly'
artifacts: false
@ -316,65 +313,23 @@ test nightly all-features:
- '.cargo test'
- .img-nightly
needs:
- job: 'trigger'
artifacts: false
- job: 'build-nightly'
artifacts: false
.cargo test sys:
stage: "test"
script:
- rustc --version
- |
get_features() {
module=${1%%/sys}
case "$module" in
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
# First build and test all the crates with their relevant features
# Keep features in sync with below
for crate in gstreamer*/sys gstreamer-gl/*/sys; do
if [ -e $crate/Cargo.toml ]; then
echo "Building $crate with $(get_features $crate)"
cargo build --locked --color=always --manifest-path $crate/Cargo.toml $(get_features $crate)
fi
done
# Run tests for crates we can currently run.
# Other tests are broken currently.
for crate in gstreamer/sys \
gstreamer-app/sys \
gstreamer-audio/sys \
gstreamer-base/sys \
gstreamer-check/sys \
gstreamer-controller/sys \
gstreamer-gl/sys \
gstreamer-gl/egl/sys \
gstreamer-gl/wayland/sys \
gstreamer-gl/x11/sys \
gstreamer-mpegts/sys \
gstreamer-net/sys \
gstreamer-pbutils/sys \
gstreamer-player/sys \
gstreamer-rtsp-server/sys \
gstreamer-rtsp/sys \
gstreamer-sdp/sys \
gstreamer-tag/sys \
gstreamer-video/sys \
gstreamer-webrtc/sys; do
echo "Testing $crate with $(get_features $crate)"
cargo test --locked --color=always --manifest-path $crate/Cargo.toml $(get_features $crate)
done
- ./ci/run-sys-cargo-test.sh
test stable sys:
extends:
- '.cargo test sys'
- .img-stable
needs:
- job: 'trigger'
artifacts: false
- job: 'build-stable'
artifacts: false
@ -383,6 +338,8 @@ test msrv sys:
- '.cargo test sys'
- .img-msrv
needs:
- job: 'trigger'
artifacts: false
- job: 'build-msrv'
artifacts: false
@ -391,6 +348,8 @@ test nightly sys:
- '.cargo test sys'
- .img-nightly
needs:
- job: 'trigger'
artifacts: false
- job: 'build-nightly'
artifacts: false
@ -419,39 +378,12 @@ clippy:
variables:
CLIPPY_LINTS: -D warnings
needs:
- job: 'trigger'
artifacts: false
- job: 'build-stable'
artifacts: false
script:
- cargo clippy --version
# Keep features in sync with above
- |
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_22"
;;
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
if [ -e $crate/Cargo.toml ]; then
FEATURES=$(get_features $crate)
echo "Running clippy on $crate with $FEATURES"
cargo clippy --locked --color=always --manifest-path $crate/Cargo.toml $FEATURES --all-targets -- $CLIPPY_LINTS
fi
done
# And also run over all the examples/tutorials
- |
cargo clippy --locked --color=always --manifest-path examples/Cargo.toml --all-targets --all-features -- $CLIPPY_LINTS
cargo clippy --locked --color=always --manifest-path tutorials/Cargo.toml --all-targets --all-features -- $CLIPPY_LINTS
- ./ci/run-clippy.sh
deny:
extends: .img-stable
@ -494,6 +426,8 @@ coverage:
- .img-stable
stage: 'extras'
needs:
- job: 'trigger'
artifacts: false
- job: 'build-stable'
artifacts: false
variables:
@ -597,6 +531,7 @@ pages:
.windows rust docker build:
stage: 'container-final'
needs: []
variables:
# Unlike the buildah/linux jobs, this file
# needs to be relative to windows-docker/ subdir
@ -642,17 +577,7 @@ windows rust docker msrv:
- 'docker'
- 'windows'
- '2022'
parallel:
matrix:
- FEATURES:
- "--features=v1_18,"
- "--features=v1_20,"
- "--features=v1_22,"
- "--no-default-features"
- ""
script:
- echo $env:FEATURES
# Skip -sys tests as they don't work
# https://github.com/gtk-rs/gtk3-rs/issues/54
#
@ -669,12 +594,16 @@ windows rust docker msrv:
test windows msrv:
image: $WINDOWS_RUST_MINIMUM_IMAGE
needs:
- job: 'trigger'
artifacts: false
- job: 'windows rust docker msrv'
artifacts: false
extends: '.msvc2019 build'
test windows stable:
needs:
- job: 'trigger'
artifacts: false
- job: 'windows rust docker stable'
artifacts: false
image: "$WINDOWS_RUST_STABLE_IMAGE"

3021
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
variables:
GST_RS_IMG_TAG: '2022-10-12.0'
GST_RS_STABLE: '1.64.0'
GST_RS_IMG_TAG: '2023-01-24.0'
GST_RS_STABLE: '1.66.0'
GST_RS_MSRV: '1.63.0'

View file

@ -1,21 +1,46 @@
#! /bin/bash
set -e
pip3 install meson==0.63.2
pip3 install meson==1.0.0
# gstreamer-rs already has a 'gstreamer' directory so don't clone there
pushd .
cd ..
git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gstreamer.git --branch main
git clone https://gitlab.freedesktop.org/gstreamer/gstreamer.git \
--depth 1 \
--branch 1.22
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"
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"
meson build -D prefix=/usr/local -D examples=disabled -D gtk_doc=disabled -D introspection=disabled -D libav=disabled -D python=disabled -D ugly=disabled -D vaapi=disabled $PLUGINS
ninja -C build
ninja -C build install
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
meson compile -C build
meson install -C build
ldconfig
cd ..
rm -rf gstreamer/
# Check what plugins we installed
gst-inspect-1.0
popd

View file

@ -2,13 +2,17 @@
set -eux
BRANCH=4.8.1
BRANCH=4.8.3
git clone https://gitlab.gnome.org/GNOME/gtk.git --branch $BRANCH --depth=1
cd gtk
meson build -D prefix=/usr/local -Dbuild-tests=false -Dwayland-protocols:tests=false
ninja -C build
ninja -C build install
meson setup build \
-D prefix=/usr/local \
-Dbuild-tests=false \
-Dwayland-protocols:tests=false
meson compile -C build
meson install -C build
ldconfig
cd ..
rm -rf gtk/

View file

@ -1,3 +1,5 @@
#! /bin/bash
source ./ci/env.sh
set -e

47
ci/run-cargo-test.sh Executable file
View file

@ -0,0 +1,47 @@
#! /bin/bash
set -ex
rustc --version
cargo --version
# First build and test all the crates with their relevant features
# Keep features in sync with the list below below
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_22"
;;
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
if [ -e "$crate/Cargo.toml" ]; then
if [ -n "$ALL_FEATURES" ]; then
FEATURES=$(get_features "$crate")
else
FEATURES=""
fi
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
fi
done
if [ -n "$EXAMPLES_TUTORIALS" ]; then
# Keep in sync with examples/Cargo.toml
# List all features except windows/win32
EXAMPLES_FEATURES="--features=gtksink,gtkvideooverlay,gtkvideooverlay-x11,gtkvideooverlay-quartz,rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gl,gst-gl-x11,gst-gl-wayland,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
fi

41
ci/run-clippy.sh Executable file
View file

@ -0,0 +1,41 @@
#! /bin/bash
set -ex
rustc --version
cargo --version
cargo clippy --version
# Keep features in sync with run-cargo-test.sh
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_22"
;;
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
if [ -e "$crate/Cargo.toml" ]; then
FEATURES=$(get_features "$crate")
echo "Running clippy on $crate with $FEATURES"
cargo clippy --locked --color=always --manifest-path "$crate/Cargo.toml" $FEATURES --all-targets -- $CLIPPY_LINTS
fi
done
# Keep in sync with examples/Cargo.toml
# List all features except windows/win32
EXAMPLES_FEATURES="--features=gtksink,gtkvideooverlay,gtkvideooverlay-x11,gtkvideooverlay-quartz,rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gl,gst-gl-x11,gst-gl-wayland,gst-gl-egl,allocators,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18"
# And also run over all the examples/tutorials
cargo clippy --locked --color=always --manifest-path examples/Cargo.toml --all-targets "$EXAMPLES_FEATURES" -- $CLIPPY_LINTS
cargo clippy --locked --color=always --manifest-path tutorials/Cargo.toml --all-targets --all-features -- $CLIPPY_LINTS

53
ci/run-sys-cargo-test.sh Executable file
View file

@ -0,0 +1,53 @@
#! /bin/bash
set -ex
rustc --version
cargo --version
get_features() {
module=${1%%/sys}
case "$module" in
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
# First build and test all the crates with their relevant features
# Keep features in sync with below
for crate in gstreamer*/sys gstreamer-gl/*/sys; do
if [ -e "$crate/Cargo.toml" ]; then
echo "Building $crate with $(get_features "$crate")"
cargo build --locked --color=always --manifest-path "$crate/Cargo.toml" $(get_features "$crate")
fi
done
# Run tests for crates we can currently run.
# Other tests are broken currently.
for crate in gstreamer/sys \
gstreamer-app/sys \
gstreamer-audio/sys \
gstreamer-base/sys \
gstreamer-check/sys \
gstreamer-controller/sys \
gstreamer-gl/sys \
gstreamer-gl/egl/sys \
gstreamer-gl/wayland/sys \
gstreamer-gl/x11/sys \
gstreamer-mpegts/sys \
gstreamer-net/sys \
gstreamer-pbutils/sys \
gstreamer-player/sys \
gstreamer-rtsp-server/sys \
gstreamer-rtsp/sys \
gstreamer-sdp/sys \
gstreamer-tag/sys \
gstreamer-video/sys \
gstreamer-webrtc/sys; do
echo "Testing $crate with $(get_features $crate)"
cargo test --locked --color=always --manifest-path $crate/Cargo.toml "$(get_features $crate)"
done

View file

@ -35,47 +35,58 @@
'examples'
)
foreach($crate in $crates)
{
Write-Host "Building crate: $crate"
Write-Host "Features: $env:FEATURES"
$env:LocalFeatures = $env:FEATURES
# "" is the default build, no flags appended
[string[]] $features_matrix = @(
# "--no-default-features",
# "--features=v1_18,",
# "--features=v1_20,",
"",
"--features=v1_22,"
)
# Don't append feature flags if the string is null/empty
# Or when we want to build without default features
if ($env:LocalFeatures -and ($env:LocalFeatures -ne '--no-default-features')) {
if ($crate -eq 'gstreamer') {
$env:LocalFeatures += "serde,"
foreach($features in $features_matrix) {
foreach($crate in $crates)
{
Write-Host "Building crate: $crate"
Write-Host "Features: $features"
$env:LocalFeatures = $features
# Don't append feature flags if the string is null/empty
# Or when we want to build without default features
if ($env:LocalFeatures -and ($env:LocalFeatures -ne '--no-default-features')) {
if ($crate -eq 'gstreamer') {
$env:LocalFeatures += "serde,"
}
if ($crate -eq 'examples') {
# FIXME: We can do --all-features for examples once we have gtk installed in the image
$env:LocalFeatures = "--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition"
}
if ($crate -eq 'tutorials') {
$env:LocalFeatures = ''
}
}
if ($crate -eq 'examples') {
# FIXME: We can do --all-features for examples once we have gtk installed in the image
$env:LocalFeatures = "--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition"
Write-Host "with features: $env:LocalFeatures"
cargo build --color=always --manifest-path $crate/Cargo.toml --all-targets $env:LocalFeatures
if (!$?) {
Write-Host "Failed to build crate: $crate"
Exit 1
}
if ($crate -eq 'tutorials') {
$env:LocalFeatures = ''
if (($crate -eq "gstreamer-tag/sys") -or ($crate -eq "gstreamer-mpegts/sys")) {
Write-Host "Skipping tests for $crate"
continue
}
}
Write-Host "with features: $env:LocalFeatures"
cargo build --color=always --manifest-path $crate/Cargo.toml --all-targets $env:LocalFeatures
$env:G_DEBUG="fatal_warnings"
cargo test --no-fail-fast --color=always --manifest-path $crate/Cargo.toml $env:LocalFeatures
if (!$?) {
Write-Host "Failed to build crate: $crate"
Exit 1
}
if (($crate -eq "gstreamer-tag/sys") -or ($crate -eq "gstreamer-mpegts/sys")) {
Write-Host "Skipping tests for $crate"
continue
}
$env:G_DEBUG="fatal_warnings"
cargo test --no-fail-fast --color=always --manifest-path $crate/Cargo.toml $env:LocalFeatures
if (!$?) {
Write-Host "Tests failed to for crate: $crate"
Exit 1
if (!$?) {
Write-Host "Tests failed to for crate: $crate"
Exit 1
}
}
}

View file

@ -1,12 +1,12 @@
# escape=`
FROM "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2022-09-23.0-main"
FROM "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2022-12-10.0-main"
# Make sure any failure in PowerShell is fatal
ENV ErrorActionPreference='Stop'
SHELL ["powershell","-NoLogo", "-NonInteractive", "-Command"]
ARG DEFAULT_BRANCH="main"
ARG DEFAULT_BRANCH="1.22"
ARG RUST_VERSION="invalid"
RUN choco install -y pkgconfiglite nasm llvm

View file

@ -33,6 +33,7 @@ $env:MESON_ARGS = "--prefix=C:\gst-install\ " +
"-Dffmpeg:tests=disabled " +
"-Dopenh264:tests=disabled " +
"-Dpygobject:tests=false " +
"-Dgpl=enabled " +
"-Dugly=enabled " +
"-Dbad=enabled " +
"-Dges=enabled " +
@ -44,10 +45,10 @@ $env:MESON_ARGS = "--prefix=C:\gst-install\ " +
"-Dvaapi=disabled " +
"-Dgst-plugins-base:pango=enabled " +
"-Dgst-plugins-good:cairo=enabled " +
"-Dgpl=enabled "
"-Dgst-plugins-good:lame=disabled "
Write-Output "Building gst"
cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && meson _build $env:MESON_ARGS && meson compile -C _build && ninja -C _build install"
cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && meson setup _build $env:MESON_ARGS && meson compile -C _build && meson install -C _build"
if (!$?) {
Write-Host "Failed to build and install gst"

View file

@ -3,7 +3,7 @@
$env:MESON_ARGS = "--prefix=C:\gst-install\"
# Download gtk and all its subprojects
git clone -b 4.8.1 --depth 1 https://gitlab.gnome.org/gnome/gtk.git C:\gtk
git clone -b 4.8.3 --depth 1 https://gitlab.gnome.org/gnome/gtk.git C:\gtk
if (!$?) {
Write-Host "Failed to clone gtk"
Exit 1

View file

@ -1,6 +1,6 @@
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
$env:MESON_ARGS = "--prefix=C:\gst-install\"
$env:MESON_ARGS = "--prefix=C:\gst-install\ -Dharfbuzz:freetype=enabled -Dfreetype:harfbuzz=disabled"
# Download pango all its subprojects
git clone -b main --depth 1 https://gitlab.gnome.org/gnome/pango.git C:\pango

View file

@ -1,43 +1,43 @@
[package]
name = "examples"
version = "0.19.0"
version = "0.19.8"
license = "MIT"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
edition = "2021"
rust-version = "1.63"
[dependencies]
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
gst-gl = { package = "gstreamer-gl", path = "../gstreamer-gl", optional = true }
gst-gl-egl = { package = "gstreamer-gl-egl", path = "../gstreamer-gl/egl", optional = true }
gst-gl-wayland = { package = "gstreamer-gl-wayland", path = "../gstreamer-gl/wayland", optional = true }
gst-gl-x11 = { package = "gstreamer-gl-x11", path = "../gstreamer-gl/x11", optional = true }
gst-app = { package = "gstreamer-app", path = "../gstreamer-app" }
gst-audio = { package = "gstreamer-audio", path = "../gstreamer-audio" }
gst-base = { package = "gstreamer-base", path = "../gstreamer-base" }
gst-video = { package = "gstreamer-video", path = "../gstreamer-video" }
gst-pbutils = { package = "gstreamer-pbutils", path = "../gstreamer-pbutils" }
gst-play = { package = "gstreamer-play", path = "../gstreamer-play", optional = true }
gst-player = { package = "gstreamer-player", path = "../gstreamer-player", optional = true }
ges = { package = "gstreamer-editing-services", path = "../gstreamer-editing-services", optional = true }
gst-sdp = { package = "gstreamer-sdp", path = "../gstreamer-sdp", optional = true }
gst-rtsp = { package = "gstreamer-rtsp", path = "../gstreamer-rtsp", optional = true }
gst-rtsp-server = { package = "gstreamer-rtsp-server", path = "../gstreamer-rtsp-server", optional = true }
gst-allocators = { package = "gstreamer-allocators", path = "../gstreamer-allocators", optional = true }
gtk = { git = "https://github.com/gtk-rs/gtk3-rs", optional = true }
gdk = { git = "https://github.com/gtk-rs/gtk3-rs", optional = true }
gio = { git = "https://github.com/gtk-rs/gtk-rs-core", optional = true }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16.2" }
gst = { package = "gstreamer", version = "0.19", path = "../gstreamer" }
gst-gl = { package = "gstreamer-gl", version = "0.19", path = "../gstreamer-gl", optional = true }
gst-gl-egl = { package = "gstreamer-gl-egl", version = "0.19", path = "../gstreamer-gl/egl", optional = true }
gst-gl-wayland = { package = "gstreamer-gl-wayland", version = "0.19", path = "../gstreamer-gl/wayland", optional = true }
gst-gl-x11 = { package = "gstreamer-gl-x11", version = "0.19", path = "../gstreamer-gl/x11", optional = true }
gst-app = { package = "gstreamer-app", version = "0.19", path = "../gstreamer-app" }
gst-audio = { package = "gstreamer-audio", version = "0.19", path = "../gstreamer-audio" }
gst-base = { package = "gstreamer-base", version = "0.19", path = "../gstreamer-base" }
gst-video = { package = "gstreamer-video", version = "0.19", path = "../gstreamer-video" }
gst-pbutils = { package = "gstreamer-pbutils", version = "0.19", path = "../gstreamer-pbutils" }
gst-play = { package = "gstreamer-play", version = "0.19", path = "../gstreamer-play", optional = true }
gst-player = { package = "gstreamer-player", version = "0.19", path = "../gstreamer-player", optional = true }
ges = { package = "gstreamer-editing-services", version = "0.19", path = "../gstreamer-editing-services", optional = true }
gst-sdp = { package = "gstreamer-sdp", version = "0.19", path = "../gstreamer-sdp", optional = true }
gst-rtsp = { package = "gstreamer-rtsp", version = "0.19", path = "../gstreamer-rtsp", optional = true }
gst-rtsp-server = { package = "gstreamer-rtsp-server", version = "0.19", path = "../gstreamer-rtsp-server", optional = true }
gst-allocators = { package = "gstreamer-allocators", version = "0.19", path = "../gstreamer-allocators", optional = true }
gtk = { git = "https://github.com/gtk-rs/gtk3-rs", branch = "0.16", version = "0.16", optional = true }
gdk = { git = "https://github.com/gtk-rs/gtk3-rs", branch = "0.16", version = "0.16", optional = true }
gio = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16", optional = true }
anyhow = "1.0"
derive_more = "0.99.5"
futures = "0.3"
byte-slice-cast = "1"
cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core", features=["use_glib"], optional = true }
pango = { git = "https://github.com/gtk-rs/gtk-rs-core", optional = true }
pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core", optional = true }
cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16", features=["use_glib"], optional = true }
pango = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16", optional = true }
pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16", optional = true }
glutin = { version = "0.29", optional = true }
once_cell = "1.0"
image = { version = "0.24", optional = true }
image = { version = "0.24", optional = true, default-features = false, features = ["png", "jpeg"] }
memmap2 = { version = "0.5", optional = true }
memfd = { version = "0.6", optional = true }
uds = { version = "0.2", optional = true }
@ -59,6 +59,9 @@ rtsp-server-record = ["gst-rtsp-server", "gst-rtsp", "gio"]
pango-cairo = ["pango", "pangocairo", "cairo-rs"]
overlay-composition = ["pango", "pangocairo", "cairo-rs"]
gl = ["gst-gl", "gl_generator", "glutin"]
gst-gl-x11 = ["dep:gst-gl-x11"]
gst-gl-egl = ["dep:gst-gl-egl"]
gst-gl-wayland = ["dep:gst-gl-wayland"]
allocators = ["gst-allocators", "memmap2", "memfd", "uds"]
[[bin]]

View file

@ -1,7 +1,7 @@
#[cfg(feature = "gl")]
fn generate_gl_bindings() {
let dest = std::path::PathBuf::from(&std::env::var("OUT_DIR").unwrap());
let mut file = std::fs::File::create(&dest.join("test_gl_bindings.rs")).unwrap();
let mut file = std::fs::File::create(dest.join("test_gl_bindings.rs")).unwrap();
gl_generator::Registry::new(
gl_generator::Api::Gles2,
(3, 0),

View file

@ -69,7 +69,7 @@ mod cairo_compositor {
.build()]
});
&*PROPERTIES
&PROPERTIES
}
// Called by the application whenever the value of a property should be changed.
@ -164,14 +164,14 @@ mod cairo_compositor {
name: Option<&str>,
caps: Option<&gst::Caps>,
) -> Option<gst::Pad> {
let element = self.instance();
let element = self.obj();
let pad = self.parent_request_new_pad(templ, name, caps)?;
element.child_added(&pad, &pad.name());
Some(pad)
}
fn release_pad(&self, pad: &gst::Pad) {
let element = self.instance();
let element = self.obj();
element.child_removed(pad, &pad.name());
self.parent_release_pad(pad);
}
@ -239,7 +239,7 @@ mod cairo_compositor {
token: &gst_video::subclass::AggregateFramesToken,
outbuf: &mut gst::BufferRef,
) -> Result<gst::FlowSuccess, gst::FlowError> {
let element = self.instance();
let element = self.obj();
let pads = element.sink_pads();
// Map the output frame writable.
@ -306,12 +306,12 @@ mod cairo_compositor {
// This allows accessing the pads and their properties from e.g. gst-launch.
impl ChildProxyImpl for CairoCompositor {
fn children_count(&self) -> u32 {
let object = self.instance();
let object = self.obj();
object.num_pads() as u32
}
fn child_by_name(&self, name: &str) -> Option<glib::Object> {
let object = self.instance();
let object = self.obj();
object
.pads()
.into_iter()
@ -320,7 +320,7 @@ mod cairo_compositor {
}
fn child_by_index(&self, index: u32) -> Option<glib::Object> {
let object = self.instance();
let object = self.obj();
object
.pads()
.into_iter()

View file

@ -21,7 +21,7 @@ impl ExampleCustomEvent {
#[allow(clippy::new_ret_no_self)]
pub fn new(send_eos: bool) -> gst::Event {
let s = gst::Structure::builder(Self::EVENT_NAME)
.field("send_eos", &send_eos)
.field("send_eos", send_eos)
.build();
gst::event::CustomDownstream::new(s)
}

View file

@ -370,7 +370,7 @@ mod video_filter {
}
}
mod imp {
use std::{cmp, mem::ManuallyDrop, os::unix::prelude::FromRawFd};
use std::{mem::ManuallyDrop, os::unix::prelude::FromRawFd};
use anyhow::Error;
use gst::{subclass::prelude::*, PadDirection, PadPresence, PadTemplate};
@ -430,9 +430,9 @@ mod video_filter {
let mut mmap = MmapMut::map_mut(mfd.as_file())?;
for pixel in mmap.chunks_exact_mut(4) {
pixel[0] = cmp::max(0, cmp::min(255, (pixel[0] as f64 * factor) as u8));
pixel[1] = cmp::max(0, cmp::min(255, (pixel[1] as f64 * factor) as u8));
pixel[2] = cmp::max(0, cmp::min(255, (pixel[2] as f64 * factor) as u8));
pixel[0] = (pixel[0] as f64 * factor).clamp(0.0, 255.0) as u8;
pixel[1] = (pixel[1] as f64 * factor).clamp(0.0, 255.0) as u8;
pixel[2] = (pixel[2] as f64 * factor).clamp(0.0, 255.0) as u8;
}
}

View file

@ -124,7 +124,7 @@ mod mirror {
}
impl GLBaseFilterImpl for GLMirrorFilter {
fn gl_start(&self) -> Result<(), gst::LoggableError> {
let filter = self.instance();
let filter = self.obj();
// Create a shader when GL is started, knowing that the OpenGL context is
// available.
@ -141,7 +141,7 @@ mod mirror {
input: &gst_gl::GLMemory,
output: &gst_gl::GLMemory,
) -> Result<(), gst::LoggableError> {
let filter = self.instance();
let filter = self.obj();
let shader = self.shader.lock().unwrap();
// Use the underlying filter implementation to transform the input texture into

View file

@ -178,7 +178,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
// Update the text layout. This function is only updating pango's internal state.
// So e.g. that after a 90 degree rotation it knows that what was previously going
// to end up as a 200x100 rectangle would now be 100x200.
pangocairo::functions::update_layout(&cr, &**layout);
pangocairo::functions::update_layout(&cr, layout);
let (width, _height) = layout.size();
// Using width and height of the text, we can properly possition it within
// our canvas.
@ -188,7 +188,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
);
// After telling the layout object where to draw itself, we actually tell
// it to draw itself into our cairo context.
pangocairo::functions::show_layout(&cr, &**layout);
pangocairo::functions::show_layout(&cr, layout);
// Here we go one step up in our stack of transformations, removing any
// changes we did to them since the last call to cr.save();

View file

@ -162,7 +162,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
// Update the text layout. This function is only updating pango's internal state.
// So e.g. that after a 90 degree rotation it knows that what was previously going
// to end up as a 200x100 rectangle would now be 100x200.
pangocairo::functions::update_layout(&cr, &**layout);
pangocairo::functions::update_layout(&cr, layout);
let (width, _height) = layout.size();
// Using width and height of the text, we can properly possition it within
// our canvas.
@ -172,7 +172,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
);
// After telling the layout object where to draw itself, we actually tell
// it to draw itself into our cairo context.
pangocairo::functions::show_layout(&cr, &**layout);
pangocairo::functions::show_layout(&cr, layout);
// Here we go one step up in our stack of transformations, removing any
// changes we did to them since the last call to cr.save();

View file

@ -108,7 +108,7 @@ mod media_factory {
fn constructed(&self) {
self.parent_constructed();
let factory = self.instance();
let factory = self.obj();
// All media created by this factory are our custom media type. This would
// not require a media factory subclass and can also be called on the normal
// RTSPMediaFactory.
@ -239,7 +239,7 @@ mod server {
// Implementation of gst_rtsp_server::RTSPServer virtual methods
impl RTSPServerImpl for Server {
fn create_client(&self) -> Option<gst_rtsp_server::RTSPClient> {
let server = self.instance();
let server = self.obj();
let client = super::client::Client::default();
// Duplicated from the default implementation
@ -300,7 +300,7 @@ mod client {
// Implementation of gst_rtsp_server::RTSPClient virtual methods
impl RTSPClientImpl for Client {
fn closed(&self) {
let client = self.instance();
let client = self.obj();
self.parent_closed();
println!("Client {:?} closed", client);
}

View file

@ -308,14 +308,13 @@ fn load(gl_context: &glutin::WindowedContext<glutin::PossiblyCurrent>) -> Gl {
#[derive(Debug)]
enum Message {
Sample(gst::Sample),
Frame(gst_video::VideoInfo, gst::Buffer),
BusEvent,
}
pub(crate) struct App {
pipeline: gst::Pipeline,
appsink: gst_app::AppSink,
glupload: gst::Element,
bus: gst::Bus,
event_loop: glutin::event_loop::EventLoop<Message>,
windowed_context: glutin::WindowedContext<glutin::PossiblyCurrent>,
@ -326,7 +325,7 @@ impl App {
pub(crate) fn new(gl_element: Option<&gst::Element>) -> Result<App, Error> {
gst::init()?;
let (pipeline, appsink, glupload) = App::create_pipeline(gl_element)?;
let (pipeline, appsink) = App::create_pipeline(gl_element)?;
let bus = pipeline
.bus()
.expect("Pipeline without bus. Shouldn't happen!");
@ -458,7 +457,6 @@ impl App {
Ok(App {
pipeline,
appsink,
glupload,
bus,
event_loop,
windowed_context,
@ -473,33 +471,49 @@ impl App {
.new_sample(move |appsink| {
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
{
let _buffer = sample.buffer().ok_or_else(|| {
let info = sample
.caps()
.and_then(|caps| gst_video::VideoInfo::from_caps(caps).ok())
.ok_or_else(|| {
element_error!(
appsink,
gst::ResourceError::Failed,
("Failed to get buffer from appsink")
("Failed to get video info from sample")
);
gst::FlowError::Error
gst::FlowError::NotNegotiated
})?;
let _info = sample
.caps()
.and_then(|caps| gst_video::VideoInfo::from_caps(caps).ok())
.ok_or_else(|| {
let mut buffer = sample.buffer_owned().unwrap();
{
let context = match (buffer.n_memory() > 0)
.then(|| buffer.peek_memory(0))
.and_then(|m| m.downcast_memory_ref::<gst_gl::GLBaseMemory>())
.map(|m| m.context())
{
Some(context) => context.clone(),
None => {
element_error!(
appsink,
gst::ResourceError::Failed,
("Failed to get video info from sample")
("Failed to get GL context from buffer")
);
gst::FlowError::Error
})?;
return Err(gst::FlowError::Error);
}
};
if let Some(meta) = buffer.meta::<gst_gl::GLSyncMeta>() {
meta.set_sync_point(&context);
} else {
let buffer = buffer.make_mut();
let meta = gst_gl::GLSyncMeta::add(buffer, &context);
meta.set_sync_point(&context);
}
}
event_proxy
.send_event(Message::Sample(sample))
.send_event(Message::Frame(info, buffer))
.map(|()| gst::FlowSuccess::Ok)
.map_err(|e| {
element_error!(
@ -529,7 +543,7 @@ impl App {
fn create_pipeline(
gl_element: Option<&gst::Element>,
) -> Result<(gst::Pipeline, gst_app::AppSink, gst::Element), Error> {
) -> Result<(gst::Pipeline, gst_app::AppSink), Error> {
let pipeline = gst::Pipeline::default();
let src = gst::ElementFactory::make("videotestsrc").build()?;
@ -556,7 +570,7 @@ impl App {
glupload.link(gl_element)?;
gl_element.link(&appsink)?;
Ok((pipeline, appsink, glupload))
Ok((pipeline, appsink))
} else {
let sink = gst::ElementFactory::make("glsinkbin")
.property("sink", &appsink)
@ -565,21 +579,7 @@ impl App {
pipeline.add_many(&[&src, &sink])?;
src.link(&sink)?;
// get the glupload element to extract later the used context in it
let mut iter = sink.dynamic_cast::<gst::Bin>().unwrap().iterate_elements();
let glupload = loop {
match iter.next() {
Ok(Some(element)) => {
if "glupload" == element.factory().unwrap().name() {
break Some(element);
}
}
Err(gst::IteratorError::Resync) => iter.resync(),
_ => break None,
}
};
Ok((pipeline, appsink, glupload.unwrap()))
Ok((pipeline, appsink))
}
}
@ -620,12 +620,10 @@ pub(crate) fn main_loop(app: App) -> Result<(), Error> {
let gl = load(&app.windowed_context);
let mut curr_frame: Option<gst_video::VideoFrame<gst_video::video_frame::Readable>> = None;
let mut gst_gl_context: Option<gst_gl::GLContext> = None;
let App {
bus,
event_loop,
glupload,
pipeline,
shared_context,
windowed_context,
@ -660,22 +658,7 @@ pub(crate) fn main_loop(app: App) -> Result<(), Error> {
},
glutin::event::Event::RedrawRequested(_) => needs_redraw = true,
// Receive a frame
glutin::event::Event::UserEvent(Message::Sample(sample)) => {
let buffer = sample.buffer_owned().unwrap();
let info = sample
.caps()
.and_then(|caps| gst_video::VideoInfo::from_caps(caps).ok())
.unwrap();
{
if gst_gl_context.is_none() {
gst_gl_context = glupload.property::<Option<gst_gl::GLContext>>("context");
}
let sync_meta = buffer.meta::<gst_gl::GLSyncMeta>().unwrap();
sync_meta.set_sync_point(gst_gl_context.as_ref().unwrap());
}
glutin::event::Event::UserEvent(Message::Frame(info, buffer)) => {
if let Ok(frame) = gst_video::VideoFrame::from_buffer_readable_gl(buffer, &info) {
curr_frame = Some(frame);
needs_redraw = true;

2
gir

@ -1 +1 @@
Subproject commit 952ff416b5997f50b9261c62c7589100e35a1459
Subproject commit 92965146f2fbeacbcb0a6dc414769b48a1897b59

@ -1 +1 @@
Subproject commit 15396abcca88607bc1c5e14b97a9cf925d23492c
Subproject commit ae0d1447f5204ddf882ff08d2163b299db5da228

View file

@ -1,6 +1,6 @@
[package]
name = "gstreamer-allocators"
version = "0.19.0"
version = "0.19.8"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Allocators library"
@ -16,9 +16,9 @@ rust-version = "1.63"
[dependencies]
libc = "0.2"
bitflags = "1.0"
ffi = { package = "gstreamer-allocators-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
ffi = { package = "gstreamer-allocators-sys", version = "0.19", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16.2" }
gst = { package = "gstreamer", version = "0.19", path = "../gstreamer" }
once_cell = "1.0"
[dev-dependencies]

View file

@ -66,6 +66,26 @@ You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
We recommend using the official GStreamer binaries over Homebrew, especially
as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964).
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and
`gstreamer-1.0-devel-1.20.4-universal.pkg`.
After installation, you also need to set the `PATH` environment variable as
follows
```console
$ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
```
Also note that the `pkg-config` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### Homebrew
Homebrew only installs various plugins if explicitly enabled, so some extra
@ -81,19 +101,6 @@ $ brew install gstreamer gst-plugins-base gst-plugins-good \
Make sure the version of these libraries is >= 1.14.
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.14.0-x86_64.pkg` and
`gstreamer-1.0-devel-1.14.0-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### Windows
@ -103,6 +110,32 @@ with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
We recommend using the official GStreamer binaries over MSYS2.
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and
`gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that
matches your Rust toolchain, i.e. MinGW or MSVC.
After installation set the ``PATH` environment variable as follows:
```console
# For a UNIX-style shell:
$ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}"
# For cmd.exe:
$ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH%
```
Make sure to update the path to where you have actually installed GStreamer
and for the corresponding toolchain.
Also note that the `pkg-config.exe` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### MSYS2 / pacman
```console
@ -120,20 +153,6 @@ Note that the version of `pkg-config` included in `MSYS2` is
compiling GStreamer, so you may need to install another version. One option
would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/).
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.14.0.msi` and
`gstreamer-1.0-devel-x86_64-1.14.0.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started

View file

@ -10,13 +10,13 @@ bitflags! {
#[doc(alias = "GstFdMemoryFlags")]
pub struct FdMemoryFlags: u32 {
#[doc(alias = "GST_FD_MEMORY_FLAG_NONE")]
const NONE = ffi::GST_FD_MEMORY_FLAG_NONE as u32;
const NONE = ffi::GST_FD_MEMORY_FLAG_NONE as _;
#[doc(alias = "GST_FD_MEMORY_FLAG_KEEP_MAPPED")]
const KEEP_MAPPED = ffi::GST_FD_MEMORY_FLAG_KEEP_MAPPED as u32;
const KEEP_MAPPED = ffi::GST_FD_MEMORY_FLAG_KEEP_MAPPED as _;
#[doc(alias = "GST_FD_MEMORY_FLAG_MAP_PRIVATE")]
const MAP_PRIVATE = ffi::GST_FD_MEMORY_FLAG_MAP_PRIVATE as u32;
const MAP_PRIVATE = ffi::GST_FD_MEMORY_FLAG_MAP_PRIVATE as _;
#[doc(alias = "GST_FD_MEMORY_FLAG_DONT_CLOSE")]
const DONT_CLOSE = ffi::GST_FD_MEMORY_FLAG_DONT_CLOSE as u32;
const DONT_CLOSE = ffi::GST_FD_MEMORY_FLAG_DONT_CLOSE as _;
}
}

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 952ff416b599)
Generated by gir (https://github.com/gtk-rs/gir @ 92965146f2fb)
from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 15396abcca88)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ ae0d1447f520)

View file

@ -57,3 +57,5 @@ pub mod prelude {
#[doc(hidden)]
pub use gst::prelude::*;
}
pub mod subclass;

View file

@ -0,0 +1,6 @@
use glib::subclass::prelude::*;
use crate::{subclass::fd_allocator::FdAllocatorImpl, DmaBufAllocator};
pub trait DmaBufAllocatorImpl: FdAllocatorImpl {}
unsafe impl<T: DmaBufAllocatorImpl> IsSubclassable<T> for DmaBufAllocator {}

View file

@ -0,0 +1,7 @@
use glib::subclass::prelude::*;
use crate::FdAllocator;
use gst::subclass::prelude::AllocatorImpl;
pub trait FdAllocatorImpl: AllocatorImpl {}
unsafe impl<T: FdAllocatorImpl> IsSubclassable<T> for FdAllocator {}

View file

@ -0,0 +1,14 @@
#[cfg(any(target_os = "linux", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(target_os = "linux")))]
mod dma_buf_allocator;
mod fd_allocator;
pub mod prelude {
#[doc(hidden)]
pub use gst::subclass::prelude::*;
#[cfg(any(target_os = "linux", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(target_os = "linux")))]
pub use super::dma_buf_allocator::DmaBufAllocatorImpl;
pub use super::fd_allocator::FdAllocatorImpl;
}

View file

@ -6,14 +6,19 @@ libc = "0.2"
[dependencies.glib]
git = "https://github.com/gtk-rs/gtk-rs-core"
branch = "0.16"
version = "0.16"
package = "glib-sys"
[dependencies.gobject]
git = "https://github.com/gtk-rs/gtk-rs-core"
branch = "0.16"
version = "0.16"
package = "gobject-sys"
[dependencies.gst]
package = "gstreamer-sys"
version = "0.19"
path = "../../gstreamer/sys"
[dev-dependencies]
@ -43,7 +48,7 @@ name = "gstreamer-allocators-sys"
readme = "README.md"
repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
rust-version = "1.63"
version = "0.19.0"
version = "0.19.8"
[package.metadata.docs.rs]
features = ["dox"]
[package.metadata.system-deps.gstreamer_allocators_1_0]

View file

@ -7,6 +7,7 @@ work_mode = "sys"
single_version_file = true
extra_versions = [
"1.22",
"1.20",
"1.18",
"1.16",

View file

@ -12,7 +12,7 @@ fn main() {} // prevent linking libraries to avoid documentation failure
#[cfg(not(feature = "dox"))]
fn main() {
if let Err(s) = system_deps::Config::new().probe() {
println!("cargo:warning={}", s);
println!("cargo:warning={s}");
process::exit(1);
}
}

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 952ff416b599)
Generated by gir (https://github.com/gtk-rs/gir @ 92965146f2fb)
from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 15396abcca88)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ ae0d1447f520)

View file

@ -44,7 +44,7 @@ pub struct GstDmaBufAllocatorClass {
impl ::std::fmt::Debug for GstDmaBufAllocatorClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDmaBufAllocatorClass @ {:p}", self))
f.debug_struct(&format!("GstDmaBufAllocatorClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -58,7 +58,7 @@ pub struct GstFdAllocatorClass {
impl ::std::fmt::Debug for GstFdAllocatorClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstFdAllocatorClass @ {:p}", self))
f.debug_struct(&format!("GstFdAllocatorClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -74,7 +74,7 @@ pub struct GstPhysMemoryAllocatorInterface {
impl ::std::fmt::Debug for GstPhysMemoryAllocatorInterface {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPhysMemoryAllocatorInterface @ {:p}", self))
f.debug_struct(&format!("GstPhysMemoryAllocatorInterface @ {self:p}"))
.field("get_phys_addr", &self.get_phys_addr)
.finish()
}
@ -90,7 +90,7 @@ pub struct GstDmaBufAllocator {
impl ::std::fmt::Debug for GstDmaBufAllocator {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDmaBufAllocator @ {:p}", self))
f.debug_struct(&format!("GstDmaBufAllocator @ {self:p}"))
.field("parent", &self.parent)
.finish()
}
@ -104,7 +104,7 @@ pub struct GstFdAllocator {
impl ::std::fmt::Debug for GstFdAllocator {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstFdAllocator @ {:p}", self))
f.debug_struct(&format!("GstFdAllocator @ {self:p}"))
.field("parent", &self.parent)
.finish()
}
@ -119,7 +119,7 @@ pub struct GstPhysMemoryAllocator {
impl ::std::fmt::Debug for GstPhysMemoryAllocator {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(f, "GstPhysMemoryAllocator @ {:p}", self)
write!(f, "GstPhysMemoryAllocator @ {self:p}")
}
}

View file

@ -41,7 +41,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
return Err(format!("compilation command {cmd:?} failed, {status}").into());
}
Ok(())
}
@ -57,7 +57,7 @@ fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<dyn Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
Err(err) => Err(format!("{name} {err}").into()),
}
}
@ -71,7 +71,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
return Err(format!("command {cmd:?} returned {}", out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
@ -127,15 +127,14 @@ fn cross_validate_constants_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
"Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}",
);
continue;
}
@ -165,16 +164,13 @@ fn cross_validate_layout_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",);
continue;
}
@ -195,7 +191,7 @@ fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
return Err(format!("command {abi_cmd:?} failed, {output:?}").into());
}
Ok(String::from_utf8(output.stdout)?)

View file

@ -1,6 +1,6 @@
[package]
name = "gstreamer-app"
version = "0.19.0"
version = "0.19.8"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer App library"
@ -18,10 +18,10 @@ futures-core = "0.3"
futures-sink = "0.3"
bitflags = "1.0"
libc = "0.2"
ffi = { package = "gstreamer-app-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
gst-base = { package = "gstreamer-base", path = "../gstreamer-base" }
ffi = { package = "gstreamer-app-sys", version = "0.19", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16.2" }
gst = { package = "gstreamer", version = "0.19", path = "../gstreamer" }
gst-base = { package = "gstreamer-base", version = "0.19", path = "../gstreamer-base" }
once_cell = "1.0"
[dev-dependencies]

View file

@ -66,6 +66,26 @@ You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
We recommend using the official GStreamer binaries over Homebrew, especially
as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964).
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and
`gstreamer-1.0-devel-1.20.4-universal.pkg`.
After installation, you also need to set the `PATH` environment variable as
follows
```console
$ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
```
Also note that the `pkg-config` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### Homebrew
Homebrew only installs various plugins if explicitly enabled, so some extra
@ -81,19 +101,6 @@ $ brew install gstreamer gst-plugins-base gst-plugins-good \
Make sure the version of these libraries is >= 1.14.
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.14.0-x86_64.pkg` and
`gstreamer-1.0-devel-1.14.0-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### Windows
@ -103,6 +110,32 @@ with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
We recommend using the official GStreamer binaries over MSYS2.
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and
`gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that
matches your Rust toolchain, i.e. MinGW or MSVC.
After installation set the ``PATH` environment variable as follows:
```console
# For a UNIX-style shell:
$ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}"
# For cmd.exe:
$ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH%
```
Make sure to update the path to where you have actually installed GStreamer
and for the corresponding toolchain.
Also note that the `pkg-config.exe` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### MSYS2 / pacman
```console
@ -120,20 +153,6 @@ Note that the version of `pkg-config` included in `MSYS2` is
compiling GStreamer, so you may need to install another version. One option
would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/).
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.14.0.msi` and
`gstreamer-1.0-devel-x86_64-1.14.0.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started

View file

@ -273,6 +273,7 @@ impl AppSink {
///
/// This method returns an instance of [`AppSinkBuilder`](crate::builders::AppSinkBuilder) which can be used to create [`AppSink`] objects.
pub fn builder() -> AppSinkBuilder {
assert_initialized_main_thread!();
AppSinkBuilder::default()
}

View file

@ -210,6 +210,7 @@ impl AppSrc {
///
/// This method returns an instance of [`AppSrcBuilder`](crate::builders::AppSrcBuilder) which can be used to create [`AppSrc`] objects.
pub fn builder() -> AppSrcBuilder {
assert_initialized_main_thread!();
AppSrcBuilder::default()
}

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 952ff416b599)
Generated by gir (https://github.com/gtk-rs/gir @ 92965146f2fb)
from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 15396abcca88)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ ae0d1447f520)

View file

@ -10,6 +10,19 @@ pub use glib;
pub use gst;
pub use gst_base;
macro_rules! assert_initialized_main_thread {
() => {
if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) {
#[allow(unused_unsafe)]
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
} else {
gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
}
}
};
}
macro_rules! skip_assert_initialized {
() => {};
}

View file

@ -7,13 +7,17 @@ libc = "0.2"
[dependencies.glib]
package = "glib-sys"
git = "https://github.com/gtk-rs/gtk-rs-core"
branch = "0.16"
version = "0.16"
[dependencies.gst_base]
package = "gstreamer-base-sys"
version = "0.19"
path = "../../gstreamer-base/sys"
[dependencies.gst]
package = "gstreamer-sys"
version = "0.19"
path = "../../gstreamer/sys"
[dev-dependencies]
@ -41,7 +45,7 @@ license = "MIT"
name = "gstreamer-app-sys"
readme = "README.md"
repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
version = "0.19.0"
version = "0.19.8"
edition = "2021"
rust-version = "1.63"
[package.metadata.docs.rs]

View file

@ -11,6 +11,7 @@ external_libraries = [
]
extra_versions = [
"1.22",
"1.20",
"1.18",
"1.16",

View file

@ -12,7 +12,7 @@ fn main() {} // prevent linking libraries to avoid documentation failure
#[cfg(not(feature = "dox"))]
fn main() {
if let Err(s) = system_deps::Config::new().probe() {
println!("cargo:warning={}", s);
println!("cargo:warning={s}");
process::exit(1);
}
}

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 952ff416b599)
Generated by gir (https://github.com/gtk-rs/gir @ 92965146f2fb)
from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 15396abcca88)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ ae0d1447f520)

View file

@ -45,7 +45,7 @@ pub struct GstAppSinkCallbacks {
impl ::std::fmt::Debug for GstAppSinkCallbacks {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSinkCallbacks @ {:p}", self))
f.debug_struct(&format!("GstAppSinkCallbacks @ {self:p}"))
.field("eos", &self.eos)
.field("new_preroll", &self.new_preroll)
.field("new_sample", &self.new_sample)
@ -74,7 +74,7 @@ pub struct GstAppSinkClass {
impl ::std::fmt::Debug for GstAppSinkClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSinkClass @ {:p}", self))
f.debug_struct(&format!("GstAppSinkClass @ {self:p}"))
.field("basesink_class", &self.basesink_class)
.field("eos", &self.eos)
.field("new_preroll", &self.new_preroll)
@ -107,7 +107,7 @@ pub struct GstAppSrcCallbacks {
impl ::std::fmt::Debug for GstAppSrcCallbacks {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSrcCallbacks @ {:p}", self))
f.debug_struct(&format!("GstAppSrcCallbacks @ {self:p}"))
.field("need_data", &self.need_data)
.field("enough_data", &self.enough_data)
.field("seek_data", &self.seek_data)
@ -134,7 +134,7 @@ pub struct GstAppSrcClass {
impl ::std::fmt::Debug for GstAppSrcClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSrcClass @ {:p}", self))
f.debug_struct(&format!("GstAppSrcClass @ {self:p}"))
.field("basesrc_class", &self.basesrc_class)
.field("need_data", &self.need_data)
.field("enough_data", &self.enough_data)
@ -166,7 +166,7 @@ pub struct GstAppSink {
impl ::std::fmt::Debug for GstAppSink {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSink @ {:p}", self))
f.debug_struct(&format!("GstAppSink @ {self:p}"))
.field("basesink", &self.basesink)
.finish()
}
@ -182,7 +182,7 @@ pub struct GstAppSrc {
impl ::std::fmt::Debug for GstAppSrc {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSrc @ {:p}", self))
f.debug_struct(&format!("GstAppSrc @ {self:p}"))
.field("basesrc", &self.basesrc)
.finish()
}

View file

@ -41,7 +41,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
return Err(format!("compilation command {cmd:?} failed, {status}").into());
}
Ok(())
}
@ -57,7 +57,7 @@ fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<dyn Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
Err(err) => Err(format!("{name} {err}").into()),
}
}
@ -71,7 +71,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
return Err(format!("command {cmd:?} returned {}", out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
@ -127,15 +127,14 @@ fn cross_validate_constants_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
"Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}",
);
continue;
}
@ -165,16 +164,13 @@ fn cross_validate_layout_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",);
continue;
}
@ -195,7 +191,7 @@ fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
return Err(format!("command {abi_cmd:?} failed, {output:?}").into());
}
Ok(String::from_utf8(output.stdout)?)

View file

@ -1,6 +1,6 @@
[package]
name = "gstreamer-audio"
version = "0.19.0"
version = "0.19.8"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Audio library"
@ -17,10 +17,10 @@ rust-version = "1.63"
libc = "0.2"
cfg-if = "1.0"
bitflags = "1.0"
ffi = { package = "gstreamer-audio-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
gst-base = { package = "gstreamer-base", path = "../gstreamer-base" }
ffi = { package = "gstreamer-audio-sys", version = "0.19", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16.2" }
gst = { package = "gstreamer", version = "0.19", path = "../gstreamer" }
gst-base = { package = "gstreamer-base", version = "0.19", path = "../gstreamer-base" }
once_cell = "1.0"
serde = { version = "1.0", optional = true }

View file

@ -23,6 +23,7 @@ generate = [
"GstAudio.AudioBaseSrc",
"GstAudio.AudioChannelPosition",
"GstAudio.AudioDitherMethod",
"GstAudio.AudioFilter",
"GstAudio.AudioFormatFlags",
"GstAudio.AudioLayout",
"GstAudio.AudioNoiseShapingMethod",
@ -53,6 +54,7 @@ manual = [
"GstBase.AggregatorPad",
"GstBase.BaseSink",
"GstBase.BaseSrc",
"GstBase.BaseTransform",
]
[[object]]
@ -95,6 +97,11 @@ status = "generate"
# getter/setter exists in base class
ignore = true
[[object.property]]
name = "force-live"
# getter/setter exists in base class
ignore = true
[[object]]
name = "GstAudio.AudioBaseSink"
status = "generate"

View file

@ -66,6 +66,26 @@ You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
We recommend using the official GStreamer binaries over Homebrew, especially
as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964).
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and
`gstreamer-1.0-devel-1.20.4-universal.pkg`.
After installation, you also need to set the `PATH` environment variable as
follows
```console
$ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
```
Also note that the `pkg-config` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### Homebrew
Homebrew only installs various plugins if explicitly enabled, so some extra
@ -81,19 +101,6 @@ $ brew install gstreamer gst-plugins-base gst-plugins-good \
Make sure the version of these libraries is >= 1.14.
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.14.0-x86_64.pkg` and
`gstreamer-1.0-devel-1.14.0-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### Windows
@ -103,6 +110,32 @@ with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
We recommend using the official GStreamer binaries over MSYS2.
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and
`gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that
matches your Rust toolchain, i.e. MinGW or MSVC.
After installation set the ``PATH` environment variable as follows:
```console
# For a UNIX-style shell:
$ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}"
# For cmd.exe:
$ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH%
```
Make sure to update the path to where you have actually installed GStreamer
and for the corresponding toolchain.
Also note that the `pkg-config.exe` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### MSYS2 / pacman
```console
@ -120,20 +153,6 @@ Note that the version of `pkg-config` included in `MSYS2` is
compiling GStreamer, so you may need to install another version. One option
would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/).
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.14.0.msi` and
`gstreamer-1.0-devel-x86_64-1.14.0.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started

View file

@ -92,7 +92,7 @@ impl<T> AudioBuffer<T> {
}
pub fn plane_size(&self) -> usize {
(self.n_samples() as usize * self.sample_stride() as usize * self.channels() as usize)
(self.n_samples() * self.sample_stride() as usize * self.channels() as usize)
/ self.n_planes() as usize
}
@ -330,7 +330,7 @@ impl<T> AudioBufferRef<T> {
}
pub fn plane_size(&self) -> usize {
(self.n_samples() as usize * self.sample_stride() as usize * self.channels() as usize)
(self.n_samples() * self.sample_stride() as usize * self.channels() as usize)
/ self.n_planes() as usize
}

View file

@ -29,7 +29,7 @@ impl AudioChannelPosition {
}
let positions_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| {
if i >= len as usize {
if i >= len {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
positions[i].into_glib()
@ -95,7 +95,7 @@ impl AudioChannelPosition {
let len = positions.len();
let mut positions_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| {
if i >= len as usize {
if i >= len {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
positions[i].into_glib()
@ -139,7 +139,7 @@ impl AudioChannelPosition {
let len = positions.len();
let positions_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| {
if i >= len as usize {
if i >= len {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
positions[i].into_glib()
@ -174,7 +174,7 @@ pub fn buffer_reorder_channels(
let to_len = to.len();
let from_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| {
if i >= from_len as usize {
if i >= from_len {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
from[i].into_glib()
@ -182,7 +182,7 @@ pub fn buffer_reorder_channels(
});
let to_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| {
if i >= to_len as usize {
if i >= to_len {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
to[i].into_glib()
@ -224,7 +224,7 @@ pub fn reorder_channels(
let to_len = to.len();
let from_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| {
if i >= from_len as usize {
if i >= from_len {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
from[i].into_glib()
@ -232,7 +232,7 @@ pub fn reorder_channels(
});
let to_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| {
if i >= to_len as usize {
if i >= to_len {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
to[i].into_glib()
@ -274,7 +274,7 @@ pub fn channel_reorder_map(
let to_len = to.len();
let from_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| {
if i >= from_len as usize {
if i >= from_len {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
from[i].into_glib()
@ -282,7 +282,7 @@ pub fn channel_reorder_map(
});
let to_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| {
if i >= to_len as usize {
if i >= to_len {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
to[i].into_glib()

View file

@ -74,7 +74,7 @@ impl AudioConverterConfig {
}
pub fn set_dither_method(&mut self, v: crate::AudioDitherMethod) {
self.0.set("GstAudioConverter.dither-method", &v);
self.0.set("GstAudioConverter.dither-method", v);
}
#[doc(alias = "get_dither_method")]
@ -86,7 +86,7 @@ impl AudioConverterConfig {
}
pub fn set_noise_shaping_method(&mut self, v: crate::AudioNoiseShapingMethod) {
self.0.set("GstAudioConverter.noise-shaping-method", &v);
self.0.set("GstAudioConverter.noise-shaping-method", v);
}
#[doc(alias = "get_noise_shaping_method")]
@ -98,7 +98,7 @@ impl AudioConverterConfig {
}
pub fn set_quantization(&mut self, v: u32) {
self.0.set("GstAudioConverter.quantization", &v);
self.0.set("GstAudioConverter.quantization", v);
}
#[doc(alias = "get_quantization")]
@ -110,7 +110,7 @@ impl AudioConverterConfig {
}
pub fn set_resampler_method(&mut self, v: crate::AudioResamplerMethod) {
self.0.set("GstAudioConverter.resampler-method", &v);
self.0.set("GstAudioConverter.resampler-method", v);
}
#[doc(alias = "get_resampler_method")]
@ -128,7 +128,7 @@ impl AudioConverterConfig {
assert_eq!(val.len(), length);
gst::Array::from_values(val.iter().map(|val| val.to_send_value())).to_send_value()
}));
self.0.set("GstAudioConverter.mix-matrix", &array);
self.0.set("GstAudioConverter.mix-matrix", array);
}
#[doc(alias = "get_mix_matrix")]
@ -157,7 +157,7 @@ impl AudioConverterConfig {
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn set_dither_threshold(&mut self, v: u32) {
self.0.set("GstAudioConverter.dither-threshold", &v);
self.0.set("GstAudioConverter.dither-threshold", v);
}
#[cfg(any(feature = "v1_22", feature = "dox"))]

View file

@ -255,7 +255,7 @@ impl AudioInfo {
}
pub fn bps(&self) -> u32 {
(self.format_info().depth() as u32) >> 3
self.format_info().depth() >> 3
}
pub fn depth(&self) -> u32 {
@ -401,6 +401,17 @@ impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstAudioInfo> for AudioInfo
}
}
#[doc(hidden)]
impl glib::translate::FromGlibPtrNone<*const ffi::GstAudioInfo> for AudioInfo {
#[inline]
unsafe fn from_glib_none(ptr: *const ffi::GstAudioInfo) -> Self {
Self(
ptr::read(ptr),
std::array::from_fn(|i| from_glib((*ptr).position[i])),
)
}
}
#[doc(hidden)]
impl glib::translate::FromGlibPtrNone<*mut ffi::GstAudioInfo> for AudioInfo {
#[inline]

View file

@ -0,0 +1,20 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
glib::wrapper! {
#[doc(alias = "GstAudioFilter")]
pub struct AudioFilter(Object<ffi::GstAudioFilter, ffi::GstAudioFilterClass>) @extends gst_base::BaseTransform, gst::Element, gst::Object;
match fn {
type_ => || ffi::gst_audio_filter_get_type(),
}
}
impl AudioFilter {
pub const NONE: Option<&'static AudioFilter> = None;
}
unsafe impl Send for AudioFilter {}
unsafe impl Sync for AudioFilter {}

View file

@ -14,7 +14,7 @@ bitflags! {
#[doc(alias = "GstAudioFlags")]
pub struct AudioFlags: u32 {
#[doc(alias = "GST_AUDIO_FLAG_UNPOSITIONED")]
const UNPOSITIONED = ffi::GST_AUDIO_FLAG_UNPOSITIONED as u32;
const UNPOSITIONED = ffi::GST_AUDIO_FLAG_UNPOSITIONED as _;
}
}
@ -72,15 +72,15 @@ bitflags! {
#[doc(alias = "GstAudioFormatFlags")]
pub struct AudioFormatFlags: u32 {
#[doc(alias = "GST_AUDIO_FORMAT_FLAG_INTEGER")]
const INTEGER = ffi::GST_AUDIO_FORMAT_FLAG_INTEGER as u32;
const INTEGER = ffi::GST_AUDIO_FORMAT_FLAG_INTEGER as _;
#[doc(alias = "GST_AUDIO_FORMAT_FLAG_FLOAT")]
const FLOAT = ffi::GST_AUDIO_FORMAT_FLAG_FLOAT as u32;
const FLOAT = ffi::GST_AUDIO_FORMAT_FLAG_FLOAT as _;
#[doc(alias = "GST_AUDIO_FORMAT_FLAG_SIGNED")]
const SIGNED = ffi::GST_AUDIO_FORMAT_FLAG_SIGNED as u32;
const SIGNED = ffi::GST_AUDIO_FORMAT_FLAG_SIGNED as _;
#[doc(alias = "GST_AUDIO_FORMAT_FLAG_COMPLEX")]
const COMPLEX = ffi::GST_AUDIO_FORMAT_FLAG_COMPLEX as u32;
const COMPLEX = ffi::GST_AUDIO_FORMAT_FLAG_COMPLEX as _;
#[doc(alias = "GST_AUDIO_FORMAT_FLAG_UNPACK")]
const UNPACK = ffi::GST_AUDIO_FORMAT_FLAG_UNPACK as u32;
const UNPACK = ffi::GST_AUDIO_FORMAT_FLAG_UNPACK as _;
}
}
@ -138,7 +138,7 @@ bitflags! {
#[doc(alias = "GstAudioPackFlags")]
pub struct AudioPackFlags: u32 {
#[doc(alias = "GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE")]
const TRUNCATE_RANGE = ffi::GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE as u32;
const TRUNCATE_RANGE = ffi::GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE as _;
}
}

View file

@ -24,6 +24,9 @@ pub use self::audio_decoder::AudioDecoder;
mod audio_encoder;
pub use self::audio_encoder::AudioEncoder;
mod audio_filter;
pub use self::audio_filter::AudioFilter;
mod audio_sink;
pub use self::audio_sink::AudioSink;

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 952ff416b599)
Generated by gir (https://github.com/gtk-rs/gir @ 92965146f2fb)
from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 15396abcca88)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ ae0d1447f520)

View file

@ -82,7 +82,7 @@ mod tests {
#[cfg(feature = "v1_18")]
{
use glib::translate::{from_glib_full, IntoGlib};
use glib::translate::IntoGlib;
/* audio_make_raw_caps() is a re-implementation so ensure it returns the same caps as the C API */
let c_caps = unsafe {
@ -96,7 +96,7 @@ mod tests {
formats.len() as u32,
ffi::GST_AUDIO_LAYOUT_INTERLEAVED,
);
from_glib_full(caps)
gst::Caps::from_glib_full(caps)
};
assert_eq!(caps, c_caps);
}

View file

@ -54,7 +54,7 @@ impl<T: AudioAggregatorImpl> AudioAggregatorImplExt for T {
.expect("Missing parent function `create_output_buffer`");
from_glib_full(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioAggregator>()
.to_glib_none()
.0,
@ -80,7 +80,7 @@ impl<T: AudioAggregatorImpl> AudioAggregatorImplExt for T {
.expect("Missing parent function `aggregate_one_buffer`");
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioAggregator>()
.to_glib_none()
.0,

View file

@ -44,7 +44,7 @@ impl<T: AudioAggregatorPadImpl> AudioAggregatorPadImplExt for T {
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioAggregatorPadClass;
if let Some(f) = (*parent_class).update_conversion_info {
f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioAggregatorPad>()
.to_glib_none()
.0);
@ -65,7 +65,7 @@ impl<T: AudioAggregatorPadImpl> AudioAggregatorPadImplExt for T {
.convert_buffer
.expect("Missing parent function `convert_buffer`");
from_glib_full(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioAggregatorPad>()
.to_glib_none()
.0,

View file

@ -144,7 +144,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.open
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0))
@ -169,7 +169,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.close
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0))
@ -194,7 +194,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.start
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0))
@ -219,7 +219,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.stop
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0))
@ -245,7 +245,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -269,7 +269,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
let mut offset = mem::MaybeUninit::uninit();
let mut len = mem::MaybeUninit::uninit();
gst::FlowSuccess::try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -300,7 +300,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.handle_frame
.map(|f| {
try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -320,7 +320,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
if let Some(f) = (*parent_class).pre_push {
let mut buffer = buffer.into_glib_ptr();
gst::FlowSuccess::try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -341,7 +341,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.flush
.map(|f| {
f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -361,7 +361,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0),
@ -381,7 +381,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.getcaps
.map(|f| {
from_glib_full(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -389,7 +389,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
))
})
.unwrap_or_else(|| {
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.proxy_getcaps(None, filter)
})
@ -404,7 +404,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.sink_event
.expect("Missing parent function `sink_event`");
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -421,7 +421,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.sink_query
.expect("Missing parent function `sink_query`");
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -438,7 +438,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.src_event
.expect("Missing parent function `src_event`");
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -455,7 +455,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.src_query
.expect("Missing parent function `src_query`");
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -476,7 +476,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,
@ -502,7 +502,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioDecoder>()
.to_glib_none()
.0,

View file

@ -138,7 +138,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.open
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0))
@ -163,7 +163,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.close
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0))
@ -188,7 +188,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.start
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0))
@ -213,7 +213,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.stop
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0))
@ -239,7 +239,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0,
@ -264,7 +264,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.handle_frame
.map(|f| {
try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0,
@ -284,7 +284,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
if let Some(f) = (*parent_class).pre_push {
let mut buffer = buffer.into_glib_ptr();
gst::FlowSuccess::try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0,
@ -305,7 +305,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.flush
.map(|f| {
f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0)
@ -323,7 +323,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(self
.instance()
.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0),
@ -343,7 +343,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.getcaps
.map(|f| {
from_glib_full(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0,
@ -351,7 +351,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
))
})
.unwrap_or_else(|| {
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.proxy_getcaps(None, filter)
})
@ -366,7 +366,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.sink_event
.expect("Missing parent function `sink_event`");
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0,
@ -383,7 +383,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.sink_query
.expect("Missing parent function `sink_query`");
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0,
@ -400,7 +400,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.src_event
.expect("Missing parent function `src_event`");
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0,
@ -417,7 +417,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.src_query
.expect("Missing parent function `src_query`");
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0,
@ -438,7 +438,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0,
@ -464,7 +464,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
self.obj()
.unsafe_cast_ref::<AudioEncoder>()
.to_glib_none()
.0,

View file

@ -0,0 +1,78 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use glib::translate::*;
use gst_base::prelude::*;
use gst_base::subclass::prelude::*;
use crate::AudioFilter;
use crate::AudioInfo;
pub trait AudioFilterImpl: AudioFilterImplExt + BaseTransformImpl {
fn allowed_caps() -> &'static gst::Caps;
fn setup(&self, info: &AudioInfo) -> Result<(), gst::LoggableError> {
self.parent_setup(info)
}
}
pub trait AudioFilterImplExt: ObjectSubclass {
fn parent_setup(&self, info: &AudioInfo) -> Result<(), gst::LoggableError>;
}
impl<T: AudioFilterImpl> AudioFilterImplExt for T {
fn parent_setup(&self, info: &AudioInfo) -> Result<(), gst::LoggableError> {
unsafe {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioFilterClass;
(*parent_class)
.setup
.map(|f| {
gst::result_from_gboolean!(
f(
self.obj().unsafe_cast_ref::<AudioFilter>().to_glib_none().0,
info.to_glib_none().0,
),
gst::CAT_RUST,
"Parent function `setup` failed"
)
})
.unwrap_or(Ok(()))
}
}
}
unsafe impl<T: AudioFilterImpl> IsSubclassable<T> for AudioFilter {
fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass);
let klass = klass.as_mut();
klass.setup = Some(audio_filter_setup::<T>);
unsafe {
ffi::gst_audio_filter_class_add_pad_templates(
&mut *klass,
T::allowed_caps().to_glib_none().0,
);
}
}
}
unsafe extern "C" fn audio_filter_setup<T: AudioFilterImpl>(
ptr: *mut ffi::GstAudioFilter,
info: *const ffi::GstAudioInfo,
) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.imp();
gst::panic_to_error!(imp, false, {
match imp.setup(&from_glib_none(info)) {
Ok(()) => true,
Err(err) => {
err.log_with_imp(imp);
false
}
}
})
.into_glib()
}

View file

@ -60,11 +60,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
Some(f) => f,
};
gst::result_from_gboolean!(
f(self
.instance()
.unsafe_cast_ref::<AudioSink>()
.to_glib_none()
.0),
f(self.obj().unsafe_cast_ref::<AudioSink>().to_glib_none().0),
gst::CAT_RUST,
"Failed to close element using the parent function"
)
@ -79,11 +75,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
Some(f) => f,
None => return 0,
};
f(self
.instance()
.unsafe_cast_ref::<AudioSink>()
.to_glib_none()
.0)
f(self.obj().unsafe_cast_ref::<AudioSink>().to_glib_none().0)
}
}
@ -96,11 +88,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
None => return Ok(()),
};
gst::result_from_gboolean!(
f(self
.instance()
.unsafe_cast_ref::<AudioSink>()
.to_glib_none()
.0),
f(self.obj().unsafe_cast_ref::<AudioSink>().to_glib_none().0),
gst::CAT_RUST,
"Failed to open element using the parent function"
)
@ -117,10 +105,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
};
gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<AudioSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<AudioSink>().to_glib_none().0,
&mut spec.0
),
gst::CAT_RUST,
@ -143,11 +128,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
}
};
gst::result_from_gboolean!(
f(self
.instance()
.unsafe_cast_ref::<AudioSink>()
.to_glib_none()
.0),
f(self.obj().unsafe_cast_ref::<AudioSink>().to_glib_none().0),
gst::CAT_RUST,
"Failed to unprepare element using the parent function"
)
@ -164,10 +145,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
};
let buffer_ptr = buffer.as_ptr() as *const _ as *mut _;
let ret = f(
self.instance()
.unsafe_cast_ref::<AudioSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<AudioSink>().to_glib_none().0,
buffer_ptr,
buffer.len() as u32,
);
@ -187,11 +165,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSinkClass;
if let Some(f) = (*parent_class).reset {
f(self
.instance()
.unsafe_cast_ref::<AudioSink>()
.to_glib_none()
.0)
f(self.obj().unsafe_cast_ref::<AudioSink>().to_glib_none().0)
}
}
}

View file

@ -65,11 +65,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
Some(f) => f,
};
gst::result_from_gboolean!(
f(self
.instance()
.unsafe_cast_ref::<AudioSrc>()
.to_glib_none()
.0),
f(self.obj().unsafe_cast_ref::<AudioSrc>().to_glib_none().0),
gst::CAT_RUST,
"Failed to close element using the parent function"
)
@ -84,11 +80,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
Some(f) => f,
None => return 0,
};
f(self
.instance()
.unsafe_cast_ref::<AudioSrc>()
.to_glib_none()
.0)
f(self.obj().unsafe_cast_ref::<AudioSrc>().to_glib_none().0)
}
}
@ -101,11 +93,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
None => return Ok(()),
};
gst::result_from_gboolean!(
f(self
.instance()
.unsafe_cast_ref::<AudioSrc>()
.to_glib_none()
.0),
f(self.obj().unsafe_cast_ref::<AudioSrc>().to_glib_none().0),
gst::CAT_RUST,
"Failed to open element using the parent function"
)
@ -122,10 +110,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
};
gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<AudioSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<AudioSrc>().to_glib_none().0,
&mut spec.0
),
gst::CAT_RUST,
@ -148,11 +133,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
}
};
gst::result_from_gboolean!(
f(self
.instance()
.unsafe_cast_ref::<AudioSrc>()
.to_glib_none()
.0),
f(self.obj().unsafe_cast_ref::<AudioSrc>().to_glib_none().0),
gst::CAT_RUST,
"Failed to unprepare element using the parent function"
)
@ -173,10 +154,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
let buffer_ptr = buffer.as_mut_ptr() as *mut _;
let mut timestamp = mem::MaybeUninit::uninit();
let ret = f(
self.instance()
.unsafe_cast_ref::<AudioSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<AudioSrc>().to_glib_none().0,
buffer_ptr,
buffer.len() as u32,
timestamp.as_mut_ptr(),
@ -197,11 +175,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSrcClass;
if let Some(f) = (*parent_class).reset {
f(self
.instance()
.unsafe_cast_ref::<AudioSrc>()
.to_glib_none()
.0)
f(self.obj().unsafe_cast_ref::<AudioSrc>().to_glib_none().0)
}
}
}

View file

@ -9,6 +9,7 @@ mod audio_base_sink;
mod audio_base_src;
mod audio_decoder;
mod audio_encoder;
mod audio_filter;
mod audio_sink;
mod audio_src;
@ -23,6 +24,7 @@ pub mod prelude {
pub use super::audio_base_src::AudioBaseSrcImpl;
pub use super::audio_decoder::{AudioDecoderImpl, AudioDecoderImplExt};
pub use super::audio_encoder::{AudioEncoderImpl, AudioEncoderImplExt};
pub use super::audio_filter::{AudioFilterImpl, AudioFilterImplExt};
pub use super::audio_sink::{AudioSinkImpl, AudioSinkImplExt};
pub use super::audio_src::{AudioSrcImpl, AudioSrcImplExt};
}

View file

@ -7,17 +7,23 @@ libc = "0.2"
[dependencies.glib]
package = "glib-sys"
git = "https://github.com/gtk-rs/gtk-rs-core"
branch = "0.16"
version = "0.16"
[dependencies.gobject]
package = "gobject-sys"
git = "https://github.com/gtk-rs/gtk-rs-core"
branch = "0.16"
version = "0.16"
[dependencies.gst_base]
package = "gstreamer-base-sys"
version = "0.19"
path = "../../gstreamer-base/sys"
[dependencies.gst]
package = "gstreamer-sys"
version = "0.19"
path = "../../gstreamer/sys"
[dev-dependencies]
@ -45,7 +51,7 @@ license = "MIT"
name = "gstreamer-audio-sys"
readme = "README.md"
repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
version = "0.19.0"
version = "0.19.8"
edition = "2021"
rust-version = "1.63"
[package.metadata.docs.rs]

View file

@ -7,6 +7,7 @@ work_mode = "sys"
single_version_file = true
extra_versions = [
"1.22",
"1.20",
"1.18",
"1.16",

View file

@ -12,7 +12,7 @@ fn main() {} // prevent linking libraries to avoid documentation failure
#[cfg(not(feature = "dox"))]
fn main() {
if let Err(s) = system_deps::Config::new().probe() {
println!("cargo:warning={}", s);
println!("cargo:warning={s}");
process::exit(1);
}
}

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 952ff416b599)
Generated by gir (https://github.com/gtk-rs/gir @ 92965146f2fb)
from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 15396abcca88)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ ae0d1447f520)

View file

@ -204,7 +204,7 @@ pub const GST_AUDIO_CONVERTER_OPT_QUANTIZATION: *const c_char =
b"GstAudioConverter.quantization\0" as *const u8 as *const c_char;
pub const GST_AUDIO_CONVERTER_OPT_RESAMPLER_METHOD: *const c_char =
b"GstAudioConverter.resampler-method\0" as *const u8 as *const c_char;
pub const GST_AUDIO_DECODER_MAX_ERRORS: c_int = 10;
pub const GST_AUDIO_DECODER_MAX_ERRORS: c_int = -1;
pub const GST_AUDIO_DECODER_SINK_NAME: *const c_char = b"sink\0" as *const u8 as *const c_char;
pub const GST_AUDIO_DECODER_SRC_NAME: *const c_char = b"src\0" as *const u8 as *const c_char;
pub const GST_AUDIO_DEF_CHANNELS: c_int = 2;
@ -338,7 +338,7 @@ pub struct GstAudioAggregatorClass {
impl ::std::fmt::Debug for GstAudioAggregatorClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioAggregatorClass @ {:p}", self))
f.debug_struct(&format!("GstAudioAggregatorClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("create_output_buffer", &self.create_output_buffer)
.field("aggregate_one_buffer", &self.aggregate_one_buffer)
@ -355,7 +355,7 @@ pub struct GstAudioAggregatorConvertPadClass {
impl ::std::fmt::Debug for GstAudioAggregatorConvertPadClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioAggregatorConvertPadClass @ {:p}", self))
f.debug_struct(&format!("GstAudioAggregatorConvertPadClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -387,7 +387,7 @@ pub struct GstAudioAggregatorPadClass {
impl ::std::fmt::Debug for GstAudioAggregatorPadClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioAggregatorPadClass @ {:p}", self))
f.debug_struct(&format!("GstAudioAggregatorPadClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("convert_buffer", &self.convert_buffer)
.field("update_conversion_info", &self.update_conversion_info)
@ -425,7 +425,7 @@ pub struct GstAudioBaseSinkClass {
impl ::std::fmt::Debug for GstAudioBaseSinkClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioBaseSinkClass @ {:p}", self))
f.debug_struct(&format!("GstAudioBaseSinkClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("create_ringbuffer", &self.create_ringbuffer)
.field("payload", &self.payload)
@ -452,7 +452,7 @@ pub struct GstAudioBaseSrcClass {
impl ::std::fmt::Debug for GstAudioBaseSrcClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioBaseSrcClass @ {:p}", self))
f.debug_struct(&format!("GstAudioBaseSrcClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("create_ringbuffer", &self.create_ringbuffer)
.finish()
@ -483,7 +483,7 @@ pub struct GstAudioBuffer {
impl ::std::fmt::Debug for GstAudioBuffer {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioBuffer @ {:p}", self))
f.debug_struct(&format!("GstAudioBuffer @ {self:p}"))
.field("info", &self.info)
.field("n_samples", &self.n_samples)
.field("n_planes", &self.n_planes)
@ -505,7 +505,7 @@ pub struct GstAudioCdSrcClass {
impl ::std::fmt::Debug for GstAudioCdSrcClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioCdSrcClass @ {:p}", self))
f.debug_struct(&format!("GstAudioCdSrcClass @ {self:p}"))
.field("pushsrc_class", &self.pushsrc_class)
.field("open", &self.open)
.field("close", &self.close)
@ -536,7 +536,7 @@ pub struct GstAudioCdSrcTrack {
impl ::std::fmt::Debug for GstAudioCdSrcTrack {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioCdSrcTrack @ {:p}", self))
f.debug_struct(&format!("GstAudioCdSrcTrack @ {self:p}"))
.field("is_audio", &self.is_audio)
.field("num", &self.num)
.field("start", &self.start)
@ -565,7 +565,7 @@ pub struct GstAudioClippingMeta {
impl ::std::fmt::Debug for GstAudioClippingMeta {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioClippingMeta @ {:p}", self))
f.debug_struct(&format!("GstAudioClippingMeta @ {self:p}"))
.field("meta", &self.meta)
.field("format", &self.format)
.field("start", &self.start)
@ -583,7 +583,7 @@ pub struct GstAudioClockClass {
impl ::std::fmt::Debug for GstAudioClockClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioClockClass @ {:p}", self))
f.debug_struct(&format!("GstAudioClockClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -597,7 +597,7 @@ pub struct GstAudioConverter {
impl ::std::fmt::Debug for GstAudioConverter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioConverter @ {:p}", self))
f.debug_struct(&format!("GstAudioConverter @ {self:p}"))
.finish()
}
}
@ -655,7 +655,7 @@ pub struct GstAudioDecoderClass {
impl ::std::fmt::Debug for GstAudioDecoderClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioDecoderClass @ {:p}", self))
f.debug_struct(&format!("GstAudioDecoderClass @ {self:p}"))
.field("element_class", &self.element_class)
.field("start", &self.start)
.field("stop", &self.stop)
@ -700,7 +700,7 @@ pub struct GstAudioDownmixMeta {
impl ::std::fmt::Debug for GstAudioDownmixMeta {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioDownmixMeta @ {:p}", self))
f.debug_struct(&format!("GstAudioDownmixMeta @ {self:p}"))
.field("meta", &self.meta)
.field("from_position", &self.from_position)
.field("to_position", &self.to_position)
@ -756,7 +756,7 @@ pub struct GstAudioEncoderClass {
impl ::std::fmt::Debug for GstAudioEncoderClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioEncoderClass @ {:p}", self))
f.debug_struct(&format!("GstAudioEncoderClass @ {self:p}"))
.field("element_class", &self.element_class)
.field("start", &self.start)
.field("stop", &self.stop)
@ -797,7 +797,7 @@ pub struct GstAudioFilterClass {
impl ::std::fmt::Debug for GstAudioFilterClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioFilterClass @ {:p}", self))
f.debug_struct(&format!("GstAudioFilterClass @ {self:p}"))
.field("basetransformclass", &self.basetransformclass)
.field("setup", &self.setup)
.finish()
@ -823,7 +823,7 @@ pub struct GstAudioFormatInfo {
impl ::std::fmt::Debug for GstAudioFormatInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioFormatInfo @ {:p}", self))
f.debug_struct(&format!("GstAudioFormatInfo @ {self:p}"))
.field("format", &self.format)
.field("name", &self.name)
.field("description", &self.description)
@ -854,7 +854,7 @@ pub struct GstAudioInfo {
impl ::std::fmt::Debug for GstAudioInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioInfo @ {:p}", self))
f.debug_struct(&format!("GstAudioInfo @ {self:p}"))
.field("finfo", &self.finfo)
.field("flags", &self.flags)
.field("layout", &self.layout)
@ -875,7 +875,7 @@ pub struct GstAudioLevelMeta {
impl ::std::fmt::Debug for GstAudioLevelMeta {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioLevelMeta @ {:p}", self))
f.debug_struct(&format!("GstAudioLevelMeta @ {self:p}"))
.field("meta", &self.meta)
.field("level", &self.level)
.field("voice_activity", &self.voice_activity)
@ -896,7 +896,7 @@ pub struct GstAudioMeta {
impl ::std::fmt::Debug for GstAudioMeta {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioMeta @ {:p}", self))
f.debug_struct(&format!("GstAudioMeta @ {self:p}"))
.field("meta", &self.meta)
.field("info", &self.info)
.field("samples", &self.samples)
@ -953,7 +953,7 @@ pub struct GstAudioRingBufferClass {
impl ::std::fmt::Debug for GstAudioRingBufferClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioRingBufferClass @ {:p}", self))
f.debug_struct(&format!("GstAudioRingBufferClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("open_device", &self.open_device)
.field("acquire", &self.acquire)
@ -987,7 +987,7 @@ pub struct GstAudioRingBufferSpec {
impl ::std::fmt::Debug for GstAudioRingBufferSpec {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioRingBufferSpec @ {:p}", self))
f.debug_struct(&format!("GstAudioRingBufferSpec @ {self:p}"))
.field("caps", &self.caps)
.field("type_", &self.type_)
.field("info", &self.info)
@ -1020,7 +1020,7 @@ pub struct GstAudioSinkClass {
impl ::std::fmt::Debug for GstAudioSinkClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioSinkClass @ {:p}", self))
f.debug_struct(&format!("GstAudioSinkClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("open", &self.open)
.field("prepare", &self.prepare)
@ -1045,7 +1045,7 @@ pub struct GstAudioSinkClassExtension {
impl ::std::fmt::Debug for GstAudioSinkClassExtension {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioSinkClassExtension @ {:p}", self))
f.debug_struct(&format!("GstAudioSinkClassExtension @ {self:p}"))
.field("clear_all", &self.clear_all)
.finish()
}
@ -1070,7 +1070,7 @@ pub struct GstAudioSrcClass {
impl ::std::fmt::Debug for GstAudioSrcClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioSrcClass @ {:p}", self))
f.debug_struct(&format!("GstAudioSrcClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("open", &self.open)
.field("prepare", &self.prepare)
@ -1091,7 +1091,7 @@ pub struct GstAudioStreamAlign {
impl ::std::fmt::Debug for GstAudioStreamAlign {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioStreamAlign @ {:p}", self))
f.debug_struct(&format!("GstAudioStreamAlign @ {self:p}"))
.finish()
}
}
@ -1104,7 +1104,7 @@ pub struct GstStreamVolumeInterface {
impl ::std::fmt::Debug for GstStreamVolumeInterface {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstStreamVolumeInterface @ {:p}", self))
f.debug_struct(&format!("GstStreamVolumeInterface @ {self:p}"))
.field("iface", &self.iface)
.finish()
}
@ -1122,7 +1122,7 @@ pub struct GstAudioAggregator {
impl ::std::fmt::Debug for GstAudioAggregator {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioAggregator @ {:p}", self))
f.debug_struct(&format!("GstAudioAggregator @ {self:p}"))
.field("parent", &self.parent)
.field("current_caps", &self.current_caps)
.finish()
@ -1139,7 +1139,7 @@ pub struct GstAudioAggregatorConvertPad {
impl ::std::fmt::Debug for GstAudioAggregatorConvertPad {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioAggregatorConvertPad @ {:p}", self))
f.debug_struct(&format!("GstAudioAggregatorConvertPad @ {self:p}"))
.finish()
}
}
@ -1155,7 +1155,7 @@ pub struct GstAudioAggregatorPad {
impl ::std::fmt::Debug for GstAudioAggregatorPad {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioAggregatorPad @ {:p}", self))
f.debug_struct(&format!("GstAudioAggregatorPad @ {self:p}"))
.field("parent", &self.parent)
.field("info", &self.info)
.finish()
@ -1178,7 +1178,7 @@ pub struct GstAudioBaseSink {
impl ::std::fmt::Debug for GstAudioBaseSink {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioBaseSink @ {:p}", self))
f.debug_struct(&format!("GstAudioBaseSink @ {self:p}"))
.field("element", &self.element)
.field("ringbuffer", &self.ringbuffer)
.field("buffer_time", &self.buffer_time)
@ -1205,7 +1205,7 @@ pub struct GstAudioBaseSrc {
impl ::std::fmt::Debug for GstAudioBaseSrc {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioBaseSrc @ {:p}", self))
f.debug_struct(&format!("GstAudioBaseSrc @ {self:p}"))
.field("element", &self.element)
.field("ringbuffer", &self.ringbuffer)
.field("buffer_time", &self.buffer_time)
@ -1228,7 +1228,7 @@ pub struct GstAudioCdSrc {
impl ::std::fmt::Debug for GstAudioCdSrc {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioCdSrc @ {:p}", self))
f.debug_struct(&format!("GstAudioCdSrc @ {self:p}"))
.field("pushsrc", &self.pushsrc)
.field("tags", &self.tags)
.finish()
@ -1249,7 +1249,7 @@ pub struct GstAudioClock {
impl ::std::fmt::Debug for GstAudioClock {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioClock @ {:p}", self))
f.debug_struct(&format!("GstAudioClock @ {self:p}"))
.field("clock", &self.clock)
.field("func", &self.func)
.field("user_data", &self.user_data)
@ -1273,7 +1273,7 @@ pub struct GstAudioDecoder {
impl ::std::fmt::Debug for GstAudioDecoder {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioDecoder @ {:p}", self))
f.debug_struct(&format!("GstAudioDecoder @ {self:p}"))
.field("element", &self.element)
.field("sinkpad", &self.sinkpad)
.field("srcpad", &self.srcpad)
@ -1299,7 +1299,7 @@ pub struct GstAudioEncoder {
impl ::std::fmt::Debug for GstAudioEncoder {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioEncoder @ {:p}", self))
f.debug_struct(&format!("GstAudioEncoder @ {self:p}"))
.field("element", &self.element)
.field("sinkpad", &self.sinkpad)
.field("srcpad", &self.srcpad)
@ -1320,7 +1320,7 @@ pub struct GstAudioFilter {
impl ::std::fmt::Debug for GstAudioFilter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioFilter @ {:p}", self))
f.debug_struct(&format!("GstAudioFilter @ {self:p}"))
.field("basetransform", &self.basetransform)
.field("info", &self.info)
.finish()
@ -1357,7 +1357,7 @@ pub struct GstAudioRingBuffer {
impl ::std::fmt::Debug for GstAudioRingBuffer {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioRingBuffer @ {:p}", self))
f.debug_struct(&format!("GstAudioRingBuffer @ {self:p}"))
.field("object", &self.object)
.field("cond", &self.cond)
.field("open", &self.open)
@ -1385,7 +1385,7 @@ pub struct GstAudioSink {
impl ::std::fmt::Debug for GstAudioSink {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioSink @ {:p}", self))
f.debug_struct(&format!("GstAudioSink @ {self:p}"))
.field("element", &self.element)
.finish()
}
@ -1401,7 +1401,7 @@ pub struct GstAudioSrc {
impl ::std::fmt::Debug for GstAudioSrc {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioSrc @ {:p}", self))
f.debug_struct(&format!("GstAudioSrc @ {self:p}"))
.field("element", &self.element)
.finish()
}
@ -1416,7 +1416,7 @@ pub struct GstStreamVolume {
impl ::std::fmt::Debug for GstStreamVolume {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(f, "GstStreamVolume @ {:p}", self)
write!(f, "GstStreamVolume @ {self:p}")
}
}

View file

@ -41,7 +41,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
return Err(format!("compilation command {cmd:?} failed, {status}").into());
}
Ok(())
}
@ -57,7 +57,7 @@ fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<dyn Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
Err(err) => Err(format!("{name} {err}").into()),
}
}
@ -71,7 +71,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
return Err(format!("command {cmd:?} returned {}", out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
@ -127,15 +127,14 @@ fn cross_validate_constants_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
"Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}",
);
continue;
}
@ -165,16 +164,13 @@ fn cross_validate_layout_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",);
continue;
}
@ -195,7 +191,7 @@ fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
return Err(format!("command {abi_cmd:?} failed, {output:?}").into());
}
Ok(String::from_utf8(output.stdout)?)
@ -722,7 +718,7 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
"GST_AUDIO_CONVERTER_OPT_RESAMPLER_METHOD",
"GstAudioConverter.resampler-method",
),
("GST_AUDIO_DECODER_MAX_ERRORS", "10"),
("GST_AUDIO_DECODER_MAX_ERRORS", "-1"),
("GST_AUDIO_DECODER_SINK_NAME", "sink"),
("GST_AUDIO_DECODER_SRC_NAME", "src"),
("GST_AUDIO_DEF_CHANNELS", "2"),

View file

@ -1,6 +1,6 @@
[package]
name = "gstreamer-base"
version = "0.19.0"
version = "0.19.8"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Base library"
@ -17,10 +17,11 @@ rust-version = "1.63"
cfg-if = "1.0"
libc = "0.2"
bitflags = "1.0"
ffi = { package = "gstreamer-base-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
ffi = { package = "gstreamer-base-sys", version = "0.19", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16.2" }
gst = { package = "gstreamer", version = "0.19", path = "../gstreamer" }
atomic_refcell = "0.1"
once_cell = "1"
[dev-dependencies]
gir-format-check = "0.1"

View file

@ -107,22 +107,37 @@ status = "generate"
[[object.function]]
name = "type_find_helper_for_data"
# broken return value
ignore = true
manual = true
[[object.function]]
name = "type_find_helper_for_data_with_extension"
# broken return value
ignore = true
manual = true
[[object.function]]
name = "type_find_helper_for_buffer"
# broken return value
ignore = true
manual = true
[[object.function]]
name = "type_find_helper_for_buffer_with_extension"
# broken return value
ignore = true
manual = true
[[object.function]]
name = "type_find_helper_for_buffer_with_caps"
# broken return value
manual = true
[[object.function]]
name = "type_find_helper_for_data_with_caps"
# broken return value
manual = true
[[object.function]]
name = "type_find_list_factories_for_caps"
# broken return value
manual = true
[[object.function]]
name = "type_find_helper"

View file

@ -66,6 +66,26 @@ You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
We recommend using the official GStreamer binaries over Homebrew, especially
as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964).
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and
`gstreamer-1.0-devel-1.20.4-universal.pkg`.
After installation, you also need to set the `PATH` environment variable as
follows
```console
$ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
```
Also note that the `pkg-config` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### Homebrew
Homebrew only installs various plugins if explicitly enabled, so some extra
@ -81,19 +101,6 @@ $ brew install gstreamer gst-plugins-base gst-plugins-good \
Make sure the version of these libraries is >= 1.14.
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.14.0-x86_64.pkg` and
`gstreamer-1.0-devel-1.14.0-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### Windows
@ -103,6 +110,32 @@ with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
We recommend using the official GStreamer binaries over MSYS2.
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and
`gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that
matches your Rust toolchain, i.e. MinGW or MSVC.
After installation set the ``PATH` environment variable as follows:
```console
# For a UNIX-style shell:
$ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}"
# For cmd.exe:
$ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH%
```
Make sure to update the path to where you have actually installed GStreamer
and for the corresponding toolchain.
Also note that the `pkg-config.exe` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### MSYS2 / pacman
```console
@ -120,20 +153,6 @@ Note that the version of `pkg-config` included in `MSYS2` is
compiling GStreamer, so you may need to install another version. One option
would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/).
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.14.0.msi` and
`gstreamer-1.0-devel-x86_64-1.14.0.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started

View file

@ -40,6 +40,12 @@ pub trait AggregatorExt: 'static {
#[doc(alias = "get_buffer_pool")]
fn buffer_pool(&self) -> Option<gst::BufferPool>;
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_aggregator_get_force_live")]
#[doc(alias = "get_force_live")]
fn is_force_live(&self) -> bool;
#[cfg(any(feature = "v1_20", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_aggregator_get_ignore_inactive_pads")]
@ -60,6 +66,11 @@ pub trait AggregatorExt: 'static {
#[doc(alias = "gst_aggregator_peek_next_sample")]
fn peek_next_sample(&self, pad: &impl IsA<AggregatorPad>) -> Option<gst::Sample>;
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_aggregator_set_force_live")]
fn set_force_live(&self, force_live: bool);
#[cfg(any(feature = "v1_20", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_aggregator_set_ignore_inactive_pads")]
@ -142,6 +153,16 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
}
}
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
fn is_force_live(&self) -> bool {
unsafe {
from_glib(ffi::gst_aggregator_get_force_live(
self.as_ref().to_glib_none().0,
))
}
}
#[cfg(any(feature = "v1_20", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
fn ignores_inactive_pads(&self) -> bool {
@ -181,6 +202,17 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
}
}
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
fn set_force_live(&self, force_live: bool) {
unsafe {
ffi::gst_aggregator_set_force_live(
self.as_ref().to_glib_none().0,
force_live.into_glib(),
);
}
}
#[cfg(any(feature = "v1_20", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
fn set_ignore_inactive_pads(&self, ignore: bool) {

View file

@ -10,15 +10,15 @@ bitflags! {
#[doc(alias = "GstBaseParseFrameFlags")]
pub struct BaseParseFrameFlags: u32 {
#[doc(alias = "GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME")]
const NEW_FRAME = ffi::GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME as u32;
const NEW_FRAME = ffi::GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME as _;
#[doc(alias = "GST_BASE_PARSE_FRAME_FLAG_NO_FRAME")]
const NO_FRAME = ffi::GST_BASE_PARSE_FRAME_FLAG_NO_FRAME as u32;
const NO_FRAME = ffi::GST_BASE_PARSE_FRAME_FLAG_NO_FRAME as _;
#[doc(alias = "GST_BASE_PARSE_FRAME_FLAG_CLIP")]
const CLIP = ffi::GST_BASE_PARSE_FRAME_FLAG_CLIP as u32;
const CLIP = ffi::GST_BASE_PARSE_FRAME_FLAG_CLIP as _;
#[doc(alias = "GST_BASE_PARSE_FRAME_FLAG_DROP")]
const DROP = ffi::GST_BASE_PARSE_FRAME_FLAG_DROP as u32;
const DROP = ffi::GST_BASE_PARSE_FRAME_FLAG_DROP as _;
#[doc(alias = "GST_BASE_PARSE_FRAME_FLAG_QUEUE")]
const QUEUE = ffi::GST_BASE_PARSE_FRAME_FLAG_QUEUE as u32;
const QUEUE = ffi::GST_BASE_PARSE_FRAME_FLAG_QUEUE as _;
}
}

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 952ff416b599)
Generated by gir (https://github.com/gtk-rs/gir @ 92965146f2fb)
from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 15396abcca88)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ ae0d1447f520)

View file

@ -101,3 +101,63 @@ pub fn type_find_helper_for_buffer_with_extension<P: IsA<gst::Object>>(
}
}
}
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_type_find_helper_for_buffer_with_caps")]
pub fn type_find_helper_for_buffer_with_caps(
obj: Option<&impl IsA<gst::Object>>,
buf: &gst::BufferRef,
caps: &gst::CapsRef,
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
assert_initialized_main_thread!();
unsafe {
let mut prob = mem::MaybeUninit::uninit();
let ret = from_glib_full(ffi::gst_type_find_helper_for_buffer_with_caps(
obj.map(|p| p.as_ref()).to_glib_none().0,
mut_override(buf.as_ptr()),
mut_override(caps.as_ptr()),
prob.as_mut_ptr(),
));
(ret, from_glib(prob.assume_init()))
}
}
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_type_find_helper_for_data_with_caps")]
pub fn type_find_helper_for_data_with_caps(
obj: Option<&impl IsA<gst::Object>>,
data: &[u8],
caps: &gst::CapsRef,
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
assert_initialized_main_thread!();
let size = data.len() as _;
unsafe {
let mut prob = mem::MaybeUninit::uninit();
let ret = from_glib_full(ffi::gst_type_find_helper_for_data_with_caps(
obj.map(|p| p.as_ref()).to_glib_none().0,
data.to_glib_none().0,
size,
mut_override(caps.as_ptr()),
prob.as_mut_ptr(),
));
(ret, from_glib(prob.assume_init()))
}
}
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_type_find_list_factories_for_caps")]
pub fn type_find_list_factories_for_caps(
obj: Option<&impl IsA<gst::Object>>,
caps: &gst::CapsRef,
) -> glib::List<gst::TypeFindFactory> {
assert_initialized_main_thread!();
unsafe {
glib::collections::List::from_glib_full(ffi::gst_type_find_list_factories_for_caps(
obj.map(|p| p.as_ref()).to_glib_none().0,
mut_override(caps.as_ptr()),
))
}
}

View file

@ -238,7 +238,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.flush
.map(|f| {
try_from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0))
@ -258,10 +258,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
match (*parent_class).clip {
None => Some(buffer),
Some(ref func) => from_glib_full(func(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
aggregator_pad.to_glib_none().0,
buffer.into_glib_ptr(),
)),
@ -280,10 +277,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.finish_buffer
.expect("Missing parent function `finish_buffer`");
try_from_glib(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
buffer.into_glib_ptr(),
))
}
@ -302,10 +296,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.finish_buffer_list
.expect("Missing parent function `finish_buffer_list`");
try_from_glib(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
buffer_list.into_glib_ptr(),
))
}
@ -319,10 +310,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.sink_event
.expect("Missing parent function `sink_event`");
from_glib(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
aggregator_pad.to_glib_none().0,
event.into_glib_ptr(),
))
@ -343,10 +331,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.sink_event_pre_queue
.expect("Missing parent function `sink_event_pre_queue`");
try_from_glib(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
aggregator_pad.to_glib_none().0,
event.into_glib_ptr(),
))
@ -361,10 +346,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.sink_query
.expect("Missing parent function `sink_query`");
from_glib(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
aggregator_pad.to_glib_none().0,
query.as_mut_ptr(),
))
@ -385,10 +367,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.sink_query_pre_queue
.expect("Missing parent function `sink_query`");
from_glib(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
aggregator_pad.to_glib_none().0,
query.as_mut_ptr(),
))
@ -403,10 +382,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.src_event
.expect("Missing parent function `src_event`");
from_glib(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
event.into_glib_ptr(),
))
}
@ -420,10 +396,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.src_query
.expect("Missing parent function `src_query`");
from_glib(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
query.as_mut_ptr(),
))
}
@ -441,10 +414,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
None => Ok(()),
Some(f) => gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
mode.into_glib(),
active.into_glib()
),
@ -463,10 +433,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.aggregate
.expect("Missing parent function `aggregate`");
try_from_glib(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
timeout.into_glib(),
))
}
@ -480,7 +447,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.start
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0))
@ -505,7 +472,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.stop
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0))
@ -530,7 +497,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.get_next_time
.map(|f| {
from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0))
@ -552,10 +519,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.create_new_pad
.expect("Missing parent function `create_new_pad`");
from_glib_full(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
templ.to_glib_none().0,
req_name.to_glib_none().0,
caps.to_glib_none().0,
@ -573,10 +537,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
let mut out_caps = ptr::null_mut();
gst::FlowSuccess::try_from_glib(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
caps.as_mut_ptr(),
&mut out_caps,
))
@ -593,10 +554,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.fixate_src_caps
.expect("Missing parent function `fixate_src_caps`");
from_glib_full(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
caps.into_glib_ptr(),
))
}
@ -611,10 +569,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
caps.to_glib_none().0
),
gst::CAT_RUST,
@ -639,10 +594,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
pad.to_glib_none().0,
decide_query
.as_ref()
@ -670,10 +622,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
query.as_mut_ptr(),
),
gst::CAT_RUST,
@ -694,7 +643,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.negotiate
.map(|f| {
from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0))
@ -713,10 +662,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.peek_next_sample
.map(|f| {
from_glib_full(f(
self.instance()
.unsafe_cast_ref::<Aggregator>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<Aggregator>().to_glib_none().0,
pad.to_glib_none().0,
))
})

View file

@ -33,7 +33,7 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
.flush
.map(|f| {
try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AggregatorPad>()
.to_glib_none()
.0,
@ -52,7 +52,7 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
.skip_buffer
.map(|f| {
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<AggregatorPad>()
.to_glib_none()
.0,

View file

@ -67,7 +67,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
.start
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<BaseParse>()
.to_glib_none()
.0))
@ -92,7 +92,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
.stop
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<BaseParse>()
.to_glib_none()
.0))
@ -118,10 +118,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<BaseParse>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseParse>().to_glib_none().0,
caps.to_glib_none().0,
),
gst::CAT_RUST,
@ -144,10 +141,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
.handle_frame
.map(|f| {
let res = try_from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseParse>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseParse>().to_glib_none().0,
frame.to_glib_none().0,
&mut skipsize,
));
@ -169,10 +163,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
let mut dest_val = mem::MaybeUninit::uninit();
let res = from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseParse>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseParse>().to_glib_none().0,
src_val.format().into_glib(),
src_val.into_raw_value(),
dest_format.into_glib(),
@ -267,7 +258,7 @@ unsafe extern "C" fn base_parse_handle_frame<T: BaseParseImpl>(
) -> gst::ffi::GstFlowReturn {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.imp();
let instance = imp.instance();
let instance = imp.obj();
let instance = instance.unsafe_cast_ref::<BaseParse>();
let wrap_frame = BaseParseFrame::new(frame, instance);

View file

@ -117,12 +117,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
(*parent_class)
.start
.map(|f| {
if from_glib(f(self
.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0))
{
if from_glib(f(self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
Ok(())
} else {
Err(gst::error_msg!(
@ -142,12 +137,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
(*parent_class)
.stop
.map(|f| {
if from_glib(f(self
.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0))
{
if from_glib(f(self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
Ok(())
} else {
Err(gst::error_msg!(
@ -168,10 +158,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
.render
.map(|f| {
try_from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
buffer.to_glib_none().0,
))
})
@ -187,10 +174,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
.prepare
.map(|f| {
try_from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
buffer.to_glib_none().0,
))
})
@ -209,10 +193,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
.render_list
.map(|f| {
try_from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
list.to_glib_none().0,
))
})
@ -236,10 +217,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
.prepare_list
.map(|f| {
try_from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
list.to_glib_none().0,
))
})
@ -260,10 +238,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
.query
.map(|f| {
from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
query.as_mut_ptr(),
))
})
@ -279,10 +254,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
.event
.map(|f| {
from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
event.into_glib_ptr(),
))
})
@ -299,10 +271,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
.get_caps
.map(|f| {
from_glib_full(f(
self.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
filter.to_glib_none().0,
))
})
@ -319,10 +288,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
caps.to_glib_none().0
),
gst::CAT_RUST,
@ -340,10 +306,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
match (*parent_class).fixate {
Some(fixate) => from_glib_full(fixate(
self.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
caps.into_glib_ptr(),
)),
None => caps,
@ -358,12 +321,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
(*parent_class)
.unlock
.map(|f| {
if from_glib(f(self
.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0))
{
if from_glib(f(self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
Ok(())
} else {
Err(gst::error_msg!(
@ -383,12 +341,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
(*parent_class)
.unlock_stop
.map(|f| {
if from_glib(f(self
.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0))
{
if from_glib(f(self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
Ok(())
} else {
Err(gst::error_msg!(
@ -413,10 +366,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<BaseSink>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
query.as_mut_ptr(),
),
gst::CAT_RUST,

View file

@ -176,12 +176,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
(*parent_class)
.start
.map(|f| {
if from_glib(f(self
.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0))
{
if from_glib(f(self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
Ok(())
} else {
Err(gst::error_msg!(
@ -201,12 +196,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
(*parent_class)
.stop
.map(|f| {
if from_glib(f(self
.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0))
{
if from_glib(f(self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
Ok(())
} else {
Err(gst::error_msg!(
@ -225,13 +215,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass;
(*parent_class)
.is_seekable
.map(|f| {
from_glib(f(self
.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0))
})
.map(|f| from_glib(f(self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0)))
.unwrap_or(false)
}
}
@ -245,10 +229,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
.map(|f| {
let mut size = mem::MaybeUninit::uninit();
if from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
size.as_mut_ptr(),
)) {
Some(size.assume_init())
@ -273,10 +254,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
let mut start = mem::MaybeUninit::uninit();
let mut stop = mem::MaybeUninit::uninit();
f(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
buffer.as_mut_ptr(),
start.as_mut_ptr(),
stop.as_mut_ptr(),
@ -303,10 +281,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
.fill
.map(|f| {
try_from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
offset,
length,
buffer.as_mut_ptr(),
@ -330,10 +305,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst::ffi::GstBuffer;
gst::FlowSuccess::try_from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
offset,
length,
buffer_ref,
@ -356,7 +328,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
(*parent_class)
.create
.map(|f| {
let instance = self.instance();
let instance = self.obj();
let instance = instance.unsafe_cast_ref::<BaseSrc>();
let orig_buffer_ptr = buffer
.as_mut()
@ -428,7 +400,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
}
};
let copied_size = new_buffer.copy_to_slice(0, &mut *map);
let copied_size = new_buffer.copy_to_slice(0, &mut map);
drop(map);
if let Err(copied_size) = copied_size {
@ -468,10 +440,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
.do_seek
.map(|f| {
from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
segment.to_glib_none_mut().0,
))
})
@ -487,10 +456,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
.query
.map(|f| {
from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
query.as_mut_ptr(),
))
})
@ -506,10 +472,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
.event
.map(|f| {
from_glib(f(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
event.to_glib_none().0,
))
})
@ -526,10 +489,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
.get_caps
.map(|f| {
from_glib_full(f(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
filter.to_glib_none().0,
))
})
@ -545,11 +505,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
.negotiate
.map(|f| {
gst::result_from_gboolean!(
f(self
.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0),
f(self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0),
gst::CAT_RUST,
"Parent function `negotiate` failed"
)
@ -567,10 +523,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
caps.to_glib_none().0
),
gst::CAT_RUST,
@ -588,10 +541,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
match (*parent_class).fixate {
Some(fixate) => from_glib_full(fixate(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
caps.into_glib_ptr(),
)),
None => caps,
@ -606,12 +556,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
(*parent_class)
.unlock
.map(|f| {
if from_glib(f(self
.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0))
{
if from_glib(f(self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
Ok(())
} else {
Err(gst::error_msg!(
@ -631,12 +576,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
(*parent_class)
.unlock_stop
.map(|f| {
if from_glib(f(self
.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0))
{
if from_glib(f(self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
Ok(())
} else {
Err(gst::error_msg!(
@ -661,10 +601,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
.unsafe_cast_ref::<BaseSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
query.as_mut_ptr(),
),
gst::CAT_RUST,
@ -840,7 +777,7 @@ unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
) -> gst::ffi::GstFlowReturn {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.imp();
let instance = imp.instance();
let instance = imp.obj();
let instance = instance.unsafe_cast_ref::<BaseSrc>();
// FIXME: Wrong signature in -sys bindings
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
@ -884,7 +821,7 @@ unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
}
};
let copied_size = new_buffer.copy_to_slice(0, &mut *map);
let copied_size = new_buffer.copy_to_slice(0, &mut map);
drop(map);
if let Err(copied_size) = copied_size {

View file

@ -277,7 +277,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.start
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0))
@ -302,7 +302,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.stop
.map(|f| {
if from_glib(f(self
.instance()
.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0))
@ -332,7 +332,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.transform_caps
.map(|f| {
from_glib_full(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -356,7 +356,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass;
match (*parent_class).fixate_caps {
Some(f) => from_glib_full(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -382,7 +382,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -405,7 +405,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.accept_caps
.map(|f| {
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -425,7 +425,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.query
.map(|f| {
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -452,7 +452,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.map(|f| {
let mut othersize = mem::MaybeUninit::uninit();
let res: bool = from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -477,11 +477,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass;
let f = (*parent_class).get_unit_size.unwrap_or_else(|| {
if !self
.instance()
.unsafe_cast_ref::<BaseTransform>()
.is_in_place()
{
if !self.obj().unsafe_cast_ref::<BaseTransform>().is_in_place() {
unimplemented!(concat!(
"Missing parent function `get_unit_size`. Required because ",
"transform doesn't operate in-place"
@ -495,7 +491,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
let mut size = mem::MaybeUninit::uninit();
if from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -517,7 +513,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.sink_event
.map(|f| {
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -536,7 +532,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.src_event
.map(|f| {
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -564,7 +560,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
let mut outbuf: *mut gst::ffi::GstBuffer = ptr::null_mut();
// FIXME: Wrong signature in FFI
gst::FlowSuccess::try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -578,6 +574,13 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
PrepareOutputBufferSuccess::Buffer(from_glib_full(outbuf))
}
})
.map_err(|err| {
if outbuf != buf as *mut _ {
drop(Option::<gst::Buffer>::from_glib_full(outbuf));
}
err
})
})
.unwrap_or(Err(gst::FlowError::NotSupported))
}
@ -595,7 +598,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.transform
.map(|f| {
try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -604,11 +607,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
))
})
.unwrap_or_else(|| {
if !self
.instance()
.unsafe_cast_ref::<BaseTransform>()
.is_in_place()
{
if !self.obj().unsafe_cast_ref::<BaseTransform>().is_in_place() {
Err(gst::FlowError::NotSupported)
} else {
unreachable!(concat!(
@ -627,11 +626,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass;
let f = (*parent_class).transform_ip.unwrap_or_else(|| {
if self
.instance()
.unsafe_cast_ref::<BaseTransform>()
.is_in_place()
{
if self.obj().unsafe_cast_ref::<BaseTransform>().is_in_place() {
panic!(concat!(
"Missing parent function `transform_ip`. Required because ",
"transform operates in-place"
@ -644,7 +639,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
});
try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -661,11 +656,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass;
let f = (*parent_class).transform_ip.unwrap_or_else(|| {
if self
.instance()
.unsafe_cast_ref::<BaseTransform>()
.is_in_place()
{
if self.obj().unsafe_cast_ref::<BaseTransform>().is_in_place() {
panic!(concat!(
"Missing parent function `transform_ip`. Required because ",
"transform operates in-place (passthrough mode)"
@ -681,7 +672,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
// FIXME: Wrong signature in FFI
let buf: *mut gst::ffi::GstBuffer = buf.to_glib_none().0;
try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -703,7 +694,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -733,7 +724,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.map(|f| {
gst::result_from_gboolean!(
f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -758,7 +749,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
if let Some(ref f) = (*parent_class).copy_metadata {
gst::result_from_gboolean!(
f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -787,7 +778,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.transform_meta
.map(|f| {
from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -806,7 +797,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass;
if let Some(ref f) = (*parent_class).before_transform {
f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -829,7 +820,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.expect("Missing parent function `submit_input_buffer`");
try_from_glib(f(
self.instance()
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
@ -848,21 +839,20 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.expect("Missing parent function `generate_output`");
let mut outbuf = ptr::null_mut();
gst::FlowSuccess::try_from_glib(f(
self.instance()
let res = gst::FlowSuccess::try_from_glib(f(
self.obj()
.unsafe_cast_ref::<BaseTransform>()
.to_glib_none()
.0,
&mut outbuf,
))
.map(|res| {
if res == crate::BASE_TRANSFORM_FLOW_DROPPED {
GenerateOutputSuccess::Dropped
} else if res != gst::FlowSuccess::Ok || outbuf.is_null() {
GenerateOutputSuccess::NoOutput
} else {
GenerateOutputSuccess::Buffer(from_glib_full(outbuf))
}
));
let outbuf = Option::<gst::Buffer>::from_glib_full(outbuf);
res.map(move |res| match (res, outbuf) {
(crate::BASE_TRANSFORM_FLOW_DROPPED, _) => GenerateOutputSuccess::Dropped,
(gst::FlowSuccess::Ok, Some(outbuf)) => GenerateOutputSuccess::Buffer(outbuf),
_ => GenerateOutputSuccess::NoOutput,
})
}
}
@ -873,7 +863,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
<Self as ObjectSubclass>::ParentType: IsA<BaseTransform>,
{
unsafe {
let instance = self.instance();
let instance = self.obj();
let ptr: *mut ffi::GstBaseTransform =
instance.unsafe_cast_ref::<BaseTransform>().to_glib_none().0;
let sinkpad: Borrowed<gst::Pad> = from_glib_borrow((*ptr).sinkpad);
@ -890,7 +880,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
<Self as ObjectSubclass>::ParentType: IsA<BaseTransform>,
{
unsafe {
let instance = self.instance();
let instance = self.obj();
let ptr: *mut ffi::GstBaseTransform =
instance.unsafe_cast_ref::<BaseTransform>().to_glib_none().0;
let sinkpad: Borrowed<gst::Pad> = from_glib_borrow((*ptr).sinkpad);
@ -1161,6 +1151,8 @@ unsafe extern "C" fn base_transform_prepare_output_buffer<T: BaseTransformImpl>(
true => InputBuffer::Writable(gst::BufferRef::from_mut_ptr(inbuf)),
};
*outbuf = ptr::null_mut();
gst::panic_to_error!(imp, gst::FlowReturn::Error, {
match imp.prepare_output_buffer(buffer) {
Ok(PrepareOutputBufferSuccess::InputBuffer) => {
@ -1328,12 +1320,9 @@ unsafe extern "C" fn base_transform_copy_metadata<T: BaseTransformImpl>(
let imp = instance.imp();
if gst::ffi::gst_mini_object_is_writable(outbuf as *mut _) == glib::ffi::GFALSE {
gst::warning!(
gst::CAT_RUST,
obj: imp.instance().unsafe_cast_ref::<BaseTransform>(),
"buffer {:?} not writable",
outbuf
);
let instance = imp.obj();
let obj = instance.unsafe_cast_ref::<BaseTransform>();
gst::warning!(gst::CAT_RUST, obj: obj, "buffer {:?} not writable", outbuf);
return glib::ffi::GFALSE;
}
@ -1401,3 +1390,133 @@ unsafe extern "C" fn base_transform_generate_output<T: BaseTransformImpl>(
})
.into_glib()
}
#[cfg(test)]
mod tests {
use super::*;
pub mod imp {
use super::*;
use std::sync::atomic::{self, AtomicBool};
#[derive(Default)]
pub struct TestTransform {
drop_next: AtomicBool,
}
#[glib::object_subclass]
impl ObjectSubclass for TestTransform {
const NAME: &'static str = "TestTransform";
type Type = super::TestTransform;
type ParentType = crate::BaseTransform;
}
impl ObjectImpl for TestTransform {}
impl GstObjectImpl for TestTransform {}
impl ElementImpl for TestTransform {
fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
use once_cell::sync::Lazy;
static ELEMENT_METADATA: Lazy<gst::subclass::ElementMetadata> = Lazy::new(|| {
gst::subclass::ElementMetadata::new(
"Test Transform",
"Generic",
"Does nothing",
"Sebastian Dröge <sebastian@centricular.com>",
)
});
Some(&*ELEMENT_METADATA)
}
fn pad_templates() -> &'static [gst::PadTemplate] {
use once_cell::sync::Lazy;
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
let caps = gst::Caps::new_any();
vec![
gst::PadTemplate::new(
"src",
gst::PadDirection::Src,
gst::PadPresence::Always,
&caps,
)
.unwrap(),
gst::PadTemplate::new(
"sink",
gst::PadDirection::Sink,
gst::PadPresence::Always,
&caps,
)
.unwrap(),
]
});
PAD_TEMPLATES.as_ref()
}
}
impl BaseTransformImpl for TestTransform {
const MODE: BaseTransformMode = BaseTransformMode::AlwaysInPlace;
const PASSTHROUGH_ON_SAME_CAPS: bool = false;
const TRANSFORM_IP_ON_PASSTHROUGH: bool = false;
fn transform_ip(
&self,
_buf: &mut gst::BufferRef,
) -> Result<gst::FlowSuccess, gst::FlowError> {
if self.drop_next.load(atomic::Ordering::SeqCst) {
self.drop_next.store(false, atomic::Ordering::SeqCst);
Ok(crate::BASE_TRANSFORM_FLOW_DROPPED)
} else {
self.drop_next.store(true, atomic::Ordering::SeqCst);
Ok(gst::FlowSuccess::Ok)
}
}
}
}
glib::wrapper! {
pub struct TestTransform(ObjectSubclass<imp::TestTransform>) @extends crate::BaseTransform, gst::Element, gst::Object;
}
impl TestTransform {
pub fn new(name: Option<&str>) -> Self {
glib::Object::builder().property("name", name).build()
}
}
#[test]
fn test_transform_subclass() {
gst::init().unwrap();
let element = TestTransform::new(Some("test"));
assert_eq!(element.name(), "test");
let pipeline = gst::Pipeline::default();
let src = gst::ElementFactory::make("audiotestsrc")
.property("num-buffers", 100i32)
.build()
.unwrap();
let sink = gst::ElementFactory::make("fakesink").build().unwrap();
pipeline
.add_many(&[&src, element.upcast_ref(), &sink])
.unwrap();
gst::Element::link_many(&[&src, element.upcast_ref(), &sink]).unwrap();
pipeline.set_state(gst::State::Playing).unwrap();
let bus = pipeline.bus().unwrap();
let eos = bus.timed_pop_filtered(gst::ClockTime::NONE, &[gst::MessageType::Eos]);
assert!(eos.is_some());
let stats = sink.property::<gst::Structure>("stats");
assert_eq!(stats.get::<u64>("rendered").unwrap(), 50);
pipeline.set_state(gst::State::Null).unwrap();
}
}

View file

@ -45,10 +45,7 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
.fill
.map(|f| {
try_from_glib(f(
self.instance()
.unsafe_cast_ref::<PushSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<PushSrc>().to_glib_none().0,
buffer.as_mut_ptr(),
))
})
@ -70,10 +67,7 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst::ffi::GstBuffer;
gst::FlowSuccess::try_from_glib(f(
self.instance()
.unsafe_cast_ref::<PushSrc>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<PushSrc>().to_glib_none().0,
buffer_ref,
))
.map(|_| from_glib_full(buffer_ref))
@ -92,7 +86,7 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
(*parent_class)
.create
.map(|f| {
let instance = self.instance();
let instance = self.obj();
let instance = instance.unsafe_cast_ref::<PushSrc>();
let orig_buffer_ptr = buffer
.as_mut()
@ -162,7 +156,7 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
}
};
let copied_size = new_buffer.copy_to_slice(0, &mut *map);
let copied_size = new_buffer.copy_to_slice(0, &mut map);
drop(map);
if let Err(copied_size) = copied_size {
@ -288,7 +282,7 @@ unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
}
};
let copied_size = new_buffer.copy_to_slice(0, &mut *map);
let copied_size = new_buffer.copy_to_slice(0, &mut map);
drop(map);
if let Err(copied_size) = copied_size {
@ -322,8 +316,7 @@ unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
}
Ok(CreateSuccess::NewBufferList(new_buffer_list)) => {
if buffer.is_some()
|| imp.instance().unsafe_cast_ref::<PushSrc>().src_pad().mode()
== gst::PadMode::Pull
|| imp.obj().unsafe_cast_ref::<PushSrc>().src_pad().mode() == gst::PadMode::Pull
{
panic!("Buffer lists can only be returned in push mode");
}

View file

@ -7,13 +7,18 @@ libc = "0.2"
[dependencies.glib]
package = "glib-sys"
git = "https://github.com/gtk-rs/gtk-rs-core"
branch = "0.16"
version = "0.16"
[dependencies.gobject]
package = "gobject-sys"
git = "https://github.com/gtk-rs/gtk-rs-core"
branch = "0.16"
version = "0.16"
[dependencies.gst]
package = "gstreamer-sys"
version = "0.19"
path = "../../gstreamer/sys"
[dev-dependencies]
@ -43,7 +48,7 @@ license = "MIT"
name = "gstreamer-base-sys"
readme = "README.md"
repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
version = "0.19.0"
version = "0.19.8"
edition = "2021"
rust-version = "1.63"
[package.metadata.docs.rs]

View file

@ -7,6 +7,7 @@ work_mode = "sys"
single_version_file = true
extra_versions = [
"1.22",
"1.20",
"1.18",
"1.16",

View file

@ -12,7 +12,7 @@ fn main() {} // prevent linking libraries to avoid documentation failure
#[cfg(not(feature = "dox"))]
fn main() {
if let Err(s) = system_deps::Config::new().probe() {
println!("cargo:warning={}", s);
println!("cargo:warning={s}");
process::exit(1);
}
}

View file

@ -1,3 +1,3 @@
Generated by gir (https://github.com/gtk-rs/gir @ 952ff416b599)
Generated by gir (https://github.com/gtk-rs/gir @ 92965146f2fb)
from gir-files (https://github.com/gtk-rs/gir-files @ 89a11aa6a362)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 15396abcca88)
from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ ae0d1447f520)

View file

@ -64,7 +64,7 @@ pub union GstCollectData_ABI {
impl ::std::fmt::Debug for GstCollectData_ABI {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstCollectData_ABI @ {:p}", self))
f.debug_struct(&format!("GstCollectData_ABI @ {self:p}"))
.field("abi", unsafe { &self.abi })
.finish()
}
@ -232,7 +232,7 @@ pub struct GstAggregatorClass {
impl ::std::fmt::Debug for GstAggregatorClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAggregatorClass @ {:p}", self))
f.debug_struct(&format!("GstAggregatorClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("flush", &self.flush)
.field("clip", &self.clip)
@ -280,7 +280,7 @@ pub struct GstAggregatorPadClass {
impl ::std::fmt::Debug for GstAggregatorPadClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAggregatorPadClass @ {:p}", self))
f.debug_struct(&format!("GstAggregatorPadClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("flush", &self.flush)
.field("skip_buffer", &self.skip_buffer)
@ -344,7 +344,7 @@ pub struct GstBaseParseClass {
impl ::std::fmt::Debug for GstBaseParseClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBaseParseClass @ {:p}", self))
f.debug_struct(&format!("GstBaseParseClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("start", &self.start)
.field("stop", &self.stop)
@ -378,7 +378,7 @@ pub struct GstBaseParseFrame {
impl ::std::fmt::Debug for GstBaseParseFrame {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBaseParseFrame @ {:p}", self))
f.debug_struct(&format!("GstBaseParseFrame @ {self:p}"))
.field("buffer", &self.buffer)
.field("out_buffer", &self.out_buffer)
.field("flags", &self.flags)
@ -441,7 +441,7 @@ pub struct GstBaseSinkClass {
impl ::std::fmt::Debug for GstBaseSinkClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBaseSinkClass @ {:p}", self))
f.debug_struct(&format!("GstBaseSinkClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("get_caps", &self.get_caps)
.field("set_caps", &self.set_caps)
@ -534,7 +534,7 @@ pub struct GstBaseSrcClass {
impl ::std::fmt::Debug for GstBaseSrcClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBaseSrcClass @ {:p}", self))
f.debug_struct(&format!("GstBaseSrcClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("get_caps", &self.get_caps)
.field("negotiate", &self.negotiate)
@ -694,7 +694,7 @@ pub struct GstBaseTransformClass {
impl ::std::fmt::Debug for GstBaseTransformClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBaseTransformClass @ {:p}", self))
f.debug_struct(&format!("GstBaseTransformClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("passthrough_on_same_caps", &self.passthrough_on_same_caps)
.field(
@ -747,7 +747,7 @@ pub struct GstBitReader {
impl ::std::fmt::Debug for GstBitReader {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBitReader @ {:p}", self))
f.debug_struct(&format!("GstBitReader @ {self:p}"))
.field("data", &self.data)
.field("size", &self.size)
.field("byte", &self.byte)
@ -769,7 +769,7 @@ pub struct GstBitWriter {
impl ::std::fmt::Debug for GstBitWriter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBitWriter @ {:p}", self))
f.debug_struct(&format!("GstBitWriter @ {self:p}"))
.field("data", &self.data)
.field("bit_size", &self.bit_size)
.finish()
@ -787,7 +787,7 @@ pub struct GstByteReader {
impl ::std::fmt::Debug for GstByteReader {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstByteReader @ {:p}", self))
f.debug_struct(&format!("GstByteReader @ {self:p}"))
.field("data", &self.data)
.field("size", &self.size)
.field("byte", &self.byte)
@ -807,7 +807,7 @@ pub struct GstByteWriter {
impl ::std::fmt::Debug for GstByteWriter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstByteWriter @ {:p}", self))
f.debug_struct(&format!("GstByteWriter @ {self:p}"))
.field("parent", &self.parent)
.field("alloc_size", &self.alloc_size)
.field("fixed", &self.fixed)
@ -831,7 +831,7 @@ pub struct GstCollectData {
impl ::std::fmt::Debug for GstCollectData {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstCollectData @ {:p}", self))
f.debug_struct(&format!("GstCollectData @ {self:p}"))
.field("collect", &self.collect)
.field("pad", &self.pad)
.field("buffer", &self.buffer)
@ -858,7 +858,7 @@ pub struct GstCollectData_ABI_abi {
impl ::std::fmt::Debug for GstCollectData_ABI_abi {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstCollectData_ABI_abi @ {:p}", self))
f.debug_struct(&format!("GstCollectData_ABI_abi @ {self:p}"))
.field("dts", &self.dts)
.finish()
}
@ -873,7 +873,7 @@ pub struct GstCollectPadsClass {
impl ::std::fmt::Debug for GstCollectPadsClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstCollectPadsClass @ {:p}", self))
f.debug_struct(&format!("GstCollectPadsClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -898,7 +898,7 @@ pub struct GstDataQueueClass {
impl ::std::fmt::Debug for GstDataQueueClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDataQueueClass @ {:p}", self))
f.debug_struct(&format!("GstDataQueueClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("empty", &self.empty)
.field("full", &self.full)
@ -920,7 +920,7 @@ pub struct GstDataQueueItem {
impl ::std::fmt::Debug for GstDataQueueItem {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDataQueueItem @ {:p}", self))
f.debug_struct(&format!("GstDataQueueItem @ {self:p}"))
.field("object", &self.object)
.field("size", &self.size)
.field("duration", &self.duration)
@ -948,7 +948,7 @@ pub struct GstDataQueueSize {
impl ::std::fmt::Debug for GstDataQueueSize {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDataQueueSize @ {:p}", self))
f.debug_struct(&format!("GstDataQueueSize @ {self:p}"))
.field("visible", &self.visible)
.field("bytes", &self.bytes)
.field("time", &self.time)
@ -964,7 +964,7 @@ pub struct GstFlowCombiner {
impl ::std::fmt::Debug for GstFlowCombiner {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstFlowCombiner @ {:p}", self))
f.debug_struct(&format!("GstFlowCombiner @ {self:p}"))
.finish()
}
}
@ -984,7 +984,7 @@ pub struct GstPushSrcClass {
impl ::std::fmt::Debug for GstPushSrcClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPushSrcClass @ {:p}", self))
f.debug_struct(&format!("GstPushSrcClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("create", &self.create)
.field("alloc", &self.alloc)
@ -1001,6 +1001,14 @@ pub struct _GstQueueArray {
pub type GstQueueArray = *mut _GstQueueArray;
#[repr(C)]
pub struct _GstTypeFindData {
_data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}
pub type GstTypeFindData = *mut _GstTypeFindData;
// Classes
#[repr(C)]
pub struct GstAdapter {
@ -1010,7 +1018,7 @@ pub struct GstAdapter {
impl ::std::fmt::Debug for GstAdapter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAdapter @ {:p}", self)).finish()
f.debug_struct(&format!("GstAdapter @ {self:p}")).finish()
}
}
@ -1025,7 +1033,7 @@ pub struct GstAggregator {
impl ::std::fmt::Debug for GstAggregator {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAggregator @ {:p}", self))
f.debug_struct(&format!("GstAggregator @ {self:p}"))
.field("parent", &self.parent)
.field("srcpad", &self.srcpad)
.finish()
@ -1043,7 +1051,7 @@ pub struct GstAggregatorPad {
impl ::std::fmt::Debug for GstAggregatorPad {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAggregatorPad @ {:p}", self))
f.debug_struct(&format!("GstAggregatorPad @ {self:p}"))
.field("parent", &self.parent)
.field("segment", &self.segment)
.finish()
@ -1064,7 +1072,7 @@ pub struct GstBaseParse {
impl ::std::fmt::Debug for GstBaseParse {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBaseParse @ {:p}", self))
f.debug_struct(&format!("GstBaseParse @ {self:p}"))
.field("element", &self.element)
.field("sinkpad", &self.sinkpad)
.field("srcpad", &self.srcpad)
@ -1102,7 +1110,7 @@ pub struct GstBaseSink {
impl ::std::fmt::Debug for GstBaseSink {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBaseSink @ {:p}", self))
f.debug_struct(&format!("GstBaseSink @ {self:p}"))
.field("element", &self.element)
.field("sinkpad", &self.sinkpad)
.field("pad_mode", &self.pad_mode)
@ -1147,7 +1155,7 @@ pub struct GstBaseSrc {
impl ::std::fmt::Debug for GstBaseSrc {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBaseSrc @ {:p}", self))
f.debug_struct(&format!("GstBaseSrc @ {self:p}"))
.field("element", &self.element)
.field("srcpad", &self.srcpad)
.field("live_lock", &self.live_lock)
@ -1185,7 +1193,7 @@ pub struct GstBaseTransform {
impl ::std::fmt::Debug for GstBaseTransform {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstBaseTransform @ {:p}", self))
f.debug_struct(&format!("GstBaseTransform @ {self:p}"))
.field("element", &self.element)
.field("sinkpad", &self.sinkpad)
.field("srcpad", &self.srcpad)
@ -1208,7 +1216,7 @@ pub struct GstCollectPads {
impl ::std::fmt::Debug for GstCollectPads {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstCollectPads @ {:p}", self))
f.debug_struct(&format!("GstCollectPads @ {self:p}"))
.field("object", &self.object)
.field("data", &self.data)
.finish()
@ -1225,7 +1233,7 @@ pub struct GstDataQueue {
impl ::std::fmt::Debug for GstDataQueue {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDataQueue @ {:p}", self))
f.debug_struct(&format!("GstDataQueue @ {self:p}"))
.field("object", &self.object)
.finish()
}
@ -1240,7 +1248,7 @@ pub struct GstPushSrc {
impl ::std::fmt::Debug for GstPushSrc {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPushSrc @ {:p}", self))
f.debug_struct(&format!("GstPushSrc @ {self:p}"))
.field("parent", &self.parent)
.finish()
}
@ -1712,6 +1720,31 @@ extern "C" {
initial_size: c_uint,
) -> *mut GstQueueArray;
//=========================================================================
// GstTypeFindData
//=========================================================================
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn gst_type_find_data_free(data: *mut GstTypeFindData);
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn gst_type_find_data_get_caps(data: *mut GstTypeFindData) -> *mut gst::GstCaps;
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn gst_type_find_data_get_probability(
data: *mut GstTypeFindData,
) -> gst::GstTypeFindProbability;
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn gst_type_find_data_get_typefind(data: *mut GstTypeFindData) -> *mut gst::GstTypeFind;
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn gst_type_find_data_new(
obj: *mut gst::GstObject,
data: *const u8,
size: size_t,
) -> *mut GstTypeFindData;
//=========================================================================
// GstAdapter
//=========================================================================
@ -1805,6 +1838,9 @@ extern "C" {
params: *mut gst::GstAllocationParams,
);
pub fn gst_aggregator_get_buffer_pool(self_: *mut GstAggregator) -> *mut gst::GstBufferPool;
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn gst_aggregator_get_force_live(self_: *mut GstAggregator) -> gboolean;
#[cfg(any(feature = "v1_20", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
pub fn gst_aggregator_get_ignore_inactive_pads(self_: *mut GstAggregator) -> gboolean;
@ -1827,6 +1863,9 @@ extern "C" {
duration: gst::GstClockTime,
info: *mut gst::GstStructure,
);
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn gst_aggregator_set_force_live(self_: *mut GstAggregator, force_live: gboolean);
#[cfg(any(feature = "v1_20", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
pub fn gst_aggregator_set_ignore_inactive_pads(self_: *mut GstAggregator, ignore: gboolean);
@ -2233,6 +2272,14 @@ extern "C" {
buf: *mut gst::GstBuffer,
prob: *mut gst::GstTypeFindProbability,
) -> *mut gst::GstCaps;
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn gst_type_find_helper_for_buffer_with_caps(
obj: *mut gst::GstObject,
buf: *mut gst::GstBuffer,
caps: *mut gst::GstCaps,
prob: *mut gst::GstTypeFindProbability,
) -> *mut gst::GstCaps;
#[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
pub fn gst_type_find_helper_for_buffer_with_extension(
@ -2247,6 +2294,15 @@ extern "C" {
size: size_t,
prob: *mut gst::GstTypeFindProbability,
) -> *mut gst::GstCaps;
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn gst_type_find_helper_for_data_with_caps(
obj: *mut gst::GstObject,
data: *const u8,
size: size_t,
caps: *mut gst::GstCaps,
prob: *mut gst::GstTypeFindProbability,
) -> *mut gst::GstCaps;
#[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
pub fn gst_type_find_helper_for_data_with_extension(
@ -2279,5 +2335,11 @@ extern "C" {
caps: *mut *mut gst::GstCaps,
prob: *mut gst::GstTypeFindProbability,
) -> gst::GstFlowReturn;
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn gst_type_find_list_factories_for_caps(
obj: *mut gst::GstObject,
caps: *mut gst::GstCaps,
) -> *mut glib::GList;
}

View file

@ -41,7 +41,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
return Err(format!("compilation command {cmd:?} failed, {status}").into());
}
Ok(())
}
@ -57,7 +57,7 @@ fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<dyn Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
Err(err) => Err(format!("{name} {err}").into()),
}
}
@ -71,7 +71,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
return Err(format!("command {cmd:?} returned {}", out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
@ -127,15 +127,14 @@ fn cross_validate_constants_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
"Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}",
);
continue;
}
@ -165,16 +164,13 @@ fn cross_validate_layout_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",);
continue;
}
@ -195,7 +191,7 @@ fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
return Err(format!("command {abi_cmd:?} failed, {output:?}").into());
}
Ok(String::from_utf8(output.stdout)?)

View file

@ -1,6 +1,6 @@
[package]
name = "gstreamer-check"
version = "0.19.0"
version = "0.19.8"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Check library"
@ -15,9 +15,9 @@ rust-version = "1.63"
[dependencies]
bitflags = "1.0"
ffi = { package = "gstreamer-check-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
ffi = { package = "gstreamer-check-sys", version = "0.19", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16.2" }
gst = { package = "gstreamer", version = "0.19", path = "../gstreamer" }
[dev-dependencies]
gir-format-check = "0.1"

View file

@ -66,6 +66,26 @@ You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
We recommend using the official GStreamer binaries over Homebrew, especially
as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964).
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and
`gstreamer-1.0-devel-1.20.4-universal.pkg`.
After installation, you also need to set the `PATH` environment variable as
follows
```console
$ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
```
Also note that the `pkg-config` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### Homebrew
Homebrew only installs various plugins if explicitly enabled, so some extra
@ -81,19 +101,6 @@ $ brew install gstreamer gst-plugins-base gst-plugins-good \
Make sure the version of these libraries is >= 1.14.
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.14.0-x86_64.pkg` and
`gstreamer-1.0-devel-1.14.0-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### Windows
@ -103,6 +110,32 @@ with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
We recommend using the official GStreamer binaries over MSYS2.
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and
`gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that
matches your Rust toolchain, i.e. MinGW or MSVC.
After installation set the ``PATH` environment variable as follows:
```console
# For a UNIX-style shell:
$ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}"
# For cmd.exe:
$ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH%
```
Make sure to update the path to where you have actually installed GStreamer
and for the corresponding toolchain.
Also note that the `pkg-config.exe` from GStreamer should be the first one in
the `PATH` as other versions have all kinds of quirks that will cause
problems.
#### MSYS2 / pacman
```console
@ -120,20 +153,6 @@ Note that the version of `pkg-config` included in `MSYS2` is
compiling GStreamer, so you may need to install another version. One option
would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/).
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.14.0.msi` and
`gstreamer-1.0-devel-x86_64-1.14.0.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```console
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started

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