Commit graph

1220 commits

Author SHA1 Message Date
Bilal Elmoussaoui 0d391d5031 regenerate with latest gir 2021-11-16 15:47:44 +01:00
Sebastian Dröge a2e22416fe gstreamer: Don't try removing locked metas from buffers
And return success from the `remove()` function.
2021-11-16 13:08:23 +02:00
Sebastian Dröge df36a7c57a gstreamer: Add gst::MetaFlags and accessor on meta 2021-11-16 13:05:47 +02:00
Sebastian Dröge 0b544ffbd3 Simplify glib::IsImplementable trait implementations 2021-11-15 11:48:14 +02:00
Sebastian Dröge dd9e12822f Regenerate with latest gir 2021-11-13 11:05:09 +02:00
Sebastian Dröge c6c499aed2 gstreamer: Update test for glib::EnumClass API changes 2021-11-13 11:03:52 +02:00
Bilal Elmoussaoui d788a10856 re-generate with per crate min version 2021-11-11 12:26:29 +01:00
Sebastian Dröge f27a2bddd6 gstreamer: Add bindings for DebugCategory::all() to list all available debug categories 2021-11-09 09:58:22 +00:00
Bilal Elmoussaoui e3a65a3a88 gst object: add a panicking variant of set_property_from_str
Similar to what was added to ObjectExt
2021-11-08 14:42:59 +01:00
Bilal Elmoussaoui 213020165a manual changes post ObjectExt improvements 2021-11-08 14:42:59 +01:00
Bilal Elmoussaoui 0d009bca31 regen with latest gir 2021-11-08 14:42:59 +01:00
Sebastian Dröge 0444660d1f gstreamer: Don't use a trait object for the property value in ChildProxy::set_child_property()
This makes it nicer to use as `1` can be passed directly instead of `&1`.
2021-11-06 09:36:38 +02:00
Sebastian Dröge 220c500799 gstreamer: Add numer()/denom() functions to gst::Fraction to get the values by value instead of reference 2021-11-06 00:23:07 +02:00
Sebastian Dröge a3015ab507 gstreamer: Refactor gst::IntRange constructors to not require specifying the contained type necessarily 2021-11-06 00:23:07 +02:00
Sebastian Dröge 9901f0c6a2 gstreamer: Refactor gst::Array / gst::List bindings to work correctly with the refactored traits in glib
Also allow only a single type inside them.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/360
2021-11-06 00:23:07 +02:00
Sebastian Dröge 30bb699cbc gstreamer: Use plain &str for parameters instead of Into<&str>
The latter doesn't really have any advantage and only bloats the API.
2021-11-05 17:37:41 +02:00
François Laignel 82b7239379 regen: NONE as associated consts 2021-11-04 18:42:06 +01:00
Sebastian Dröge c942a1d563 gstreamer: Implement Element::request_pad_simple() only once
With < 1.20 it will use `gst_element_get_request_pad()` and otherwise
`gst_element_request_pad_simple()`. It's not marked as deprecated in
either case.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/358
2021-11-04 15:44:35 +02:00
Sebastian Dröge cdfe4b3d67 Remove unneeded std::convert::TryFrom/TryInto and std::str::FromStr imports 2021-10-31 18:20:31 +02:00
Sebastian Dröge d785bf8c3a Regenerate with latest gir 2021-10-31 11:47:34 +02:00
Sebastian Dröge e657e676d5 Relax main context checks in Bus::add_local() and gst_video::convert_sample_async_local() 2021-10-25 09:54:33 +00:00
Sebastian Dröge 92f9f3be39 Remove various unnecessary & from property/structure field related code 2021-10-24 20:52:23 +03: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
Sebastian Dröge 7f0ca0011c Add gst::GstObjectImpl, gst::ProxyPadImpl, gst_audio::AudioBaseSrc, gst_audio::AudioBaseSink subclassing traits
These were missing from the type hierarchy previously and are now
required because of more strict checks in the GLib bindings.
2021-10-23 11:59:03 +03:00
Sebastian Dröge 12fec484c7 Simplify IsSubclassable trait impls 2021-10-23 11:27:46 +03:00
Sebastian Dröge cc76442601 gstreamer: Update ron dev-dependency to 0.7 2021-10-23 10:40:24 +03:00
Sebastian Dröge 18e45dd991 gstreamer: Add FromIterator/Extend impls based on owned Strings and glib::Quark 2021-10-20 14:28:14 +03:00
Sebastian Dröge a7be9ea9d9 gstreamer: Implement Extend trait for buffer, buffer list, caps, caps features and structure
And also implement FromIterator<Memory> for buffer.
2021-10-20 13:53:23 +03:00
Sebastian Dröge e6b78d1489 gstreamer: Have Structure::from_iter() take owned values
They were copied internally, which can be avoided in many cases if
working with owned values anyway.
2021-10-18 16:36:15 +03:00
François Laignel 4bbd201377 Impl Option*{Div,Mul,Rem}
Use the inner type for Rhs, as implemented for Duration.
These operations make sense without providing a "unit".
2021-10-18 14:30:59 +02:00
François Laignel deb22b264e format, clock_time: gather macros together
The modules format and clock_time share common macros which are
scattered between each modules. This cross reference makes it
difficult to maintain the macros.

This commit also make it possible to use macro
impl_common_ops_for_newtype_uint for Percent.
2021-10-18 14:30:59 +02:00
François Laignel 986a136492 clock_time & format: basic opt-ops impl
The option-operations crate provides traits to improve usability
when dealing with `Option`s, which is often the case with
`ClockTime` & most formats.
2021-10-18 14:30:59 +02:00
François Laignel 051df59cd1 clock_time, format: fix checked, saturating, wrapping ops
These operations were implemented using the integer implementations.
These types' MAX values are different from the integers so they must
use specific implementations.

Also add the overflowing variants.
2021-10-18 14:30:59 +02:00
Guillaume Desmottes 675fe349a7 gstreamer: implement Sum on ClockTime
Small convenient helper.
2021-10-18 08:05:56 +02:00
Sebastian Dröge 67af5ac569 gstreamer: Add support for 1.18 instant rate request message 2021-10-17 14:39:38 +03:00
Sebastian Dröge cdddf48f08 gstreamer: Correctly mark various messages as new in 1.10/1.16 2021-10-17 14:33:34 +03:00
Sebastian Dröge 6e3878c8f5 gstreamer: Add bindings for 1.18 instant-rate-change related events 2021-10-17 14:27:44 +03:00
Sebastian Dröge 8b77bd4068 gstreamer: Mark select-streams / stream-collection as only available in 1.10 2021-10-17 14:11:56 +03:00
Sebastian Dröge d01ed466d0 gstreamer: Use #[non_exhaustive] annotation instead of a dummy enum variant 2021-10-17 14:04:18 +03:00
Sebastian Dröge aab0a45cfc gstreamer: Implement pad sticky event getter by type
This allows the caller to directly use the specific event type API on
the result instead of first having to match on it first.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/314
2021-10-17 14:04:18 +03:00
Sebastian Dröge 87e7a84a27 gstreamer: Remove one unnecessary use of unsafe in query code 2021-10-17 12:38:59 +03:00
Sebastian Dröge e989899467 gstreamer: Remove FromIterator impls on references
Creating copies silently while calling collect() is unexpected and can
explicitly added to the iterator via map() if needed.
2021-10-17 11:21:31 +03:00
Sebastian Dröge 3670076f07 gstreamer: Implement IntoIterator / FromIterator for Buffer, BufferList, Caps, CapsFeatures, StreamCollection and Structure
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/285
2021-10-16 23:24:08 +03:00
Philippe Normand b9cd38b796 gstreamer: query: Tidy up allocation pool API
Use `impl IsA<BufferPool>` and make the `set_nth_` and
`remove_nth_` methods check the index bounds.
2021-10-12 17:16:21 +01:00
Philippe Normand 6d88e18772 gstreamer: Add bindings for querying allocation params
This can be used to query downstream for custom allocators.
2021-10-12 17:16:21 +01:00
Sebastian Dröge 8fb37c5134 gstreamer: Implement Deref<Target=[glib::SendValue]> for List and Array 2021-10-12 11:24:54 +03:00
Sebastian Dröge 1c7b4516f9 Regenerate everything with latest GStreamer gir files 2021-10-08 19:44:38 +03:00
Sebastian Dröge c4cbcecc7c Regenerate everything 2021-09-28 18:11:20 +03:00
Sebastian Dröge baccf52e43 Regenerate with latest gir 2021-09-28 15:46:37 +03:00
Sebastian Dröge f5f5fae815 Regenerate with latest gir and gtk-rs gir-files 2021-09-28 12:55:58 +03:00
Jan Alexander Steffens (heftig) c05d2e24af
gstreamer/clock_time: Format Debug like Display
This allows us to drop `.to_string()` from the custom Debug
implementations, which now also no longer print as strings.
2021-09-23 02:19:41 +02:00
Sebastian Dröge 14edcf9aaf Regenerate with latest gir 2021-09-22 12:02:53 +03:00
Marijn Suijten 226419003d Use impl for some Into* trait bounds 2021-09-21 23:54:11 +02:00
Marijn Suijten 669bf52291 Use impl for AsRef trait bounds 2021-09-21 23:54:07 +02:00
Marijn Suijten 13165938ab Regen 2021-09-20 20:38:25 +02:00
Marijn Suijten e2a9f83f5b gir: Update and regenerate with impl Trait instead of named types
https://github.com/gtk-rs/gir/pull/1153
2021-09-20 20:19:04 +02:00
Sebastian Dröge a1c4a58180 Bind various new API 2021-09-19 13:12:58 +00:00
Sebastian Dröge 4b8f85c4c6 Regenerate with new gir and gir files 2021-09-19 13:12:58 +00:00
Sebastian Dröge 1856d47a06 gstreamer: Add bindings to MiniObject together with casting functionality
This is only possible with 1.20 because gst_mini_object_get_type() was
added then. Previous versions only provide bindings for the specific
types, like Caps, Event, etc.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/353
2021-09-19 13:12:58 +00:00
Sebastian Dröge 538ce91987 gstreamer: Provide getter for meta type in addition to meta API type 2021-09-19 15:45:58 +03:00
Sebastian Dröge 7c5303c492 gstreamer: Add support for gst::CustomMeta 2021-09-19 15:45:58 +03:00
Sebastian Dröge 80ee1edec5 gstreamer: Clean up meta code a bit 2021-09-19 15:45:58 +03:00
Jonas Platte 4b2f0a936b
Derive PartialOrd, Ord and Hash for PadProbeId 2021-09-15 20:12:03 +02:00
Sebastian Dröge 6b4f6ca45c gstreamer/device_provider: Add constructor for device provider metadata 2021-09-13 11:34:00 +03:00
Guillaume Gomez c68b601c74 regen 2021-08-31 15:11:15 +02:00
Simonas Kazlauskas db30c121a0 const ElementMetadata constructor
The usual use of this will be through the `ElementImpl::metadata`
method, which requires a `&'static` reference to `ElementMetadata` to be
returned, so we better make it easy to construct these (without forcing
people to resort to `Lazy`'n'stuff)
2021-08-31 09:10:31 +00:00
Marijn Suijten adfb6e35a4 Update gir and regenerate with attributes removed from macro calls
See https://github.com/gtk-rs/gir/pull/1213.
2021-08-30 09:52:36 +02:00
Marijn Suijten 12887f1931 gstreamer: Move attributes on macro-calls like cfg_if inside the macro
Attributes don't do anything when applied to macro invocations:

    warning: unused attribute `doc`
       --> gstreamer/src/lib.rs:146:29
        |
    146 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
        |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `#[warn(unused_attributes)]` on by default
    note: the built-in attribute `doc` will be ignored, since it's applied to the macro invocation `cfg_if::cfg_if`
       --> gstreamer/src/lib.rs:147:1
        |
    147 | cfg_if::cfg_if! {
        | ^^^^^^^^^^^^^^

And, on line 294-295:

    warning: unused attribute `doc`
       --> gstreamer/src/lib.rs:294:33
        |
    294 |     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
        |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
    note: the built-in attribute `doc` will be ignored, since it's applied to the macro invocation `cfg_if::cfg_if`
       --> gstreamer/src/lib.rs:295:5
        |
    295 |     cfg_if::cfg_if! {
        |     ^^^^^^^^^^^^^^

Fortunately these two `cfg_if`'s for the Unix and Windows bus already
apply unnecessary trickery that duplicates the `mod`s and `use`s in
order to get documenation for both no matter the target platform; we can
capitalize on that by removing the `cfg_if` altogether and instead
applying the `cfg` and `doc(cfg())` attributes directly.
2021-08-29 11:21:46 +02:00
Simonas Kazlauskas 782d84bede Remove the links annotations
The `links` annotation in `Cargo.toml` is intended to ensure that in the
crate graph there's at most one crate that's an implementation of
some sort concept.

This can make sense in some scenarios, most prominent of which is when
the crate defines `#[no_mangle]` symbols (e.g. by compiling a vendored C
library.) In that situation linking a binary that depends on two
versions of the library cannot work because of colliding symbol names.

There does not appear to be a similar reason to impose such a
restriction on the users of `gstreamer-sys` and similar, however. All of
these crates link to a system library, they do not define any
`#[no_mangle]` symbols nor they vendor and build C libraries as part of
their build process. All they do is linking to a system library.  Most
likely all the different versions of the bindings will link to the exact
same library too.

I haven't seen any global resources that these bindings use to ensure
soundness of the library, either.
2021-08-23 16:56:27 +00:00
Sebastian Dröge bdccaeee0d gstreamer: Manually implement Object::set_property_from_str() to be able to catch deserialization errors 2021-08-17 09:12:38 +03:00
Sebastian Dröge 43bfd1ae85 gstreamer: Add Value::deserialize_with_pspec() from 1.20 2021-08-17 08:53:53 +03:00
Sebastian Dröge c5c9fd81e4 gstreamer: Value::deserialize() needs to take the target type as parameter
Otherwise it will always fail.
2021-08-17 08:53:52 +03:00
Jordan Petridis 2ded2837ba
tracer: add rustdoc-stripper-ignore-next annotations 2021-08-16 18:49:23 +03:00
Edward Hervey f504493134 gstreamer: Add serde support for more enums and flags
PadDirection, PadPresence, URITYpe, Rank
2021-08-16 15:05:37 +02:00
Simonas Kazlauskas cb475e0965 Bindings to GstTracer and GstTracerFactory
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/147
2021-08-16 14:38:22 +03:00
Simonas Kazlauskas 3ad9d3340b Make plugin date-time optional
It is described as optional in
https://gstreamer.freedesktop.org/documentation/gstreamer/gstplugin.html?gi-language=c#GstPluginDesc
and is also pretty difficult to provide for Rust plugins, I feel. For C
stuff the expectation is that build system would set something like
GST_PACKAGE_RELEASE_DATETIME=`date -u "+%Y-%m-%dT%H:%MZ"` which is
terrible.
2021-08-10 17:38:55 +03:00
Guillaume Gomez 26a6fba6e2 regen 2021-08-03 11:55:44 +02:00
Guillaume Gomez e2264a3f3f Fix (new) clippy warnings 2021-08-03 10:08:32 +02:00
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
Olivier Crête 93c794b338 subclass: Declare minimum to be 1.19 for v1_20 2021-07-13 08:42:56 +03:00
Sebastian Dröge b73b4428ba gstreamer/segment: Return a segment reference instead of the value itself from the getter 2021-07-12 14:22:09 +03:00
Vivia Nikolaidou eb5df0ae26 event: Implement gap_flags 2021-07-09 16:27:41 +03:00
Vivia Nikolaidou 45f8035ccb structure, caps: Implement 1.20 serialize functions 2021-07-09 15:10:02 +03:00
Sebastian Dröge edac1a1d3a gstreamer/element: Include ElementExtManual::request_pad_simple() in the docs too
Currently only the v1_20 ElementExt::request_pad_simple() appears in the
docs but it's available from the other trait in older versions.
2021-06-30 09:26:51 +00:00
Sebastian Dröge c0904af4a7 Regenerate with latest gir-files 2021-06-28 18:34:03 +03:00
Sebastian Dröge 9123143b57 Regenerate 2021-06-24 08:58:46 +03:00
Guillaume Gomez dfeb777513 regen 2021-06-21 23:07:45 +02:00
Sebastian Dröge a94d84e780 Silence/fix various clippy warnings 2021-06-20 10:59:49 +03:00
Guillaume Gomez 64d1598336 regen 2021-06-13 20:52:12 +02:00
Sebastian Dröge 0a71e3c8da Regenerate with latest gir 2021-06-10 12:53:52 +03:00
François Laignel e31ce9d07b Manual ClockTime updates 2021-06-04 22:09:38 +02:00
François Laignel 90bb458e64 Rework ClockTime & FormattedValues 2021-06-04 22:09:38 +02:00
François Laignel 8dda8def6e Manual try_from_glib shortcuts + unsafe 2021-06-04 22:09:38 +02:00
François Laignel 03e8e6d22f regen: use TryFromGlib::Option for ClockTime 2021-06-04 22:09:38 +02:00
Marijn Suijten 510e4cd2b1 Regenerate with 1.19.1 updates 2021-06-04 11:51:00 +02:00
Marijn Suijten 9fd768425e Rename request_pad_simple to avoid 1.19.1 clash
Fixes: 3f442d977 ("prep for regen: relaxed get fn identification")
2021-06-03 20:35:35 +02:00
Marijn Suijten 3d8d1ffb19 Update gir and regenerate with automated enum/flag member versioning
https://github.com/gtk-rs/gir/pull/1180
2021-06-03 20:33:34 +02:00
Guillaume Gomez b0fc500ed1 Generate missing doc aliases 2021-06-02 20:23:29 +02:00
Guillaume Gomez abf82e6f7a Replace raw constants with the FFI constants 2021-06-02 20:23:01 +02:00
Guillaume Gomez 96266ff922 Generate missing doc aliases 2021-06-02 17:35:30 +02:00
Marijn Suijten 7fcd560d18 Update gir and regenerate
- Doc aliases for types;
- ffi constants for bitflags too;
- Completely overhauled docs generation under the hood (only emitting
  valid links, more types receive documentation now).
2021-06-02 09:47:51 +02:00
Marijn Suijten 170f7214eb Regen with extended Gir.toml 2021-06-01 13:40:52 +00:00
Guillaume Gomez 5ba79976a9 Generate missing doc aliases for newtypes 2021-06-01 15:15:59 +02:00
Sebastian Dröge 849a524b09 element: Make caps in link_filtered() / link_pads_filtered() mandatory
Instead of passing `None`, the non-filtered variants of the functions
can be used.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/328
2021-05-30 17:30:22 +00:00
Bilal Elmoussaoui b2083d0973 gir-files: drop broken commit & regen 2021-05-28 14:16:15 +02:00
Marijn Suijten eaed54e279 Update gir and regenerate with simplified trait bounds
Trait bounds moved from `where T: Foo` directly into the type parameter
definition at `<T: Foo>`: https://github.com/gtk-rs/gir/pull/1160.
2021-05-27 00:02:42 +02:00
Sebastian Dröge 88c4f70195 Regenerate with latest gir 2021-05-23 16:27:57 +00:00
Guillaume Gomez dcd0695567 Improve conversion code for enum variants 2021-05-23 13:15:27 +02:00
Guillaume Gomez 7e892b507f Add missing doc aliases on variants 2021-05-23 13:06:57 +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
Sebastian Dröge b02f2acae5 gstreamer: Update for try_from_glib() having become an unsafe function
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/337
2021-05-19 11:47:11 +03:00
Sebastian Dröge 11a85449e7 gstreamer/uri_handler: Only assign to GError**s if they're not NULL 2021-05-15 10:41:34 +03:00
François Laignel 65fd79f973 ParamSpec: conform to glib naming for constructors 2021-05-06 21:40:19 +02:00
Marijn Suijten e8c90c9186 gstreamer/lib: Prevent fn deinit() docs from being stripped 2021-05-05 12:23:40 +02:00
Marijn Suijten d50d7b4a95 Update gir and regenerate
This version adds a `--strip-docs` flag to `generator.py`, used in
conjunction with `--strip-docs --embed-docs` to clean documentation
first before re-embedding it (otherwise the same text would show up
multiple times).  It is also used in the CI to check that no
documentation disappears on stripping, ie. all documentation is properly
annotated with `// rustdoc-stripper-ignore-next`.
2021-05-05 12:23:40 +02:00
Sebastian Dröge aa3cc48756 Fix new 1.52 clippy warnings 2021-05-05 12:02:03 +03:00
François Laignel 5505715cc4 Manual code updates for *Return types 2021-05-04 11:33:51 +00:00
François Laignel 2364361f6b regen: use TryFromGlib for *Return types 2021-05-04 11:33:51 +00:00
François Laignel 49583597ed manual code: fix-getters-def doc aliases 2021-05-03 20:46:57 +02:00
François Laignel 01b6d342a4 regen: prop alias + connect_*_notify signal + add fn doc alias 2021-05-03 20:46:56 +02:00
Marijn Suijten 1eb0c483fe gstreamer: Fix some clippy::use_self warnings 2021-04-30 10:58:36 +02:00
Marijn Suijten 980304ce36 Replace T::type_data with Self::type_data for clippy::use_self 2021-04-30 10:02:55 +02:00
Marijn Suijten e52e4328b3 Allow clippy::use_self on auto module 2021-04-30 10:02:47 +02:00
Marijn Suijten 10c93807fb Replace explicit type with Self in for_value_type::<> turbofish 2021-04-30 10:02:47 +02:00
Marijn Suijten e8f340c60a Update gir and regenerate with clippy::use_self fixes
`Self` is now used in more places, shortening the code and making it
more readable at the same time.
2021-04-30 10:02:44 +02:00
Marijn Suijten f89e840d27 Remove redundant prelude imports
When importing the prelude of a crate like `gst` the `glib` prelude is
provided too.  Shedding these imports saves quite a few lines and
adheres to keeping it simple; we're not reexporting base/parent preludes
for no reason :)
2021-04-29 12:05:13 +02:00
Sebastian Dröge 3ad7a18792 gstreamer: Remove unused leftover ToGlib import
And directly call from_glib_borrow() instead of adding a use statement
for it.
2021-04-28 09:28:54 +03:00
Bilal Elmoussaoui 890cd03632 manual renames of to_glib into into_glib 2021-04-27 19:44:41 +02:00
Bilal Elmoussaoui 060a7df448 regen with renamed ToGlib into IntoGlib 2021-04-27 19:14:52 +02:00
Marijn Suijten da156e8ce7 Update gir and regenerate without unused glib::ToValue imports 2021-04-27 10:14:19 +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
Sebastian Dröge 1d59ea91c5 Clean up various imports everywhere 2021-04-26 15:16:58 +03:00
Marijn Suijten 1a07bfc710 Update gir and regenerate without trait reexports in crate root 2021-04-26 13:24:02 +02:00
Marijn Suijten 2c40ce10ab gstreamer,pbutils: Only import traits from prelude
Future changes will make all traits - both manual and auto - unavailable
from the crate root; they can then only be imported from the `prelude`.
2021-04-26 13:24:02 +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 5b7b39c448 gstreamer: Add CapsFeatures API using glib::Quarks instead of strings
The same API for Structures already exists.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/141
2021-04-26 10:54:23 +03:00
Sebastian Dröge eda1d3d4a7 Update for Value trait refactoring 2021-04-25 14:45:08 +03:00
Sebastian Dröge 0eb5845934 Regenerate with latest gir 2021-04-25 14:45:01 +03:00
Marijn Suijten 1b2b3a75bc Update gir with generator.py included and regenerate
The `gir` repository now includes `generator.py` for easier sharing of
improvements with other projects like `gtk(4)-rs`.
2021-04-24 09:39:04 +02:00
Sebastian Dröge 9d3888d294 gstreamer: Fix PromiseFuture implementation
We can't return a plain reference to something stored inside the future
as that would go out of scope after `await`. Instead return a struct
that wraps the `gst::Promise`, derefs to a structure and keeps the
promise alive as long as needed.
2021-04-23 11:52:02 +00:00
François Laignel 1395d773c3 manual fixes remove get prefix round 2 2021-04-20 18:18:02 +02:00
François Laignel 6ab9164dca fix-getters-calls 0.3.0 pass 2021-04-20 18:18:02 +02:00
François Laignel e80a29372a fix-getters-def 0.3.0 pass 2021-04-20 18:18:02 +02:00
François Laignel b8b944b72b subclass: remove get prefix where applicable 2021-04-20 18:18:02 +02:00
François Laignel f7472c82e3 regen: relaxed get fn identification 2021-04-20 18:18:02 +02:00
François Laignel 172a4d47ab regen: use type_ for glib macros
This also includes a new substitution for bool getters:
get_need_... -> needs_...
2021-04-20 18:18:02 +02:00
Sebastian Dröge bf6669a9cb gstreamer: Add TagList::remove() for removing tags
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/327
2021-04-20 10:22:14 +03:00
Marijn Suijten 9cc488db4c gstreamer/miniobject: Make get_type function optional
Static typing is needed for `Value` interop, but not every type
(GLMemory in this instance) requires that.
2021-04-17 07:54:40 +00:00
François Laignel 99616ec0b4 post fix-getters manual updates 2021-04-13 17:54:40 +02:00
François Laignel 53be8e5f58 fix-getters-{def,calls} pass 2021-04-13 17:54:40 +02:00
François Laignel 08545cbefc regen - remove get prefix for getters 2021-04-13 17:54:38 +02:00
Sebastian Dröge 7e7f358ba2 gstreamer/tags: Replace removed glib TypedValue with local TagValue
See https://github.com/gtk-rs/gtk-rs/pull/449.  This struct remains
vital in GStreamer code to tie a type to an (untyped) SendValue, so that
the underlying value can be retrieved without having to guess its type.
That type is anyway stored in a private member T::TagType.

Co-authored-by: Marijn Suijten <marijns95@gmail.com>
2021-04-12 10:04:26 +02:00
Sebastian Dröge a775f58753 Use glib::Error::into_raw() for passing GErrors without copying back to C 2021-04-11 10:45:56 +03:00
Sebastian Dröge 8d983066f5 gstreamer: Store ffi::GstCaps inside gst::Caps and equivalent for other miniobjects
Simplifies code and prepares for the next changes.
2021-04-03 17:43:50 +03:00
Sebastian Dröge 21ff418b0f gstreamer: Store ffi::GstCapsFeatures inside gst::CapsFeatures
Simplifies code and prepares for the next changes.
2021-04-03 17:35:22 +03:00
Sebastian Dröge b6f6758454 gstreamer: Store ffi::GstStructure inside gst::Structure
Simplifies code and prepares for the next changes.
2021-04-03 17:35:10 +03:00
Marijn Suijten 6ec0e3ac4b Update gir and regenerate with extended gir-dirs comments
Gir now prints all directories and their hashes in the version file and
comments; useful now that gstreamer-rs is being generated from both
gir-files/ and gst-gir-files/ submodules.
2021-04-01 15:58:41 +02:00
Marijn Suijten a38561fbcd Update gir and regenerate with redundant #[cfg]/#[cfg_attr] removed
Also ignores `clippy::upper_case_acronyms` introduced with 1.51 which
can't be adhered to in bindings.
2021-04-01 15:53:18 +02:00
Sebastian Dröge 15505cc5b8 Re-export interface ImplExt traits from the preludes 2021-03-14 14:06:30 +02:00
Sebastian Dröge 27385104d8 Update for glib interface API changes 2021-03-14 10:45:52 +02:00
Sebastian Dröge ea239c587e Store panic information not in a custom instance struct but in the instance data provided by the subclassing infrastructure
This scales better as there will only be only such data instead of two
or more when having deeper class hierarchies with multiple Rust
elements, and also makes it unnecessary to use a special instance struct
so the default works well.
2021-03-09 16:36:35 +02:00
Sebastian Dröge 6fa48890bc Update for the subclassing glib bindings API changes 2021-03-09 16:04:32 +02:00
Sebastian Dröge 0b61713398 gstreamer/uri_handler: Update for glib bindings API changes 2021-03-09 11:17:15 +02:00
Sebastian Dröge a311591310 Regenerate with latest gir 2021-03-08 12:25:37 +02:00
Sebastian Dröge 0803dd411e Update for glib subclass API cleanup 2021-03-08 12:18:24 +02:00
Sebastian Dröge b8c20c07ce Update for new #[glib::object_subclass] attribute macro 2021-03-07 13:08:06 +02:00
Sebastian Dröge 932b8f813d gstreamer/pad: Add support for removing pad probes from the probe callback
While this allows to remove the pad probe multiple times, which would
cause a g_warning(), this is not actually making the situation worse
than before while making some code patterns easier to implement:

  - Probes could already be removed twice by return
    gst::PadProbeReturn::Remove and then calling pad.remove_probe()
  - Probes could be removed from a different pad than where they were
    added

As such let's go with the simple solution here for now and allow giving
owned access to the probe id from the probe callback.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/286
2021-02-28 19:08:59 +02:00
Sebastian Dröge 5822785191 Regenerate with latest gir 2021-02-28 18:30:54 +02:00
Sebastian Dröge a316d610eb gstreamer: Update for glib::Type API changes 2021-02-25 12:49:47 +02:00
Sebastian Dröge 2b0b3910ee Regenerate everything with latest gir 2021-02-22 17:13:45 +02:00
Jan Alexander Steffens (heftig) 59d91b2abf gstreamer/plugin_feature: Make load downcast to Self
The loaded plugin feature is always of the same type as the unloaded
one. Move `fn load` to PluginFeatureExtManual to implement this.
2021-02-19 11:23:56 +00: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 ce67076f26 gstreamer,video: Do not zero-initialize designated struct members
This should be analogous to C struct initalizers where all unspecified
fields are initialized to zero. Without mut this reads a bit nicer as
well.

Note that two out of three structs have all members specified, hence
need no zero-initialization of the remainder at all.
2021-02-15 20:19:38 +01: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
Marijn Suijten 6b94083a07 gstreamer/allocation_params: Implement to_glib_none
This is needed by the now-autogenerated implementation of
Allocator::alloc, and later on the GL bindings.
2021-02-15 20:19:38 +01:00
Marijn Suijten 439db15c20 Regenerate with 1.18.3 and preliminary changes for 1.18.4 2021-02-15 20:19:38 +01:00
Sebastian Dröge 5da6e82b5e gstreamer/datetime: Silence new 1.50 clippy warning 2021-02-10 13:09:51 +02:00
Sebastian Dröge faa6463bda gstreamer/clock: Move away from deprecated atomic API 2021-02-10 13:09:51 +02:00
Vivia Nikolaidou 0a119cada6 gstreamer-audio: Add AudioConverterConfig 2021-02-09 19:13:30 +02:00
Sebastian Dröge 3c0281db0c gstreamer/uri_handler: Update for glib class data API changes
Based on a patch by Bilal Elmoussaoui
2021-02-07 17:40:45 +02:00
Sebastian Dröge 9d86cef2da Regenerate everything with latest gir 2021-02-07 17:07:17 +02:00
Sebastian Dröge 32a96dd72c gstreamer/log: Handle compiled out GStreamer debug system properly
By mirroring the no-op behaviour of the C code instead of failing
because of a NULL debug category.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/306
2021-01-31 12:25:48 +02:00
Marijn Suijten 1ffa02fc1f Update gir to c85699a with import cleanups; regenerate
Apply import cleanups from https://github.com/gtk-rs/gir/pull/1043,
omitting `use` statements where unnecessary or guarding them with
versioning constraints to prevent `unused_imports` warnings.

Removes unnecessary `mut_override` with
https://github.com/gtk-rs/gir/pull/1044 as well.
2021-01-30 15:49:38 +01:00
Jan Alexander Steffens (heftig) 796f93f7f4 gstreamer/clock_time: Improve Display formatting
- Add support for precision, padding and alignment.
- Format the invalid time using dashes (`--:--:--.---------`) instead of
  a technically valid `99:99:99.999999999`

The latter is something C's `GST_TIME_FORMAT` can't do, though something
obviously invalid like `-1👎-1.000000000` would be possible.
2021-01-29 16:31:07 +00:00
Sebastian Dröge 0e8b95f1d0 urihandler: Provide URIType as associated constant when implementing the gst::URIHandler interface
The supported protocols still stay a function because they might have to
be probed at runtime, but they return a static string array now as they
must not randomly change at runtime.
2021-01-25 13:56:55 +02: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 e11b12df7c gstreamer: Provide class metadata, pad templates and basetransform configuration via trait methods
This is closer to how this works in Python and also how properties and
signals work now in the glib bindings.

class_init() only has to be implemented for more special uses now.
2021-01-25 13:56:55 +02:00
Jonas Platte 72f191b79b
Use std::future::ready instead of futures_util::future::ready 2021-01-19 13:33:11 +01:00
Sebastian Dröge 927cca106d Use async/await in a few places and reduce dependencies as a result 2021-01-14 15:25:03 +02:00
Zeeshan Ali 4a92966ed5 Add get_current_state & get_pending_state to ElementExtManual
Convenient API to simply get the current or pending state of the
element.
2021-01-10 08:52:28 +00:00
Marijn Suijten c4a06e515b gstreamer/format,value: Skip init in functions that contain self
These functions were changed to return Self instead of the direct name
of the type, and are hence caught by the init checker.

Also remove some tabs that sit in the macro but are not cleaned up by
the formatter.
2021-01-08 11:50:31 +01:00
Marijn Suijten 4cb6b64e2d gstreamer/format,value: Use Self in more places 2021-01-08 11:49:46 +01:00
Marijn Suijten 9890803cc6 gstreamer: Fix clippy::from_over_into 2021-01-08 11:43:14 +01:00
Marijn Suijten 46cb1595c0 gstreamer/tags: Fix redundant_semicolons lint warning 2021-01-08 11:01:02 +01:00
Marijn Suijten 7ed20090d1 Fix clippy::field_reassign_with_defaults instead of ignoring it
Fixes: fc2d7fc4 ("ci: Add some more ignored lints to the clippy configuration")
2021-01-08 11:01:02 +01:00
Marijn Suijten 3c610e12e5 gst,base,sdp: Use specific copy/free or (un)ref instead of g_boxed
SDPMessage, FlowCombiner and ParseContext have specific functions
available to perform copying, freeing and (un)ref'ing. Calling them
directly on versions where they are supported prevents us from going
through GType machinery and locks that end up the same functions in the
end.
2021-01-08 10:41:06 +01:00
Sebastian Dröge ec2a287842 gstreamer/datetime: Update for glib::DateTime API changes 2020-12-24 12:46:27 +02:00
Sebastian Dröge 03f928ee0c gstreamer/serde: Update for glib::Date API changes 2020-12-23 10:31:49 +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
Sebastian Dröge 53aae7ddba Remove gst_ prefix from all macros except for the logging macros
The latter stay e.g. gst_debug! to be more clear and not conflict with
e.g. the debug! macro from the log crate.
2020-12-20 19:40:34 +02:00
François Laignel 87446d4d8e ClockTime: const for zero & none constructors 2020-12-18 18:00:47 +01:00
François Laignel a216f85abf ClockTime: use matches! now that MSRV allows it 2020-12-18 18:00:35 +01:00
Guillaume Gomez 2f0e386037 Regen with more doc alias for enums and consts 2020-12-18 15:23:05 +01:00
Sebastian Dröge ce1148b474 Update everything for glib macro renamings 2020-12-18 00:56:47 +02:00
Sebastian Dröge d0b0006d27 Regenerate 2020-12-18 00:34:53 +02:00
Sebastian Dröge f3b5340875 Update for new simplified glib::Object::new() API 2020-12-17 17:43:17 +02:00
Guillaume Gomez ff5a36561a Fix license header situation 2020-12-15 11:53:31 +01:00
François Laignel 0dce894b13 gstreamer/message: 2d attempt at printing src for Debug impl
1st attempt in c987bb0c was reverted by 89c4f68f due to
clippy "redundant clone" warning.
2020-12-13 19:44:34 +01:00
Marijn Suijten 132477f51f cargo.toml: Add v1_20 feature to all crates 2020-12-12 13:17:20 +01:00
Marijn Suijten 0ff16c589f Regenerate sys Cargo.toml with 1.20 version 2020-12-12 13:17:03 +01:00
Marijn Suijten bc5b44ddad gstreamer: new_from_g_date_time only returns NULL if arg is NULL 2020-12-12 13:15:11 +01:00
Guillaume Gomez fb56af8d84 Update from_glib calls and put them in unsafe blocks 2020-12-08 15:50:15 +01:00
Guillaume Gomez 959568f124 regen 2020-12-08 14:00:17 +01:00
Marijn Suijten 15d8774e6b Update gir to 1c1a8d7 and regenerate with associated enum/flag functions 2020-12-07 12:11:27 +01:00
Marijn Suijten 01ae47c90c gstreamer: Manually implement StateChange::get_name on < v1_14
By setting the version to 1.8 and using `manual = true` an unconditional
trait implementation calling get_name is generated, while the
autogenerated version is omitted.
2020-12-07 12:09:39 +01:00
Marijn Suijten f260fa4f8d gstreamer/event: Use autogenerated EventType::get_name 2020-12-07 12:09:39 +01:00
Marijn Suijten 0763d2645d video: Reuse Self::Err in from_str 2020-12-07 12:09:39 +01:00
Marijn Suijten 2447664df6 Replace Result<(), fmt::Error> with fmt::Result 2020-12-07 12:09:39 +01:00
Marijn Suijten 9f0befa033 gstreamer: macro_use is for use statements, not macro calls 2020-12-07 12:09:39 +01:00
Sebastian Dröge 15722ec5d2 gstreamer/datetime: Check invariants on the bindings side instead of asserting in the C code
Newer versions of GStreamer (1.20 and above) will not assert any longer
but handle it more gracefully, so let's do the same here for all
versions.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/297
2020-12-06 19:23:32 +02:00
Marijn Suijten 92df13eeb1 Regenerate with trusted nullability 2020-12-04 19:37:06 +01:00
Marijn Suijten 47102b0e76 Regenerate with fresh gir files 2020-12-04 19:34:09 +01:00
Guillaume Gomez 8f9d76bb8c Revert "Remove unnecessary dox feature"
This reverts commit 9dd8bd9095.
2020-11-27 14:37:49 +01:00
Guillaume Gomez 7daac635c4 regen 2020-11-27 14:37:24 +01:00
Marijn Suijten 513cf47447 gstreamer/query: Fix clippy::single_match 2020-11-25 21:16:40 +01:00
Marijn Suijten 56c2b730f8 gstreamer/buffer: Fix clippy::needless_lifetimes 2020-11-25 21:16:40 +01:00
Guillaume Gomez 9dd8bd9095 Remove unnecessary dox feature 2020-11-25 15:54:02 +01:00
Guillaume Gomez 28438d245a regen 2020-11-25 15:53:45 +01:00
Sebastian Dröge 9d9522016b gstreamer: Update manual code to 2018 edition 2020-11-22 19:15:20 +02:00
Sebastian Dröge b933931d6c gstreamer: Regenerate 2020-11-22 19:15:20 +02:00
Sebastian Dröge 4d52ab7d37 gstreamer: Fix plugin version for v1_18 2020-11-21 18:08:24 +02:00
François Laignel 75f6babb57 Event: impl structure_mut getter 2020-11-19 21:12:18 +01:00
Sebastian Dröge 89c4f68fa3 gstreamer: Remove redundant clone of element name
error: redundant clone
   --> gstreamer/src/message.rs:162:63
    |
162 |             .field("src", &self.get_src().map(|s| s.get_name().to_owned()))
    |                                                               ^^^^^^^^^^^ help: remove this
    |
    = note: `-D clippy::redundant-clone` implied by `-D warnings`
2020-11-19 20:30:51 +02:00
Sebastian Dröge 389fa306aa Regenerate with latest gir 2020-11-19 19:53:22 +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 aeb1b70581 Remove doc(cfg()) from expressions
warning: unused doc comment
       --> gstreamer-video/src/video_info.rs:655:37
        |
    655 |           #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
        |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    656 | /         {
    657 | |             VideoInfoBuilder {
    658 | |                 format,
    659 | |                 width,
    ...   |
    674 | |             }
    675 | |         }
        | |_________- rustdoc does not generate documentation for expressions

Also simplify some blocks into expressions which are allowed to have
attributes as well since Rust 1.43.
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 9daa8d20a9 Regenerate with doc(cfg()) attribute on all symbols
This is enabled by a new version of gir, as updated in the previous
commit.
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 8aba0597e4 Pad: use Result<FlowSuccess, FlowError> for flow return type 2020-11-18 16:59:25 +01:00
François Laignel 755496d0f9 Pad: allow handling Events in PadProbes 2020-11-18 16:59:23 +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 4eaf574cf8 gstreamer: Make virtual methods take wrapper of type, not parent 2020-11-14 19:39:27 +02:00
Sebastian Dröge 1d53b66858 Fix compilation with GLib subclassing changes 2020-11-14 19:39:27 +02:00
François Laignel ca96014c47 Use fully qualified path for plugin_desc in gst_plugin_define
This is required when gst_plugin_define is used from a a submodule
mod.rs (not from the crate's lib.rs).
2020-11-12 13:24:16 +01:00
Sirius Wu a7b0d42964 Check if LoggedObject really a GObject. 2020-11-09 17:33:52 +08:00
Sebastian Dröge 9379c730b9 gstreamer: Update for removal of ElementClass/DeviceProviderClass type aliases 2020-11-07 12:49:19 +02:00
Sebastian Dröge f6ace04caf Regenerate everything with latest gir 2020-11-07 12:17:25 +02:00
François Laignel 5903496e5b regenerate all 2020-11-05 18:29:47 +01:00