Commit graph

3224 commits

Author SHA1 Message Date
François Laignel 8e2c621a9f gst/lib: cleanup format re-exports 2022-10-10 15:10:10 +02:00
Sebastian Dröge a4d901ee63 gstreamer: Add an gst::element_error! variant that works on element implementations 2022-10-10 15:01:07 +03:00
Sebastian Dröge 7bd4d770ff gstreamer: Remove unnecessary trait bounds 2022-10-10 15:01:07 +03:00
Sebastian Dröge f17781e188 Change *Impl trait methods to only take &self and not Self::Type in addition 2022-10-10 15:01:07 +03:00
Sebastian Dröge 25c53c4276 gstreamer: Implement new logging variants that work ObjectSubclass values 2022-10-10 15:01:07 +03:00
François Laignel 274a5bd020 gst/format: implement GenericSignedFormattedValue
The `Signed` version for `GenericFormattedValue` was implemented as
`Signed<GenericFormattedValue>`, which failed to represent properly
the `None` variants when applicable and could represent inconsistent
`Signed` variant combined with `GenericFormattedValue` formats which
are internaly represented as signed integers.
2022-10-09 20:00:40 +02:00
François Laignel 04b6710f84 format/Other: use u64 internally instead of i64 2022-10-09 20:00:38 +02:00
François Laignel 8a7813d04c gst: move format_serde.rs under format module 2022-10-09 18:53:57 +02:00
Sebastian Dröge dac3cf67f4 Update for additional translation trait impls in gtk-rs-core 2022-10-08 15:35:37 +03:00
Sebastian Dröge 3cd902513d Update for glib::Object::new() API changes 2022-10-07 21:45:01 +03:00
Sebastian Dröge dcd53bd16e Regenerate with latest gir 2022-10-07 20:30:24 +03:00
Sebastian Dröge 6300c39998 Update gir 2022-10-07 20:28:51 +03:00
SeaDve d8a57e6d4a pbutils/encoding_profile: Prevent copies by taking data by value 2022-10-03 12:21:44 +00:00
SeaDve 238f9baee5 pbutils/element-properties: Add ElementPropertiesMapItem
Also add `field_value` counterpart on both ElementPropertiesGeneralBuilder and ElementPropertiesMapBuilder.
2022-10-03 12:21:44 +00:00
Sebastian Dröge c64b6ac68b tracer: Use Results instead of plain success/failure enums
This makes it more convenient to handle the success/failure cases in
tracer implementations and is more consistent.
2022-10-02 10:45:14 +03:00
Sebastian Dröge ade0aad6b0 tracer: Make buffer in pull-range-post function optional
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/410
2022-10-02 10:36:05 +03:00
François Laignel bff1354b74 gst/format: module doc 2022-10-01 13:16:06 +02:00
François Laignel e2fe1d6371 gst/format: macros minor cleanups 2022-10-01 13:16:06 +02:00
François Laignel 57d8d46ab6 gst/format: fix some ops and add others
Some operations were implemented on types that wouldn't result in
the expected physical unit. E.g.:

- `ClockTime / ClockTime` results in a unit-less factor.
- `u64 / ClockTime` would result in a `1 / ClockTime`. Since we don't
  use any `Frequency` type, this operation is removed. Users should
  use the `ClockTime` accessors to compute the expected value.

This commit also adds:

- multiplications with integers as the left hand side operands.
- `Partial{Eq,Ord} for `Signed<T>` with `T` as left hand side operand.
- `opt_add` / `opt_sub` for `Signed<T>` with `T` as left or right hand
   side operands.
- missing tests for `Partial{Eq,Ord}` and `OptionOrd`.

This implementation can interfere with unrelated code and was removed:

- `Signed<usize>.` `PartialOrd` makes existing code computing the len
  of slices needing type annotation because the len is later used in
  a comparison for which the compiler is unable to determine if
  the len is `Signed<usize>` or `usize`.
2022-10-01 13:15:11 +02:00
François Laignel eb4d997f0a gst/format: shuffle types and traits 2022-10-01 00:49:42 +02:00
François Laignel 79377337a4 gst/format: move related modules under a directory 2022-10-01 00:49:39 +02:00
Rafael Caricio 69ea30dbda
gstreamer: meta: Allow to register custom meta without transform function 2022-09-29 14:05:35 +02:00
Jordan Petridis 4f2d974aa6 ci/windows: Install pango explicitly
Instead of relying on the subproject

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1110>
2022-09-29 05:01:05 +03:00
Jordan Petridis 21e342c947 ci/windows: Update base windows image tag
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1110>
2022-09-29 05:01:05 +03:00
Jordan Petridis ccb9e3a7f8 ci: Update gtk to 4.8.1
And follow release tags instead of branches.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1110>
2022-09-29 05:01:05 +03:00
Sebastian Dröge e294bb9713 ci: Update to meson 0.63.2 for the image
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1110>
2022-09-29 05:01:05 +03:00
Sebastian Dröge a2150b8368 ci: Update to Rust 1.64
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1110>
2022-09-29 05:01:05 +03:00
Sebastian Dröge 92c6eefadd audio: Ignore ignore-inactive-pads property in AudioAggregator
getters/setters are already generated for the `Aggregator` base class
and the property in the subclass is not really needed here. It also
causes problems with trait resolution as the getter/setter functions
will exist twice.
2022-09-23 17:01:06 +03:00
François Laignel 99e344af4d gst/format: simplify some ops impl
The `SpecificFormattedValue` types are newtypes of `u64` or `u32`
and they all implement `Copy`. It shouldn't be needed to implement
operations on `&Type` nor `&inner_type`.
2022-09-22 00:05:28 +02:00
François Laignel 86549dc06e gst/Segment: return immediately from some functions...
... if the input `is_none`.
2022-09-21 17:20:43 +00:00
François Laignel 8595b67218 gst/Signed: impl option-operations traits 2022-09-21 17:20:43 +00:00
François Laignel 183a399d1d gst/Signed: impl MulDiv 2022-09-21 17:20:43 +00:00
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