Commit graph

53 commits

Author SHA1 Message Date
Sebastian Dröge a7f670df7a Return exit code from gio::Application::run() from main()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1208>
2023-01-27 19:02:03 +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 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
Bilal Elmoussaoui 213020165a manual changes post ObjectExt improvements 2021-11-08 14:42:59 +01:00
Sebastian Dröge 37c3d2d8e0 Update for glib::source_remove() removal 2021-10-12 09:30:10 +03:00
François Laignel e31ce9d07b Manual ClockTime updates 2021-06-04 22:09:38 +02:00
François Laignel 90bb458e64 Rework ClockTime & FormattedValues 2021-06-04 22:09:38 +02:00
Guillaume Desmottes 7c592a5b9b examples: manually destroy the GTK window when shutting down
Make the leaks tracer happy, allowing us to detect actual leaks.

Fix #341
2021-05-25 11:57:52 +02:00
Guillaume Desmottes 37a352dc35 examples: ensure pipeline is destroyed when application is shutting down 2021-05-25 11:57:52 +02:00
Guillaume Desmottes 4ae0168aea examples: gtksink: call gst::deinit()
Needed so we can use the leaks tracer.
2021-05-22 17:38:48 +02:00
Guillaume Desmottes 87fb66f283 examples: gtksink: use app.quit() to exit properly
We can't use gtk::main_quit() as the loop is handled by the
GtkApplication.
2021-05-22 17:36:31 +02:00
Sebastian Dröge eda1d3d4a7 Update for Value trait refactoring 2021-04-25 14:45:08 +03:00
François Laignel 6ab9164dca fix-getters-calls 0.3.0 pass 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
Marijn Suijten a65d2df25c examples: Application::new always returns an application without Result
Since https://github.com/gtk-rs/gtk-rs/pull/447, supposedly the native
function is never returning a `NULL` `Application` hence it makes little
sense to handle an "unreachable" error here.
2021-04-12 10:28:16 +02:00
Sebastian Dröge 8da8e31d63 examples: Update for gio::Application::run() API simplification 2021-04-08 10:36:05 +03:00
Sebastian Dröge ba719ac90c Update for glib changes in glib::Value handling 2020-10-20 13:50:35 +00: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 da4efdfa90 examples: Update for glib API changes
Timeouts now use std::time::Duration instead of plain integers.
2020-09-14 16:44:46 +03:00
Sebastian Dröge fb779b42a8 Use glib::timeout_add_local() instead of removed gtk::timeout_add() 2020-08-27 09:49:27 +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 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 39ef834cfe examples: Fix compilation after GValue API changes 2019-08-13 18:30:40 +03:00
Víctor Manuel Jáquez Leal 066b22efc5 Fix examples and tutorial with GTK API updates 2019-02-28 12:02:51 +01:00
Sebastian Dröge f2d79fb352 Make use of Bus::add_watch_local() 2019-02-10 12:06:40 +02: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
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
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 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
Mathieu Duponchelle ab0df6ddf0 examples: use Cargo.toml required-features
This lets us avoid #ifdef forests
2018-02-26 20:35:23 +02: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 9b6efb2339 Fix various clippy warnings 2017-12-20 21:46:58 +02:00
Sebastian Dröge c99928d030 Change FormatValue related API to be more convenient to use
FormatValue is now renamed to GenericFormattedValue and the API slightly
changed. In addition there is now a FormattedValue trait, and a
SpecificFormattedValue trait plus types for Bytes, Buffers and the
existing ClockTime.

This allows to create functions like
  Pad::query_duration<F: SpecificFormattedValue>() -> Option<F>
and doesn't require the caller to unwrap the generic value anymore,
which is completely unneeded in these cases.

In addition, Segment became FormattedSegment<T> with API to
upcast/downcast between the specific formatted values and the generic
formatted value. This greatly simplifies usage of Segments.
2017-12-09 19:45:18 +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 c39c0c7264 Implement ClockTime as ClockTime(Option<u64>)
And also implement a FormatValue type that holds a value together with
its format to make usage of the positions/durations/seek positions/etc
more convenient and safe.

Fixes https://github.com/sdroege/gstreamer-rs/issues/3
2017-11-11 11:57:29 +01:00
Sebastian Dröge 884c9790ef Fix compilation of GTK examples with latest gio 2017-10-01 16:32:33 +02:00
Sebastian Dröge d608cff9e9 Fix build with latest GApplication API changes 2017-09-26 10:41:03 +03:00
Sebastian Dröge 58998af124 Fix examples build again 2017-08-29 11:56:30 +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 0bc43ed053 Make gtk dependency optional in the examples 2017-08-17 18:07:48 +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 5cd94a279e Minor simplification in gtksink example 2017-08-07 18:59:44 +03:00
Sebastian Dröge 8accac8d75 Clean up gtksink example imports a bit 2017-08-07 14:18:24 +03:00
Sebastian Dröge be6f03a1af Use SendCell from the newly created crate 2017-08-04 22:57:12 +03:00
Sebastian Dröge 43a014b6fa Add into_inner() / try_into_inner() functions for SendCell 2017-08-04 20:23:51 +03:00
Sebastian Dröge 5676aeb3ef Add a borrow() function to SendCell
To allow doing the thread check only once for performance reasons.
2017-08-04 19:56:39 +03:00
Sebastian Dröge c23498039d Clean up SendCell implementation and implement some more traits
For moving it elsewhere later as public API.
2017-08-04 18:31:54 +03:00
Sebastian Dröge 0dcf9c2be7 Move gtksink example to GtkApplication
And have an example for using GTK objects from closures that require Send
2017-08-04 17:42:08 +03:00