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 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 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 a1165a7456 gstreamer: Add bin/pipeline builders
And also implement the Default trait for them.
2022-10-22 17:36:36 +03:00
Sebastian Dröge 2a4e1069a1 app: Add an AppSrc/AppSink builder
These allows to construct these elements explicitly together with all the
properties instead of going via gst::ElementFactory::make().
2022-10-22 10:19:49 +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
François Laignel e31ce9d07b Manual ClockTime updates 2021-06-04 22:09:38 +02:00
François Laignel 99616ec0b4 post fix-getters manual updates 2021-04-13 17:54:40 +02:00
François Laignel 53be8e5f58 fix-getters-{def,calls} pass 2021-04-13 17:54:40 +02:00
Marijn Suijten d8cd01027e examples: Fix some typos 2021-04-10 13:42:04 +02:00
Sebastian Dröge 5ad45cef42 examples: Rename crates in Cargo.toml and get rid of extern crate 2020-10-10 11:10:20 +03:00
Sebastian Dröge 9379098a3f examples/appsrc: Make use of the VideoFrame API for accessing the data
This is not really needed here but useful to have an example for the
videoframe API usage.
2020-10-03 17:55:36 +03:00
Sebastian Dröge 947ac8db5c Name functions returning a builder builder(), not new()
And also make the video event API more consistent with the normal event
API.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/269
2020-06-25 19:42:33 +03:00
Otavio Salvador 2022890766 examples: Move out from 'failure' crate as it is deprecated
The 'failure' crate has been stale for quite some time and better
alternatives has been developed since its introduction. We choose the
'anyhow' and 'derive_more' to replace it.
2020-05-04 11:16:50 -03:00
Otavio Salvador 6fc70ee6b6 examples: Move to 2018 edition
This code rework the examples to use the new 2018 edition and also
rework the code to avoid using unnecessary 'extern crate' calls.

The 'use extern crate gstreamer as gst', as well as the other gstramer
related crates, were kept, otherwise we'd need to do it on 'Cargo.toml'
but it would make it more difficult to figure out the respective crate
name.
2020-05-03 18:42:57 -03:00
Sebastian Dröge ca6bcf36ab examples: Stop using deprecated Error::description() 2020-03-19 14:20:52 +02:00
Sebastian Dröge 69be1ce2fc Fix various new clippy warnings from 1.40 2019-12-22 12:10:27 +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 107ae588f2 examples: Fix various clippy warnings 2019-10-04 11:01:55 +03:00
Sebastian Dröge 8618085d46 Port examples/tutorials to the explicit Option parameter changes 2019-04-15 19:19:19 +03: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
Philippe Normand bef6d741d3 Fix examples and tutorials for GString support 2019-01-03 22:01:41 +00:00
Sebastian Dröge 69af6a5975 bus: Add iter() and iter_timed() that return Iterators around the corresponding pop() functions
And make use of them in the examples where it makes sense.
2018-12-28 00:06:03 +02:00
Markus Ebner 466e02df3a Add verbose documentation to the examples
Added verbose documentation to all of the repository's examples.
2018-11-29 19:59:57 +01:00
Sebastian Dröge 8a6bcbcedb Run through rustfmt once again 2018-10-28 13:47:02 +00:00
Sebastian Dröge eb0a804a50 Run everything through latest rustfmt 2018-10-08 15:02:23 +03:00
Sebastian Dröge 2c7dff3b45 Run everything through rustfmt again 2018-10-08 09:32:08 +03:00
Sebastian Dröge 33a6aab6d7 Run everything through latest rustfmt 2018-07-27 13:36:40 +03:00
Sebastian Dröge c0422acf66 Fix reference cycles and minor related problems in all examples and tutorials
These are now all leak-free.
2018-07-27 13:07:24 +03:00
Sebastian Dröge dc219af36e Add another comment to the appsrc example about the need-data callback not being mandatory 2018-05-18 11:42:24 +03:00
Sebastian Dröge 7734725da1 Change appsrc example to directly push data from the need-data callback
There's no need to start yet another thread just to push data in this
case, we can simply use the callback and store the frame counter in the
mutable environment of the closure.
2018-05-18 11:38:50 +03:00
Sebastian Dröge 4117c01ff2 Run everything through latest rustfmt-nightly 2018-02-22 11:18:37 +01:00
fengalin 21c687f256 Examples: message handlers: invoke generic Message method from the concrete message
Generic methods for events, messages and queries can now be invoked from the concrete type.
2018-01-29 17:33:49 +02:00
Sebastian Dröge b6d13272df Fix some clippy warnings in examples/tutorials 2017-11-27 14:03:33 +02:00
Sebastian Dröge f895f484cc Fix up tutorials and examples for Message::get_src() returning an Option now 2017-11-16 13:58:56 +02:00
Sebastian Dröge a01f1385ec examples: Set up a runloop on macOS 2017-11-12 19:07:02 +01:00
Sebastian Dröge c9027fb244 Switch appsrc example to failure based error handling 2017-11-12 10:15:37 +01:00
Sebastian Dröge 95204c2294 Add Success/Error variants of #[must_use] enums
And implement basically the Try trait for them. This will be replaced by
the Try trait once it is stable.

Fixes https://github.com/sdroege/gstreamer-rs/issues/44
2017-11-06 11:43:54 +02:00
Sebastian Dröge f1025170d9 Use while-let and CLOCK_TIME_NONE for the bus.timed_pop() loops in the examples/tutorials 2017-09-13 19:35:35 +03:00
Sebastian Dröge 062b596432 Fix-up various unused external crate warnings 2017-09-01 13:42:59 +03:00
Sebastian Dröge 8013169e09 Add constants for SECOND, MSECOND, USECOND, NSECOND
And use them in the examples.
2017-08-29 11:07:59 +03:00
Sebastian Dröge f751afc0fb Add prelude modules to all cratest that only re-export the traits
And use those in the examples instead of blanket * imports
2017-08-17 18:02:25 +03:00
Sebastian Dröge b392c82ba9 Use gstreamer-video API in appsrc example and make frame generation a bit more efficient 2017-08-11 17:59:05 +03:00
Sebastian Dröge c9423471b0 Fix some clippy warnings in the examples 2017-08-04 15:36:12 +03:00
Philippe Normand 7326377f5f examples: app*: refactor error enum to a utils module
The module also contains create_element, link_elements and set_state functions
to help reduce boilerplate.
2017-08-04 15:09:29 +03:00
Philippe Normand 50e6e2e108 examples: appsrc: improved error handling
The program should now exit gracefully with human readable messages.
2017-08-03 18:09:29 +03:00
Sebastian Dröge b08a101cc6 Fix clippy warnings in the examples 2017-08-02 20:15:16 +03:00
Sebastian Dröge dc640249ef Add simple appsrc example 2017-08-01 21:30:51 +03:00