Commit graph

61 commits

Author SHA1 Message Date
Bilal Elmoussaoui 4ebec84f5e Adapt to no longer renamed ffi crates
Allows us to set all the crates in the main workspace file, so changing
their versions or branch is much simpler and reduce the amount of noise
in the diff

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1450>
2024-06-02 11:20:55 +02:00
Sebastian Dröge 92064a0c41 Remove &mut BufferRef getter from write-mapped AudioBuffer / VideoFrame
This allows invalidating the buffer map.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1374>
2024-01-05 22:27:07 +02:00
Sebastian Dröge 38a9b7a242 video: Add array-based accessor for all video frame planes' data at once
This is mostly useful for getting mutable access to all planes at once.

Using `plane_data_mut()` for this is not possible as it would require
borrowing the frame mutably multiple times.

As each plane's data is not overlapping with any other plane we can
still provide such functionality safely.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1367>
2023-12-19 10:14:23 +02:00
Anders Hellerup Madsen f8effdda61 gl: export GLMemory getter methods on GLVideoFrame
also change `as_non_null_ptr()` to `as_raw()`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1312>
2023-10-02 11:33:57 +02:00
Anders Hellerup Madsen 6eb01dc916 video_frame: refactor traits
this adds an IsVideoFrame trait that makes it easier to provide all the
shared methods between VideoFrame, VideoFrameRef, GLVideoFrame and
GLVideoFrameRef. Now only a single method, `as_non_null_ptr()` has to be
implemented and the rest of the shared methods will be provided by the
`VideoFrameExt` trait.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1312>
2023-10-02 11:33:57 +02:00
Anders Hellerup Madsen 2a00236a1f video: extract common videoframe methods to trait
In preparation to make a more specialized VideoFrameGL this extracts
common helper functions valid for all VideoFrames into a trait that can
be implemented without too much code duplication.

Note that this is a breaking change, now VideoFrame and VideoFrameRef
cannot really be used without include the gst_video prelude.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1312>
2023-10-02 11:33:54 +02:00
Sebastian Dröge e584fdb17b video: Don't store a copy of the VideoInfo in VideoFrame
Instead just reference the one inside the FFI struct directly by making
sure that the memory representation of the FFI and Rust type are the
same.

This reduces the size of `VideoFrame` by about half.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1244>
2023-04-06 21:08:51 +03:00
Sebastian Dröge f0bb4e5bef video: Don't leak the gst::Buffer when converting a VideoFrame into an ffi::GstVideoFrame
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1219>
2023-02-13 14:29:10 +02:00
Sebastian Dröge 6ffb1db482 video: Don't forget to unmap the VideoFrame when converting into a gst::Buffer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1219>
2023-02-13 14:28:47 +02:00
Sebastian Dröge 37bfb78fdc Change some assertions to debug assertions
These assertions can only trigger because of bugs in the bindings
implementation or in the C code and not because of bugs in calling code,
so using debug assertions is perfectly fine for them and reduces the
number of assertions inlined everywhere in release builds.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1188>
2023-01-14 17:13:46 +02:00
Sebastian Dröge f235dc987d Inline various trivial functions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1177>
2023-01-11 11:33:54 +02:00
Sebastian Dröge f07727ee6d Use uninitialized stack memory for out parameters instead of zeroed memory if applicable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1187>
2023-01-11 09:06:38 +00:00
Sebastian Dröge 1b022a6b7c Get rid of unnecessary option wrapping
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1187>
2023-01-11 09:06:38 +00:00
Sebastian Dröge 567ce0a3bf Group and merge imports in all manual code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1182>
2023-01-04 13:25:17 +02:00
Sebastian Dröge eed648831d video: Add various VideoFormatInfo/VideoInfo/VideoFrame helper API 2022-04-04 15:50:09 +03:00
Sebastian Dröge 215cdfd548 video: Allow converting a VideoFrame into an FFI GstVideoFrame 2022-03-22 19:00:32 +02:00
Sebastian Dröge 0173b73170 Handle empty slices correctly
Passing `NULL` to `slice::from_raw_parts` is invalid.
2022-02-07 12:50:37 +02:00
Marijn Suijten 540062b97c Add missing doc aliases to manual code
Using the same script as [1], called with:

    python3 add_doc_alias.py gstreamer*/**/src

[1]: https://github.com/gtk-rs/gtk-rs-core/pull/83
2021-05-19 22:36:18 +02:00
Sebastian Dröge 255c0ff95e video: Don't return glib::Borrowed from VideoFrameRef::from_glib_borrow_mut()
For it to be usable we need a mutable reference, which Borrowed does not
provide. This should be handled via Pin at a later time, see
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/324
2021-05-09 19:15:47 +03:00
François Laignel 49583597ed manual code: fix-getters-def doc aliases 2021-05-03 20:46:57 +02:00
Marijn Suijten 28cf8434d0 video: Fix all clippy::use_self warnings 2021-04-30 10:58:35 +02:00
François Laignel 53be8e5f58 fix-getters-{def,calls} pass 2021-04-13 17:54:40 +02:00
Sebastian Dröge ce1148b474 Update everything for glib macro renamings 2020-12-18 00:56:47 +02:00
Guillaume Gomez ff5a36561a Fix license header situation 2020-12-15 11:53:31 +01:00
Guillaume Gomez fb56af8d84 Update from_glib calls and put them in unsafe blocks 2020-12-08 15:50:15 +01:00
Sebastian Dröge d31badf9ac gstreamer-video: Update manual code to 2018 edition 2020-11-22 19:15:20 +02:00
Sebastian Dröge febb0dfd16 video/video_frame: Allow getting an owned buffer from readable video frames
In all other variations this is not possible as it would allow to
circumvent the mini object writability rules.
2020-08-11 13:35:39 +03:00
Sebastian Dröge af01f1bc67 gstreamer: Simplify MiniObject bindings by removing one layer of abstraction
And instead directly implementing this via the macro on the target
types.
2020-06-30 11:06:02 +03:00
Sebastian Dröge 947ac8db5c Name functions returning a builder builder(), not new()
And also make the video event API more consistent with the normal event
API.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/269
2020-06-25 19:42:33 +03:00
Sebastian Dröge 926ed2f53d video: Don't unmap VideoFrameRef created from a VideoFrame
Otherwise we're going to unmap it twice. Also add a test for the
different interactions.
2020-06-07 15:22:33 +00:00
Sebastian Dröge 4f5aceaa5a video: Check that the passed in video info is valid when creating a VideoFrame 2020-06-07 15:22:33 +00:00
Sebastian Dröge 019afd54f9 Update for new from_glib_borrow signature
See https://github.com/gtk-rs/glib/pull/605
2020-04-05 18:48:48 +03:00
Sebastian Dröge 0b16556d9b video/video-frame: Implement immutable frame functions more generically 2020-01-30 23:11:12 +02:00
Sebastian Dröge d3c77f400d Don't derive Debug impls for generic types where the type parameters don't have to impl Debug themselves
This allows to use MappedBuffer and similar types to be properly
debug-printed.

Also change VideoFrame/VideoFrameRef/RTPBuffer from a tuple struct to a
struct with proper field names to make the code easier to understand.
2020-01-22 19:10:04 +02:00
Sebastian Dröge 2ba5105b80 Implement Sync/Send for more types and don't implement Send for TypeFind
They can actually be shared with multiple threads at the same time
safely as all functions requiring an immutable reference are
thread-safe.

OTOH TypeFind can't be shared safely between different threads as not
all implementations of the TypeFind struct are thread-safe.
2019-12-18 18:37:44 +02:00
Sebastian Dröge be3c378f28 Use Results instead of Options where they signal an error instead of just a missing value
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
2019-12-17 22:21:28 +02:00
Sebastian Dröge e3282c27f1 video: Generate VideoBufferFlags and add a extension trait for setting/getting them on buffers 2019-07-16 11:51:23 +03:00
Sebastian Dröge 424a87efbf Use MaybeUninit::zeroed() everywhere possible instead of mem::zeroed() 2019-07-11 17:56:50 +03:00
Sebastian Dröge e7898c1b24 Update manual code 2019-04-15 19:19:19 +03:00
Sebastian Dröge bd0cbe99b3 Add more Debug impls to everything possible 2019-01-22 17:46:08 +02:00
François Laignel 226070d216 BoolError: update to new build macros
See https://github.com/gtk-rs/glib/pull/419
2019-01-04 16:02:40 +01:00
Sebastian Dröge 43f5a10f9c Add API for mapping GL buffers as VideoFrameRef in addition to a full VideoFrame 2018-12-08 18:59:14 +00:00
Sebastian Dröge aea6f79ef9 Implement Send/Sync for VideoFrame
Closes #153
2018-11-26 11:13:13 +01:00
Víctor Manuel Jáquez Leal 284992d83a Add VideoFrame::from_glib_full() constructor
Thus it would be possible to instantiate gst_video::VideoFrame from
FFI's VideoFrame created outside of gstreamer_video's crate.

Fixes #152
2018-11-16 11:45:38 +01:00
Sebastian Dröge bc8da095c3 Add functions to get the FFI pointer behind a VideoFrame/VideoFrameRef 2018-09-28 17:35:48 +03:00
Sebastian Dröge 33a6aab6d7 Run everything through latest rustfmt 2018-07-27 13:36:40 +03:00
Sebastian Dröge 632d5f4c57 Change some empty structs to empty enums
These should only really exist at the type-level.
2018-07-25 10:07:20 +03:00
Sebastian Dröge 694bcaa697 Fix all clippy warnings
Or silence the ones we don't care about.
2018-07-20 10:28:20 +03:00
Sebastian Dröge 9a3ef2e9f1 Regenerate with latest GIR and update for the non-bitflags flags in -sys now 2018-04-04 10:47:12 +03:00
Sebastian Dröge 492c3d656c Run everything through rustfmt again 2018-04-01 11:57:58 +03:00