Commit graph

53 commits

Author SHA1 Message Date
Marijn Suijten 10c93807fb Replace explicit type with Self in for_value_type::<> turbofish 2021-04-30 10:02:47 +02:00
Sebastian Dröge eda1d3d4a7 Update for Value trait refactoring 2021-04-25 14:45:08 +03: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
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
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 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
Guillaume Gomez ff5a36561a Fix license header situation 2020-12-15 11:53:31 +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 dbc76f1053 gstreamer/miniobject: Remove DerefMut and AsMut impls
They were side-stepping the miniobject writability mechanism.
2020-06-30 15:23:50 +03:00
Sebastian Dröge af01f1bc67 gstreamer: Simplify MiniObject bindings by removing one layer of abstraction
And instead directly implementing this via the macro on the target
types.
2020-06-30 11:06:02 +03: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
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 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
Sebastian Dröge 019afd54f9 Update for new from_glib_borrow signature
See https://github.com/gtk-rs/glib/pull/605
2020-04-05 18:48:48 +03:00
Sebastian Dröge 9d5ae8ed14 gstreamer: Don't take mini objects by value for append() and similar operations
Compared to
  let foo = Foo::bar(foo);
the new form is easier to follow
  foo.bar();
2020-03-07 00:31:30 +02:00
Sebastian Dröge e6f65a5032 gstreamer/miniobject: ToOwned::to_owned() on references has to create a copy
Otherwise it's possible to create a new owned reference from a mutable
reference, and then there is a mutable and immutable reference to the
same data at the same time, which is simply not allowed.

https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/204
2019-05-24 10:04:16 +00:00
Sebastian Dröge b2b8bfab52 Add manual implementations for various new 1.16 functions 2019-04-23 20:45:39 +03: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 fa988fe73d Make gst_define_mini_object_wrapper! macro work stand-alone without requiring specific names in scope 2018-12-08 12:53:10 +02:00
Sebastian Dröge 5d9a3b4272 Use ptr::add(i) instead of ptr::offset(i as isize) 2018-10-11 11:58:01 +03:00
Sebastian Dröge c56e9ddfea Also implement copy() returning the wrapper miniobject on the reference type
This way CapsRef::copy() will return a Caps, and not a GstRc<CapsRef>.
2018-10-05 16:36:15 +03:00
Sebastian Dröge 30b9527112 Implement ::copy() directly on miniobject wrapper types
This provides the additional wrapping as the one via get via deref will
only give back a GstRc<T> without the additional wrapping.
2018-10-03 16:54:00 +03:00
Sebastian Dröge 6fd0ed4cb3 Move all minobjects to newtype wrapper types
For consistency with external crates and to help rustdoc, which gets
confused on impl blocks for type aliases.
2018-09-28 18:11:46 +03:00
Sebastian Dröge 26ee546d1a Always derive Clone for miniobject wrappers 2018-09-28 17:42:52 +03:00
Sebastian Dröge 74024447fe Add macro to define newtype wrappers around MiniObjects
To allow implementing them in a meaningful way in external crates.
2018-09-28 17:37:27 +03:00
Sebastian Dröge 33a6aab6d7 Run everything through latest rustfmt 2018-07-27 13:36:40 +03:00
Sebastian Dröge e88017f914 Ensure that miniobjects are writable before creating a mutable borrow 2018-07-06 10:29:09 +02: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 e1d134c4be Run everything through latest rustfmt-nightly 2017-10-17 12:06:51 +03:00
Sebastian Dröge 1f16a39ca4 Move gst_mini_object_copy() from GstRc<T> to MiniObject directly
It can also be called on the shallow references.
2017-10-12 17:58:46 +03:00
Sebastian Dröge 5589d5221f Revert "Don't require &mut self for GstRc::get_mut()"
This reverts commit 4b77c18b5b.

It unfortunately allows to get multiple mutable references to the same
underlying data, which is not allowed.
2017-10-11 15:30:55 +03:00
Sebastian Dröge 4b77c18b5b Don't require &mut self for GstRc::get_mut() 2017-10-05 14:48:33 +03:00
Sebastian Dröge b4cb81cd56 Run everything through latest rustfmt-nightly 2017-09-10 15:21:26 +03:00
Sebastian Dröge 85b335fd89 Fix/hide various clippy warnings in gstreamer 2017-09-10 15:21:26 +03:00
Sebastian Dröge f0935d7e1e Add remaining gst_init() assertions 2017-08-30 14:39:09 +03:00
Sebastian Dröge 6c4ee55f27 Implement SetValueOptional for GstRc<T> 2017-08-18 15:38:51 +03:00
Sebastian Dröge 146b3092aa Minor miniobject code cleanup 2017-08-09 20:08:02 +03:00
Sebastian Dröge f00af84105 Properly implement Eq/PartialEq/Debug for miniobjects 2017-08-09 20:08:02 +03:00
Sebastian Dröge 0720b9f6f1 Add missing array translation trait impls to GstRc<T> 2017-08-02 20:46:22 +03:00
Sebastian Dröge 03285a6311 Run everything through latest rustfmt-nightly 2017-07-31 12:16:42 +01:00
Sebastian Dröge e75d2c224e Add GValue support to GstRc/MiniObject 2017-07-28 11:09:34 +01:00
Sebastian Dröge acd0fc7874 Add Buffer bindings from gst-plugin-rs 2017-07-25 15:01:24 +03:00