Commit graph

171 commits

Author SHA1 Message Date
Sebastian Dröge
a091ea201c examples/tutorials: Use cocoa crate to initialize the shared NSApplication instance
This is required for OpenGL to work nowadays on macOS. Simply running an
CFRunLoop on the main thread is not sufficient.

Thanks to Philippe Normand for testing this on macOS and making sure it
actually compiles and works.
2021-07-13 07:42:46 +00:00
Marijn Suijten
bea15b8ebd tutorials/13: Use nested or patterns, available since Rust 1.53 2021-07-05 06:36:57 +00:00
Sebastian Dröge
a06cf66e6d Update versions to 0.18.0 2021-06-29 00:08:16 +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
Sebastian Dröge
04e6c1b547 app: Remove signals bindings from appsrc/appsink for the signals that also have callbacks
The callbacks are more flexible and performant.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/338
2021-05-30 23:00:44 +03:00
Sebastian Dröge
b1088a6d11 tutorials/basic-tutorial-13: Make sure that acquiring the main context actually succeeds 2021-05-18 12:16:59 +03:00
Sebastian Dröge
6b8bfd2701 tutorials/basic-tutorial-13: Store the main context acquire guard in a variable
Otherwise it will be immediately released again.
2021-05-18 11:43:37 +03:00
Guillaume Gomez
6fdf35846e Update repository URL for gtk-rs "core" crates 2021-05-12 21:21:18 +02:00
François Laignel
49583597ed manual code: fix-getters-def doc aliases 2021-05-03 20:46:57 +02:00
Marijn Suijten
f89e840d27 Remove redundant prelude imports
When importing the prelude of a crate like `gst` the `glib` prelude is
provided too.  Shedding these imports saves quite a few lines and
adheres to keeping it simple; we're not reexporting base/parent preludes
for no reason :)
2021-04-29 12:05:13 +02:00
yatinmaan
ffe6821813 tutorials: Add playback-tutorial-1 2021-04-28 02:28:38 +05:30
Sebastian Dröge
eda1d3d4a7 Update for Value trait refactoring 2021-04-25 14:45:08 +03:00
François Laignel
1395d773c3 manual fixes remove get prefix round 2 2021-04-20 18:18:02 +02:00
François Laignel
6ab9164dca fix-getters-calls 0.3.0 pass 2021-04-20 18:18:02 +02:00
François Laignel
e80a29372a fix-getters-def 0.3.0 pass 2021-04-20 18:18:02 +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
Sebastian Dröge
8b71f5331a examples/tutorials: Update for new Bus::connect_message() API that takes signal details 2021-02-28 19:08:50 +02:00
Sebastian Dröge
efb249f7b9 tutorials: Change from set_property_with_value() to set_property_from_value() 2021-02-23 12:11:48 +02:00
Sebastian Dröge
b5d5838d96 examples/tutorials: Change from emit() to emit_by_name()
And set_property_generic() to set_property_with_value()
2021-02-22 17:28:05 +02:00
Guillaume Gomez
a3f6f710a9 tutorials/basic-tutorial-13: Add "\r" at each println to fix the raw terminal display 2021-01-09 16:08:06 +01:00
Guillaume Gomez
2fcaaa53ce Add basic tutorial 13 from C gstreamer examples 2021-01-08 15:49:30 +01:00
Sebastian Dröge
d84336dc12 tutorials/basic-tutorial-5: Don't unnecessarily cast float literals to f64
error: casting float literal to `f64` is unnecessary
   --> tutorials/src/bin/basic-tutorial-5.rs:141:13
    |
141 |             1.0 as f64,
    |             ^^^^^^^^^^ help: try: `1.0_f64`
    |
2020-12-29 16:56:13 +02:00
Fernando Jiménez Moreno
dfa3812ccc Playback tutorial 4: Progressive streaming 2020-12-16 11:10:51 +00:00
Marijn Suijten
5afca49a7b gstreamer: Propagate nullability changes into manual code 2020-12-04 19:37:07 +01:00
Sebastian Dröge
b5c376d315 Move every gtk-rs dependency to the combined gtk-rs repository 2020-10-30 18:15:53 +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
Jonas Platte
da5d6df694
Remove unused dependencies
found by cargo-udeps
2020-10-14 19:00:04 +02:00
Sebastian Dröge
025f215bd3 Update byte-slice-cast dependency to 1.0 2020-10-13 09:35:59 +00:00
Sebastian Dröge
ad1d78b599 examples: Move to Rust 2018 edition 2020-10-10 11:00:48 +03:00
Sebastian Dröge
096ce958a4 tutorials: Move from failure to anyhow 2020-10-10 10:52:15 +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
Guillaume Gomez
6752ef8a69 tutorials: Add resample element to the pipeline in tutorials 3 2020-07-10 11:12:38 +02:00
Guillaume Gomez
7d28106c2e tutorials: Improve code of tutorial 3 a bit by removing unneeded downgrades and
using closure parameters instead of capturing variables
2020-07-10 11:12:36 +02:00
Sebastian Dröge
f40821ba66 Update versions to 0.17.0 2020-07-06 15:22:55 +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
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
François Laignel
c94baa4fe8 query: add constructor on target types
... and deprecate the `Query::new_*` forms.
2020-06-25 10:48:25 +02:00
François Laignel
f421d878b6 message: add constructor on target types
... and deprecate the `Message::new_*` forms.
2020-06-25 10:48:20 +02:00
Sebastian Dröge
bfde1fd9d5 Update for new_with_XXX/new_from_XXX function renaming 2020-06-16 11:45:12 +03:00
alleynb
86e6d3afa4 tutorials/tutorial-6: Improve caps output
Fixed printing of pad capabilites in tutorial6.
Output now displays the capability lists eg:
  layout:{ (string)interleaved, (string)non-interleaved }

The origional broken output was being displayed as:
  layout:SendValue(Value(GString(Foreign(0x557140c99d00, 40))))
2020-04-21 12:01:41 +01:00
Sebastian Dröge
a07d6f2823 Revert "tutorials: Temporarily pin quote to 1.0.2"
This reverts commit bcfc88a560.

It was fixed in the meantime.
2020-03-06 11:17:17 +02:00
Philippe Normand
bcfc88a560 tutorials: Temporarily pin quote to 1.0.2
See https://github.com/rust-lang-nursery/failure/issues/342

gstreamer/gst-build#83
2020-03-05 13:28:41 +00:00
Sebastian Dröge
d26ffc2c21 Update version to 0.16.0 2019-12-19 00:48:08 +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
Tony Jinwoo Ahn
c3b7f0f353 gstreamer-gl, gstreamer-pbutils, gstreamer-sdp: Change functions from returning Option to Result
Partial work for:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
2019-12-17 08:20:47 +00:00
Jordan Petridis
dc3a039a3b
Add license key for tutorials and examples 2019-10-22 16:36:32 +03:00
François Laignel
514a05accd Manual update for new Value::get signature 2019-08-13 10:57:32 +02:00
Sebastian Dröge
f7cf709062 tutorials/basic-tutorial-5: Make sure to only declare GDK C functions for the right platform
Otherwise linking might fail depending on the compiler flags if the
linker does not remove all references to unused code.
2019-07-06 02:38:58 +03:00
Sebastian Dröge
28a24a4fc0 Update versions to 0.15.0 2019-06-24 20:53:05 +03:00
Sebastian Dröge
4096869075 Update byte-slice-cast to 0.3 2019-05-24 13:26:49 +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
8618085d46 Port examples/tutorials to the explicit Option parameter changes 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
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
32e961d418 Update versions to 0.14.0 2019-02-22 13:04:56 +02:00
Sebastian Dröge
95f6844702 Fix various minor clippy warnings 2019-02-21 19:56:23 +02:00
Sebastian Dröge
b4ad105c1d basic-tutorial-5: Stop using deprecated GTK API
Disabling double buffering is deprecated since quite a while.
2019-02-07 10:26:37 +02:00
Sebastian Dröge
de978bd115 Update gtk feature flags
The minimum supported version of GTK is now 3.14 so we don't have to
opt-in for 3.8/3.10 APIs anymore.
2019-02-07 09:49:07 +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
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
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
Sebastian Dröge
e804ef4d76 Switch to Rust 1.31 as minimum supported version
Too many dependencies switched and we can't really keep everything at an
older version.

Commented out for now until stable becomes 1.32.
2018-12-19 12:45:57 +02:00
Jordan Petridis
02dc888a3a
Examples: Pin some dependencies to builda with rustc 1.28
These dependencies require rustc 1.31, which we can't yet use.
Since they are only affecting examples its not a big deal to pin
them to an earlier version.
2018-12-17 14:52:45 +02:00
Sebastian Dröge
890b47eef9 Fix up some error handling in basic-tutorial-12
And minor code cleanup
2018-12-04 11:14:03 +02:00
Tony Jinwoo Ahn
b9fa4870ad Add basic-tutorial-12
Add basic-tutorial-12 from the GStreamer tutorials
2018-12-04 08:52:10 +00:00
Sebastian Dröge
8c9d1abe9d Remove GitLab badge
It only works for gitlab.com currently
2018-11-26 16:16:26 +01:00
Sebastian Dröge
352f1c80d4 Run everything through rustfmt 2018-11-03 20:28:58 +02:00
Sebastian Dröge
f4a6aa4481 Change all references from GitHub to freedesktop.org GitLab 2018-11-03 20:08:42 +02:00
Charlie Turner
98c69609cc Cturner/add tutorial 9 (#142)
Add basic-tutorial 9
2018-10-31 23:43:04 +02: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
8f9c0a72e0 Get rid of all usage of send-cell 2018-07-27 13:25:47 +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
694bcaa697 Fix all clippy warnings
Or silence the ones we don't care about.
2018-07-20 10:28:20 +03:00
Sebastian Dröge
8d0a0ee6b1 Directly use byte-slice-cast on the mapped buffer
No need to first get a byte slice from it anymore due to the buffer map
implementing AsRef/AsMut for byte slices
2018-06-01 11:55:13 +03:00
Sebastian Dröge
8ff9294f9d Update to byte-slice-cast 0.2.0 2018-06-01 11:52:56 +03:00
Sebastian Dröge
2cefd9aea6 Re-run everything through rustfmt 2018-04-25 11:13:14 +03:00
Sebastian Dröge
492c3d656c Run everything through rustfmt again 2018-04-01 11:57:58 +03:00
Sebastian Dröge
6d5f7337fc Update version to 0.12.0 2018-03-20 12:37:24 +02:00
Sebastian Dröge
4117c01ff2 Run everything through latest rustfmt-nightly 2018-02-22 11:18:37 +01:00
François Laignel
c971727193 Query: allow concrete query instantiation
Allow instantiating and dereferencing concrete queries. The motivation
for this proposal is to allow the following usability enhancements:

- Concrete queries mutability guaranteed by the borrow checker,
including for generic functions:
``` rust
    let mut p = Query::new_position(::Format::Time);
    p.get_mut_structure().set("check_mut", &true);
```

- Concrete queries functions available in place:
``` rust
    let mut q = gst::Query::new_duration(gst::Format::Time);
    let duration = if pipeline.query(&mut q) {
        Some(q.get_result())
    } else {
        None
    };
```
2018-02-16 10:33:40 +02:00
fengalin
ce28fed070 Tutorials: 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
4a5987d03d Update versions to 0.11.0 2017-12-22 15:06:06 +02:00
Sebastian Dröge
9b6efb2339 Fix various clippy warnings 2017-12-20 21:46:58 +02:00
Sebastian Dröge
e0dc84c10a Run everything through rustfmt again 2017-12-20 19:30:14 +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
d7792a4fca Fix calculation for buffer duration in basic-tutorial-8
We need to scale the number of samples, not the buffer size.
2017-12-09 14:03:18 +02:00
Sebastian Dröge
77d439338b Fix build after Event/Message::get_structure() API change 2017-12-01 17:31:47 +02:00
Sebastian Dröge
b6d13272df Fix some clippy warnings in examples/tutorials 2017-11-27 14:03:33 +02:00
Sebastian Dröge
f1e095eb0e Update versions to 0.10.0 2017-11-26 18:33:12 +02:00
Sebastian Dröge
8014b387c4 Don't list versions for the glib/gtk/gio GIT repositories 2017-11-26 18:32:14 +02:00
Sebastian Dröge
483b40679a Flush stdout after writing every * in basic-tutorial-8 2017-11-17 20:43:13 +02:00
Guillaume Desmottes
82681d2b24 Add basic-tutorial-8
Fixes https://github.com/sdroege/gstreamer-rs/pull/52
2017-11-17 20:43:08 +02:00