Commit graph

35 commits

Author SHA1 Message Date
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
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
4ab5893359 Allow to return something from the examples/tutorials main() wrapper 2017-11-12 20:11:25 +01:00
Kornel
10151b9f0d tutorials: Set up a runloop on macOS
Fixes https://github.com/sdroege/gstreamer-rs/pull/62
Fixes https://github.com/sdroege/gstreamer-rs/issues/58
2017-11-12 18:58:15 +01:00
Sebastian Dröge
126159c762 Run everything through rustfmt once again 2017-11-11 13:31:01 +01:00
Sebastian Dröge
246a54368d Clean up Query API a bit
There's now get_result() instead of get(), and separate getters for only
getting the constructor arguments of each query (otherwise query
handlers will get useless values when trying to answer a query).
2017-11-11 12:27:30 +01: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
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
6bb9eaf739 Remove unneeded reference 2017-10-26 12:56:52 +02:00
Luis de Bethencourt
e82e8e0c34 Needless pass by value
Avoid an unnecessary allocation by passing the Caps by reference instead of
by value.

Fixes https://github.com/sdroege/gstreamer-rs/pull/46
Fixes https://github.com/sdroege/gstreamer-rs/issues/45
2017-10-24 23:41:20 +02:00
Luis de Bethencourt
95dc336b65 Use while let
When destructuring a single pattern in a loop it is nicer to use while let.

Fixes https://github.com/sdroege/gstreamer-rs/pull/46
Fixes https://github.com/sdroege/gstreamer-rs/issues/45
2017-10-24 23:41:05 +02:00
Thijs Vermeir
b24f628772 Add basic-tutorial-6 from the GStreamer tutorials
https://cgit.freedesktop.org/gstreamer/gst-docs/tree/examples/tutorials/basic-tutorial-6.c

Fixes https://github.com/sdroege/gstreamer-rs/pull/43
2017-10-17 12:24:54 +03:00
Sebastian Dröge
e1d134c4be Run everything through latest rustfmt-nightly 2017-10-17 12:06:51 +03:00
Thibault Saunier
faae914f72 Add the tutorial5 (Gtk video player with informations about streams)
Fixes https://github.com/sdroege/gstreamer-rs/pull/41
2017-10-14 20:22:10 +03:00
Thibault Saunier
08c30a0566 Add basic-tutorial-7.rs
Fixes https://github.com/sdroege/gstreamer-rs/pull/42
2017-10-13 09:47:10 +03:00
Sebastian Dröge
b773c0b46a Fix compilation again now that GstRc::get_mut() requires &mut self again 2017-10-11 15:39:27 +03:00
Thijs Vermeir
f253caac19 Add basic-tutorial-4 from the GStreamer tutorials
https://cgit.freedesktop.org/gstreamer/gst-docs/tree/examples/tutorials/basic-tutorial-4.c

Fixes https://github.com/sdroege/gstreamer-rs/pull/39
2017-10-11 11:29:35 +03:00
Thijs Vermeir
38b58cbf9d Add basic-tutorial-3 from the GStreamer tutorials
https://cgit.freedesktop.org/gstreamer/gst-docs/tree/examples/tutorials/basic-tutorial-3.c

Fixes https://github.com/sdroege/gstreamer-rs/pull/38
2017-10-09 16:38:13 +03: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
Jouan
a1679f6216 Added basic-tutorial-2
Fixes https://github.com/sdroege/gstreamer-rs/pull/33
2017-09-13 19:33:02 +03:00
Sebastian Dröge
24b8b383d8 Add comments from the C tutorial to basic-tutorial-1 2017-09-08 16:33:09 +03:00
Sebastian Dröge
6f6db8ac47 Add basic-tutorial-1 from the GStreamer tutorials
https://cgit.freedesktop.org/gstreamer/gst-docs/tree/examples/tutorials/basic-tutorial-1.c
2017-09-08 11:51:27 +03:00