Commit graph

104 commits

Author SHA1 Message Date
Sebastian Dröge a316d610eb gstreamer: Update for glib::Type API changes 2021-02-25 12:49:47 +02:00
Sebastian Dröge ce1148b474 Update everything for glib macro renamings 2020-12-18 00:56:47 +02:00
Sebastian Dröge f3b5340875 Update for new simplified glib::Object::new() API 2020-12-17 17:43:17 +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 9d9522016b gstreamer: Update manual code to 2018 edition 2020-11-22 19:15:20 +02:00
François Laignel 8aba0597e4 Pad: use Result<FlowSuccess, FlowError> for flow return type 2020-11-18 16:59:25 +01:00
François Laignel 755496d0f9 Pad: allow handling Events in PadProbes 2020-11-18 16:59:23 +01:00
Sebastian Dröge 43d1d0a4e9 gstreamer/pad: Factor out PadProbeInfo handling from pad probe trampoline into separate functions
This makes that part of the code non-generic and thus allows the
compiler to not put a copy of it into every caller with a different
closure.

For a test with 3 pad probes this overall reduced the number of LLVM IR
lines needed for the pad probes to about 8.5% of what it was before
(4485 -> 381 lines).
2020-08-05 10:33:12 +03:00
Sebastian Dröge 4246a560fc gstreamer/ghost_pad: Move GhostPad specific code into the ghost_pad module 2020-07-10 12:12:03 +00: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
François Laignel 884e5e4e4a event: add constructor on target types
... and deprecate the `Event::new_*` forms.
2020-06-25 10:48:25 +02:00
Sebastian Dröge 07e786b44f gstreamer/pad: Add support for setting proxy pad functions on a ghost pad during construction 2020-06-22 21:20:20 +00:00
Sebastian Dröge a80471747c gstreamer/pad: Borrow the pad when taking the stream lock
Instead of taking a new reference to the pad.
2020-06-22 11:48:56 +03:00
Sebastian Dröge 79c457c8c4 gstreamer/pad: Rename Pad::builder_from_template() to builder_with_template()
Sounds more natural as it creates a build that is initialized *with* a
template.

But keep Pad::from_template() as it creates a new pad *from* a template.
2020-06-22 11:26:24 +03:00
Sebastian Dröge 0c0d671922 gstreamer/pad: Don't provide constructors anymore but instead a builder
This handles safely setting the pad functions during construction and
also has special support for ghost pads.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/247
2020-06-22 10:55:24 +03:00
Sebastian Dröge 210e7c8777 gstreamer/pad: Mark pad function setters as unsafe
This is not thread-safe and changing the function at a bad time will
cause crashes or worse. It's only really safe to set the functions right
after construction of the pad before any other code can know about it.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/247
2020-06-21 20:02:52 +03:00
Guillaume Desmottes a954c03bc0 functions: rename constructors in manual API
The idiomatic way for Rust constructors is to be named from_XXX()
instead of new_from_XXX() and with_XXX() instead of new_with_XXX().

Fix #460
2020-06-11 12:33:52 +02:00
Guillaume Desmottes 872024c372 fix option_as_ref_deref clippy warnings 2020-04-21 09:00:35 +02: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 7120d54a46 gstreamer/pad: Add tests for getrange functions 2020-04-02 19:58:15 +03:00
Sebastian Dröge d7e6c2e37f gstreamer/pad: Add support for filling the passed in buffer in the getrange function
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/242
2020-04-02 19:58:09 +03:00
Sebastian Dröge 7c2f3bafa0 gstreamer/pad: Add get_range_fill() and pull_range_fill() functions
These allow providing an already allocated, writable buffer.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/242
2020-04-02 19:57:28 +03:00
Sebastian Dröge 8d0fa62275 Minor cleanup in various places 2020-03-09 12:55:14 +02:00
Sebastian Dröge b21f576430 Add #[must_use] attribute to mutex guards / stream lock
It's usually a mistake if creating one of these and immediately dropping
them again as that would immediately unlock the mutex again.
2020-02-28 16:29:48 +02:00
Guillaume Desmottes a9adac85aa gstreamer: pad: fix build on Windows
GstPadProbeInfo.id is a gulong which are 32 bits on Windows.
2020-01-09 10:14:21 +00:00
Sebastian Dröge 775c5bfe27 gstreamer: Add getters/setters for BinFlags and fix flags API for PadFlags
The BinFlags API was accidentally used for PadFlags, allowing to set
BinFlags on pads which is not very useful.
2020-01-06 17:23:39 +02:00
Sebastian Dröge 8aac047af5 Use NonZeroU64/U32 for PadProbeId, NotifyId and DeviceMonitorFilterId
This allows for some further optimizations.
2020-01-05 11:09:46 +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 3a8d05075d Switch everything from mem::uninitialized() to MaybeUninit or mem::zeroed()
And also fix a few cases where mem::uninitialized() was simply wrong to
use.
2019-07-11 17:56:50 +03:00
Sebastian Dröge d1e562b9f6 Explicitly add dyn keyword to trait objects
Trait objects without are deprecated with the latest nightly and this
makes it more clear that we're doing dynamic dispatch anyway.
2019-06-06 09:09:34 +03:00
Sebastian Dröge 86e969d964 Remove various Into<Option<_>> trait bounds from functions
In autogenerated code these were already replaced but some manual code
still kept them.
2019-05-24 10:04:16 +00:00
Sebastian Dröge a986914bad Use Option<&T> instead of &Option<T> everywhere
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/203
2019-05-22 23:27:13 +03:00
Jan Alexander Steffens (heftig) 5398a80a73
gstreamer/pad: Add a probe test 2019-05-16 18:17:15 +02:00
Jan Alexander Steffens (heftig) d470881ac2
gstreamer/pad: Handle PadProbeReturn::Handled more correctly
If the probe returns Handled and the data was a Buffer we need to ensure
it was consumed. Queries need to be returned. The behavior of Handled
for other probes is not clear.
2019-05-16 16:55:02 +02:00
Jan Alexander Steffens (heftig) d5317cccdd
gstreamer/pad: Expose the flow_ret value in PadProbeInfo
This is present since GStreamer 1.5.90 so no feature flags needed.
2019-05-16 16:55:02 +02:00
Jan Alexander Steffens (heftig) 061683af7b
gstreamer/pad: Assert post-probe data did not become None
GStreamer does not allow the probe to consume the reference here.
2019-05-16 16:55:02 +02:00
Vivia Nikolaidou 1a65c674a9 Add unset_*_flags functions
Implemented for element, object, pad, and pipeline

https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/104
2019-05-11 15:51:33 +03:00
Vivia Nikolaidou 6403c06990 Add API for setting/getting object flags
Implemented for Object, Pipeline, Bin, Element, Plugin.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/104
2019-05-11 13:13:33 +03:00
Sebastian Dröge e7898c1b24 Update manual code 2019-04-15 19:19:19 +03:00
Sebastian Dröge 8c39da4e5b Update to Rust 1.31 linter-specific attributes 2019-03-04 15:16:01 +02:00
Sebastian Dröge 631eee13da gstreamer/pad: Use the correct type for destroying the pad task closure data
It's a Box<RefCell<_>> and not a plain Box<_> like for the other pad
functions, and doing this wrong causes crashes at runtime.
2019-03-01 19:49:27 +02:00
Sebastian Dröge 95f6844702 Fix various minor clippy warnings 2019-02-21 19:56:23 +02:00
Sebastian Dröge 42a8b9e505 Get rid of double-boxing for some other closures 2019-01-30 13:02:41 +00:00
François Laignel f59e35d0a3 Use LoggableError in user defined functions and callbacks
`LoggableError` ensures an error in a user defined function is always
logged. This commit changes eligible function signatures accordingly.
2019-01-26 11:58:30 +01:00
Sebastian Dröge bd0cbe99b3 Add more Debug impls to everything possible 2019-01-22 17:46:08 +02:00
François Laignel 333d71f92b Update functions returning bool to use Result<(), glib::BoolError>
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/171
2019-01-17 23:13:44 +01:00
Sebastian Dröge 43ec33a1db Remove some code that is nowadays generated by the glib_wrapper! macro 2019-01-16 15:23:53 +02:00
Sebastian Dröge 931c485150 Update manual code for glib API changes 2019-01-16 13:52:56 +02:00
François Laignel 948fb2ae4b Replace XXXReturn with Result<XXXSuccess, XXXError>
... in function signatures.

These breaking changes aim at improving usability by allowing users
to take advantage of Rust error management features sur as `ok_or`,
`map_err`, `expect` and the `?` operator. See the `examples` and
`tutorials` to get an idea of the impacts.
2019-01-11 18:33:04 +01:00