Commit graph

314 commits

Author SHA1 Message Date
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 eee82fd402 Export FlowError/Success, ClockError/Success, PadLinkError/Success too 2017-11-26 20:40:05 +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 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 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 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 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 0454a9cb95 Ignore some now generated functions for which we have manual implementations 2017-08-31 12:13:44 +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 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 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
Sebastian Dröge e7a0543c73 Clean up global functions 2017-08-17 15:31:00 +03:00
Sebastian Dröge 33fb38efd9 Remove traits for things that are not subclassed 2017-08-17 14:50:25 +03:00
Sebastian Dröge 165d85646f Move futures based BusStream from examples to the bindings
And hide behind the "futures" feature.

Fixes https://github.com/sdroege/gstreamer-rs/issues/26
2017-08-17 13:07:59 +03:00
Sebastian Dröge 08e2f6d917 Add Element::get_metadata(), get_pad_template(), get_pad_template_list() and DeviceProvider::get_metadata()
As wrapper around the C class functions.

Fixes https://github.com/sdroege/gstreamer-rs/issues/28
2017-08-17 12:49:58 +03:00
Sebastian Dröge 7991b4d8eb Don't export tag name strings directly
They can be accessed via the Tag trait impls instead
2017-08-17 12:49:58 +03:00
Sebastian Dröge dc703cc6e9 Add push_list/chain_list functions to Pad 2017-08-14 22:24:54 +03:00
Sebastian Dröge de98b8039e Add GstPadLinkCheck 2017-08-14 22:19:47 +03:00
Sebastian Dröge 97bca10484 Add GstRank 2017-08-14 22:18:34 +03:00
Sebastian Dröge 474749598e Add GstElementFlags and suppressed_flags API of GstBin 2017-08-14 22:15:37 +03:00
Sebastian Dröge 77cb4da32a Add ClockId and related waiting API, and SystemClock
Fixes https://github.com/sdroege/gstreamer-rs/issues/23
2017-08-14 01:41:37 +03:00
Philippe Normand d654252e65 gstreamer: disable calculate_linear_regression
It's not binding friendly.
2017-08-11 15:42:28 +03:00
Philippe Normand 8badc33df9 gstreamer: expose version functions 2017-08-11 15:41:20 +03:00
Sebastian Dröge 93cc21112c Don't re-export everything from the tags module
All the tags are supposed to be used via gst::tags::Title, etc to
prevent conflicts.
2017-08-11 15:32:28 +03:00
Sebastian Dröge 1a3b556fb6 Make Buffer map bindings more simple and consistent 2017-08-11 15:20:43 +03:00
Sebastian Dröge e1538b6ca5 Add bindings for various audio channel position functions 2017-08-10 14:39:57 +03:00
Sebastian Dröge 009bb7f39b Add getters/setters for all the segment fields 2017-08-10 01:25:19 +03:00
Sebastian Dröge 2452f7f6a9 Allow usage of Structures in GValues 2017-08-10 01:13:28 +03:00
Sebastian Dröge a10d081c22 Fix FromValueOptional impl for Segment
Should be from_glib_none(), not from_glib_full()
2017-08-10 01:09:42 +03:00
Sebastian Dröge c8910aae08 Initial gstreamer-audio bindings
Only wrapping AudioInfo and AudioFormatInfo and related for now.

https://github.com/sdroege/gstreamer-rs/issues/4
2017-08-09 20:33:45 +03:00
Sebastian Dröge 146b3092aa Minor miniobject code cleanup 2017-08-09 20:08:02 +03:00
Sebastian Dröge f00af84105 Properly implement Eq/PartialEq/Debug for miniobjects 2017-08-09 20:08:02 +03:00
Sebastian Dröge 31b65e572c Add bindings for Bitmask values 2017-08-09 20:08:02 +03:00
fengalin 04f09ebc86 Add bindings for GstToc/TocSetter
https://github.com/sdroege/gstreamer-rs/pull/22

Fixes https://github.com/sdroege/gstreamer-rs/issues/10
2017-08-09 19:38:39 +03:00
Sebastian Dröge f1ac59a400 Autogenerate GstObject bindings again now that gir has support for renaming the trait 2017-08-07 10:24:43 +03:00
Sebastian Dröge 88f4fe5ea3 The message signal of Bus only has to require Send for the closure 2017-08-04 23:04:42 +03:00
Sebastian Dröge 3395203a53 Make miniobject ToOwned impls actually safe
Previously it was possible to create a new reference from a mutable
reference, which is not good. Now a copy is always created to prevent
that.
2017-08-04 18:51:27 +03:00
Sebastian Dröge 86fc001e35 Regenerate code with new GIR and suppress various clippy warnings in generated code
Now only a few are left in the manually written code.
2017-08-03 21:56:39 +03:00
Sebastian Dröge d6c032be7b Add bindings for Pad::stream_lock() 2017-08-03 11:11:07 +03:00
Sebastian Dröge ed90fcbd10 Add bufferlist support to Sample 2017-08-03 10:15:20 +03:00
Sebastian Dröge a0c6db70e0 Add Context support for messages/queries 2017-08-02 20:58:33 +03:00
Sebastian Dröge bf0f472014 Add autogenerated GstContext functions 2017-08-02 20:46:39 +03:00
Sebastian Dröge 0720b9f6f1 Add missing array translation trait impls to GstRc<T> 2017-08-02 20:46:22 +03:00
Sebastian Dröge 3fdc4cf5fc Add GstContext bindings 2017-08-02 20:34:37 +03:00
Sebastian Dröge d7baadee22 Fix various other compiler/clippy warnings 2017-08-02 20:09:00 +03:00
Sebastian Dröge 32c5218e7d Fix indentation 2017-08-02 19:41:33 +03:00
Sebastian Dröge 09db28bbf5 Fix various clippy warnings 2017-08-02 19:40:31 +03:00
Sebastian Dröge c4c8e738fd Enable Date tag and GDataTime support for GstDateTime 2017-08-02 11:39:37 +03:00
Sebastian Dröge 23ef3c1f08 Add a function to unset the Bus' current sync handler
And use it in the Tokio example to unset the handler once the BusStream
is dropped.
2017-08-01 20:52:29 +03:00
Sebastian Dröge 7c600bfce3 Fix unsafety of pad probes and sync bus handler
These can't be FnMut but must be Fn as they can be called from many
threads at the same time.
2017-08-01 15:28:36 +01:00
Sebastian Dröge e55c7d4088 Rename ObjectExt trait to GstObjectExt
This works around a bug in the compiler with multiple traits having the
same name, but being re-exported with a different one.

https://github.com/gtk-rs/glib/issues/211
2017-08-01 14:04:42 +01:00
Sebastian Dröge 38496eca7d Pass events by value instead of reference 2017-08-01 13:59:12 +01:00
Sebastian Dröge eb567a5048 Rename ChildProxy::set/get_property() to set/get_child_property() to prevent conflict with glib::ObjectExt 2017-07-31 17:14:00 +01:00
Sebastian Dröge 03285a6311 Run everything through latest rustfmt-nightly 2017-07-31 12:16:42 +01:00
Sebastian Dröge ff12c054e3 Add all tags from core 2017-07-31 11:33:05 +01:00
Sebastian Dröge 7e24bae7c0 Improve Segment bindings to directly store the segment instead of a pointer to it 2017-07-31 10:54:22 +01:00
Sebastian Dröge 0a0b82d1b2 Get tag names from gstreamer-sys 2017-07-30 23:11:57 +01:00
fengalin 61cc1aaea7 Add more tags Album covers can be found in image as a Sample Some containers (e.g. mkv) may use album-artist instead of artist 2017-07-30 22:59:48 +01:00
Sebastian Dröge f06bc0d6ef Add event example and clean-up event/message constructor API 2017-07-30 15:49:25 +01:00
Sebastian Dröge 70a98cdc59 Fix compilation of 1.10 API 2017-07-30 15:15:34 +01:00
Sebastian Dröge 35160bedbc Add support for Events in pad probes 2017-07-30 15:11:47 +01:00
Sebastian Dröge 421e648a27 Enable functions working on Events 2017-07-30 15:09:51 +01:00
Sebastian Dröge 2c949a9a05 Add Event bindings
And make Message bindings more consistent
2017-07-30 15:06:44 +01:00
Sebastian Dröge 2915bfa299 Add support for queries in pad probes 2017-07-29 16:09:14 +01:00
Sebastian Dröge 5fa961f5b9 Add TagSetter and Preset bindings 2017-07-29 15:21:25 +01:00
Sebastian Dröge 33ccfc7225 Add GDateTime bindings 2017-07-29 15:14:02 +01:00
Sebastian Dröge 9d35eff8d5 Add ChildProxy bindings 2017-07-29 15:10:10 +01:00
Sebastian Dröge 02a4c8c14d Add new() functions for all messages 2017-07-29 14:56:34 +01:00
Sebastian Dröge 4730500662 Add Iterator bindings 2017-07-29 14:37:06 +01:00
Sebastian Dröge 21888daab6 Add GhostPad bindings 2017-07-29 14:19:15 +01:00
Sebastian Dröge 52dbf03d4f Add functions using queries 2017-07-29 14:04:34 +01:00
Sebastian Dröge 5afa1858ed Fix handling of pad probe info data for real
The miniobjects passed are never going to be writeable due to the
additional reference, but can safely be replaced.
2017-07-29 13:52:46 +01:00