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
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
6bba3d8518
Add 'static trait bound to all ExtManual traits and get rid of trait bounds for their impls
2018-12-08 14:58:14 +02:00
Víctor Manuel Jáquez Leal
ec8727c3ca
Make rustfmt in CI happy
2018-11-23 15:32:05 +01:00
Sebastian Dröge
ec2a0635ca
Port Pad subclassing
2018-11-21 16:14:06 +02:00
Arun Raghavan
f4685c4629
Use FlowError instead of FlowReturn as error part of Result
...
This prevents the possibility of a Result that is an Err(Ok), which
would not be meaningful.
2018-10-29 14:40:39 +00:00
Sebastian Dröge
eb0a804a50
Run everything through latest rustfmt
2018-10-08 15:02:23 +03:00
Sebastian Dröge
0d70950821
Implement Pad::sticky_events_foreach()
2018-08-13 19:58:30 +03:00
Sebastian Dröge
ccca8248c3
Add getter for the current pad mode
2018-08-01 19:28:57 +03:00
Sebastian Dröge
33a6aab6d7
Run everything through latest rustfmt
2018-07-27 13:36:40 +03:00
Sebastian Dröge
ec8b55ec30
Stream-line pad probe code
...
Don't take another reference of the data passed through the pad probes,
i.e. keeping buffers writable if they're writable.
2018-07-26 03:14:04 +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
e0972ae1e5
Get rid of manual usage of callback_guard!
2018-06-24 14:52:50 +03:00
JohanGoversTech
db3fe69415
Change return type of add_probe to support removing ( #116 )
...
* Change return type of add_probe to support 0 PadProbeId
* use from_glib for the conversion of the PadProbeId
2018-06-14 15:45:54 +03:00
Sebastian Dröge
2cefd9aea6
Re-run everything through rustfmt
2018-04-25 11:13:14 +03:00
Sebastian Dröge
492c3d656c
Run everything through rustfmt again
2018-04-01 11:57:58 +03:00
Sebastian Dröge
a3b294f0f2
Add back callback guards
2018-03-02 21:34:29 +02:00
Sebastian Dröge
f1426c82ba
Remove callback guards
...
Since Rust 1.24 it is safe to let panics go to the FFI boundary
2018-02-17 19:58:41 +02:00
Sebastian Dröge
ad219dd171
Remove PAD_PROBE_ID_INVALID and Default impls for PadProbeId and NotifyWatchId
...
These should never ever be 0, and passing 0 to any of the functions
using them will result in assertions.
2018-01-25 21:06:39 +02:00
Sebastian Dröge
e0dc84c10a
Run everything through rustfmt again
2017-12-20 19:30:14 +02:00
Sebastian Dröge
5065bc76ee
Rename FormattedValue::from_glib/to_glib to from_raw/to_raw_value
...
Otherwise we conflict with GLib translation traits, which causes some
annoyances.
2017-12-10 12:10:25 +02:00
Sebastian Dröge
c99928d030
Change FormatValue related API to be more convenient to use
...
FormatValue is now renamed to GenericFormattedValue and the API slightly
changed. In addition there is now a FormattedValue trait, and a
SpecificFormattedValue trait plus types for Bytes, Buffers and the
existing ClockTime.
This allows to create functions like
Pad::query_duration<F: SpecificFormattedValue>() -> Option<F>
and doesn't require the caller to unwrap the generic value anymore,
which is completely unneeded in these cases.
In addition, Segment became FormattedSegment<T> with API to
upcast/downcast between the specific formatted values and the generic
formatted value. This greatly simplifies usage of Segments.
2017-12-09 19:45:18 +02:00
Sebastian Dröge
411f54afed
Run everything to rustfmt again
2017-12-01 19:02:53 +02:00
Sebastian Dröge
94ba143c74
Allow anything that implements Into<Option<&str>> to be used for creating new pads
2017-11-21 16:16:56 +02:00
Sebastian Dröge
c39c0c7264
Implement ClockTime as ClockTime(Option<u64>)
...
And also implement a FormatValue type that holds a value together with
its format to make usage of the positions/durations/seek positions/etc
more convenient and safe.
Fixes https://github.com/sdroege/gstreamer-rs/issues/3
2017-11-11 11:57:29 +01:00
Sebastian Dröge
e1d134c4be
Run everything through latest rustfmt-nightly
2017-10-17 12:06:51 +03:00
Sebastian Dröge
9206ddba61
Add StaticCaps and StaticPadTemplate bindings
...
No way to create them though, just use lazy_static from Rust instead if
something like this is needed.
2017-10-15 11:08:56 +03:00
Sebastian Dröge
19e40a5e2c
Remove accidental leftover debug output
2017-09-18 20:44:59 +03:00
Sebastian Dröge
e026c2f652
Directly poke at GstPad struct for retrieving pad function data
...
glib-sys was just fixed: https://github.com/gtk-rs/sys/pull/62
2017-09-18 17:26:42 +03:00
Sebastian Dröge
f4958b71d7
Add test for pad tasks
2017-09-18 01:53:02 +03:00
Sebastian Dröge
c471a67e78
Add test for pad chain/event function and fix-up code
...
Need to handle NULL parents, and also work-around incomplete GstPad
struct definition in gstreamer-sys due to GHookList being incomplete.
2017-09-18 01:45:39 +03:00
Sebastian Dröge
dc6c7500df
Add bindings for remaining pad task functions
...
Especially Pad::start_task()
2017-09-18 00:32:29 +03:00
Sebastian Dröge
88f37b799c
Re-add Pad::iterate_internal_links()
...
It was accidentially dropped when making Iterator generic.
2017-09-18 00:24:36 +03:00
Sebastian Dröge
ce5c01a88e
Implement gst::Iterator as a generic type to not require using glib::Values everywhere
2017-09-17 18:45:38 +03:00
Sebastian Dröge
858b73a672
Add bindings for setting all the pad functions
2017-09-17 13:31:34 +03:00
Sebastian Dröge
b4cb81cd56
Run everything through latest rustfmt-nightly
2017-09-10 15:21:26 +03:00
Sebastian Dröge
85b335fd89
Fix/hide various clippy warnings in gstreamer
2017-09-10 15:21:26 +03:00
Sebastian Dröge
3b0e6843e2
Regenerate everything with latest GIR
2017-09-09 16:35:01 +03:00
Sebastian Dröge
8caf88810c
Don't implement Clone/Copy for PadProbeId
...
It's only possible to use it at most once.
2017-09-09 00:45:45 +03:00
Sebastian Dröge
f0935d7e1e
Add remaining gst_init() assertions
2017-08-30 14:39:09 +03:00
Sebastian Dröge
dc703cc6e9
Add push_list/chain_list functions to Pad
2017-08-14 22:24:54 +03:00
Sebastian Dröge
d6c032be7b
Add bindings for Pad::stream_lock()
2017-08-03 11:11:07 +03:00
Sebastian Dröge
09db28bbf5
Fix various clippy warnings
2017-08-02 19:40:31 +03:00
Sebastian Dröge
7c600bfce3
Fix unsafety of pad probes and sync bus handler
...
These can't be FnMut but must be Fn as they can be called from many
threads at the same time.
2017-08-01 15:28:36 +01:00
Sebastian Dröge
38496eca7d
Pass events by value instead of reference
2017-08-01 13:59:12 +01:00
Sebastian Dröge
03285a6311
Run everything through latest rustfmt-nightly
2017-07-31 12:16:42 +01:00
Sebastian Dröge
35160bedbc
Add support for Events in pad probes
2017-07-30 15:11:47 +01:00
Sebastian Dröge
2915bfa299
Add support for queries in pad probes
2017-07-29 16:09:14 +01:00
Sebastian Dröge
52dbf03d4f
Add functions using queries
2017-07-29 14:04:34 +01:00
Sebastian Dröge
5afa1858ed
Fix handling of pad probe info data for real
...
The miniobjects passed are never going to be writeable due to the
additional reference, but can safely be replaced.
2017-07-29 13:52:46 +01:00
Sebastian Dröge
29d4e3a56d
Handle bufferlists in pad probes
...
And fix replacing of the previous buffer/bufferlist
2017-07-28 19:18:08 +01:00
Sebastian Dröge
80265967f7
Add some more bindings related to buffers and taglists
2017-07-25 15:21:03 +03:00
Sebastian Dröge
e73f57cd31
Add support for Buffers in pad probes
...
Including replacing of the buffer with another one
2017-07-25 15:10:31 +03:00
Sebastian Dröge
9fdf422e9b
Random cleanup
2017-07-25 01:17:50 +03:00
Sebastian Dröge
e87c459099
Add bindings for pad probes
...
Missing for this to be actually useful: Buffer, BufferList, Event, Query bindings
2017-07-24 11:52:21 +03:00