Commit graph

379 commits

Author SHA1 Message Date
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
Sebastian Dröge
029527a6d4 Toc::merge() doesn't take ownership of the taglist 2017-11-27 14:03:33 +02:00
Sebastian Dröge
8c697b3a27 Use Arc::clone(&val) instead of val.clone() to make it more explicit that only the Arc cloned here 2017-11-27 14:03:33 +02:00
Sebastian Dröge
34f70ee0d7 Derive more useful traits for various enums 2017-11-27 14:03:30 +02:00
Sebastian Dröge
80ebc86e94 Update CHANGELOG.md from 0.9.1 2017-11-26 20:42:53 +02:00
Sebastian Dröge
eee82fd402 Export FlowError/Success, ClockError/Success, PadLinkError/Success too 2017-11-26 20:40:05 +02:00
Sebastian Dröge
ea3d08d65a Update CHANGELOG.md with 0.9.0 2017-11-26 19:49:56 +02:00
Sebastian Dröge
f1e095eb0e Update versions to 0.10.0 2017-11-26 18:33:12 +02:00
Sebastian Dröge
94ba143c74 Allow anything that implements Into<Option<&str>> to be used for creating new pads 2017-11-21 16:16:56 +02:00
Sebastian Dröge
1dbc63dcb3 Message::get_src() can return None
The src is optional
2017-11-16 13:58:42 +02:00
Sebastian Dröge
d430467ed5 Don't require Send for Structure::get()
Otherwise we won't be able to get references here.
2017-11-16 13:39:01 +02:00
Sebastian Dröge
9085474e37 Fix error/warning/info message macros that use format strings 2017-11-16 13:37:52 +02:00
Sebastian Dröge
7eb8429046 Run everything through latest rustfmt-nightly again 2017-11-15 22:33:51 +02:00
Sebastian Dröge
0629a0283e Use SendValue instead of Value for all our GValue usage
We require types that can be sent between threads.
2017-11-15 20:32:52 +02:00
Sebastian Dröge
9734ec29cc Implement macros for Element::message_full_with_details()
Allows attaching arbitrary structures to error/warning/info messages
2017-11-15 17:03:19 +02:00
Sebastian Dröge
d4bd1c2d76 Add dox feature to everything as needed 2017-11-12 13:33:02 +01:00
Sebastian Dröge
a557a8d66e Require the dox feature of dependant crates 2017-11-12 12:58:30 +01:00
Sebastian Dröge
d857fbd349 Add helper macros for generating error/warning/info messages 2017-11-11 16:43:29 +01:00
Sebastian Dröge
5494e5b827 Use u32 instead of i32 for Element::message_full() line numbers 2017-11-11 16:38:54 +01:00
Sebastian Dröge
126159c762 Run everything through rustfmt once again 2017-11-11 13:31:01 +01:00
Sebastian Dröge
2fc3470fa1 Add a Builder for caps and structures 2017-11-11 13:18:50 +01:00
Sebastian Dröge
f823ef9cf7 Add constants for SECONDS, etc in u64 2017-11-11 13:00:50 +01:00
Sebastian Dröge
d5b2f5900c Add API for converting ClockTime to/from mseconds, useconds, nseconds 2017-11-11 12:44:58 +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
f6ffa6919f Run latest commit through rustfmt 2017-11-10 18:24:44 +01:00
Philippe Normand
93a1b3929c Implement Error trait for error enums. 2017-11-10 17:51:06 +01:00
Sebastian Dröge
5d266bf31b Regenerate with latest GIR
Which gives us mappings between instance and class struct for now.
2017-11-09 13:33:40 +02: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
e8638c1630 Mark various enums that can signal errors as #[must_use]
See https://github.com/sdroege/gstreamer-rs/issues/44
2017-11-05 19:16:50 +02:00
Sebastian Dröge
3179806f01 Regenerate everything with latest GIR
And fix-up manual code
2017-11-05 19:08:39 +02:00
Sebastian Dröge
99a60e921d Ignore property notify functions
They're manually implemented now.
2017-11-04 12:12:07 +02:00
Sebastian Dröge
3193c19131 Add a table of contents to the README.md 2017-10-31 21:08:40 +02:00
Sebastian Dröge
1b5762c02f Update README.md with installation instructions and some links for getting started
https://github.com/sdroege/gstreamer-rs/issues/49
https://github.com/sdroege/gstreamer-rs/issues/50
2017-10-30 13:00:39 +02:00
Sebastian Dröge
b58f4cd1ed Add Object::connect_deep_notify() and test 2017-10-27 23:03:45 +02:00
Sebastian Dröge
ec6dde855a Replace ulong for the property notify watches with a custom NotifyWatchId type 2017-10-27 17:55:48 +02:00
Sebastian Dröge
a1a841afc8 Require Send+'static for Buffer::from_*slice() 2017-10-26 14:02:36 +02:00
Sebastian Dröge
f08f0f6f15 Add tests for Bin::get_children() and Element::get_*pads() 2017-10-26 13:29:37 +02:00
Sebastian Dröge
95317267ec Add BinExtManual::get_children() that returns a Vec<Element>
This is sometimes more convenient than using the iterator.
2017-10-25 12:58:22 +02:00
Sebastian Dröge
20729497a2 Add ElementExtManual::get_{,src,sink}pads() functions
These can sometimes be more usable than the iterator based approach
2017-10-25 12:58:22 +02:00
Sebastian Dröge
f30121ec53 Add private utils module with a MutexGuard around GMutex 2017-10-25 12:58:16 +02:00
Sebastian Dröge
342d89dd44 Allow creating buffers from AsRef<[u8]> and AsMut<[u8]>
Not just from Vec<u8>.
2017-10-20 18:37:38 +02:00
Sebastian Dröge
e1d134c4be Run everything through latest rustfmt-nightly 2017-10-17 12:06:51 +03:00
Sebastian Dröge
9a6713b901 Store pointers for static caps and pad templates
We don't own them, we don't want to copy them. They're *statically*
allocated things in C.
2017-10-15 11:27:08 +03:00
Sebastian Dröge
9206ddba61 Add StaticCaps and StaticPadTemplate bindings
No way to create them though, just use lazy_static from Rust instead if
something like this is needed.
2017-10-15 11:08:56 +03:00
Sebastian Dröge
1f16a39ca4 Move gst_mini_object_copy() from GstRc<T> to MiniObject directly
It can also be called on the shallow references.
2017-10-12 17:58:46 +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
Sebastian Dröge
5589d5221f Revert "Don't require &mut self for GstRc::get_mut()"
This reverts commit 4b77c18b5b.

It unfortunately allows to get multiple mutable references to the same
underlying data, which is not allowed.
2017-10-11 15:30:55 +03:00
Sebastian Dröge
d85be4fe03 Don't make variable mutable if not needed 2017-10-09 16:38:13 +03:00
Sebastian Dröge
4b77c18b5b Don't require &mut self for GstRc::get_mut() 2017-10-05 14:48:33 +03:00
Sebastian Dröge
19c5556239 Regenerate with latest GIR 2017-10-01 15:52:15 +02:00
Sebastian Dröge
19e40a5e2c Remove accidental leftover debug output 2017-09-18 20:44:59 +03:00
Sebastian Dröge
e026c2f652 Directly poke at GstPad struct for retrieving pad function data
glib-sys was just fixed: https://github.com/gtk-rs/sys/pull/62
2017-09-18 17:26:42 +03:00
Sebastian Dröge
f4958b71d7 Add test for pad tasks 2017-09-18 01:53:02 +03:00
Sebastian Dröge
c471a67e78 Add test for pad chain/event function and fix-up code
Need to handle NULL parents, and also work-around incomplete GstPad
struct definition in gstreamer-sys due to GHookList being incomplete.
2017-09-18 01:45:39 +03:00
Sebastian Dröge
dc6c7500df Add bindings for remaining pad task functions
Especially Pad::start_task()
2017-09-18 00:32:29 +03:00
Sebastian Dröge
88f37b799c Re-add Pad::iterate_internal_links()
It was accidentially dropped when making Iterator generic.
2017-09-18 00:24:36 +03:00
fengalin
7a108ddd0d Set version (1.12) for StackTraceFlags
Fixes https://github.com/sdroege/gstreamer-rs/pull/36
2017-09-17 18:58:10 +03:00
Sebastian Dröge
5881dc7d53 Also export IteratorImpl trait 2017-09-17 18:51:45 +03:00
Sebastian Dröge
191b90b1df Add copyright/license header to iterator.rs 2017-09-17 18:50:35 +03:00
Sebastian Dröge
ce5c01a88e Implement gst::Iterator as a generic type to not require using glib::Values everywhere 2017-09-17 18:45:38 +03:00
Sebastian Dröge
8085c4ce8e Add gst::Iterator example with Resync handling 2017-09-17 14:59:01 +03:00
Sebastian Dröge
f7bce553cd Implement std::iter::Iterator<Item=Result<glib::Value, IteratorError> for gst::Iterator 2017-09-17 14:43:33 +03:00
Sebastian Dröge
8306e5cf72 Add more complete gst::Iterator bindings
filter(), foreach(), find(), fold() are implemented now and we can
create our own iterators from a Vec<_> or by implementing a new trait.
2017-09-17 13:31:34 +03:00
Sebastian Dröge
858b73a672 Add bindings for setting all the pad functions 2017-09-17 13:31:34 +03:00
Sebastian Dröge
cc9780520c Implement StaticType for BufferRef, not Buffer 2017-09-16 19:27:46 +03:00
Sebastian Dröge
3cb5b591ca Add bindings for Element::message_full() and _full_with_details() 2017-09-15 19:00:51 +03:00
Sebastian Dröge
de10335167 Allow creating Error/Warning/Info messages only from specific kinds of glib::Error domains 2017-09-15 18:35:54 +03:00
Sebastian Dröge
0de4c0c1af Update CHANGELOG.md for 0.8.1 2017-09-15 00:50:22 +03:00
Sebastian Dröge
499ca3eff3 Also implement Sync+Send for Event and Message 2017-09-14 15:52:40 +03:00
fengalin
bb1b3cb1b4 Implement Sync and Send for Query
Fixes https://github.com/sdroege/gstreamer-rs/pull/35
2017-09-14 15:52:34 +03:00
Sebastian Dröge
608279c6d4 Fix various clippy warnings 2017-09-13 23:54:22 +03:00
Sebastian Dröge
17cce1a3d7 Add support for setting custom fields in message/events during construction 2017-09-13 22:38:19 +03:00
Sebastian Dröge
60e6bd8604 Require passing an object reference directly to the GStreamer logging macros 2017-09-11 14:18:32 +03:00
Sebastian Dröge
b4cb81cd56 Run everything through latest rustfmt-nightly 2017-09-10 15:21:26 +03:00
Sebastian Dröge
85b335fd89 Fix/hide various clippy warnings in gstreamer 2017-09-10 15:21:26 +03:00
Sebastian Dröge
3b0e6843e2 Regenerate everything with latest GIR 2017-09-09 16:35:01 +03:00
Sebastian Dröge
ca6c597fad Add bindings for the GStreamer logging system 2017-09-09 16:35:01 +03:00
Sebastian Dröge
8caf88810c Don't implement Clone/Copy for PadProbeId
It's only possible to use it at most once.
2017-09-09 00:45:45 +03:00
Sebastian Dröge
be9f544d0a Update crate versions to 0.9.0
0.8 bugfix release development will be in the 0.8 branch
2017-09-01 13:44:07 +03:00
Sebastian Dröge
a30582a1ef Add README.md to all crate subdirectories
This way it would show up on crates.io
2017-09-01 12:08:59 +03:00
Sebastian Dröge
380fb319ba Don't return &'static references from functions but give them a generic lifetime
https://github.com/rust-lang/rust/pull/42417#issue-233404573
2017-09-01 11:40:32 +03:00
Sebastian Dröge
15d05ed3ac Don't use versions for GIT dependencies in master 2017-08-31 13:34:52 +03:00
Sebastian Dröge
c94eb34f34 Add LICENSE files to all crate subdirectories 2017-08-31 13:34:52 +03:00
Sebastian Dröge
d3d00130df Add links to homepage and proper docs
docs.rs can't generate our docs due to missing C libraries
2017-08-31 13:04:19 +03:00
Sebastian Dröge
0454a9cb95 Ignore some now generated functions for which we have manual implementations 2017-08-31 12:13:44 +03:00
Sebastian Dröge
6450fec398 Update versions to 0.8.0 2017-08-31 10:53:45 +03:00
Sebastian Dröge
dae1a51764 Work around rustdoc bug with impls on type aliases
https://github.com/rust-lang/rust/issues/44182
2017-08-30 15:12:11 +03:00
Sebastian Dröge
52c013b834 Regenerate everything with latest GIR 2017-08-30 14:45:25 +03:00
Sebastian Dröge
f0935d7e1e Add remaining gst_init() assertions 2017-08-30 14:39:09 +03:00
Sebastian Dröge
f05df73088 Add various gst_init() assertions to video/app bindings
audio and core should come next.

Also print something more meaningful than using assert_eq!().
2017-08-30 12:48:01 +03:00
Sebastian Dröge
046edc5efd Add initial 0.8.0 (basically empty) CHANGELOG.md
Another release preparation.
2017-08-29 15:44:33 +03:00
Sebastian Dröge
8013169e09 Add constants for SECOND, MSECOND, USECOND, NSECOND
And use them in the examples.
2017-08-29 11:07:59 +03:00
Sebastian Dröge
083a6b6eeb Update glib/gtk/etc versions, and gstreamer-sys
Fixes https://github.com/sdroege/gstreamer-rs/pull/30
2017-08-29 11:03:33 +03:00
Sebastian Dröge
342d5ab935 Add signal connectors for property notifications
Have to hide some properties again at a later time, which have actual
getter/setter functions already. We only need the notification signals
for those.

Depends on the GIR patch in https://github.com/gtk-rs/gir/pull/441
2017-08-18 17:43:55 +03:00
Sebastian Dröge
337f00a85c Implement SetValueOptional for Structure 2017-08-18 16:28:08 +03:00
Sebastian Dröge
14adb331ec Implement StaticType on the actual MiniObjects, not the GstRc wrapper 2017-08-18 16:21:49 +03:00
Sebastian Dröge
6c4ee55f27 Implement SetValueOptional for GstRc<T> 2017-08-18 15:38:51 +03:00
Sebastian Dröge
f751afc0fb Add prelude modules to all cratest that only re-export the traits
And use those in the examples instead of blanket * imports
2017-08-17 18:02:25 +03:00
Sebastian Dröge
767bd0537e Only re-export traits once 2017-08-17 16:32:17 +03:00
Sebastian Dröge
50a1535771 Add ParseContext bindings and corresponding functions
And use it in the launch example to print more useful error information,
like which elements are missing.
2017-08-17 16:17:02 +03:00