Commit graph

423 commits

Author SHA1 Message Date
François Laignel
dfc961679f segment: serde FormattedSegments too
... and use the same `struct` for serialization and deserialization so
that fields mapping consistency is ensured at compilation time.
2018-07-30 23:18:30 +03:00
François Laignel
ab9cd29bd6 serde: fmt pass
Note: clippy didn't raise any warning
2018-07-30 23:18:30 +03:00
François Laignel
d4fb10ef4c Toc: serde: rename loop_ to loop 2018-07-30 23:18:30 +03:00
François Laignel
0aac055727 Caps: serde: use a placeholder for CapsFeature
`CapsFeature` is not available in `gstreamer-rs` yet. Use a placeholder
with a `None` value for now.
2018-07-30 23:18:30 +03:00
François Laignel
fd0c3f4464 Structure: de: pass the new Structure to the Visitor
Use a `DeserializeSeed` to pass the newly created and named `Structure`.
2018-07-30 23:18:30 +03:00
François Laignel
23307a4795 Tags: ser/de: gather tags with the same name together 2018-07-30 23:18:30 +03:00
François Laignel
d856fedf06 Buffer: ser: don't panick if not readable 2018-07-30 23:18:30 +03:00
François Laignel
693121bc55 Buffer: fix instanstiation during deserialization 2018-07-30 23:18:30 +03:00
François Laignel
90b046fbcf serde: separate serde impl and tests from base module
+ fix erroneous `datetime` instead of `buffer` in `BufferRef::serialize`
+ remove ser/de for `Value`s with types `ULong` & `ILong`
2018-07-30 23:18:30 +03:00
François Laignel
3f0cd6fb87 Toc: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
20834e475b Tags: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
4f948e2cce Sample: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
5e6f80cc32 Segment: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
a2c4e78f70 GenericFormattedValue: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
0f1d3bea89 BufferList: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
862afe5cc7 Buffer: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
138a0fb18c ClockTime: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
49d3ee29e9 Caps: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
1ef83c24b8 Structure: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
778e11742f value: serde impl 2018-07-30 23:18:30 +03:00
François Laignel
0d65b7f1ed DateTime: serde impl 2018-07-30 23:18:30 +03:00
Sebastian Dröge
2240ef109f Regenerate with latest GIR and update for the glib::Quark changes 2018-07-30 11:46:40 +03:00
Sebastian Dröge
33a6aab6d7 Run everything through latest rustfmt 2018-07-27 13:36:40 +03:00
Sebastian Dröge
ec8b55ec30 Stream-line pad probe code
Don't take another reference of the data passed through the pad probes,
i.e. keeping buffers writable if they're writable.
2018-07-26 03:14:04 +03:00
Sebastian Dröge
632d5f4c57 Change some empty structs to empty enums
These should only really exist at the type-level.
2018-07-25 10:07:20 +03:00
Sebastian Dröge
af5470a8b0 Unref the message in sync bus handlers if Drop is returned 2018-07-24 15:35:26 +03:00
Sebastian Dröge
93b32882ee tags: Use to_glib_none() to convert &str to a C string instead of as_ptr()
The latter does not necessarily give us a NUL-terminated string.

Fixes https://github.com/sdroege/gstreamer-rs/issues/122
2018-07-23 10:17:38 +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
François Laignel
02a8e9faa0 Tags: more and better getters/adder factorizations 2018-07-12 07:22:39 +02:00
François Laignel
7ca54cf1c5 Tags: factorize get_index unsafe code 2018-07-12 07:22:39 +02:00
François Laignel
0b9edee8d7 Tags: use SendValue for generic getters and iterator 2018-07-12 07:22:39 +02:00
François Laignel
be9ef0d152 Tags: implement generic iterators
This is the continuation of PR #107 by @ystreet
2018-07-12 07:22:39 +02:00
Matthew Waters
2e1f1eadac tags: add dynamic tag retrieval based on string's and Value's
The rust compiler won't complain if you use the wrong types with the
dynamic getter/adder however GStreamer itself does.
2018-07-12 07:22:39 +02:00
Matthew Waters
fa054fe3b0 gst/tags: combine the static tag references into the impl_tag macro
There's no real reason to have them separate when there's already a
macro making types for different tags.
2018-07-12 07:22:39 +02:00
Sebastian Dröge
73a5b26638 Use ParamSpec for the deep-notify signal callback instead of just the name
And allow filtering by property-name via the signal details
2018-07-09 19:47:15 +02:00
Sebastian Dröge
dc32d338ef Let various Caps operations take &CapsRef instead of &Caps 2018-07-06 17:58:54 +02:00
Sebastian Dröge
480d373fbc Caps::subtract() does not take ownership of the arguments and can be implemented for CapsRef 2018-07-06 17:56:55 +02:00
Sebastian Dröge
8c268ecd06 Gracefully return None in Caps::get_structure() if the index is too high 2018-07-06 10:36:00 +02:00
Sebastian Dröge
75acd7ea95 Fix typefind test if typefind factories without caps are available 2018-07-06 10:35:57 +02:00
Sebastian Dröge
e88017f914 Ensure that miniobjects are writable before creating a mutable borrow 2018-07-06 10:29:09 +02:00
Sebastian Dröge
e0972ae1e5 Get rid of manual usage of callback_guard! 2018-06-24 14:52:50 +03:00
Sebastian Dröge
2085d170be Get rid of callback_guard! as unwinding through FFI is defined behaviour now and aborts 2018-06-24 14:42:11 +03:00
JohanGoversTech
db3fe69415 Change return type of add_probe to support removing (#116)
* Change return type of add_probe to support 0 PadProbeId

* use from_glib for the conversion of the PadProbeId
2018-06-14 15:45:54 +03:00
François Laignel
f4d57a6652 Fix memory issue building a Sample with an info Structure
The following code in a `[test]`:
``` rust
let info = Structure::builder("sample.info")
    .field("f3", &123i32)
    .build();
let sample = Sample:🆕:<GenericFormattedValue>(
        None,
        None,
        None,
        Some(info.as_ref())
    );
```

generates one of the followings executing `cargo test`:
```
- segmentation fault
- signal: 6, SIGABRT: process abort signal
- signal: 11, SIGSEGV: invalid memory reference
```

This is due to `ffi::gst_sample_new` expecting to take ownership of the `info`
`Structure`.
2018-06-12 00:23:10 +03:00
Sebastian Dröge
1192a027b4 Regenerated with latest GIR and GIR files 2018-05-21 11:55:19 +03:00
Sebastian Dröge
4692806b00 Add Bus::remove_watch()
It was accidentially ignored before
2018-05-19 10:37:09 +03:00
Sebastian Dröge
da6b04abfd Bus::create_watch() can't return None, change it to return no Option 2018-05-19 10:36:15 +03:00
Thibault Saunier
2962f186f7 Print pointer value when formatting debug strings 2018-05-14 09:22:25 +03:00
Sebastian Dröge
c31921e093 Further work-arounds for floating reference handling changes between 1.12 and 1.14
This fixes various memory-safety issues caused by broken reference
counting. We have to handle pre-1.14 and post-1.14 differently in
constructors.

See https://bugzilla.gnome.org/show_bug.cgi?id=743062#c30
2018-05-09 12:20:59 +03:00
Sebastian Dröge
2cefd9aea6 Re-run everything through rustfmt 2018-04-25 11:13:14 +03:00
Sebastian Dröge
46d27e3e75 Regenerate everything with latest GIR 2018-04-23 20:45:15 +03:00
Sebastian Dröge
a276c226fd Port BusStream to futures 0.2 2018-04-23 20:27:17 +03:00
Sebastian Dröge
03055f4e84 Change Structure/StructureRef to_string() to the minimal required fix
And add a comment to why we need it. No other struct with a to_string()
function is affected.

https://github.com/sdroege/gstreamer-rs/issues/101
2018-04-07 13:37:44 +03:00
Sebastian Dröge
ce9b98f338 Add Display impl for StructureRef too 2018-04-06 13:22:08 +03:00
Sebastian Dröge
f346d57b4f Fix infinite recursion in Structure::to_string()
Instead of StructureRef's to_string(), we were calling
ToString::to_string() in the Display impl. Which then called into itself
again.

Fixes https://github.com/sdroege/gstreamer-rs/issues/101
2018-04-06 13:22:08 +03:00
Guillaume Desmottes
c5617f6a47 WIP: test Structure string conversions 2018-04-06 13:22:08 +03:00
Sebastian Dröge
9a3ef2e9f1 Regenerate with latest GIR and update for the non-bitflags flags in -sys now 2018-04-04 10:47:12 +03:00
Sebastian Dröge
492c3d656c Run everything through rustfmt again 2018-04-01 11:57:58 +03:00
Sebastian Dröge
fca0287dec Use ptr::NonNull in various places 2018-04-01 11:29:55 +03:00
Sebastian Dröge
a33fd41d02 Regenerate everything with latest gir 2018-03-20 11:52:29 +02:00
François Laignel
cd56d60352 Bus::get_pollfd generate doc for both unix & windows
There are different implementations and signatures for `get_pollfd` depending
on whether the target platform is unix or windows. When generating the doc,
we need both implementations to appear regardless of the target platform. This
commit is inspired by the way Rust `std` library deals with `process::Command`
OS dependent variants
(https://doc.rust-lang.org/std/process/struct.Command.html#impl-CommandExt).

Documentation can't be accurate though as we can't use the`std::os::windows`
on `unix` and vice versa. As a workaround a fake fd class matching the other
platform is declared.

This could be further enhanced once `#[doc(cfg(...))]` is stabilized
(https://github.com/rust-lang/rust/issues/43781) by declaring `#[doc(cfg(unix))]`
or `#[doc(cfg(windows))]` instead of the hard coded comments `This is supported
on **Windows/Unix** only`. Unfortunately, these comments disappear when
generating will `--all-features` because they are not part of the documentation
in the gir file.
2018-03-19 13:48:59 +02:00
François Laignel
406eb119d3 message: add test_other_fields
Fixes https://github.com/sdroege/gstreamer-rs/pull/93
2018-03-19 10:32:07 +02:00
Sebastian Dröge
3a755219f4 Add Promise bindings 2018-03-19 10:32:07 +02:00
Sebastian Dröge
0112d22804 Various manual 1.14 API additions and remove deprecated functions 2018-03-19 10:32:07 +02:00
Sebastian Dröge
4864a1e089 Fix build 2018-03-19 10:32:07 +02:00
Sebastian Dröge
1abe9cbeb9 Update gstreamer 2018-03-19 10:32:07 +02:00
François Laignel
93442e94dd element: add feature gate for test_call_async
Fixes https://github.com/sdroege/gstreamer-rs/pull/92
2018-03-16 17:51:56 +02:00
Sebastian Dröge
11c974a55e Fix some unused import compiler warnings if using < v1_10 2018-03-16 12:28:20 +02:00
Sebastian Dröge
fc7cda4522 Directly dereference DebugCategory struct to read the threshold and #[inline]
This should improve logging performance if the threshold is not high
enough.
2018-03-16 12:27:36 +02:00
Sebastian Dröge
c38af51bf0 Add Element::call_async() bindings 2018-03-14 15:42:17 +02:00
Sebastian Dröge
de8f4694f5 Add initial BufferPool bindings 2018-03-07 11:08:21 +02:00
Sebastian Dröge
a3b294f0f2 Add back callback guards 2018-03-02 21:34:29 +02:00
Sebastian Dröge
808ff293ec Regenerate everything with latest gir 2018-03-02 21:34:29 +02:00
Sebastian Dröge
4117c01ff2 Run everything through latest rustfmt-nightly 2018-02-22 11:18:37 +01:00
François Laignel
84e4546f72 Toc: implement Debug trait 2018-02-20 19:29:26 +01:00
Sebastian Dröge
f1426c82ba Remove callback guards
Since Rust 1.24 it is safe to let panics go to the FFI boundary
2018-02-17 19:58:41 +02: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
Sebastian Dröge
6d0d7a3df8 Regenerate everything with latest GIR 2018-02-06 16:42:34 +02:00
François Laignel
ac31688fbd Value: use new union for GValue_data 2018-02-05 05:28:09 +01:00
fengalin
da924e5d4d Event & Message: factorize common attributes in generic builders
Concrete events and messages share common attributes which can be factorized in generic builder `struct`s. This reduces noise in the concrete implementations.
2018-01-29 17:33:49 +02:00
fengalin
2d1218e6d6 Event, Message & Query: allow dereferencing concrete types to access generic type methods
Implement `deref` for concrete derivatives of `Event`, `Message` and `Query`. This allows accessing generic methods such as `is_sticky` for events, `get_seqnum` for messages or `is_serialized` for queries and `get_structure` for all.
2018-01-29 17:33:49 +02:00
fengalin
86812c1a53 MessageBuilder: comment out other_fields related methods until GStreamer v1.14 is released
These methods are commented out in order to maintain consistency between messages with and without arguments. It will be restored and conditioned to feature "v1_14" when GStreamer v1.14 is released.
2018-01-29 10:07:42 +02:00
fengalin
3c65a50076 Fix building argument-less messages
Building an argument-less message such as eos yields an assertion failure due to the inner structure being null. The short term solution consists in checking that the inner `structure` is not `null` before attempting to insert `other_fields`. The consequence is that `others_fields` defined for argument-less messages will be ignored. A correction will be applied when GStreamer 1.14 is released thank to the introduction of `gst_message_writable_structure` (see https://bugzilla.gnome.org/show_bug.cgi?id=792928). Due to the dependency on GStreamer 1.14, the correction will be only available under the activation of a feature "v1_14".

Events are not affected as the build method the availability of `gst_event_writable_structure` and this function "will never return NULL". However, we can avoid a `structure` allocation for argument-less messages without `other_fields`.
2018-01-29 10:07:42 +02:00
Sebastian Dröge
ad219dd171 Remove PAD_PROBE_ID_INVALID and Default impls for PadProbeId and NotifyWatchId
These should never ever be 0, and passing 0 to any of the functions
using them will result in assertions.
2018-01-25 21:06:39 +02:00
Sebastian Dröge
65468c1fc8 Add Sample::get_info() and deprecate get_structure()
For consistency with the C API naming.
2017-12-30 12:03:03 +02:00
Sebastian Dröge
4a9cb50670 Add Sample::with_buffer_list() constructor 2017-12-30 12:02:48 +02:00
Sebastian Dröge
f47b30b8d1 Add Debug impl for Sample 2017-12-30 12:02:33 +02:00
Sebastian Dröge
755982bb38 Correctly mark Stream and StreamType as requiring version 1.10 at least
Should fix https://github.com/sdroege/gstreamer-rs/issues/68
2017-12-26 18:13:15 +01:00
Sebastian Dröge
c56251d673 Don't require a mutable self for TagSetterExtManual::add()
Like all GObjects, mutation works through interior mutability.
2017-12-23 11:43:09 +02:00
Sebastian Dröge
9b6efb2339 Fix various clippy warnings 2017-12-20 21:46:58 +02:00
Sebastian Dröge
15ea81e473 Derive Clone on ErrorMessage 2017-12-20 20:08:00 +02:00
Sebastian Dröge
9066cf0634 Add ErrorMessage type
This can be used to propagate an element error via a Result until the
place where it can be actually posted on an element.
2017-12-20 20:00:05 +02:00
Sebastian Dröge
e0dc84c10a Run everything through rustfmt again 2017-12-20 19:30:14 +02:00
Sebastian Dröge
f439f14ec3 SystemClock::set_default() can accept None 2017-12-20 18:57:16 +02:00
Sebastian Dröge
95c9f92549 Add StreamCollection::iter() 2017-12-20 18:54:56 +02:00
Sebastian Dröge
67a46b3bf5 Most Preset functions that return a bool signal an error with this, use a Result 2017-12-20 18:47:04 +02:00
Sebastian Dröge
f2729fb730 Preset::set_app_dir() returning false is an error, make it a Result 2017-12-20 18:44:57 +02:00
Sebastian Dröge
d182584c25 Object::set_name() should not accept NULL 2017-12-20 18:35:41 +02:00
Sebastian Dröge
55c8cf69f3 update_registry() returning false is not an error
It means that there were no changes.
2017-12-20 18:22:30 +02:00
Sebastian Dröge
e34212d517 parse_bin_from_description() return value is not nullable, except for errors 2017-12-20 18:22:30 +02:00