Commit graph

73 commits

Author SHA1 Message Date
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 e80a29372a fix-getters-def 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 b6f6758454 gstreamer: Store ffi::GstStructure inside gst::Structure
Simplifies code and prepares for the next changes.
2021-04-03 17:35:10 +03:00
Sebastian Dröge a316d610eb gstreamer: Update for glib::Type API changes 2021-02-25 12:49:47 +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
Marijn Suijten 0763d2645d video: Reuse Self::Err in from_str 2020-12-07 12:09:39 +01:00
Sebastian Dröge 9d9522016b gstreamer: Update manual code to 2018 edition 2020-11-22 19:15:20 +02:00
Sebastian Dröge a6c8fe0c8a Use repr(transparent) where it is more correct and get rid of some unneeded repr(C) 2020-10-24 17:09:10 +00:00
Sebastian Dröge 4c216bca3a Remove unneeded PhantomData markers
And as a side-effect also get rid of the lifetime parameter of
gst::TypeFind that was completely unused anyway.
2020-10-24 17:09:10 +00:00
Sebastian Dröge 7086a754be Add various glib::Value trait impls for borrowed versions of types
For SDPMessageRef, StructureRef and CapsFeatureRef this involves the
conversion from and to a glib::Value. Specifically this means that e.g.
a StructureRef can be retrieved from a glib::Value via borrowing, i.e.
without creating a copy of the structure first.

For all mini objects only retrieval from a glib::Value is implemented as
the other direction would allow to get multiple immutable references
from a mutable reference without borrowing, which is not allowed and
would make it possible to observe a mini object changing while having an
immutable reference to it.
2020-05-27 13:17:54 +03:00
Sebastian Dröge d417656707 Use thiserror more widely for deriving Error/Display impls of error types 2020-05-26 19:26:35 +03:00
Vivia Nikolaidou ec4a43be89 Regenerate 2020-05-03 16:48:35 +03:00
Jan Alexander Steffens (heftig) 1d2609d448
gstreamer: Return any lifetime instead of 'static
Following https://github.com/gtk-rs/glib/pull/633
2020-04-30 09:50:00 +02:00
Guillaume Desmottes 97026d7f86 gstreamer: structure: add new_from_iter()
Allow to easily create a new Structure from an iterator.

Fix #250
2020-04-20 15:53:28 +02:00
Guillaume Gomez c07fe14191 gstreamer*: Add missing init checks 2020-04-12 17:25:54 +03:00
Sebastian Dröge 62e9af58c6 Fix some clippy warnings 2020-04-11 21:18:18 +03:00
Sebastian Dröge 94ace06883 Remove deprecated std::error::Error::description() impls 2020-04-11 19:39:04 +03:00
Sebastian Dröge 62c0f5ef42 Use mem::ManuallyDrop instead of mem::forget() everywhere
It makes the intentions clearer and potentially results in simpler
assembly, at least in debug builds.
2020-04-09 16:57:06 +03:00
Jan Alexander Steffens (heftig) af27d73e5c
gstreamer: Return &'static str from StructureRef
The names are backed by Quarks and thus eternally valid.
2020-03-12 19:25:12 +01:00
Sebastian Dröge 8d0fa62275 Minor cleanup in various places 2020-03-09 12:55:14 +02:00
Sebastian Dröge be3c378f28 Use Results instead of Options where they signal an error instead of just a missing value
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
2019-12-17 22:21:28 +02:00
Sebastian Dröge 06cfcd57fc Move to_string() methods into the Display trait or rename to to_str(), move from_string() into the FromStr trait
Fixes clippy warnings, prevents confusing errors and is more consistent.

The Display trait provides a to_string() method by itself and FromStr
provides from_str().
2019-10-04 11:01:55 +03:00
Jan Alexander Steffens (heftig) 29710d9970 gstreamer: Assert that FromValueOptional works as expected
Fails without the preceding patch.
2019-09-24 10:34:44 +00:00
Jan Alexander Steffens (heftig) dca2cc1c5d gstreamer: Remove bad asserts in two impl FromValueOptional
These prevented actually getting a None out of a Value which contains a
NULL.
2019-09-24 10:34:44 +00:00
François Laignel 26423a069c structure::tests: use error constructors 2019-08-16 15:04:01 +02:00
Sebastian Dröge 2829c7ee2f gstreamer: Add StructureRef::get_optional()
This only returns Err on type mismatches. If the field does not exist or
None it returns None, otherwise the value.

StructureRef::get() returns Err also if the field does not exist.
2019-08-13 18:30:40 +03:00
François Laignel 514a05accd Manual update for new Value::get signature 2019-08-13 10:57:32 +02:00
Sebastian Dröge d1e562b9f6 Explicitly add dyn keyword to trait objects
Trait objects without are deprecated with the latest nightly and this
makes it more clear that we're doing dynamic dispatch anyway.
2019-06-06 09:09:34 +03:00
Sebastian Dröge e7898c1b24 Update manual code 2019-04-15 19:19:19 +03:00
Sebastian Dröge 2b2c3bbade Make sure to initialize GStreamer in all Structure tests 2019-01-27 03:02:11 +02:00
Sebastian Dröge bd0cbe99b3 Add more Debug impls to everything possible 2019-01-22 17:46:08 +02:00
Sebastian Dröge 857ed8609c Structure is Sync, and StructureRef is Send+Sync 2018-09-22 11:00:17 +03:00
François Laignel 90b046fbcf serde: separate serde impl and tests from base module
+ fix erroneous `datetime` instead of `buffer` in `BufferRef::serialize`
+ remove ser/de for `Value`s with types `ULong` & `ILong`
2018-07-30 23:18:30 +03:00
François Laignel 4f948e2cce Sample: serde impl 2018-07-30 23:18:30 +03:00
François Laignel 1ef83c24b8 Structure: serde impl 2018-07-30 23:18:30 +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 03055f4e84 Change Structure/StructureRef to_string() to the minimal required fix
And add a comment to why we need it. No other struct with a to_string()
function is affected.

https://github.com/sdroege/gstreamer-rs/issues/101
2018-04-07 13:37:44 +03:00
Sebastian Dröge ce9b98f338 Add Display impl for StructureRef too 2018-04-06 13:22:08 +03:00
Sebastian Dröge f346d57b4f Fix infinite recursion in Structure::to_string()
Instead of StructureRef's to_string(), we were calling
ToString::to_string() in the Display impl. Which then called into itself
again.

Fixes https://github.com/sdroege/gstreamer-rs/issues/101
2018-04-06 13:22:08 +03:00
Guillaume Desmottes c5617f6a47 WIP: test Structure string conversions 2018-04-06 13:22:08 +03:00
Sebastian Dröge 492c3d656c Run everything through rustfmt again 2018-04-01 11:57:58 +03:00
Sebastian Dröge fca0287dec Use ptr::NonNull in various places 2018-04-01 11:29:55 +03: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 1f6fd3def7 Structure intersection can return None 2017-12-17 11:52:52 +02:00
Sebastian Dröge 411f54afed Run everything to rustfmt again 2017-12-01 19:02:53 +02:00