Commit graph

61 commits

Author SHA1 Message Date
Sebastian Dröge
7230aee069 Switch everything from lazy_static to once_cell::Lazy
Fewer macros, faster compile-time and the Lazy type will likely end up
in the standard library in a similar form to this.
2020-01-22 19:57:41 +02:00
Sebastian Dröge
aa29567171 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-20 12:03:59 +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
Vivia Nikolaidou
6488c42890 element: Added num_pads, num_src_pads, num_sink_pads
Exposing the corresponding struct element in GstElement
2019-09-03 17:14:47 +03: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
Guillaume Desmottes
1cd733fb0b gstreamer: allow to register using Rank enum directly
Prevent user to have to cast to a u32 manually.
2019-06-04 12:50:43 +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
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
5af54b8d94 Use the slice::windows() iterator instead of zipping twice for Element::link_many() and unlink_many()
Has the same effect but is easier to read and more efficient.
2019-04-10 16:30:26 +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
354f9fbfe4 Fix compilation of tests without features="v1_14" 2019-01-30 13:02:41 +00:00
Sebastian Dröge
42a8b9e505 Get rid of double-boxing for some other closures 2019-01-30 13:02:41 +00:00
Sebastian Dröge
49c5fa33ba Add tests for Element::foreach_pad() and Bus::set_sync_handler() 2019-01-29 16:45:35 +02:00
François Laignel
a88918dd5f Use glib_result_from_gboolean! where applicable 2019-01-26 12:46:37 +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
Philippe Normand
9534416760 Regenerate and fix manual bindings for GString support 2019-01-03 22:01:41 +00: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
Sebastian Dröge
56319f9294 Move subclassing infrastructure into the main bindings
And port Element bindings to the new infrastructure.
2018-11-21 16:14:06 +02:00
Sebastian Dröge
2240ef109f Regenerate with latest GIR and update for the glib::Quark changes 2018-07-30 11:46:40 +03:00
Sebastian Dröge
33a6aab6d7 Run everything through latest rustfmt 2018-07-27 13:36:40 +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
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
François Laignel
93442e94dd element: add feature gate for test_call_async
Fixes https://github.com/sdroege/gstreamer-rs/pull/92
2018-03-16 17:51:56 +02:00
Sebastian Dröge
11c974a55e Fix some unused import compiler warnings if using < v1_10 2018-03-16 12:28:20 +02:00
Sebastian Dröge
c38af51bf0 Add Element::call_async() bindings 2018-03-14 15:42:17 +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
9066cf0634 Add ErrorMessage type
This can be used to propagate an element error via a Result until the
place where it can be actually posted on an element.
2017-12-20 20:00:05 +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
34f70ee0d7 Derive more useful traits for various enums 2017-11-27 14:03:30 +02:00
Sebastian Dröge
9085474e37 Fix error/warning/info message macros that use format strings 2017-11-16 13:37:52 +02:00
Sebastian Dröge
9734ec29cc Implement macros for Element::message_full_with_details()
Allows attaching arbitrary structures to error/warning/info messages
2017-11-15 17:03:19 +02:00
Sebastian Dröge
d4bd1c2d76 Add dox feature to everything as needed 2017-11-12 13:33:02 +01:00
Sebastian Dröge
d857fbd349 Add helper macros for generating error/warning/info messages 2017-11-11 16:43:29 +01:00
Sebastian Dröge
5494e5b827 Use u32 instead of i32 for Element::message_full() line numbers 2017-11-11 16:38:54 +01: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
ec6dde855a Replace ulong for the property notify watches with a custom NotifyWatchId type 2017-10-27 17:55:48 +02:00
Sebastian Dröge
f08f0f6f15 Add tests for Bin::get_children() and Element::get_*pads() 2017-10-26 13:29:37 +02:00
Sebastian Dröge
20729497a2 Add ElementExtManual::get_{,src,sink}pads() functions
These can sometimes be more usable than the iterator based approach
2017-10-25 12:58:22 +02:00
Sebastian Dröge
e1d134c4be Run everything through latest rustfmt-nightly 2017-10-17 12:06:51 +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
3cb5b591ca Add bindings for Element::message_full() and _full_with_details() 2017-09-15 19:00:51 +03:00