Commit graph

106 commits

Author SHA1 Message Date
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
Guillaume Gomez ff5a36561a Fix license header situation 2020-12-15 11:53:31 +01:00
Guillaume Gomez 8f9d76bb8c Revert "Remove unnecessary dox feature"
This reverts commit 9dd8bd9095.
2020-11-27 14:37:49 +01:00
Guillaume Gomez 9dd8bd9095 Remove unnecessary dox feature 2020-11-25 15:54:02 +01:00
Sebastian Dröge 88a7c18746 gstreamer-base: Update manual code to 2018 edition 2020-11-22 19:15:20 +02:00
Marijn Suijten aeb1b70581 Remove doc(cfg()) from expressions
warning: unused doc comment
       --> gstreamer-video/src/video_info.rs:655:37
        |
    655 |           #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
        |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    656 | /         {
    657 | |             VideoInfoBuilder {
    658 | |                 format,
    659 | |                 width,
    ...   |
    674 | |             }
    675 | |         }
        | |_________- rustdoc does not generate documentation for expressions

Also simplify some blocks into expressions which are allowed to have
attributes as well since Rust 1.43.
2020-11-19 16:39:31 +01:00
Marijn Suijten bd75778fcb Add doc(cfg()) on all manual files 2020-11-19 16:39:31 +01:00
Sebastian Dröge 145f0ed6f5 gstreamer-base: Make virtual methods take wrapper of type, not parent 2020-11-14 19:39:27 +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
Marijn Suijten beaa22fabb base_transform: Reset unused vfuncs on consecutive configure calls
If a user ends up changing the configured mode later on previously
registered vfuncs are not reset meaning the object is effectively stuck
in mode `Both`.
2020-09-02 00:39:38 +02:00
Sebastian Dröge dfe87cf5c9 Add various new 1.18 APIs 2020-08-11 12:54:32 +03:00
Sebastian Dröge 4f5b2f5060 Update for removal of ObjectImpl::get_type_data() 2020-07-26 18:02:05 +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 71b83b7c84 base/aggregator: Mark new 1.18 vfuncs as only available from the version onwards
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/272
2020-06-30 23:46:51 +03:00
Sebastian Dröge 9911de6591 base/baseparse: Add support for overriding stop vfunc 2020-06-30 23:46:51 +03:00
Sebastian Dröge cc866b53d0 Call the parent impl of various vfuncs if not overridden
This was forgotten for a few types and would require each subclass to
implement them, even if a parent class already provided an
implementation.
2020-06-30 23:46:51 +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
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 90a4918f92 gstreamer-base/aggregator: Add subclassing support for new 1.18 virtual methods 2020-05-03 16:48:35 +03:00
Guillaume Desmottes 872024c372 fix option_as_ref_deref clippy warnings 2020-04-21 09:00:35 +02: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 d3e93f172f gstreamer-base/basetransform: Rename PreparedOutputBuffer and GeneratedOutput enums
PrepareOutputBufferSuccess and GenerateOutputSuccess is more consistent
with what we do elsewhere.
2020-04-02 19:58:47 +03:00
Sebastian Dröge 2006bd51cc gstreamer-base: Add pushsrc subclassing bindings
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/244
2020-04-02 19:58:42 +03:00
Sebastian Dröge 13411b7461 gstreamer-base: Add basesrc alloc() vfunc 2020-04-02 19:58:42 +03:00
Sebastian Dröge 0b0544da63 gstreamer-base/basesrc: Add support for filling the passed in buffer in the create function
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/242
2020-04-02 19:58:42 +03:00
Sebastian Dröge e0a71563ba gstreamer/base_transform: Add support for implementing prepare_output_buffer()
This requires some acrobatics due to inconsistent ownership handling of
the buffers on the C side.
2020-02-22 18:55:56 +02:00
Sebastian Dröge 870978e286 base/base_transform: Fix minor clippy warning
warning: called `map(f)` on an Option value where `f` is a unit closure
   --> gstreamer-base/src/subclass/base_transform.rs:683:13
    |
683 | /             (*parent_class)
684 | |                 .before_transform
685 | |                 .map(|f| f(element.to_glib_none().0, inbuf.as_ptr() as *mut _));
    | |_______________________________________________________________________________^
    |
    = note: `#[warn(clippy::option_map_unit_fn)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
2020-02-09 21:22:04 +02:00
Sebastian Dröge 09212add47 base/base_transform: Add before_transform/copy_metadata/transform_meta support for subclasses 2020-02-09 20:45:29 +02:00
Sebastian Dröge e63e8b81ff base/base_transform: Add submit_input_buffer/generate_output support for subclasses
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/155
2020-02-09 20:22:54 +02:00
Hans Ole Hatzel 14a55dc73d gstreamer-base/basesink: Provide default implementation for render
We need some classes derived from `BaseSink` to not enforce render being
implemented.

An example of this is AudioSink which only requires the user to
implement `write` but not `render`, so the default implementation
of render needs to be called.
2019-12-18 15:14:35 +02:00
Sebastian Dröge 90854eb047 base/basesrc: Add bindings for BaseSrc::get_times()
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/228
2019-12-10 19:49:36 +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 a783280dcf base/basetransform: Update BaseTransformImpl::set_caps() return type for consistency
In all other base classes it is a Result instead of a bool, so do the
same here.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/225
2019-11-21 00:02:23 +02:00
Sebastian Dröge 2d2459ed52 Export traits from the crate level and ensure that all traits are in the preludes 2019-10-17 13:30:35 +03:00
Sebastian Dröge d8325212f4 Fix various clippy warnings 2019-07-11 22:02:01 +03:00
Sebastian Dröge 3a8d05075d Switch everything from mem::uninitialized() to MaybeUninit or mem::zeroed()
And also fix a few cases where mem::uninitialized() was simply wrong to
use.
2019-07-11 17:56:50 +03:00
Guillaume Desmottes c774bd8114 base: add bindings for GstBaseParse
Fix #157
2019-06-01 13:04:12 +05:30
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 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
François Laignel e24efa7259 gstreamer-base: subclassing: move parent fn in dedicated trait (!231) 2019-02-13 11:53:14 +00:00
François Laignel 37b717c020 gstreamer-base: add parent_xxx impl for all vfunc 2019-02-03 08:41:20 +00:00
François Laignel ac00608b7e gstreamer-base: fix parent vfunc invocations when needed
Fixes #180
2019-02-03 08:41:20 +00:00
François Laignel c65214b207 gstreamer-base: update signatures to Result<(), ErrorMessage>
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/175
2019-01-27 09:36:56 +00:00
François Laignel 5d1a839558 gstreamer-base: update signatures to Result<(), LoggableError>
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/175
2019-01-27 09:36:56 +00: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
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 8eb4b879fc Port Aggregator subclassing 2018-11-21 17:03:59 +02:00
Sebastian Dröge 2bc6efa893 Port AggregatorPad subclassing 2018-11-21 17:03:59 +02:00
Sebastian Dröge 411319198a Port BaseTransform subclassing 2018-11-21 17:03:59 +02:00
Sebastian Dröge 2f90961ef1 Port BaseSink subclassing 2018-11-21 16:14:06 +02:00
Sebastian Dröge 771defa377 Port BaseSrc subclassing 2018-11-21 16:14:06 +02:00