Previously it was not thread-safe to change them and could lead to
crashes but with 1.16.3 it is now.
Unsetting the bus sync handler before 1.16.3 will have no effect at all,
setting a new bus sync handler or appsink/src callbacks will panic.
This partially reverts 2f88dc6576
warning: called `map(f)` on an Option value where `f` is a unit closure
--> gstreamer-base/src/subclass/base_transform.rs:683:13
|
683 | / (*parent_class)
684 | | .before_transform
685 | | .map(|f| f(element.to_glib_none().0, inbuf.as_ptr() as *mut _));
| |_______________________________________________________________________________^
|
= note: `#[warn(clippy::option_map_unit_fn)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
This returns a tuple that basically works like a oneshot channel: the
Promise acts as the "sender" and once the promise resolves the
"receiver" contains the result.
This is racy and can cause the consumer of the messages to never be
woken up anymore:
1. Waker is stored because no message on the bus
2. Sync handler is called, waker is woken up
3. Bus is polled again and no message is on it (yet),
new waker is registered
4. Bus stores the message from 2. in its queue (after
the sync handler has returned BusSyncReply::Pass)
5. No new message ever appears on the bus because all
this happened for the very last message
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/235
For the latter introduce an actual opaque type that allows using them
for comparison purposes but is not just a plain u64.
For the former represent them as opaque type around an NonZeroU32. 0 is
the invalid case and does not happen in the majority of functions. Where
it can happen, represent this case by using an Option<_> instead.
This makes it harder to mis-use these types.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/209
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.
The future would resolve into the return value of the closure that is
called asynchronously on the thread pool, and allows asynchronous
awaiting for it to finish.
let res = element.call_async(|element| {
element.set_state(gst::State::Playing)
}).await;
assert_eq!(res, Ok(gst::StateChangeSuccess::Success))
Rework the API to statically prevent users adding extra features if the
builder has been created with builder_full_with_any_features(). It
doesn't make sense to add extra features if all are already included.
It does not borrow from anything else and can be safely stored away.
Only the VideoCodecState<InNegotiation> is actively borrowing from the
element to ensure that it is only modified during negotiation in a safe
way.