François Laignel
5505715cc4
Manual code updates for *Return types
2021-05-04 11:33:51 +00:00
Marijn Suijten
1eb0c483fe
gstreamer: Fix some clippy::use_self warnings
2021-04-30 10:58:36 +02:00
Marijn Suijten
980304ce36
Replace T::type_data with Self::type_data for clippy::use_self
2021-04-30 10:02:55 +02:00
Sebastian Dröge
3ad7a18792
gstreamer: Remove unused leftover ToGlib import
...
And directly call from_glib_borrow() instead of adding a use statement
for it.
2021-04-28 09:28:54 +03:00
Bilal Elmoussaoui
890cd03632
manual renames of to_glib into into_glib
2021-04-27 19:44:41 +02:00
Marijn Suijten
827ff99965
lib: Only export traits (Ext and ExtManual) from prelude
...
In gir it was brought up [1] that some traits (in particular
`*ExtManual`) are exported from the crate root in addition to the
prelude, cluttering the environment unnecessarily. This commit removes
all these reexports, leaving those in prelude (that were already there)
only.
After this commit everything matching `Ext(Manual)?\b` in `lib.rs` sits
within `pub mod prelude {};`.
[1]: https://github.com/gtk-rs/gir/pull/1111
2021-04-26 11:25:23 +02:00
François Laignel
6ab9164dca
fix-getters-calls 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
Sebastian Dröge
a775f58753
Use glib::Error::into_raw() for passing GErrors without copying back to C
2021-04-11 10:45:56 +03:00
Sebastian Dröge
15505cc5b8
Re-export interface ImplExt traits from the preludes
2021-03-14 14:06:30 +02:00
Sebastian Dröge
27385104d8
Update for glib interface API changes
2021-03-14 10:45:52 +02:00
Sebastian Dröge
ea239c587e
Store panic information not in a custom instance struct but in the instance data provided by the subclassing infrastructure
...
This scales better as there will only be only such data instead of two
or more when having deeper class hierarchies with multiple Rust
elements, and also makes it unnecessary to use a special instance struct
so the default works well.
2021-03-09 16:36:35 +02:00
Sebastian Dröge
6fa48890bc
Update for the subclassing glib bindings API changes
2021-03-09 16:04:32 +02:00
Sebastian Dröge
0b61713398
gstreamer/uri_handler: Update for glib bindings API changes
2021-03-09 11:17:15 +02:00
Sebastian Dröge
0803dd411e
Update for glib subclass API cleanup
2021-03-08 12:18:24 +02:00
Sebastian Dröge
b8c20c07ce
Update for new #[glib::object_subclass] attribute macro
2021-03-07 13:08:06 +02:00
Sebastian Dröge
a316d610eb
gstreamer: Update for glib::Type API changes
2021-02-25 12:49:47 +02:00
Sebastian Dröge
3c0281db0c
gstreamer/uri_handler: Update for glib class data API changes
...
Based on a patch by Bilal Elmoussaoui
2021-02-07 17:40:45 +02:00
Sebastian Dröge
0e8b95f1d0
urihandler: Provide URIType as associated constant when implementing the gst::URIHandler interface
...
The supported protocols still stay a function because they might have to
be probed at runtime, but they return a static string array now as they
must not randomly change at runtime.
2021-01-25 13:56:55 +02:00
Sebastian Dröge
e11b12df7c
gstreamer: Provide class metadata, pad templates and basetransform configuration via trait methods
...
This is closer to how this works in Python and also how properties and
signals work now in the glib bindings.
class_init() only has to be implemented for more special uses now.
2021-01-25 13:56:55 +02:00
Sebastian Dröge
68839c0e79
Re-export all dependency crates and their preludes
...
This makes code in examples potentially simpler.
2020-12-20 19:40:34 +02: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
Sebastian Dröge
ce1148b474
Update everything for glib macro renamings
2020-12-18 00:56:47 +02:00
Sebastian Dröge
f3b5340875
Update for new simplified glib::Object::new() API
2020-12-17 17:43:17 +02:00
Guillaume Gomez
ff5a36561a
Fix license header situation
2020-12-15 11:53:31 +01:00
Marijn Suijten
132477f51f
cargo.toml: Add v1_20 feature to all crates
2020-12-12 13:17:20 +01:00
Sebastian Dröge
9d9522016b
gstreamer: Update manual code to 2018 edition
2020-11-22 19:15:20 +02:00
Sebastian Dröge
4d52ab7d37
gstreamer: Fix plugin version for v1_18
2020-11-21 18:08:24 +02:00
Marijn Suijten
e88994a0b7
use cfg_if to refactor some #[cfg()] / #[cfg(not())] pairs
2020-11-19 16:39:31 +01:00
Sebastian Dröge
4eaf574cf8
gstreamer: Make virtual methods take wrapper of type, not parent
2020-11-14 19:39:27 +02:00
Sebastian Dröge
1d53b66858
Fix compilation with GLib subclassing changes
2020-11-14 19:39:27 +02:00
François Laignel
ca96014c47
Use fully qualified path for plugin_desc in gst_plugin_define
...
This is required when gst_plugin_define is used from a a submodule
mod.rs (not from the crate's lib.rs).
2020-11-12 13:24:16 +01:00
Sebastian Dröge
9379c730b9
gstreamer: Update for removal of ElementClass/DeviceProviderClass type aliases
2020-11-07 12:49:19 +02:00
Sebastian Dröge
b91123d298
Simplify IsSubclassable::override_vfunc() implementations
2020-11-05 17:12:06 +00:00
Sebastian Dröge
99fbbc32cb
Use glib::Class instead of glib::object::Class
2020-11-05 17:12:06 +00:00
Sebastian Dröge
027de84349
Update for class struct handling changes in the glib bindings
...
See https://github.com/gtk-rs/gtk-rs/pull/10
2020-11-05 16:41:48 +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
Marijn Suijten
cb362e6fbc
gstreamer: plugin: Prefix glib:: with $crate:: in gst_plugin_define
...
Crates using gst_plugin_define might not (need to) import `glib`
directly into their scope; use the one imported in `gstreamer`s root
to make this macro more portable.
Besides, `glib` is prefixed with `$crate::` just below.
2020-10-10 11:54:20 +02:00
Marijn Suijten
10bc09ba82
gstreamer: error: Prefix gst_error_msg with $crate
...
This macro might not have been imported in the surrounding scope where
gst_panic_to_error is used, thus reference it directly by the full
namespace.
2020-10-10 11:47:41 +02:00
Sebastian Dröge
4f5b2f5060
Update for removal of ObjectImpl::get_type_data()
2020-07-26 18:02:05 +03:00
Sebastian Dröge
0cc32a02cc
gstreamer/element: Don't catch panics in post_message() vfunc
...
Otherwise we would post a message, which calls into this code again and
then does the whole thing recursively forever.
2020-07-01 01:36:16 +03:00
Sebastian Dröge
4fbbf48622
gstreamer/element: Change post_message() vfunc return type to bool
...
It regularly fails in normal situations, e.g. when the element is not
inside a bin and has no bus, and we don't really want to log errors for
that.
2020-07-01 01:15:57 +03:00
Sebastian Dröge
9cc99b27e0
gstreamer/element: Let post_message() and post_error_message() take ownership of the message
...
This is more in line with the C API and simplifies callers in Rust.
2020-06-30 23:55:02 +03:00
Sebastian Dröge
5b3d6418f0
gstreamer/element: Add support for overriding post_message vfunc
2020-06-30 23:46:51 +03:00
Sebastian Dröge
79c457c8c4
gstreamer/pad: Rename Pad::builder_from_template() to builder_with_template()
...
Sounds more natural as it creates a build that is initialized *with* a
template.
But keep Pad::from_template() as it creates a new pad *from* a template.
2020-06-22 11:26:24 +03:00
Sebastian Dröge
0c0d671922
gstreamer/pad: Don't provide constructors anymore but instead a builder
...
This handles safely setting the pad functions during construction and
also has special support for ghost pads.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/247
2020-06-22 10:55:24 +03:00
Sebastian Dröge
bfde1fd9d5
Update for new_with_XXX/new_from_XXX function renaming
2020-06-16 11:45:12 +03:00
Guillaume Desmottes
7b2fe31cc1
update gir generator and regenerate
2020-06-11 12:33:49 +02:00
Guillaume Desmottes
6cd711cfdf
subclass: clean up subclassing prelude/re-exports
...
Use re-export pattern from glib.
Fix #255
2020-06-09 14:36:37 +02:00
Sebastian Dröge
3f495ce1da
gstreamer/plugin: Register plugins with the correct minor version when building for 1.18
2020-05-08 14:32:50 +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
2b5f16391d
gstreamer/childproxy: Fix unused variable compiler warnings
2020-01-22 19:57:41 +02:00
Sebastian Dröge
280fe38fe4
gstreamer/childproxy: Don't require implementing child_added/removed() signal vfuncs
...
Most implementers will not care about default handlers for these signals
so requiring to implement them is only unnecessarily verbose.
2020-01-22 17:14:38 +02:00
Guillaume Desmottes
01c4d08501
gstreamer: use thiserror crate
...
Make code simpler and fix deprecated warning when building on nightly as
Error::description is being deprecated.
2020-01-10 18:54:50 +05:30
Sebastian Dröge
69be1ce2fc
Fix various new clippy warnings from 1.40
2019-12-22 12:10:27 +02:00
Sebastian Dröge
2ba5105b80
Implement Sync/Send for more types and don't implement Send for TypeFind
...
They can actually be shared with multiple threads at the same time
safely as all functions requiring an immutable reference are
thread-safe.
OTOH TypeFind can't be shared safely between different threads as not
all implementations of the TypeFind struct are thread-safe.
2019-12-18 18:37:44 +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
f417d68820
Remove usage of glib_floating_reference_guard!()
...
It's not needed anymore.
2019-12-07 23:05:14 +02:00
Sebastian Dröge
2375c9da59
gstreamer/element: Don't steal floating references passed into release_pad()
...
They are apparently not part of this element so we can directly return
here instead of stealing the reference.
2019-12-07 22:58:26 +02:00
Sebastian Dröge
802fa4fcb4
gstreamer/bin: Take a strong reference of the element passed into remove_element()
...
It might be gone once we called into the parent class' implementation so
we need to keep a strong reference around here. Also we need to ensure
that we don't accidentally steal a floating reference from the caller
here: if the element is still floating it is apparently not part of this
bin and we can directly return FALSE.
2019-12-07 22:56:11 +02:00
Sebastian Dröge
bef1143df3
gstreamer/device: Preserve floating reference flag from create_element() parent class' implementation
2019-12-07 22:51:57 +02:00
Sebastian Dröge
84ac2ef073
bin: Use from_glib_none() in Bin::add() for subclasses
...
This way we take ownership of any floating references passed in here, as
required by the GstBin API, instead of just borrowing the reference and
having someone else sink it or not.
2019-12-04 18:49:12 +02:00
François Laignel
dc7937a8d4
Don't leak missing Safety doc clippy warnings
...
With rustc 1.40.0, clippy checks that the `unsafe` functions come with
a `Safety` section. When running clippy on a downstream crate, the
macros such as `gst_plugin_define!` leak the clippy warnings for the
unsafe functions.
Silence the warnings for now.
2019-11-18 10:25:06 +01:00
Sebastian Dröge
861f5c1e1a
Re-run cargo fmt
...
Minor changes in the latest version.
2019-10-04 08:19:24 +03:00
Sebastian Dröge
19b3427909
clock: Move wake_id() from ClockId to ClockImpl
...
This shouldn't really be called on anything outside a Clock
implementation.
2019-09-26 11:25:52 +03:00
Sebastian Dröge
6abb0d3506
gstreamer: Add support for subclassing gst::SystemClock
2019-09-25 17:22:15 +03:00
Sebastian Dröge
1c8b2c671b
gstreamer: Add support for subclassing gst::Clock
2019-09-25 17:22:15 +03:00
Sebastian Dröge
74b05f0272
gstreamer: Add support for implementing gst::TagSetter interface
2019-09-25 17:22:11 +03:00
Sebastian Dröge
eda3539330
gstreamer: Add support for implementing gst::Preset interface
2019-09-25 16:11:54 +03:00
Sebastian Dröge
7868018abb
gstreamer/element: Add support for ElementClass::add_metadata()
2019-09-12 10:18:23 +03:00
Sebastian Dröge
6dcd255815
gstreamer/deviceprovider: Add support for subclassing gst::DeviceProvider
2019-09-12 10:18:23 +03:00
Sebastian Dröge
9df56faf48
gstreamer/device: Add support for creating gst::Device subclasses
2019-09-11 22:46:15 +03:00
François Laignel
8af1da1a4e
Fully qualify inner macros for exported macros...
...
... otherwise they can't be resolved in dependent crates compiled
for edition 2018.
2019-09-02 09:06:29 +00:00
Mathieu Duponchelle
d3d503cea6
subclass/element: expose set_clock and provide_clock vmethods
2019-08-31 02:05:21 +02:00
Sebastian Dröge
e00781309b
gstreamer/element: Use from_glib_none() for the release_pad() trampoline
...
The reference to the pad we get passed is not guaranteed to be valid for
the whole scope of release_pad(). It might be the last reference as
owned by GstElement, and gst_element_remove_pad() would destroy it then.
2019-08-14 11:58:05 +03:00
Sebastian Dröge
004ce5d392
gstreamer: Re-export the paste crate for the gst_plugin_define! macro
...
And only depend on the paste crate if the subclass feature is requested.
2019-05-27 22:46:26 +02:00
Sebastian Dröge
faa6467d7a
gstreamer: Export new 1.14+ plugin symbols if configured for 1.14+
...
This is also needed for static linking on Android to work correctly.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/154
2019-05-27 20:22:05 +00:00
Arun Raghavan
61b1822c95
gstreamer: Fix URIHander::set_uri annotation
...
We don't actually accept a NULL uri, so it doesn't need to be an Option,
and using &str instead of String is more efficient.
2019-05-25 19:12:42 +02:00
Sebastian Dröge
6cef32a4dd
Change various mini object references to references to the refcounted object
...
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/204
2019-05-24 10:04:16 +00:00
Sebastian Dröge
a986914bad
Use Option<&T> instead of &Option<T> everywhere
...
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/203
2019-05-22 23:27:13 +03:00
Sebastian Dröge
698120c620
Add tests for pad and element subclassing
2019-05-11 13:45:09 +00:00
Sebastian Dröge
e7898c1b24
Update manual code
2019-04-15 19:19:19 +03:00
Sebastian Dröge
86a31b4139
Silence/fix various clippy warnings
2019-03-07 14:05:35 +02:00
Sebastian Dröge
8c39da4e5b
Update to Rust 1.31 linter-specific attributes
2019-03-04 15:16:01 +02:00
Sebastian Dröge
95f6844702
Fix various minor clippy warnings
2019-02-21 19:56:23 +02:00
François Laignel
fb99f1abad
gstreamer: subclassing: move parent fn in dedicated trait ( !231 )
2019-02-13 11:53:14 +00:00
François Laignel
fcb46ee5bf
gstreamer: add parent_xxx impl for all vfunc
2019-02-03 08:41:20 +00:00
François Laignel
56c00d9250
gstreamer: fix parent vfunc invocations when needed
...
Fixes #180
2019-02-03 08:41:20 +00:00
François Laignel
f59e35d0a3
Use LoggableError in user defined functions and callbacks
...
`LoggableError` ensures an error in a user defined function is always
logged. This commit changes eligible function signatures accordingly.
2019-01-26 11:58:30 +01:00
François Laignel
333d71f92b
Update functions returning bool to use Result<(), glib::BoolError>
...
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/171
2019-01-17 23:13:44 +01:00
Sebastian Dröge
58ccf666a6
Change some const raw pointers to mutable
...
We cast them to a mutable pointer of another type right afterwards
anyway.
2019-01-16 13:52:56 +02:00
Sebastian Dröge
931c485150
Update manual code for glib API changes
2019-01-16 13:52:56 +02:00
François Laignel
948fb2ae4b
Replace XXXReturn with Result<XXXSuccess, XXXError>
...
... in function signatures.
These breaking changes aim at improving usability by allowing users
to take advantage of Rust error management features sur as `ok_or`,
`map_err`, `expect` and the `?` operator. See the `examples` and
`tutorials` to get an idea of the impacts.
2019-01-11 18:33:04 +01:00
Sebastian Dröge
93d1349d78
Use new GLib API for generically implementing GObject interfaces
2018-12-19 13:15:20 +02:00
François Laignel
8c3df63b95
URIHandler: rename get_type
...
Avoid a conflict with the `get_type` function declared by the
`glib_object_subclass!` macro.
2018-12-03 20:47:58 +01:00
Sebastian Dröge
3febc42628
Update for glib-rs API changes
2018-11-28 21:55:21 +02:00
Sebastian Dröge
d2b911a629
Port GhostPad subclassing
2018-11-21 16:14:06 +02:00
Sebastian Dröge
ec2a0635ca
Port Pad subclassing
2018-11-21 16:14:06 +02:00
Sebastian Dröge
97211e869b
Port Pipeline subclassing
2018-11-21 16:14:06 +02:00