Sebastian Dröge
24a16a43b6
Update CHANGELOG.md for 0.19.7
2023-01-19 19:05:17 +02:00
Sebastian Dröge
d6e9cd33c0
gstreamer: Make allocation query caps optional
...
See also https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3752
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1194 >
2023-01-19 16:08:16 +02:00
Sebastian Dröge
56498aa856
Fix version links in CHANGELOG.md
2023-01-18 16:53:08 +02:00
Sebastian Dröge
a6abe15678
Update CHANGELOG.md for 0.19.6 release
2023-01-18 16:53:05 +02:00
Sebastian Dröge
8aa3e4417c
gstreamer: Fix another typo in macro
2023-01-16 11:30:56 +02:00
Sebastian Dröge
2a11b9d2cf
gstreamer: Fix typo in macro
2023-01-16 11:30:08 +02:00
Sebastian Dröge
64abf69987
Use glib::function_name!
instead of module_path!
macro in more places
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1191 >
2023-01-16 11:10:21 +02:00
Sebastian Dröge
3e2eb6e652
gstreamer: Reduce code bloat in panic handling
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1191 >
2023-01-16 11:08:02 +02:00
Sebastian Dröge
3a340d0a89
gstreamer: Implement Structure::from_iter()
more generically
2023-01-15 23:06:45 +02:00
Sebastian Dröge
003554876c
Update various APIs to use glib::GStr
...
Currently only covers what is needed to keep code compiling, plus
everything caps/structure/tags related.
This avoids unnecessary heap allocations for adding the NUL-terminator
of C strings, and especially makes caps/structure handling as efficient
as in C.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1190 >
2023-01-15 21:05:57 +02:00
Sebastian Dröge
ea136515cf
Regenerate with latest gir
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1190 >
2023-01-15 20:17:11 +02:00
Sebastian Dröge
aa23ddbbdb
gstreamer: Simplify element subclass panic catching functions
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1188 >
2023-01-14 17:13:53 +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
f235dc987d
Inline various trivial functions
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1177 >
2023-01-11 11:33:54 +02:00
Sebastian Dröge
0fccb73eb6
gstreamer: Remove unnecessary cast in gst::element_imp_error!
and others
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1187 >
2023-01-11 09:06:38 +00:00
Sebastian Dröge
608cae3703
gstreamer: Register only a single type instead of per return value for the gst::Iterator::filter()
GValue
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1187 >
2023-01-11 09:06:38 +00:00
Sebastian Dröge
f07727ee6d
Use uninitialized stack memory for out parameters instead of zeroed memory if applicable
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1187 >
2023-01-11 09:06:38 +00:00
Sebastian Dröge
1b022a6b7c
Get rid of unnecessary option wrapping
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1187 >
2023-01-11 09:06:38 +00:00
Sebastian Dröge
84720eee66
gstreamer: Use Value::from_type_unchecked()
where applicable
...
Gets rid of some unnecessary assertions.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1184 >
2023-01-06 10:41:55 +02:00
Sebastian Dröge
89326c7e7c
Compile out GStreamer version checks if a high enough version is configured at build time
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1184 >
2023-01-06 10:41:55 +02:00
Sebastian Dröge
277d63601c
gstreamer: Return glib::GString
for the error/warning/info message debug string
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1184 >
2023-01-06 10:41:55 +02:00
Sebastian Dröge
ba1d8c5ce6
gstreamer: Move initialization panic into a separate function
...
This keeps the number of duplicated panics all over the codebase lower
and reduces generated code size.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1184 >
2023-01-05 21:33:14 +02:00
Sebastian Dröge
8d30bcbf4b
Use IntoGlibPtr
trait instead of to_glib_full()
where appropriate to reduce unnecessary refcounting/copying
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1183 >
2023-01-05 12:09:57 +02:00
Sebastian Dröge
1e793f3b65
gstreamer: Return some values by reference instead
...
Less refcounting.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1183 >
2023-01-05 12:09:57 +02:00
Sebastian Dröge
b94bfe1613
gstreamer: Remove useless GstPluginExtManual
trait
...
`Plugin` is a final type.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1182 >
2023-01-04 13:25:17 +02:00
Sebastian Dröge
a028e807df
gstreamer: Autogenerate some more API
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1182 >
2023-01-04 13:25:17 +02:00
Sebastian Dröge
7490846309
Fix compilation due to changes in autogenerated code
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1182 >
2023-01-04 13:25:17 +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
45c145ad50
Regenerate with latest gir
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1182 >
2023-01-04 13:25:17 +02:00
Sebastian Dröge
6ff5f89832
gstreamer: Fix memory leak in buffer pool subclassing test
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1180 >
2023-01-03 10:41:35 +00:00
Sebastian Dröge
0ed3d95c60
gstreamer: Use glib::StrV
internally instead of a custom version of it
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1180 >
2023-01-03 10:41:35 +00:00
Sebastian Dröge
cbd3035a5b
gstreamer: Implement gst::Segment
via glib::wrapper!
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1180 >
2023-01-03 10:41:35 +00:00
Sebastian Dröge
8ed150c853
gstreamer: Add missing doc alias
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1180 >
2023-01-03 10:41:35 +00:00
Sebastian Dröge
ae688406f8
gstreamer: Allocate debug messages up to 256 bytes on the stack and only then spill over into the heap
...
With this, debug logging from Rust is completely allocation-less for
short messages and string literals.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1179 >
2023-01-03 10:28:43 +00:00
Sebastian Dröge
06a0dbacba
gstreamer: Don't inline debug logging function
...
It's relatively big and increases code size and stack usage quite a bit,
and having a function call for logging is not going to make much of a
difference as it happens *after* filtering for the debug level
threshold.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1179 >
2023-01-03 10:28:43 +00:00
Sebastian Dröge
036a020b62
gstreamer: Optimize various from/to Vec
FFI translation functions
...
Use memcpys if possible instead of manual loops, and directly write into
the `Vec` memory and set the length afterwards to avoid having the
reallocate logic at every step.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1181 >
2023-01-03 12:06:29 +02:00
Sebastian Dröge
882513d33a
Make use of the new TransparentType
/ TransparentPtrType
traits
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1178 >
2023-01-02 19:07:24 +02:00
Sebastian Dröge
e6e5d25e48
Update CHANGELOG.md for 0.19.5
2022-12-27 12:53:30 +02:00
Sebastian Dröge
3d0f563111
Update minimum supported Rust version to 1.64
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1175 >
2022-12-25 14:54:38 +02:00
Sebastian Dröge
146b4fc08e
gstreamer: Fix glib::GStr
API changes
2022-12-25 00:25:42 +02:00
Sebastian Dröge
cdc7aa4846
gstreamer: Allow returning Handled
from BufferList
pad probes
...
This is handled exactly the same way as buffers.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1174 >
2022-12-23 12:21:18 +00:00
Sebastian Dröge
d6cc452cf3
Use PhantomData
as Stash::Storage
if nothing has to be stored except for a lifetime
...
This reduces the size of all stashes from two pointers to one.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1171 >
2022-12-20 17:07:39 +00:00
Sebastian Dröge
f166e80a79
gstreamer: Only use a single temporary Vec
for [T]::to_glib_none()
for miniobjects
...
The value itself is already kept alive via the stash and we only need a
temporary `Vec` to be able to append the terminating `NULL` pointer.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1171 >
2022-12-20 17:07:39 +00:00
Sebastian Dröge
3764bf75f8
Regenerate with latest GStreamer gir files
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1170 >
2022-12-16 22:09:29 +02:00
Sebastian Dröge
8c22ba25f8
Update CHANGELOG.md for 0.19.4
2022-12-16 11:56:04 +02:00
Sebastian Dröge
e3ad1918dc
Fix various new clippy warnings
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1164 >
2022-12-13 11:29:45 +02:00
Sebastian Dröge
0fa8d0d62f
gstreamer: Fix formatting if a string literal needs formatting
...
E.g. "blabla {some_variable}" is a string literal but needs formatting,
so we can't just pass it as a literal to the logger.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1161 >
2022-12-11 12:20:35 +02:00
Sebastian Dröge
2a935320e7
gstreamer: Replace some generic function parameters with impl trait
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1160 >
2022-12-10 20:18:11 +02:00
Sebastian Dröge
ef5d5f50e4
gstreamer: Actually log the function name instead of the module name
...
As there is no way to get the function name as a string literal
currently, we have to copy locally into a NUL-terminated array.
Up to 256 bytes this is managed on the stack, otherwise a heap
allocation is necessary.
For the <256 bytes case the compiler is optimizing most of this away.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1160 >
2022-12-10 20:18:11 +02:00
Sebastian Dröge
355ebc243f
gstreamer: Add DebugCategory::above_threshold()
to check if the category's threshold is above the given level
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1160 >
2022-12-10 20:18:11 +02:00
Sebastian Dröge
b58d518aa3
gstreamer: Use glib::GStr
for DebugMessage
string API too
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1160 >
2022-12-10 20:18:11 +02:00
Sebastian Dröge
de04e3f827
gstreamer: Reduce allocations in custom logging functions for the file/function strings
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1160 >
2022-12-10 20:18:11 +02:00
Sebastian Dröge
0e7f5a19df
gstreamer: Require using a NUL-terminated UTF-8 string or a string literal for the logging ID
...
Otherwise each log will involve a new allocation just for the ID.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1160 >
2022-12-10 20:18:11 +02:00
Sebastian Dröge
2be477b753
gstreamer: Make logging of messages from a string literal allocation-free if using GStreamer 1.20 or newer
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1160 >
2022-12-10 20:18:11 +02:00
Sebastian Dröge
3a61276cdd
gstreamer: Reduce some allocations for passing the filename/module name to the logging functions
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1160 >
2022-12-10 20:18:11 +02:00
Sebastian Dröge
750422d8eb
gstreamer: Reduce some code duplication in the logging code
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1160 >
2022-12-10 15:48:02 +02:00
Sebastian Dröge
3ab7bc7648
gstreamer: Add bindings for new 1.22 debug log ID API
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1159 >
2022-12-09 17:37:01 +02:00
Sebastian Dröge
a54c234fc6
gstreamer: Directly use fields for DebugCategory
getters
...
This allows for better optimizations as it doesn't go through an opaque
FFI function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1159 >
2022-12-09 17:37:01 +02:00
Sebastian Dröge
e8859951d3
gstreamer: Ignore EventType::to_sticky_ordering
...
This is handled manually via the `PartialOrd` impl.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1159 >
2022-12-09 17:37:01 +02:00
Sebastian Dröge
7012fa638e
Regenerate with latest gir/gir-files/gst-gir-files
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1159 >
2022-12-09 17:37:01 +02:00
Sebastian Dröge
b89b98b6e9
Update CHANGELOG.md for 0.19.3
2022-11-28 10:16:21 +02:00
Sebastian Dröge
b5fcbc9657
gstreamer: Get rid of some unnecessary unsafe API usage
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1157 >
2022-11-27 00:59:38 +02:00
Sebastian Dröge
0bc16c65f0
gstreamer: Add some API for add new items to a gst::Array and gst::List
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1157 >
2022-11-27 00:59:38 +02:00
Sebastian Dröge
ae4dd88f3d
Update for GLib Into<Value>
changes
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1156 >
2022-11-26 15:19:35 +02:00
Sebastian Dröge
0b013001b7
Regenerate with latest gir
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1156 >
2022-11-26 15:01:10 +02:00
Sebastian Dröge
3da927a856
gstreamer: Fix sticky event ordering for instant-rate-change
...
The event type for instant-rate-change events was poorly chosen, leading
to them being re-sent too late and even after EOS.
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3387
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1154 >
2022-11-21 13:43:22 +02:00
Sebastian Dröge
cbfc19ccfc
Regenerate with latest GStreamer gir files
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1153 >
2022-11-21 13:29:38 +02:00
Sebastian Dröge
fa5491e6b3
Use borrowed miniobject/structure types in more places
...
When the function does not keep around an additional reference of the
value this is correct and more flexible for callers.
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/420
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1152 >
2022-11-21 12:40:37 +02:00
Sebastian Dröge
5a0152b469
gstreamer: tracer: Pass &QueryRef
instead of &Query
to the functions
...
To make it impossible for implementor to keep around a reference to the
query as that would break element code that actually tries to answer the
query.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1152 >
2022-11-21 12:40:37 +02:00
Sebastian Dröge
1264eb10ac
gstreamer: Add PartialEq
impls between owned/borrowed miniobjects/structures
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1152 >
2022-11-21 12:40:37 +02:00
Sebastian Dröge
56b9b66027
gstreamer: Implement FromIterator<Caps>
and Extend<Caps>
for Caps
...
This allows easily generating new/extending existing caps from an
iterator.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1151 >
2022-11-21 10:10:04 +02:00
Sebastian Dröge
774fafd987
gstreamer: Implement From<T> for Signed<T>
...
This makes usage simpler in a few places.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1150 >
2022-11-18 12:07:13 +02:00
Edward Hervey
77fd187986
format: Add Signed<T>
<=> signed integer conversions
...
Co-authored-by: Sebastian Dröge <sebastian@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1149 >
2022-11-16 16:32:24 +02:00
Sebastian Dröge
88791294a5
Update CHANGELOG.md for 0.19.2
2022-11-13 20:13:29 +02:00
Sebastian Dröge
9ba448427d
Regenerate with latest gir
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1148 >
2022-11-12 17:40:16 +02:00
Elie Génard
f1c8869447
gstreamer: Add gst::Allocator
subclassing support
2022-11-08 19:28:42 +00:00
Sebastian Dröge
d3543efec2
gstreamer: Manually implement Allocator::register()
...
Due to a bug it causes use-after-free in versions < 1.20.5, so work
around that here.
2022-11-08 19:07:48 +02:00
Sebastian Dröge
32c432655f
Regenerate with latest GStreamer gir files
2022-11-08 18:15:34 +02:00
Sebastian Dröge
01e24d2018
Fix various new clippy warnings
2022-11-01 11:10:57 +02:00
Sebastian Dröge
2bffc4e5ec
Fix 0.19.1 release date in the changelog
2022-10-24 12:34:21 +03:00
Sebastian Dröge
708ad14422
Update CHANGELOG.md for 0.19.1
2022-10-24 12:32:45 +03:00
Sebastian Dröge
90b8ee2022
Move from imp.instance()
to imp.obj()
...
It's doing the same thing and is shorter.
2022-10-23 23:06:44 +03:00
François Laignel
87ea535bc1
gst/log: accept non-ref obj in macros
2022-10-23 20:44:38 +02:00
Sebastian Dröge
031133c179
Update versions to 0.20.0
2022-10-22 20:27:42 +03:00
Sebastian Dröge
7331dbc440
Update CHANGELOG.md for 0.19.0
2022-10-22 20:22:10 +03:00
Sebastian Dröge
bf7c770457
Regenerate with latest gir files
2022-10-22 20:22:10 +03:00
Sebastian Dröge
a1165a7456
gstreamer: Add bin/pipeline builders
...
And also implement the Default trait for them.
2022-10-22 17:36:36 +03:00
François Laignel
0e5a4f05f8
gst: fix Element::request_new_pad
signature
...
See:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1133#note_1600152
2022-10-21 11:30:02 +02:00
François Laignel
4ebdfb8602
Use impl Into<Option<_>>
for functions impacted by nullability fixes
...
This commit addresses the functions which signatures changed in
commit f9690817
so that users can still use e.g.
`query.set_result(val)` instead of `query.set_result(Some(val))`.
See [1] for an attempt at generalizing this approach.
[1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1133
2022-10-21 11:30:02 +02:00
Sebastian Dröge
130cc9d63b
element: Implement linking functions manually for better error reporting
...
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/318
2022-10-19 17:59:04 +03:00
Sebastian Dröge
7423b1dea6
elementfactory: Change make()
/ create()
to builders and keep the old variants as create_with_name()
/ make_with_name()
...
As a side-effect, this also now includes the element factory name in the
error messages instead of giving the same error string for every
factory.
Partially fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/318
Also let them all go through the same, single object construction code.
2022-10-19 17:48:39 +03:00
Sebastian Dröge
7ad75d4b1f
elementfactory: ElementFactory::create_with_properties() is available in any GStreamer version
...
As it's re-implemented here now instead of calling into the C function.
2022-10-19 13:53:06 +03:00
Sebastian Dröge
9c282ec7c3
gstreamer: Implement ElementFactory::create_with_properties() manually
...
This way we can get the same property checks as normal object
construction would provide.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/402
2022-10-18 16:27:10 +00:00
Sebastian Dröge
67e3183922
Regenerate with latest gir and gir-files
2022-10-18 18:16:51 +03:00
Sebastian Dröge
19f7aaf413
Generate only a single versions file for sys crates too
2022-10-18 18:15:01 +03:00
Sebastian Dröge
9a9ce252a4
Fix usage of dox feature
2022-10-18 18:15:01 +03:00
Sebastian Dröge
d80227e566
Trust nullability annotations everywhere
2022-10-18 18:15:01 +03:00
Sebastian Dröge
f9690817ad
Fix nullability handling in some functions in manual code
2022-10-18 18:15:01 +03:00
Vivia Nikolaidou
8d3ada5d89
pad: Catch panics in pad task functions
...
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/246
2022-10-18 10:38:12 +00:00
François Laignel
49faa03c98
gst/format: make from_u64
constructors const
...
This commit makes the formatted values' main constructors `const`,
so that they can be used in constant definitions.
`from_usize` constructors can't be made const because `try_into`
can't be used in `const` functions as of rustc 1.64.0. Same for
`Percent::from_ratio`: floating point arithmetic is not allowed.
2022-10-18 11:24:57 +02:00
François Laignel
384783b242
gst/format: introduce Constructor traits
...
Introduce a set of Constructor traits which are implemented on
integer of float depending on the formatted values. This traits
allows building formatted values using expressions such as:
```rust
let buffer_nb = 20.buffers();
let size = 42.k_bytes();
let duration = 15.minutes() + 30.seconds();
let quantity = 42.default_format();
let progress = 20.percent();
let progress = 0.2.percent_ratio();
```
2022-10-18 11:24:08 +02:00
Vivia Nikolaidou
39bb9abc3c
caps: Add .structure() to CapsBuilder
...
Allows us to get the structure, to read fields after adding them to the
builder.
2022-10-14 16:24:51 +03:00
Sebastian Dröge
734afa998b
gstreamer: Implement pad default functions as associated functions
...
Making them associated functions clearer that special care is required
and avoid conflicts with the same functions in ghostpad/proxypad.
2022-10-12 18:29:52 +03:00
Sebastian Dröge
7d10f9f4c8
Regenerate with latest gir/gir-files
2022-10-12 15:05:07 +03:00
François Laignel
dcf6d16496
gst/format: new panicking constructors and some Percent fixes
...
Previous proposition for constructing specific formatted values was
to use an operation such as `42 * Default::ONE` which, in retrospect,
doesn't seem idiomatic.
This commit adds `from_u64` and `from_usize` constructors for most
formatted values. Having `from_usize` is convenient when dealing with
quantities related to containers indices or length.
This also fixes the `Percent` from float constructors from which was
derived the `ONE` constant as well as previous display implementation.
Also removed the `pub` specifier for `Undefined` inner value. It wasn't
removed in a previous commit as `Undefined` can use the full range of
the inner type. But now, it seems preferable not to expose the inner
value for proper encapsulation and so as to reduce the differences with
other formatted values (kind of least astonishment principle).
2022-10-11 13:25:53 +02:00
François Laignel
08551bb1bc
format/specific: don't expose inner as pub
...
... users would be able to bypass the range checks and build a
defined Rust value which would be interpreted as `None` in C code.
Added format module examples for formatted values constructions.
2022-10-10 19:23:35 +02:00
François Laignel
f6336b1be3
gst/format: fix Percent
Display
impl
...
- The `GST_FORMAT_PERCENT_SCALE` was not used to compute the value
to display.
- Added `Display` examples in the format module documentation.
- Simplified `glib_newtype_display` macro.
2022-10-10 18:44:59 +02:00
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
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
69ea30dbda
gstreamer: meta: Allow to register custom meta without transform function
2022-09-29 14:05:35 +02: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
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
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
dec112d0a8
Regenerate with latest gir/gir-files/gst-gir-files
2022-09-13 12:13:07 +03:00
François Laignel
f014505e1c
regen: rename feature 'ser_de' as 'serde'
2022-09-12 19:36:32 +02:00
François Laignel
069c6a2c01
Rename feature 'ser_de' as 'serde'
...
When I introduced the 'ser_de' feature, I couldn't find a way to
name it 'serde' while also make it pull the optional 'serde'
crate together with the other related dependencies.
With rustc >= 1.60 we can use 'dep:serde' to refer to the 'serde'
dependency as part of the 'serde' feature.
2022-09-12 19:36:30 +02:00
Sebastian Dröge
efe13948cc
ci: Update gst-gir-files and bring autogenerated code in sync
2022-09-04 20:51:07 +03:00
Sebastian Dröge
35c6af424d
Update minimum supported Rust version to 1.63
2022-09-04 10:37:13 +03:00
Sebastian Dröge
201eed8400
gstreamer: Sync param spec API with glib
2022-09-04 10:34:05 +03:00
Sebastian Dröge
44d899a0eb
Regenerate with latest gir / gir-files / gst-gir-files
2022-08-31 11:13:08 +03:00
Guillaume Desmottes
e229288ecd
gstreamer: manually implement Debug on PromiseReply
...
The default implementation was not very useful:
PromiseReply(
Promise {
inner: Shared {
inner: 0x00007ff108001090,
},
},
)
2022-08-29 08:59:21 +00:00
Guillaume Desmottes
1e24e2d133
gstreamer: caps: improve Debug implementation
2022-08-25 10:54:16 +02:00
Guillaume Desmottes
0c9158f404
gstreamer: taglist: improve Debug implementation
2022-08-25 10:54:16 +02:00
Guillaume Desmottes
64c09353b7
gstreamer: structure: improve Debug implementation
...
g_strdup_value_contents() output is not easily readable with nested
structures
2022-08-25 10:54:16 +02:00
Thibault Saunier
e9d95eda59
gstreamer: Add extension trait to mark API as plugins API
...
This adds an extension trait implemented for GType so we can
add and check plugins API status.
Required so we can document plugins written in rust.
2022-08-24 10:38:06 -04:00
Sebastian Dröge
76f01516e3
Regenerate with latest GStreamer gir files
2022-08-19 19:42:05 +03:00
Sebastian Dröge
8d9abb935b
gstreamer: Update to ron 0.8
2022-08-16 13:09:49 +03:00
François Laignel
be2de21602
Update option-operations to 0.5.0
...
This fixes the trait `OptionEq` not being exported in `prelude`.
2022-08-15 22:44:53 +02:00
Sebastian Dröge
fbad0fd0bc
Regenerate with latest gir / gir-files / gst-gir-files
2022-08-14 14:02:50 +03:00
Guillaume Desmottes
c5d19e7c80
miniobject: implement ptr_eq() on ref type
2022-08-12 11:15:08 +02:00
Guillaume Desmottes
c0fd8a8aad
gstreamer: add BufferRef::ptr_eq()
2022-08-12 08:29:49 +02:00
Guillaume Desmottes
2dcd5cf9eb
as_ptr() and as_mut_ptr() accessors are safe
...
Nothing unsafe about getting a pointer, deferencing it is unsafe.
2022-08-12 08:29:49 +02:00
Sebastian Dröge
b06a692dea
Fix a new beta clippy warning
...
warning: unused return value of `std::boxed::Box::<T>::from_raw` that must be used
--> gstreamer-rtsp-server/src/rtsp_session_pool.rs:23:5
|
23 | Box::<F>::from_raw(ptr as *mut _);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
= note: call `drop(from_raw(ptr))` if you intend to drop the `Box`
2022-08-10 10:27:27 +00:00
Sebastian Dröge
2cb7fc8122
gstreamer: Add GstParamSpecBuilderExt trait to easily allow setting controllable, mutable-ready and other extension flags
2022-08-10 12:28:05 +03:00
Sebastian Dröge
446f09fec6
gstreamer: Implement new ParamSpecBuilderExt trait from glib
2022-08-10 12:03:51 +03:00
François Laignel
2d17d46c50
gst: use Signed where applicable
2022-07-18 23:26:20 +02:00
François Laignel
414222aa99
gst/format: Signed wrapper
...
Functions such as Segment::to_running_time_full replicate the C
signature for the return type: an integer indicates whether the
resulting value must be interpreted as positive or negative.
In Rust, alternatives are usually represented using an enum.
This commit implements an enum wrapper to represent the sign
and adds functions to FormattedValue to ease Signed handling.
2022-07-18 23:26:20 +02:00
Sebastian Dröge
b5920ee729
Regenerate with latest gir
2022-07-18 13:25:36 +03:00
Sebastian Dröge
cf1a64ecf8
gstreamer: Hide some useless enum variants that only make sense in C
2022-07-18 13:13:48 +03:00
Tomasz Andrzejak
2090452e3d
Update minimum supported rust version
2022-07-14 15:23:34 +02:00
François Laignel
a787197254
Use CompatibleFormattedValue where applicable
...
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1059
2022-07-11 19:45:52 +02:00
François Laignel
865df62f8d
gst/format: add CompatibleFormattedValue
...
The trait CompatibleFormattedValue can be used to check argument
compatibility to a certain Format. This is convenient to define
function which accept several FormattedValues which must hold
values of the same Format.
This trait enforces format compatibility at compilation time for
SpecificFormattedValues and at runtime when a GenericFormattedValue
is provided.
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1059
2022-07-11 19:45:52 +02:00
François Laignel
fe319af598
Implement FormattedValue on any candidate type
...
The trait FormattedValue was only implemented on types which
could implement the full range of values for a Format. In order
to declare a function which could take both the intrinsic type
of any Format (e.g. `ClockTime`) as well the full range of values
(e.g. `Option<ClockTime>`), the argument was declared:
```rust
impl Into<GenericFormattedValue>,
```
This commit implements `FormattedValue` for any type representing
a format. E.g.: both `ClockTime` and `Option<ClockTime>` will now
implement `FormattedValue`. The trait `FormattedValueFullRange`
is implemented on types which can be built from any raw value.
These changes are intended to help for the implementation of a
means to enforce format conformity at compilation time for
functions with multiple formatted value arguments.
The following signatures were found to be incorrect and are fixed:
- `message::StepDone`: forced the type for `amount` and `duration`
to be of the same type, when `duration` is expected to be of the
`Time` format.
- `query::Convert::set`: the two arguments were forced to the same
type, so potentialy the same format, unless a
`GenericFormattedValue` was used.
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1059
2022-07-11 19:45:52 +02:00
Paolo Borelli
f2a2e6702c
caps: add new_empty_simple constructor
2022-07-05 14:49:21 +02:00
Sebastian Dröge
4dade30f0d
Fix/silence a couple new clippy warnings
2022-06-30 13:08:33 +00:00
Sebastian Dröge
65629426cb
tracer: Add bindings for new pad chain hooks
2022-06-30 08:46:06 +03:00
Sebastian Dröge
90aaa32957
Regenerate
2022-06-30 08:46:06 +03:00
Sebastian Dröge
c61d913ec6
tracer: Add support for the 1.20 "plugin-feature-loaded" hook
2022-06-29 10:13:59 +03:00
Sebastian Dröge
9e77ab3212
tracer: Re-order trait functions slightly for the order to make more sense
2022-06-29 10:13:36 +03:00
Sebastian Dröge
14f485d0b1
bus: Take ownership of the message in post()
2022-06-28 23:36:08 +03:00
Sebastian Dröge
20ac231146
gstreamer: Allow borrowing Segment
s from Value
s without copying
2022-06-27 22:28:49 +03:00
Sebastian Dröge
c9d07219c8
Store whether GStreamer was initialized in an AtomicBool
...
Avoids a function call in the normal case.
2022-06-27 10:28:28 +03:00
Sebastian Dröge
b28664ccbd
gstreamer: Fix serde serialization tests
...
ron serialization is now writing `1.0` instead of just `1`.
2022-06-24 11:13:06 +03:00
Stephan Seitz
c254c5fd1a
gstreamer: add PadProbeId::as_raw()
...
This allows to convert PadProbeId to numberic values without
taking them by value (like `into_glib`).
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/382#note_1391236
2022-05-23 08:19:47 +00:00
Sebastian Dröge
cb1f08a425
gstreamer: Implement FusedFuture for PromiseFuture
2022-05-22 12:42:42 +03:00
Sebastian Dröge
aaf601831e
gstreamer: Index structures/taglist more safely
...
Accessing after the length will lead to a critical warning and should
not happen.
2022-05-22 12:42:42 +03:00
Sebastian Dröge
d4430ecc6a
Implement more iterator functions / traits in custom iterators for efficiency reasons
2022-05-22 12:42:42 +03:00
Philippe Renon
8f1c94f45d
Regenerate with latest gir
2022-05-20 17:48:40 +02:00
Sebastian Dröge
e76ae3f434
gstreamer: Fix a few new clippy warnings
2022-05-20 11:19:07 +03:00
Philippe Renon
5d2f36fac3
gstreamer: implement FromGlibPtrBorrow trait for gst::Structure
...
needed for callbacks that pass GstStructure by reference
for example: the PlaySignalAdapter error and warning signals
needed by https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1036
2022-05-17 23:19:35 +02:00
Sebastian Dröge
45e16f7753
gstreamer: Add #[must_use]
annotation to PadTemplateBuilder
2022-05-08 11:41:54 +03:00
Guillaume Gomez
c1d3ed5eac
Use IntoGlibPtr trait instead of implementing into_ptr
2022-05-07 13:38:11 +02:00
Sebastian Dröge
cd49659fae
gstreamer: Add a PadTemplateBuilder
...
And only allow setting documentation caps via that. It's not actually
allowed to update the documentation caps at random times as it is not
thread-safe.
2022-05-06 16:57:06 +03:00
Sebastian Dröge
0aa59be45c
gstreamer: Improve accessors to various pad template fields
2022-05-06 16:22:40 +03:00
Sebastian Dröge
45856ac35b
gstreamer: Return a glib::List
instead of a Vec
for the pad template list
...
Avoids an unnecessary allocation for the `Vec`.
2022-05-06 12:42:52 +03:00
Vivienne Watermeier
1b22be2e15
Add De/Serialization for most bitflag types
...
Represents combinations of flags with a '+' separated string of nicks,
or an empty string for no flags set.
Note that most flag types will ignore any flags using multiple bits when
serializing, since in most cases these flags cover all used bits.
2022-05-06 09:05:52 +00:00
Vivienne Watermeier
94b5a13f4b
Regenerate with Gir.toml changes
2022-05-06 09:05:52 +00:00
Vivienne Watermeier
fec2718aef
Remove generated serde derives from all bitflags types
2022-05-06 09:05:52 +00:00
Sebastian Dröge
4a28a188d9
Regenerate with latest gir/gir-files
2022-05-03 15:37:25 +03:00