Commit graph

178 commits

Author SHA1 Message Date
Guillaume Gomez a0d82ec741 Merge README files and crate documentation 2021-07-30 20:26:11 +02:00
Sebastian Dröge b1afc4804a Fix various needless-borrow clippy warnings 2021-07-30 13:19:24 +03:00
François Laignel 90bb458e64 Rework ClockTime & FormattedValues 2021-06-04 22:09:38 +02:00
Marijn Suijten 540062b97c Add missing doc aliases to manual code
Using the same script as [1], called with:

    python3 add_doc_alias.py gstreamer*/**/src

[1]: https://github.com/gtk-rs/gtk-rs-core/pull/83
2021-05-19 22:36:18 +02:00
Marijn Suijten e8c90c9186 gstreamer/lib: Prevent fn deinit() docs from being stripped 2021-05-05 12:23:40 +02:00
Marijn Suijten e52e4328b3 Allow clippy::use_self on auto module 2021-04-30 10:02:47 +02:00
Marijn Suijten 5dade6a93c Disallow unused_imports in auto module again
This was temporarily allowed by Value trait refactoring, but the root
cause of the unused imports has been found (`glib::ToValue` for property
getters) and fixed in https://github.com/gtk-rs/gir/pull/1117.
2021-04-27 10:14:12 +02:00
Marijn Suijten 827ff99965 lib: Only export traits (Ext and ExtManual) from prelude
In gir it was brought up [1] that some traits (in particular
`*ExtManual`) are exported from the crate root in addition to the
prelude, cluttering the environment unnecessarily.  This commit removes
all these reexports, leaving those in prelude (that were already there)
only.

After this commit everything matching `Ext(Manual)?\b` in `lib.rs` sits
within `pub mod prelude {};`.

[1]: https://github.com/gtk-rs/gir/pull/1111
2021-04-26 11:25:23 +02:00
Sebastian Dröge eda1d3d4a7 Update for Value trait refactoring 2021-04-25 14:45:08 +03:00
Sebastian Dröge d746bf91e1 gstreamer: Provide better bindings for ElementFactoryListType
Make it an actual bitflags type instead of just an u64 alias and add all
the constants. As it's not defined as bitflags in C this needs to be
done manually.
2021-02-19 12:56:54 +02:00
Marijn Suijten 89c7883202 gstreamer: Automatically generate Allocator::alloc
Parameter mutability has been fixed (and reverted, hence overridden with
const=true)for this function in gstreamer; it can now be automatically
generated.
2021-02-15 20:19:38 +01:00
Sebastian Dröge ea0eb4fa70 gstreamer/paramspecs: Add bindings for GST_PARAM_CONTROLLABLE and related custom paramspec flags 2021-01-25 13:56:55 +02:00
Sebastian Dröge 68839c0e79 Re-export all dependency crates and their preludes
This makes code in examples potentially simpler.
2020-12-20 19:40:34 +02:00
Guillaume Gomez ff5a36561a Fix license header situation 2020-12-15 11:53:31 +01:00
Guillaume Gomez 8f9d76bb8c Revert "Remove unnecessary dox feature"
This reverts commit 9dd8bd9095.
2020-11-27 14:37:49 +01:00
Guillaume Gomez 9dd8bd9095 Remove unnecessary dox feature 2020-11-25 15:54:02 +01:00
Sebastian Dröge 9d9522016b gstreamer: Update manual code to 2018 edition 2020-11-22 19:15:20 +02:00
Marijn Suijten e88994a0b7 use cfg_if to refactor some #[cfg()] / #[cfg(not())] pairs 2020-11-19 16:39:31 +01:00
Marijn Suijten bd75778fcb Add doc(cfg()) on all manual files 2020-11-19 16:39:31 +01:00
Marijn Suijten 3f373f623a Enable feature(doc_cfg) in all lib.rs
The next version of gir is going to generate doc(cfg()) attributes on
many symbols to show feature-dependence hints. While autogenerated sys
crates get this attribute in their own (generated) lib.rs file the safe
wrapper crates do not have such an autogenerated lib.rs file.
2020-11-19 16:39:31 +01:00
François Laignel 9fb0c4937b ProxyPad: impl ExtManual functions as trait functions, not associated functions 2020-11-17 16:35:31 +01:00
Sebastian Dröge 027de84349 Update for class struct handling changes in the glib bindings
See https://github.com/gtk-rs/gtk-rs/pull/10
2020-11-05 16:41:48 +02:00
François Laignel ae9d97dfca ClockTime & opt Formats: fix PartialOrd impl, remove Ord and add min & max
- `PartialOrd` was returning `true` for expressions such as
  - `ClockTime::none() < ClockTime::from_seconds(1)`.
  - `ClockTime::from_seconds(1) > ClockTime::none()`.
- Remove `Ord` because `ClockTime` is not a total order due to
  `ClockTime::none()`. See test `not_ord`.

This also applies to others `Format(Option<{u32,u64}>)` types.
2020-10-20 23:40:18 +02:00
Sebastian Dröge 531014a35c gstreamer/clock: Improve ClockId bindings
There is now a separate type for Single and Periodic clock ids. This
allows to have API that is only for one type on that specific type
instead of doing runtime checks, and allows for more refined async
waiting API.
2020-10-10 10:25:44 +00:00
Alexey Galakhov 4120ded424 Add gstreamer-controller 2020-09-30 16:28:51 +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
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 ede4588e0c gstreamer: Add bindings for ProtectionMeta 2020-06-02 16:05:01 +03:00
Sebastian Dröge 834b6d8d69 gstreamer/proxypad: Convert default pad functions to plain functions on ProxyPad instead of a trait
This allows to use them properly when overriding these functions.
2020-04-23 15:37:18 +03:00
Sebastian Dröge aea43c428c gstreamer: Add Stream::debug() and StreamCollection::debug()
These provide more helpful debug output than just the pointer when
printing.
2020-04-14 17:31:54 +00:00
Sebastian Dröge 42d09c2834 gstreamer/buffer: Move BufferCursor/BufferRefCursor into its own module
It's quite a bit of code and can be kept nicely separate.
2020-04-07 12:59:24 +03:00
Sebastian Dröge 5fc68e252d gstreamer: Add missing BufferCursorRef re-export 2020-04-06 21:00:42 +03:00
Sebastian Dröge a884a419db gstreamer/buffer: Add a BufferCursor / BufferCursorRef helper structs
This implements Read/Seek or Write/Seek and allows to read/write/seek
into the buffer without merging the memories inside.

The writer also only maps the memory write-only as compared to all other
ways of accessing the buffer/memory data in a writable way, which have
to map it read-write.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/425
for a similar API proposal for GStreamer core.
2020-04-06 20:15:35 +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 cddccf9502 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-09 19:08:41 +02:00
Valmir Pretto 6263922b6d gstreamer: BusStream tests 2020-02-04 10:33:34 -03:00
Valmir Pretto 7663589d94 gstreamer: BusStream cleanup
A few small readability changes
2020-02-04 10:33:25 -03:00
Sebastian Dröge 63a8afafa5 gstreamer: Use more accurate types for Seqnum, GroupId and MetaSeqnum
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
2020-01-25 00:07:36 +02:00
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 b17f04e866 bus: Make bus Stream private and add functions on the bus directly for it
Also add a helper function that allows filtering the stream directly.
2020-01-22 10:05:36 +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
Guillaume Desmottes 01c4d08501 gstreamer: use thiserror crate
Make code simpler and fix deprecated warning when building on nightly as
Error::description is being deprecated.
2020-01-10 18:54:50 +05:30
Guillaume Desmottes c298577139 gstreamer: add MemoryRef::dump() 2019-12-24 09:15:34 +05:30
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 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
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 bacf4998ce clock: Add some more ClockId API for being able to implement clock subclasses 2019-09-25 17:22:15 +03:00
Sebastian Dröge 52509b4b95 Remove subclassing feature and make it the default 2019-09-09 11:51:07 +03:00
Jan Alexander Steffens (heftig) a30935ad1f
Iterator: Add a wrapper implementing std's Iterator
Transposing the item type lets us be a std-compatible Iterator.

The iterator is automatically resynced when resuming iteration after
yielding Resync. This lets some combinators like `collect` and `find`
work properly.
2019-09-04 14:34:05 +02:00