Commit graph

1139 commits

Author SHA1 Message Date
Sebastian Dröge
4d002786ec gstreamer: Don't re-export traits from the crate root 2022-04-04 08:51:04 +00:00
Sebastian Dröge
73ab9054c4 Don't use unnecessary RefCell wrappers for FnMut callbacks
They don't add any safety as this is via unsafe code anyway and are not
needed to get mutable references in this context anyway, while adding a
bit of runtime overhead.
2022-04-03 11:15:19 +03:00
Jan Alexander Steffens (heftig)
b7afdd4dd0
gstreamer: Add TaskPool bindings and subclassing
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/14
2022-03-30 23:01:21 +02:00
Jan Alexander Steffens (heftig)
44b2eba600
Update gir 2022-03-30 22:36:53 +02:00
Sebastian Dröge
07be60a22f Don't unnecessarily borrow dereferenced values explicitly
warning: this expression borrows a value the compiler would automatically borrow
  --> gstreamer-rtsp-server/src/rtsp_session_pool.rs:16:5
   |
16 |     (&mut *func.borrow_mut())(&from_glib_borrow(pool)).into_glib()
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `(*func.borrow_mut())`
   |
   = note: `#[warn(clippy::needless_borrow)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
2022-03-24 12:40:52 +02:00
Sebastian Dröge
609a744d6c Regenerate autogenerated bindings 2022-03-17 18:05:13 +02:00
Sebastian Dröge
12f1483d43 gstreamer: Create plugins with version 1.21 if v1_22 is selected 2022-03-17 11:06:26 +02:00
Christian Meissl
44d39f8824 Add infrastructure for casting from/to memory subtypes 2022-03-12 14:19:40 +00:00
Sebastian Dröge
b69043d462 gstreamer: Require Send and not Sync for the values of an Array / List
`Sync` is more than required here: only sending of the values to another
thread is required.
2022-03-08 14:46:13 +02:00
Sebastian Dröge
1f7a0f29d9 gstreamer: Update for optional glib::Value type refactoring 2022-03-07 13:20:08 +02:00
Sebastian Dröge
0f22eb7633 Remove now unnecessary Send+Sync impls for element/etc subclasses
This is now automatically implemented.
2022-02-28 18:25:15 +02:00
Sebastian Dröge
319f1c68a5 gstreamer: Simplify and speed up log message string construction
For pre-1.20 simply use `%s` as format string instead of escaping the
`%` inline while writing. This allows a simpler implementation and is
also faster, see https://github.com/gtk-rs/gtk-rs-core/pull/583.
2022-02-26 13:33:00 +02:00
Sebastian Dröge
fc1185b951 gstreamer: Add builders for the fraction/array paramspecs 2022-02-22 00:00:39 +02:00
François Laignel
972c4e75ac remove gst_ prefix for log macros
It's quite quite common to use similar macros in the form `log::debug!`
or `glib::clone!`. This MR renames the gst log macros so that we can
`gst::debug!` instead of `gst_debug!` and whithout the need for
`use gst::gst_debug`.
2022-02-21 18:56:06 +01:00
Marijn Suijten
462e19dee9 gstreamer/plugin_1_14: Use minor version 20 instead of 19 for v1_20
Now that gstreamer 1.20 is out all v1_20 plugins will be linked against
the 1.20 stable release, not the unstable 1.19 development release.
2022-02-18 11:33:17 +01:00
Sebastian Dröge
d68c359db5 gstreamer: Fix downcast_ref() / downcast_mut() impls on MiniObjectRef
They have to return the `Ref` type and not the owned type.
2022-02-16 12:13:19 +02:00
Sebastian Dröge
a1fed48e8c gstreamer: Add Debug impl for MiniObject / MiniObjectRef 2022-02-16 12:13:03 +02:00
Sebastian Dröge
d1f978f9f1 gstreamer: Improve StreamsSelectedBuilder::streams()
It's much easier to use if it takes any kind of iterator instead of a
slice of references.
2022-02-14 13:44:19 +02:00
Christian Meissl
033dac2270 support for subclassing buffer pool 2022-02-08 15:59:55 +01:00
Sebastian Dröge
0173b73170 Handle empty slices correctly
Passing `NULL` to `slice::from_raw_parts` is invalid.
2022-02-07 12:50:37 +02:00
Sebastian Dröge
47ae1c8658 Regenerate with latest gir files 2022-02-04 12:35:01 +02:00
Sebastian Dröge
deced8b3b8 Regenerate with latest GStreamer gir files 2022-01-29 18:17:26 +02:00
Sebastian Dröge
26f2ed30ae Regenerate with latest gst-gir-files 2022-01-25 13:10:58 +02:00
Sebastian Dröge
06cf5de45f Get rid of fragile dependency and use GLib API instead 2022-01-24 19:33:15 +02:00
Sebastian Dröge
13eb483444 Regenerate everything with latest gir 2022-01-24 19:29:18 +02:00
Sebastian Dröge
eecce101da gstreamer: Implement FromValue for mini object references 2022-01-24 13:13:24 +00:00
Sebastian Dröge
b66a00ed07 gstreamer: Minor cleanup 2022-01-24 14:48:36 +02:00
Sebastian Dröge
ab0eb8a1a4 gstreamer: Add bindings for gst_debug_log_get_line() 2022-01-24 14:48:21 +02:00
Sebastian Dröge
5e2249d368 message/query/event: Implement views in a more consistent way
Co-authored-by: Jan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
2022-01-19 13:29:59 +02:00
Sebastian Dröge
68d492bb33 gstreamer: Mark Structure and CapsFeatures as #[repr(transparent)] too 2022-01-17 19:42:20 +00:00
Jan Alexander Steffens (heftig)
fb56bbda6e gstreamer: Split parsers for owned and borrowed views
When we have a view like `Caps<&EventRef>`, we can return a `CapsRef`
borrowing from the wrapped `EventRef`. This way, the `CapsRef` we return
can outlive the view itself.

This is in contrast to a `Caps<Event>` view which owns the `Event`.
Here, the `CapsRef` we return cannot outlive the view.

gstreamer-rs 0.18 consolidated code and treated everything like the
latter case. Fix this by duplicating the accessors for each case.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/367
2022-01-17 19:13:47 +00:00
Sebastian Dröge
8f5e373882 gstreamer: Mark miniobject wrapper types as #[repr(transparent)]
That way they're treated everywhere exactly like a raw pointer.
2022-01-17 18:04:40 +00:00
Sebastian Dröge
8fa1076dfa Replace Foo::from_instance(foo) with foo.imp() 2022-01-17 19:34:06 +02:00
Sebastian Dröge
711a4bb76e gstreamer: Silence a new clippy warning in the tests 2022-01-14 12:58:26 +02:00
Sebastian Dröge
605c633579 Ignore clippy::non_send_fields_in_send_ty lint
It's useless in its current shape and wrongly triggering on all types.

See https://github.com/rust-lang/rust-clippy/issues/8045
2022-01-13 23:38:11 +02:00
Sebastian Dröge
9eb479cf78 Regenerate everything 2022-01-12 15:40:36 +02:00
Sebastian Dröge
843d3749b7 caps: Add bindings for foreach(), map_in_place() and filter_map_in_place()` 2022-01-11 13:37:40 +00:00
Sebastian Dröge
1b46bca2db structure: Add bindings for foreach(), map_in_place() and filter_map_in_place()` 2022-01-11 13:37:40 +00:00
Sebastian Dröge
6d63180bfc Update for glib::Quark API changes 2022-01-11 12:50:13 +02:00
Guillaume Gomez
ac9b1e881c Add missing #[must_use] attribute for clippy 2022-01-04 19:43:07 +01:00
Guillaume Gomez
27dd305cb4 Regen to get #[must_use] attributes generated 2022-01-04 19:02:58 +01:00
Sebastian Dröge
bbcd221e8d Change from impl_() to imp() 2021-12-28 17:50:06 +02:00
Sebastian Dröge
1e18c59d2a Implement glib::ValueTypeOptional for various types 2021-12-16 17:40:39 +00:00
Luca BRUNO
c30eff771a
Regenerate with latest gir (gboolean return codes) 2021-12-14 11:43:30 +00:00
Paolo Borelli
97f59d34fa Add the has_name() fn to EventRef, MessageRef and StructureRef
They are handy and they match the C api
2021-12-14 09:59:39 +01:00
Sebastian Dröge
9bf5f641ff Regenerate with latest gir 2021-12-12 17:54:20 +02:00
Sebastian Dröge
1541fbf32a gstreamer: Add many new doc aliases for C function 2021-12-12 17:52:32 +02:00
Luca BRUNO
d1cc8d1298
Regenerate with latest gir (assert safe gerror) 2021-12-07 12:07:45 +00:00
Sebastian Dröge
ee1a5e8395 Add #[must_use] attribute to many builders 2021-12-04 10:26:08 +02:00
Sebastian Dröge
f6dc14b946 Add a few missing docs aliases for constants 2021-12-03 10:19:22 +02:00
Sebastian Dröge
7d968d78bb Silence false needless_option_as_deref clippy warnings
See https://github.com/rust-lang/rust-clippy/issues/8047
2021-12-02 17:52:23 +02:00
Mathieu Duponchelle
8e6c08f8fd gstreamer/value_serde: fix nested structures
When serializing a structure, if it contains a nested structure
the serialization / deserialization code goes through value_serde,
which was lacking support for Structure.
2021-12-01 17:41:48 +00:00
Sebastian Dröge
c965217e54 gstreamer: bufferlist: Implement buffer foreach functions around ControlFlow enum
This makes it clearer than a plain `bool` or `Result<Option<Buffer>, Option<Buffer>>`.

Also pass a `&Buffer` instead of a `&BufferRef` to the immutable foreach
function to allow taking references of the buffer outside the scope of
the closure by cloning instead of requiring a full copy.
2021-12-01 14:16:33 +02:00
Sebastian Dröge
15fbb17a09 gstreamer: buffer: Implement meta foreach functions around ControlFlow enum
This makes it clearer than a plain `bool` or `Result<bool, bool>`.
2021-12-01 14:02:50 +02:00
Tim-Philipp Müller
e0e17b8b25 gstreamer: pad: use ControlFlow with custom enum for sticky_events_foreach() return value
... instead of Result<Option<Event>,Option<Event>> which isn't very nice.

And use static dispatch instead of dynamic dispatch.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/361
2021-12-01 14:02:50 +02:00
Piotrek Brzeziński
abd2d4dfd7 gstreamer: Add getters for ElementFactory/DeviceProviderFactory metadata 2021-11-28 21:00:05 +01:00
Bilal Elmoussaoui
86b07ce5b9 regen per emit_by_name changes 2021-11-21 09:35:36 +01:00
Sebastian Dröge
668b2b3fdf gstreamer: Use glib::List in various places for reducing allocations when working with factory lists
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/359
2021-11-20 14:44:49 +02:00
Sebastian Dröge
9263c9f42e gstreamer: Correctly rename ParamSpecArray constructor 2021-11-20 13:47:18 +02:00
Sebastian Dröge
21d38e41d6 gstreamer: Rename DateTime constructors to replace the new_ prefix with from_ 2021-11-20 12:20:25 +02:00
Sebastian Dröge
3b28bccf03 Update for GLib constructor renames
See https://github.com/gtk-rs/gtk-rs-core/pull/384
2021-11-20 12:20:17 +02:00
Sebastian Dröge
ddf398e3da gstreamer: Add various missing doc aliases to event/message/query functions
This is going to make it easier to find them from the corresponding C
function names.
2021-11-19 10:38:46 +00:00
Sebastian Dröge
2471150e72 gstreamer: Add bindings for StreamCollection::stream-notify signal 2021-11-19 10:57:54 +02:00
Sebastian Dröge
63f6d6a7d3 gstreamer: Make child proxy property API more consistent with the object property API
And especially check various conditions for the property and the value.
Also add `ChildProxy::lookup()`.
2021-11-19 10:54:52 +02:00
Sebastian Dröge
7c1ed9ff4d Regenerate with latest gir
Updates to use system-deps 6
2021-11-18 16:32:17 +02:00
Bilal Elmoussaoui
e61b83f592 regenerate with not renamed libs on ffi crates 2021-11-17 12:00:06 +01:00
Sebastian Dröge
279f1a404b gstreamer: Use glib::SList instead of our own version of it for listing all debug categories 2021-11-16 20:18:31 +02:00
Sebastian Dröge
e68790d579 gstreamer: Directly format into a NUL-terminated C string for debug log messages
And also replace `%` with `%%` for < 1.20 inline, and for >= 1.20 use
the new `gst_debug_log_literal()` function that doesn't require this and
also reduces string allocations further.
2021-11-16 20:18:31 +02:00
Sebastian Dröge
e74f54a64f Regenerate with latest gst-gir-files 2021-11-16 20:18:31 +02:00
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