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`.
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.
When feature `dox` is selected but not `futures`, the `futures` crate is not
available as a dependency leading to a "can't find crate for `futures`" error.
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
};
```
Concrete events and messages share common attributes which can be factorized in generic builder `struct`s. This reduces noise in the concrete implementations.
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.
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.