Commit graph

379 commits

Author SHA1 Message Date
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
f92f0a99e8 Update CHANGELOG.md for 0.10.2 2018-02-18 23:25:11 +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
98290bcc55 Update CHANGELOG.md for 0.10.1 2018-01-03 17:08:46 +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
4a5987d03d Update versions to 0.11.0 2017-12-22 15:06:06 +02:00
Sebastian Dröge
95562b8d22 Update CHANGELOG.md for 0.10.0 2017-12-22 14:44:24 +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
Sebastian Dröge
210119d9aa Element::set_clock() allows None for the clock parameter 2017-12-20 18:22:30 +02:00
Sebastian Dröge
6d7acd200d Element::set_bus() allows None for the bus parameter 2017-12-20 18:10:50 +02:00
Sebastian Dröge
241bb823d5 Element::link_pads_full() should return a Result instead of a bool 2017-12-20 18:07:55 +02:00
Sebastian Dröge
e2970db84c Failure to post a message is an error, so return a Result instead of a bool 2017-12-20 18:07:28 +02:00
Sebastian Dröge
6d8cfa5de0 Add support for TypeFind and implement Ord on Rank and TypeFindProbability
Fixes https://github.com/sdroege/gstreamer-rs/issues/11
2017-12-19 19:14:12 +02:00
Sebastian Dröge
12ee7358e3 Add bindings for TypeFindFactory 2017-12-18 09:53:08 +02:00
Sebastian Dröge
5dd89d01e2 DeviceMonitor/Provider::start() should return a Result 2017-12-18 09:49:15 +02:00
Sebastian Dröge
48958d381e Implement Sync for DateTime
It's immutable.
2017-12-18 09:42:27 +02:00
Sebastian Dröge
9223386750 Remove clock parameter from Clock::(un)adjust_with_calibration()
It's useless and not used.
2017-12-18 09:39:37 +02:00
Sebastian Dröge
9a7ede1dcc Bus::add_signal_watch_full() should take a Priority, not u32 for the priority 2017-12-18 09:39:14 +02:00
Sebastian Dröge
49627b8de7 Various nullability fixes everywhere and hide enum->string functions 2017-12-17 18:29:22 +02:00
Sebastian Dröge
5108c941ed Various nullability fixes to plugin bindings, and add add_dependency() API
Also fix structure ownership for the cache data API
2017-12-17 14:26:17 +02:00
Sebastian Dröge
4b2fd0e593 Require SendValue for value::Array and value::List 2017-12-17 14:06:22 +02:00
Sebastian Dröge
2035bba437 Make value of Bitmask public 2017-12-17 11:57:37 +02:00
Sebastian Dröge
1f6fd3def7 Structure intersection can return None 2017-12-17 11:52:52 +02:00
Sebastian Dröge
dfdae187a3 Filter in caps queries can be None, and there could be no resulting caps 2017-12-17 11:32:01 +02:00
Sebastian Dröge
ffb5869dd1 Use the correct pad type for the proxy/ghost pad default pad functions 2017-12-17 11:24:03 +02:00
Sebastian Dröge
62058ab1c3 Use &ToSendValue for the stream-status stream_object in the builder 2017-12-16 18:39:50 +02:00
Sebastian Dröge
ccf6c1a632 Owner of structure-change and stream-status messages is mandatory 2017-12-16 18:39:33 +02:00
Sebastian Dröge
bcf6b34c1b Code/text of progress messages is mandatory 2017-12-16 18:38:53 +02:00
Sebastian Dröge
974e681a5d Move optional taglist/entry_struct fields into the Redirect builder from the constructor 2017-12-16 18:13:25 +02:00
Sebastian Dröge
7bc1fce97d Move value for PropertyNotification message into the builder instead of constructor 2017-12-16 18:10:10 +02:00
Sebastian Dröge
c2f075ed8d Description of debug categories is optional
Also add a getter for the description of a debug category
2017-12-16 17:56:23 +02:00
Sebastian Dröge
f7c971874d Implement Display and Error for IteratorError 2017-12-16 17:48:38 +02:00
Sebastian Dröge
7065d1d884 Add constants for COPY_ALL and COPY_METADATA buffer copy flags 2017-12-16 17:40:47 +02:00
Sebastian Dröge
fa05ee7b08 Various fixes for nullability in the event bindings
The origin in protection events is optional, the stream id in
stream-start events is not.

Also return a segment reference instead of a segment copy when parsing a
segment event.
2017-12-16 17:30:50 +02:00
Sebastian Dröge
9608ef52ec Mark Segment as #[repr(C)] 2017-12-16 17:30:37 +02:00
Sebastian Dröge
b9c4e4cd6e Allow no value for the PropertyNotify message
It can contain no value.

Also use &ToSendValue instead of an actual value for building the
message.
2017-12-16 15:37:06 +02:00
Sebastian Dröge
52ca97e7e6 Let ChildProxy::set_child_property() take a &ToValue instead of an actual Value 2017-12-16 15:24:18 +02:00
Sebastian Dröge
3de73d89f2 Add Buffer::copy_into() and add flags parameter to ::copy_region()
Also ::copy_deep() can fail, return an Option<_>
2017-12-16 15:15:42 +02:00
Sebastian Dröge
18f99073c1 Use from_glib_none/full directly on potential NULL pointers if Option<_> is returned
The implementation for Option<_> is doing exactly what we did manually
here.
2017-12-16 15:07:26 +02:00
Sebastian Dröge
8a2c6a3246 Implement AsRef<[u8]>, AsMut, Deref, DerefMut, PartialEq, Eq and Debug for BufferMap too 2017-12-13 11:00:29 +02:00
Sebastian Dröge
e37c3d684c Fix PartialEq for MappedBuffer
No need to map the buffer again, we can just compare the slice directly.
2017-12-13 11:00:02 +02:00
Sebastian Dröge
5dff6026be Also implement Deref/DerefMut for MappedBuffer for &[u8] 2017-12-13 10:55:26 +02:00
Sebastian Dröge
85fdc8bf13 Implement AsRef<[u8]>, AsMut, Debug, PartialEq and Eq for MappedBuffer 2017-12-13 09:58:41 +02:00
Sebastian Dröge
298cb754c9 Fix precision handling in ClockTime Display impl 2017-12-10 12:31:41 +02:00
Sebastian Dröge
5065bc76ee Rename FormattedValue::from_glib/to_glib to from_raw/to_raw_value
Otherwise we conflict with GLib translation traits, which causes some
annoyances.
2017-12-10 12:10:25 +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
520a9bb879 Use downcast_unchecked() for sender in deep-notify signal handler
This is guaranteed to be of the correct type.
2017-12-09 18:08:57 +02:00
Sebastian Dröge
963557b79f Query::get_structure() can also return NULL 2017-12-06 13:43:37 +02:00
Sebastian Dröge
1f80df493a Let the glib::Value destructor clean up our values instead of doing so manually 2017-12-06 11:17:59 +02:00
Sebastian Dröge
ad7b21ba55 Use unwrap_or_else() for the default value in the DateTime Display impl 2017-12-05 23:20:10 +02:00
Sebastian Dröge
05c51dd778 Change all values in Segment to FormatValue 2017-12-05 23:16:12 +02:00
Sebastian Dröge
e6da3554ee Use ClockTime for the Duration tag
And implement the Value traits for ClockTime
2017-12-05 22:54:03 +02:00
Sebastian Dröge
f1c6c4fd06 Change various integers to FormatValue and ClockTime in events/queries/messages 2017-12-05 22:43:37 +02:00
Sebastian Dröge
801a7ed43c Use ClockTime instead of u64 for the Gap event 2017-12-05 21:36:56 +02:00
Sebastian Dröge
55f044dd83 Add newtype wrappers and INVALID constants for event/message GroupId and Seqnum 2017-12-05 21:33:04 +02:00
Sebastian Dröge
97b786a0c7 Regenerate element bindings for gst_element_remove_pad() annotation fix 2017-12-04 18:12:55 +02:00
Sebastian Dröge
c965422410 Update to lazy_static 1.0 2017-12-04 11:11:26 +02:00
Sebastian Dröge
88ff4289d1 Add Event::set_running_time_offset() 2017-12-03 17:13:46 +02:00
Sebastian Dröge
e5bbf93670 Registry::scan_path() returning false is not an error 2017-12-03 14:54:52 +02:00
Sebastian Dröge
6015e74f0e Regenerate with gir filename/utf8 fixes 2017-12-03 14:51:16 +02:00
Sebastian Dröge
49e1fe1c3f Add bindings for Registry and PluginFeature 2017-12-03 14:40:38 +02:00
Sebastian Dröge
c6c7693550 Add Buffer::get_dts_or_pts() 2017-12-02 12:15:07 +02:00
Sebastian Dröge
411f54afed Run everything to rustfmt again 2017-12-01 19:02:53 +02:00
Sebastian Dröge
0920008869 Print clock times as actual time in Segment/Buffer/BufferList debug output 2017-12-01 19:02:29 +02:00
Sebastian Dröge
fccb1eca5e Implement fmt::Debug more consistently for miniobjects and various other types 2017-12-01 11:34:01 +02:00
Sebastian Dröge
c57d5523d2 Implement ToOwned for Message/Event/QueryRef 2017-12-01 11:34:01 +02:00
Sebastian Dröge
1576ff6c32 Event/Message::get_structure() can return None 2017-12-01 11:33:21 +02:00
Sebastian Dröge
7342a0fb98 Implement some functions on EventType and implement PartialOrd for serialized events 2017-11-29 18:55:56 +02:00
Sebastian Dröge
8a2e78e586 Regenerate with latest GIR to fix various issues with property getters
Get rid of unneeded transmutes and actually initialize flags/enum
GValues with the correct type instead of using integers.
2017-11-27 19:16:34 +02:00
Sebastian Dröge
b198ee21da Let Sample::new(), TagList::add(), Structure::set() and others take more values by reference instead of by value 2017-11-27 14:34:02 +02:00
Sebastian Dröge
2508f432f4 Remove some unneeded lifetime annotations 2017-11-27 14:03:33 +02:00
Sebastian Dröge
52d13c010a Add TagListRef::merge() and ::insert() 2017-11-27 14:03:33 +02:00