Commit graph

724 commits

Author SHA1 Message Date
Sebastian Dröge
122ccafd1a gstreamer/gstreamer-app: Don't store strong references in futures Stream/Sink adapters
This applies to the ones of the appsink, appsrc and bus. If we would
store a strong reference then they would keep alive the underlying
object forever even if their pipeline disappeared in the meantime.

Like this e.g. the bus stream would start returning None once the bus
was destroyed, similar to how other channels are working in Rust.
2020-05-27 14:51:21 +03:00
Guillaume Desmottes
605898277f gstreamer: caps: add new_from_iter(_with_features)() 2020-05-27 14:51:21 +03:00
Guillaume Desmottes
b724e0c46c gstreamer: structure: add new_from_iter()
Allow to easily create a new Structure from an iterator.

Fix #250
2020-05-27 13:28:42 +03:00
Sebastian Dröge
d623bcdce5 gstreamer: Add Stream::debug() and StreamCollection::debug()
These provide more helpful debug output than just the pointer when
printing.
2020-05-27 13:28:22 +03:00
Sebastian Dröge
43e7f9f589 Update version to 0.15.5 2020-05-03 09:52:04 +03:00
Sebastian Dröge
4a8b904c6c Update CHANGELOG.md for 0.15.5 2020-05-03 09:51:01 +03:00
Sebastian Dröge
451c198cec Run everything through cargo fmt again 2020-04-30 11:01:25 +03:00
Sebastian Dröge
774281a0c9 gstreamer: Add some API to calculate the next state convert state changes into their component states and back 2020-04-30 10:58:34 +03:00
Sebastian Dröge
d23d313b39 gstreamer: Add Element::get_current_clock_time() and ::get_current_running_time()
This was added in GStreamer 1.18 but we can easily implement it
ourselves here for the time being and for older versions.
2020-04-30 10:57:12 +03:00
Sebastian Dröge
96c83bc0e6 gstreamer: Add bindings for Plugin::get_plugin_name()
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/248
2020-04-30 10:57:03 +03:00
Sebastian Dröge
5479b23eb9 Use mem::ManuallyDrop instead of mem::forget() everywhere
It makes the intentions clearer and potentially results in simpler
assembly, at least in debug builds.
2020-04-30 10:56:38 +03:00
Sebastian Dröge
973ac7344e gstreamer/buffer: Add tests for various memory related buffer API 2020-04-30 10:56:20 +03:00
Sebastian Dröge
2bbfbb5842 gstreamer/buffer: Add iterators for iterating over the memories inside a buffer
With immutable, mutable and owned variant.
2020-04-30 10:56:13 +03:00
Sebastian Dröge
0749250743 gstreamer/buffer: Add BufferRef::peek_memory_mut() function
This gives a mutable reference to the given memory and fails if the
memory is not actually writable.
2020-04-30 10:56:02 +03:00
Sebastian Dröge
e8c5f5fb6b gstreamer/log: Replace % with %% in the debug message
Otherwise gst_debug_log() will look for further arguments that don't
exist, and will likely crash or worse.
2020-04-30 10:54:09 +03:00
Sebastian Dröge
8077b7ac82 Revert "gstreamer/log: Allow any glib::Object as target for logging"
This reverts commit 67e6afc628.

Unfortunately this breaks the API due to how subclassing is modeled in
the GObject bindings.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/251
2020-04-30 10:19:55 +03:00
Sebastian Dröge
ef77a5ae92 Update versions to 0.15.4 2020-03-09 23:01:42 +02:00
Sebastian Dröge
079095b55c Update CHANGELOG.md for 0.15.4 2020-03-09 23:01:42 +02:00
Sebastian Dröge
2599acc681 gstreamer/caps: Assert on ANY caps in fixate() and work around bug in handling EMPTY caps
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/388
2020-03-09 23:01:42 +02:00
Sebastian Dröge
671605d8ac Minor cleanup in various places 2020-03-09 22:49:51 +02:00
Sebastian Dröge
4e30798ac7 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-03-09 22:49:51 +02:00
Sebastian Dröge
ed80467ff6 Make sure to hold MutexGuard for the remainder of the function in various places
Not assigning it to a variable would cause it to be dropped immediately
and the lock to be released again immediately.
2020-03-09 22:49:50 +02:00
Sebastian Dröge
67e6afc628 gstreamer/log: Allow any glib::Object as target for logging
gst::Object is not actually required. For plain glib::Objects only the
pointer address is printed instead of a name but it works fine.
2020-03-09 22:42:26 +02:00
Sebastian Dröge
0e69898faf Update version to 0.15.3 2020-02-15 10:46:41 +01:00
Sebastian Dröge
45b7676d02 Update CHANGELOG.md for 0.15.3 2020-02-15 10:46:14 +01:00
Sebastian Dröge
315a59e47d Allow changing bus sync handler and appsink/src callbacks when running with 1.16.3 or newer
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
2020-02-15 10:35:35 +01:00
Sebastian Dröge
3b56f470e5 Only allow setting Bus sync handler and AppSrc/Sink callbacks once
Re-setting them is not thread-safe and can cause segfaults or worse.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/506
and https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/729
2020-02-15 10:33:53 +01:00
Valmir Pretto
66338881e8 gstreamer: BusStream tests 2020-02-15 10:29:43 +01:00
Valmir Pretto
5beb871419 gstreamer: BusStream cleanup
A few small readability changes
2020-02-15 10:29:38 +01:00
Sebastian Dröge
9b593f626b gstreamer/promise: Add Future constructor for Promise
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.
2020-02-15 10:14:35 +01:00
Sebastian Dröge
188ef1e242 impl Clone for BufferPoolConfig and PlayerConfig 2020-02-15 10:11:19 +01:00
Sebastian Dröge
a47a6ea76c Update versions to 0.15.2 2020-01-30 00:20:38 +02:00
Sebastian Dröge
e5397f5a33 Update CHANGELOG.md for 0.15.2 2020-01-30 00:20:22 +02:00
Sebastian Dröge
41663f15ef bus: Don't use the bus sync handler in the bus Stream to notify about messages being available
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
2020-01-28 23:43:41 +02:00
Sebastian Dröge
8a9be64c3f Update version to 0.15.1 2020-01-23 08:06:17 +02:00
Sebastian Dröge
3a8ae5ddd4 Update CHANGELOG.md for 0.15.1 2020-01-23 08:06:00 +02:00
Sebastian Dröge
fc1e909925 gstreamer/childproxy: Fix unused variable compiler warnings 2020-01-22 22:31:10 +02:00
Sebastian Dröge
5577e8a457 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 22:31:10 +02:00
Sebastian Dröge
456ad9fb4a gstreamer/childproxy: Don't require implementing child_added/removed() signal vfuncs
Most implementers will not care about default handlers for these signals
so requiring to implement them is only unnecessarily verbose.
2020-01-22 22:31:10 +02:00
Sebastian Dröge
b127f93cb9 bus: Take the mutex before popping messages for the bus stream
Otherwise a message might arrive between popping, getting None and
locking the mutex for storing the waker. In that case we would never
be woken up.
2020-01-22 22:31:10 +02:00
Sebastian Dröge
db1c341cdf gstreamer/element: Add call_async_future() that returns a future
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))
2020-01-22 22:31:10 +02:00
Guillaume Desmottes
c29a7638d3 gstreamer: caps: BuilderFull: prevent adding features if using any
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.
2020-01-22 19:44:43 +02:00
Guillaume Desmottes
7f07bac0c7 gstreamer: add Caps::builder_full()
API to create a caps containing multiple structures.
Fix #231
2020-01-22 19:44:15 +02:00
Sebastian Dröge
3425bcfe9d 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-22 19:44:09 +02:00
Sebastian Dröge
fedf4b664a Fix various new clippy warnings from 1.40 2019-12-23 13:40:58 +02:00
Sebastian Dröge
6fd13cc807 Update versions of all dependencies and point to releases instead of GIT 2019-12-18 19:15:21 +02:00
Sebastian Dröge
bb321f7fa8 Update CHANGELOG.md for 0.15.0 2019-12-18 19:15:21 +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
eaafbd14f7 Regenerate 2019-12-15 12:19:33 +02:00