Commit graph

695 commits

Author SHA1 Message Date
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
Sebastian Dröge
f417d68820 Remove usage of glib_floating_reference_guard!()
It's not needed anymore.
2019-12-07 23:05:14 +02:00
Sebastian Dröge
2375c9da59 gstreamer/element: Don't steal floating references passed into release_pad()
They are apparently not part of this element so we can directly return
here instead of stealing the reference.
2019-12-07 22:58:26 +02:00
Sebastian Dröge
802fa4fcb4 gstreamer/bin: Take a strong reference of the element passed into remove_element()
It might be gone once we called into the parent class' implementation so
we need to keep a strong reference around here. Also we need to ensure
that we don't accidentally steal a floating reference from the caller
here: if the element is still floating it is apparently not part of this
bin and we can directly return FALSE.
2019-12-07 22:56:11 +02:00
Sebastian Dröge
bef1143df3 gstreamer/device: Preserve floating reference flag from create_element() parent class' implementation 2019-12-07 22:51:57 +02:00
Sebastian Dröge
84ac2ef073 bin: Use from_glib_none() in Bin::add() for subclasses
This way we take ownership of any floating references passed in here, as
required by the GstBin API, instead of just borrowing the reference and
having someone else sink it or not.
2019-12-04 18:49:12 +02:00
François Laignel
fd6bbf5929 Fully qualify glib_bool_error! in gst_loggable_error! 2019-11-21 19:18:01 +01:00
Sebastian Dröge
175863668d Regenerate everything with latest gir 2019-11-21 09:52:51 +02:00
François Laignel
dc7937a8d4 Don't leak missing Safety doc clippy warnings
With rustc 1.40.0, clippy checks that the `unsafe` functions come with
a `Safety` section. When running clippy on a downstream crate, the
macros such as `gst_plugin_define!` leak the clippy warnings for the
unsafe functions.

Silence the warnings for now.
2019-11-18 10:25:06 +01:00
Sebastian Dröge
9f121b1f12 gstreamer/sample: Silence clippy warning
warning: methods called `new` usually return `Self`
   --> gstreamer/src/sample.rs:107:5
    |
107 | /     pub fn new<'a>() -> SampleBuilder<'a> {
    | |_____^
2019-11-14 12:11:10 +00:00
Sebastian Dröge
0c944cb26e gstreamer: Add documentation to gst::deinit() about when it's safe to be called 2019-11-14 12:11:10 +00:00
Sebastian Dröge
8b687ab4a7 Remove header from the README.md about the move from github to gitlab
At this point everybody should've noticed.
2019-11-14 10:21:02 +00:00
Guillaume Desmottes
1206dc5b15 gstreamer: typefind: add binding for gst_type_find_get_length() 2019-11-14 09:33:29 +00:00
Sebastian Dröge
043af60126 iterator: Fix leak of the closure in Iterator::filter() 2019-11-13 12:18:21 +01:00
Sebastian Dröge
3d1b3211bf promise: Add unit test for change func handling 2019-11-13 12:13:14 +01:00
Sebastian Dröge
d69e8e237f promise: Remove unneeded feature gates 2019-11-13 12:05:25 +01:00
Sebastian Dröge
cd55f02e20 promise: Change change_func to get the actual reply of the promise passed 2019-11-13 11:40:41 +01:00
Sebastian Dröge
77c6741ae0 Update to futures 0.3 and require Rust 1.39
Also use async/await in the futures examples.
2019-11-11 12:18:49 +01:00
Guillaume Gomez
9e30687d8e Fix glib reexports 2019-11-11 11:34:09 +01:00
Guillaume Gomez
a58cd4b5bc Manual code fixes 2019-11-11 11:34:09 +01:00
Guillaume Gomez
457ac9118b Regenerate with latest gir 2019-11-11 11:34:09 +01:00
Sebastian Dröge
8dcf3fec20 gstreamer: Change Sample constructor to the builder pattern
Simplifies construction of Samples considerably.
2019-10-23 09:55:56 +03:00
Sebastian Dröge
2d2459ed52 Export traits from the crate level and ensure that all traits are in the preludes 2019-10-17 13:30:35 +03:00
Sebastian Dröge
132eb891ed Fix dox feature and docs.rs Cargo.toml metadata 2019-10-05 00:13:29 +03:00
Sebastian Dröge
991f2e1576 Update and regenerate everything with latest gir 2019-10-05 00:03:57 +03:00
Fernando Jimenez Moreno
591468f53b gstreamer/log: Use non-panicking UTF8 conversion in log handler
Make sure that `log_handler` and `DebugMessage::get` do not panic while
processing non-UTF8 characters by using lossy instead of strict UTF8
string conversion.
2019-10-04 09:03:28 +00:00
Sebastian Dröge
06cfcd57fc Move to_string() methods into the Display trait or rename to to_str(), move from_string() into the FromStr trait
Fixes clippy warnings, prevents confusing errors and is more consistent.

The Display trait provides a to_string() method by itself and FromStr
provides from_str().
2019-10-04 11:01:55 +03:00
Sebastian Dröge
861f5c1e1a Re-run cargo fmt
Minor changes in the latest version.
2019-10-04 08:19:24 +03:00
Sebastian Dröge
19b3427909 clock: Move wake_id() from ClockId to ClockImpl
This shouldn't really be called on anything outside a Clock
implementation.
2019-09-26 11:25:52 +03:00
Sebastian Dröge
6abb0d3506 gstreamer: Add support for subclassing gst::SystemClock 2019-09-25 17:22:15 +03:00