Commit graph

3192 commits

Author SHA1 Message Date
François Laignel 2b4fcb131e gst/Signed: impl div & mul 2022-09-21 17:20:43 +00:00
François Laignel 1411c9e35e gst/Signed: use a new trait for into_{signed,positive,negative}
The functions `into_{signed,positive,negative}` used to be implemented
on the `FormattedValue` trait for convenience. This was wrong for the
following reasons:

- They aren't specific to `FormattedValue`s: they can also be
  implemented for regular unsigned integers such as `u64`, `usize` or
  `u32`.
- They were implemented for `format::Undefined` and all variants of
  `GenericFormattedValue`, some of which are already signed.

This commit introduces the new trait `UnsignedIntoSigned`, which makes
it possible to fix both of the above problems.

Users can build a `Signed` from an `Undefined`, an `i64`, `isize` or
`i32` thanks to the `From` trait implementations.
2022-09-21 17:20:43 +00:00
François Laignel 960befb2f5 gst/Signed: move signed ops macro to macro.rs
This will help with the implementation of Signed muls & divs for
`FormattedValue`s since we need to know about the inner types.
2022-09-21 17:20:43 +00:00
François Laignel 0d229b4c69 gst/format: separate non trait ops format macros from common ops 2022-09-21 17:20:43 +00:00
François Laignel 432cb36611 gst/Signed: add tests and fix some ops impl 2022-09-21 17:20:43 +00:00
François Laignel 8e6afe147e gst/Signed: impl Display and Displayable 2022-09-21 17:20:43 +00:00
François Laignel a1dbc7a0ee gst/format: use fmt::Display whenever possible
Previous implementation for the glib format new types built a
`String` for the displayable value. This commit uses `fmt`
mechanisms so as to limit useless allocations.
2022-09-21 17:20:43 +00:00
François Laignel e0d9f886e3 gst/format: add Signed::{positive, negative}
It's more convenient to use than:

```rust
    signed_val.positive_or(()).ok()
```
2022-09-21 17:20:43 +00:00
François Laignel 55ef309b16 gst/ClockTime: panic building from GST_CLOCK_TIME_NONE
Using `ClockTime::from_nseconds` it was possible to build a valid
`ClockTime` which would match `GST_CLOCK_TIME_NONE` when passed to
the C API, leading to unexpected behaviour as `GST_CLOCK_TIME_NONE`
is represented as an `Option::<ClockTime>::None` in Rust.

This commit panics when this function is called with
`GST_CLOCK_TIME_NONE` (defined as `u64::MAX`). This is similar to
what happens when calling other `ClockTime` constructors (e.g.
`from_seconds`) with too large a value: the internal multiplication
overflows leading to a panic.
2022-09-21 17:20:43 +00:00
François Laignel b8e1c25c85 gst/log: log arg eval fix non regression test 2022-09-21 17:20:43 +00:00
Jordan Petridis 253ba03a7a ci: Use correct variable for the upstream image repo 2022-09-20 17:47:43 +03:00
Jordan Petridis a75d881272 ci: Don't filter out scheduled pipelines
Close #370

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1105>
2022-09-16 16:18:55 +03:00
Sebastian Dröge 64829ac47a gstreamer: Use type parameters instead of trait objects for TypeFindFactory::call_function()
No need to do dynamic dispatch here.
2022-09-16 11:26:24 +03:00
Sebastian Dröge 1b10c5324d gstreamer: Add BinImpl::do_latency() 2022-09-16 06:54:55 +00:00
SeaDve 59efe09fe5 pbutils/encoding_profile: Add support for 1.20 element-properties API 2022-09-15 16:36:44 +03:00
Sebastian Dröge 8a6de3ca4f gstreamer: Implement various operations on Signed for working with it more easily 2022-09-14 12:20:47 +03:00
François Laignel f294339240 log: differ formatted args evaluation
When the `format_args!` macro is used, formatted args are evaluated
in order to form the argument collection that ends up being formatted
when requested to do so.

For the log macro, this means that any argument that is an expression
was evaluated even if the log level was below current threshold. This
can be examplified by the following code:

```rust
    gst::debug!(CAT, "{}", {
        println!("fmt arg executed");
        "A debug log"
    });
```

This used to print "fmt arg executed" even when the log threshold for
`CAT` was filtering `debug` out.

Note that this could break existing code that would incorrectly rely
on the side effect.
2022-09-13 19:25:14 +02:00
Sebastian Dröge 7fa76eac1b ci: Update image template version for a rebuild 2022-09-13 12:13:30 +03:00
Sebastian Dröge dec112d0a8 Regenerate with latest gir/gir-files/gst-gir-files 2022-09-13 12:13:07 +03:00
Sebastian Dröge 77029602ae Update GStreamer gir files 2022-09-13 12:12:57 +03:00
Sebastian Dröge eb798fb83b Update gir-files 2022-09-13 11:49:22 +03:00
Sebastian Dröge 97e8913cb9 Update gir 2022-09-13 11:49:10 +03:00
François Laignel f014505e1c regen: rename feature 'ser_de' as 'serde' 2022-09-12 19:36:32 +02:00
François Laignel 069c6a2c01 Rename feature 'ser_de' as 'serde'
When I introduced the 'ser_de' feature, I couldn't find a way to
name it 'serde' while also make it pull the optional 'serde'
crate together with the other related dependencies.

With rustc >= 1.60 we can use 'dep:serde' to refer to the 'serde'
dependency as part of the 'serde' feature.
2022-09-12 19:36:30 +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
Sebastian Dröge 099ffdc4b4 examples: Change cairo-compositor example to use ParamSpec builders 2022-09-05 11:48:37 +03:00
Sebastian Dröge 8d982d8b51 ci: Checkout git submodules before running gir checks 2022-09-04 22:46:57 +03:00
Sebastian Dröge efe13948cc ci: Update gst-gir-files and bring autogenerated code in sync 2022-09-04 20:51:07 +03:00
Sebastian Dröge 5163e212ed ci: Install rustfmt in the nightly toolchain for generator.py 2022-09-04 20:49:19 +03:00
Sebastian Dröge a7618aecc2 ci: Add job that checks that all generated files and submodules are in the correct version
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/400
2022-09-04 10:42:29 +03:00
Sebastian Dröge e5a785c9a5 ci: Embed docs before removing them to check more completely that there are no leftover docs 2022-09-04 10:41:57 +03:00
Sebastian Dröge d00b289621 Don't checkout submodules by default
This makes sure that cargo does not clone and checkout all the
submodules if pointing to this repository as a git dependency.

To checkout the submodules `git submodule update --checkout` can be
used.
2022-09-04 10:39:18 +03:00
Sebastian Dröge 35c6af424d Update minimum supported Rust version to 1.63 2022-09-04 10:37:13 +03:00
Sebastian Dröge 201eed8400 gstreamer: Sync param spec API with glib 2022-09-04 10:34:05 +03:00
Arun Raghavan 6c594b4c38 ci: Bump Rust MSRV to 1.61
This is needed by recent bytes-utils (see
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/847#note_1536032)
2022-09-02 12:45:31 -04:00
Arun Raghavan b6c8938f1a ci: Enable libnice while building GStreamer
This enables webrtcbin as well, which is needed for the whipsink plugin
in gst-plugins-rs.
2022-09-02 12:22:00 -04:00
Thibault Saunier 5227af5935 validate: Update from fixed gir 2022-08-31 22:02:22 +00:00
Jordan Petridis 8ca9692924 windows: Install dav1d in the docker image
Also to be used in the gst-plugins-rs CI

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1084>
2022-08-31 23:08:14 +03:00
Jordan Petridis 29bc304c88 ci: Set the PATH var in the docker image rather than scripts
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1084>
2022-08-31 23:05:08 +03:00
Jordan Petridis be356dbf08 ci: Use a prefix for the meson build in the windows image
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1084>
2022-08-31 23:05:08 +03:00
Jordan Petridis 9a9b7bc5ce ci: Install gtk on the windows image
So we can use it in gst-plugins-rs CI.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1084>
2022-08-31 23:05:08 +03:00
Jordan Petridis f7248408cb ci: Update the docker windows base image
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1084>
2022-08-31 23:05:07 +03:00
Rafael Caricio 6163914605
pbutils: Add bindings for the AudioVisualizer base class 2022-08-31 14:03:58 +02:00
Sebastian Dröge 44d899a0eb Regenerate with latest gir / gir-files / gst-gir-files 2022-08-31 11:13:08 +03:00
Sebastian Dröge 8a89be67f7 ci: Update image template version to update GStreamer 2022-08-31 11:02:14 +03:00
Sebastian Dröge 870ad5e4d7 Update gst-gir-files 2022-08-31 11:02:00 +03:00
Sebastian Dröge a207765e36 Update gir-files 2022-08-31 11:01:55 +03:00
Sebastian Dröge ebab45d7b0 Update gir 2022-08-31 11:01:45 +03:00
Guillaume Desmottes e229288ecd gstreamer: manually implement Debug on PromiseReply
The default implementation was not very useful:

PromiseReply(
    Promise {
        inner: Shared {
            inner: 0x00007ff108001090,
        },
    },
)
2022-08-29 08:59:21 +00:00
Thibault Saunier a341b4972f validate: Do not check if initialized when initializing
🤦
2022-08-26 11:27:23 -04:00