Commit graph

56 commits

Author SHA1 Message Date
Sebastian Dröge ae4dd88f3d Update for GLib Into<Value> changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1156>
2022-11-26 15:19:35 +02:00
Vivia Nikolaidou 6f51444c1f audio: Add channel_mask() and default_channel_mask() to AudioCapsBuilder
Also use default_channel_mask() where applicable
2022-10-14 16:58:19 +03:00
Vivia Nikolaidou 6d4ad712c7 examples, audio, pbutils, video: Use AudioCapsBuilder and VideoCapsBuilder
Simplify caps creation code
2022-10-14 13:59:51 +03:00
François Laignel 8e2c621a9f gst/lib: cleanup format re-exports 2022-10-10 15:10:10 +02:00
Sebastian Dröge 879d6a4548 audio: Use new 1.63 std::array::from_fn instead of the external array-init crate 2022-09-05 18:10:17 +03:00
François Laignel fe319af598 Implement FormattedValue on any candidate type
The trait FormattedValue was only implemented on types which
could implement the full range of values for a Format. In order
to declare a function which could take both the intrinsic type
of any Format (e.g. `ClockTime`) as well the full range of values
(e.g. `Option<ClockTime>`), the argument was declared:

```rust
    impl Into<GenericFormattedValue>,
```

This commit implements `FormattedValue` for any type representing
a format. E.g.: both `ClockTime` and `Option<ClockTime>` will now
implement `FormattedValue`. The trait `FormattedValueFullRange`
is implemented on types which can be built from any raw value.

These changes are intended to help for the implementation of a
means to enforce format conformity at compilation time for
functions with multiple formatted value arguments.

The following signatures were found to be incorrect and are fixed:

- `message::StepDone`: forced the type for `amount` and `duration`
  to be of the same type, when `duration` is expected to be of the
  `Time` format.
- `query::Convert::set`: the two arguments were forced to the same
  type, so potentialy the same format, unless a
  `GenericFormattedValue` was used.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1059
2022-07-11 19:45:52 +02:00
Sebastian Dröge ee1a5e8395 Add #[must_use] attribute to many builders 2021-12-04 10:26:08 +02:00
Sebastian Dröge b4a3738b82 Move more code to caps/structure builders
Instead of the new() functions requiring slices. The code reads cleaner.
2021-10-24 18:57:15 +03:00
François Laignel e31ce9d07b Manual ClockTime updates 2021-06-04 22:09:38 +02:00
Guillaume Gomez 5ba79976a9 Generate missing doc aliases for newtypes 2021-06-01 15:15:59 +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 66b60a0822 audio: Fix all clippy::use_self warnings 2021-04-30 10:02:55 +02:00
Marijn Suijten 10c93807fb Replace explicit type with Self in for_value_type::<> turbofish 2021-04-30 10:02:47 +02:00
Bilal Elmoussaoui 890cd03632 manual renames of to_glib into into_glib 2021-04-27 19:44:41 +02:00
Sebastian Dröge eda1d3d4a7 Update for Value trait refactoring 2021-04-25 14:45:08 +03:00
François Laignel 6ab9164dca fix-getters-calls 0.3.0 pass 2021-04-20 18:18:02 +02:00
François Laignel 53be8e5f58 fix-getters-{def,calls} pass 2021-04-13 17:54:40 +02:00
Sebastian Dröge ce1148b474 Update everything for glib macro renamings 2020-12-18 00:56:47 +02:00
Guillaume Gomez ff5a36561a Fix license header situation 2020-12-15 11:53:31 +01:00
Guillaume Gomez fb56af8d84 Update from_glib calls and put them in unsafe blocks 2020-12-08 15:50:15 +01:00
Marijn Suijten 2447664df6 Replace Result<(), fmt::Error> with fmt::Result 2020-12-07 12:09:39 +01:00
Sebastian Dröge 4a928136ed gstreamer-audio: Update manual code to 2018 edition 2020-11-22 19:15:20 +02:00
Sebastian Dröge 947ac8db5c Name functions returning a builder builder(), not new()
And also make the video event API more consistent with the normal event
API.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/269
2020-06-25 19:42:33 +03:00
Sebastian Dröge be00953ec6 audio: Add AudioInfo::is_valid() and guard against finfo being NULL when retrieving the audio format 2020-06-07 18:58:54 +03:00
Tony Jinwoo Ahn c563fb6f44 gstreamer-audio/audio_info: Change functions from returning Option to Result
Partial work for:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
2019-12-14 14:10:06 +00:00
Sebastian Dröge 1eb5525a27 Update array-init to 0.1 and gl_generator to 0.13 2019-07-24 14:23:15 +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 f84e94db78 audio: AudioInfo: display format info in Debug 2019-07-03 15:27:30 +02:00
Sebastian Dröge e7898c1b24 Update manual code 2019-04-15 19:19:19 +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 bd0cbe99b3 Add more Debug impls to everything possible 2019-01-22 17:46:08 +02:00
Sebastian Dröge 255243c16a Implement Sync for VideoInfo and AudioInfo
They are immutable on the Rust side after all.
2018-09-22 10:56:25 +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 f271c99498 Implement fmt::Debug for AudioInfo 2018-06-08 10:19:06 +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
Sebastian Dröge 4864a1e089 Fix build 2018-03-19 10:32:07 +02:00
Sebastian Dröge 4117c01ff2 Run everything through latest rustfmt-nightly 2018-02-22 11:18:37 +01:00
Sebastian Dröge e0dc84c10a Run everything through rustfmt again 2017-12-20 19:30:14 +02:00
Sebastian Dröge 8bdd24a840 Run everything through rustfmt again 2017-12-16 14:53:00 +02:00
Sebastian Dröge 70e031b729 VideoInfo/AudioInfo are not Sync, only Send 2017-12-16 11:40:36 +02:00
Sebastian Dröge 0eb32f0483 Some nullability fixes in gstreamer-audio 2017-12-16 10:56:59 +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 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 3179806f01 Regenerate everything with latest GIR
And fix-up manual code
2017-11-05 19:08:39 +02:00
Sebastian Dröge e1d134c4be Run everything through latest rustfmt-nightly 2017-10-17 12:06:51 +03:00
Sebastian Dröge 19c5556239 Regenerate with latest GIR 2017-10-01 15:52:15 +02:00
Sebastian Dröge f0935d7e1e Add remaining gst_init() assertions 2017-08-30 14:39:09 +03:00