Commit graph

48 commits

Author SHA1 Message Date
Sebastian Dröge f24b38470b Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1203>
2023-01-25 10:18:33 +02:00
Sebastian Dröge 82cf6e7842 Update for glib::Boxed ToGlibPtr<*mut _> trait impl addition
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1192>
2023-01-17 09:59:02 +02:00
Sebastian Dröge 37bfb78fdc Change some assertions to debug assertions
These assertions can only trigger because of bugs in the bindings
implementation or in the C code and not because of bugs in calling code,
so using debug assertions is perfectly fine for them and reduces the
number of assertions inlined everywhere in release builds.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1188>
2023-01-14 17:13:46 +02:00
Sebastian Dröge 567ce0a3bf Group and merge imports in all manual code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1182>
2023-01-04 13:25:17 +02:00
Sebastian Dröge 4dade30f0d Fix/silence a couple new clippy warnings 2022-06-30 13:08:33 +00:00
Sebastian Dröge d4430ecc6a Implement more iterator functions / traits in custom iterators for efficiency reasons 2022-05-22 12:42:42 +03:00
Guillaume Gomez 5ba79976a9 Generate missing doc aliases for newtypes 2021-06-01 15:15:59 +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
François Laignel 49583597ed manual code: fix-getters-def doc aliases 2021-05-03 20:46:57 +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
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 53be8e5f58 fix-getters-{def,calls} pass 2021-04-13 17:54:40 +02:00
Marijn Suijten f4ad451956 sdp: Use .ok() instead of manual match on Ok and Err
Using `.ok()` is more concise when loosing error context in favour of a
simple `None` value.

Automatic replacement SSR pattern in rust-analyzer:

    {let $a = $b;match $c {Ok($d) => Some($e), Err(_) => None }} ==>> {$b.ok()}

Note that rust-analyzer does not support:
- duplicate labels (ie. $c should be equal to $a, and $e equal to $d);
- statement lists yet, hence both sides are wrapped in braces.

But it performs the desired operation well enough here.
2021-03-15 21:07:17 +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 59397c84be sdp: Use an actual error type instead of ()
Fixes a new clippy warning.
2020-12-29 16:55:45 +02:00
Sebastian Dröge 08c54145d3 gstreamer/sdp: Fix SDPMessage::medias_mut() iterator
The raw pointer manipulation code was adding one indirection too many.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/304
2020-12-20 19:21:20 +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
Sebastian Dröge e18cc55049 gstreamer-sdp: Update manual code to 2018 edition 2020-11-22 19:15:21 +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 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
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
Tony Jinwoo Ahn c3b7f0f353 gstreamer-gl, gstreamer-pbutils, gstreamer-sdp: Change functions from returning Option to Result
Partial work for:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
2019-12-17 08:20:47 +00:00
Sebastian Dröge 2c4c2c4784 sdp: Guard against NULL strings/arrays in the SDP data structures
While all these are invalid for a proper SDP, they appear as NULL when
creating a new, empty SDP.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/221
2019-11-21 09:39:02 +00:00
Sebastian Dröge d8325212f4 Fix various clippy warnings 2019-07-11 22:02:01 +03:00
Sebastian Dröge 424a87efbf Use MaybeUninit::zeroed() everywhere possible instead of mem::zeroed() 2019-07-11 17:56:50 +03:00
Sebastian Dröge 86e969d964 Remove various Into<Option<_>> trait bounds from functions
In autogenerated code these were already replaced but some manual code
still kept them.
2019-05-24 10:04:16 +00:00
Sebastian Dröge e9edb8ddca sdp: Add SDPMessage::get_media_mut() and ::medias_mut()
This allows getting mutable references to the medias so that they can be
modified, which is allowed by the C API and safe to do.
2019-05-15 17:15:41 +03:00
Sebastian Dröge e7898c1b24 Update manual code 2019-04-15 19:19:19 +03:00
Sebastian Dröge 43a7eb8642 sdp: Fix leaking of SDPMedia in the adder of SDPMessage 2019-02-28 20:35:45 +02:00
Sebastian Dröge 0dcaa072a1 sdp: Fix various add/set functions on SDPMessage to not have a return value
These can't possibly fail.
2019-02-28 20:35:45 +02:00
Sebastian Dröge e830de8904 sdp: Fix freeing of message content when parsing fails 2019-02-28 20:35:45 +02:00
Sebastian Dröge 7673be5baa sdp: Remove MIKEY API for now
It was completely broken and has to be done differently. Once someone
actually needs it this can be re-added properly.
2019-02-28 20:35:45 +02:00
Sebastian Dröge 1d2f77bb64 sdp: Implement Borrow/BorrowMut/ToOwned for SDPMessage 2019-02-28 20:35:45 +02:00
Sebastian Dröge af86d5745d sdp: Implement a proper Debug impl on SDPMessage 2019-02-28 20:35:45 +02:00
Sebastian Dröge baf1d299d7 sdp: Fix up SDPMessage API that accesses indexed fields
It's forbidden to provide an index higher than the number of elements in
the array, and will cause crashes or other undesired outcomes.

Also the insert() API should take an Option<u32> instead of an i32 that
might also be -1 for appending. It's awful API otherwise.
2019-02-28 20:35:45 +02:00
Sebastian Dröge 95b3a3a648 sdp: Add message iterators for the various arrays 2019-02-28 20:35:45 +02:00
Sebastian Dröge fa14530c1d sdp: Add a SDPMessageRef that allows borrowing of a message 2019-02-28 20:35:45 +02:00
Sebastian Dröge 20e10698ac sdp: Add a SDPMediaRef that allows borrowing of a media
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/189
2019-02-28 20:35:45 +02:00
Sebastian Dröge bd0cbe99b3 Add more Debug impls to everything possible 2019-01-22 17:46:08 +02:00
Sebastian Dröge 5c93e134a7 Regenerate everything with new version of gir 2018-12-08 14:58:14 +02: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
maxmcd 40c206d813 Add sdp message init in parse functions 2018-05-31 16:30:18 +03:00
Sebastian Dröge 2d260b4f0c Rename manual files with too many underscores 2018-04-23 20:45:15 +03:00
Renamed from gstreamer-sdp/src/s_d_p_message.rs (Browse further)