Sebastian Dröge
d05f8cace8
gstreamer: Add bindings for Plugin::get_plugin_name()
...
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/248
2020-04-11 19:33:34 +03:00
Sebastian Dröge
62c0f5ef42
Use mem::ManuallyDrop instead of mem::forget() everywhere
...
It makes the intentions clearer and potentially results in simpler
assembly, at least in debug builds.
2020-04-09 16:57:06 +03:00
Sebastian Dröge
9f96c5e573
gstreamer/buffer: Unmap memory in flush() of the Write impl of the buffer cursor
...
This makes sure that any remaining data is actually written out as part
of the unmapping, which might be necessary depending on the memory type.
2020-04-07 13:47:04 +03:00
Sebastian Dröge
2fbb10ec92
gstreamer/buffer: Only unmap memory in buffer cursor seek impl if we have to move to a different memory
...
Prevents some unnecessary unmaps.
2020-04-07 13:45:36 +03:00
Sebastian Dröge
35f7c910a9
gstreamer/buffer: Refactor buffer cursor implementation with macros to reduce code duplication
2020-04-07 13:45:36 +03:00
Sebastian Dröge
42d09c2834
gstreamer/buffer: Move BufferCursor/BufferRefCursor into its own module
...
It's quite a bit of code and can be kept nicely separate.
2020-04-07 12:59:24 +03:00
Sebastian Dröge
5fc68e252d
gstreamer: Add missing BufferCursorRef re-export
2020-04-06 21:00:42 +03:00
Sebastian Dröge
ee3a8caa7d
gstreamer/buffer: Add various tests for the BufferCursor / BufferCursorRef
2020-04-06 20:15:51 +03:00
Sebastian Dröge
a884a419db
gstreamer/buffer: Add a BufferCursor / BufferCursorRef helper structs
...
This implements Read/Seek or Write/Seek and allows to read/write/seek
into the buffer without merging the memories inside.
The writer also only maps the memory write-only as compared to all other
ways of accessing the buffer/memory data in a writable way, which have
to map it read-write.
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/425
for a similar API proposal for GStreamer core.
2020-04-06 20:15:35 +03:00
Sebastian Dröge
9b782b4dfa
gstreamer/buffer: Add tests for various memory related buffer API
2020-04-06 19:29:19 +03:00
Sebastian Dröge
9e0c980a49
gstreamer/buffer: Add iterators for iterating over the memories inside a buffer
...
With immutable, mutable and owned variant.
2020-04-06 19:28:28 +03:00
Sebastian Dröge
2b70db3a9e
gstreamer/buffer: Add BufferRef::peek_memory_mut() function
...
This gives a mutable reference to the given memory and fails if the
memory is not actually writable.
2020-04-06 19:27:40 +03:00
Sebastian Dröge
019afd54f9
Update for new from_glib_borrow signature
...
See https://github.com/gtk-rs/glib/pull/605
2020-04-05 18:48:48 +03:00
Sebastian Dröge
7120d54a46
gstreamer/pad: Add tests for getrange functions
2020-04-02 19:58:15 +03:00
Sebastian Dröge
d7e6c2e37f
gstreamer/pad: Add support for filling the passed in buffer in the getrange function
...
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/242
2020-04-02 19:58:09 +03:00
Sebastian Dröge
7c2f3bafa0
gstreamer/pad: Add get_range_fill() and pull_range_fill() functions
...
These allow providing an already allocated, writable buffer.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/242
2020-04-02 19:57:28 +03:00
Sebastian Dröge
962da8a63d
gstreamer/datetime: Add TryFrom impls for converting between glib::DateTime and gst::DateTime
2020-03-22 14:01:32 +02:00
Sebastian Dröge
7dd0404927
gstreamer/datetime: new_from_g_date_time() can actually return NULL
...
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/411
2020-03-22 14:01:32 +02:00
Sebastian Dröge
d0bfdda97f
examples: Update for new GLib boxed deriving API
2020-03-19 14:20:52 +02:00
Sebastian Dröge
8bb64bb825
gstreamer/log: Replace % with %% in the debug message
...
Otherwise gst_debug_log() will look for further arguments that don't
exist, and will likely crash or worse.
2020-03-18 23:54:46 +02:00
Jan Alexander Steffens (heftig)
af27d73e5c
gstreamer: Return &'static str from StructureRef
...
The names are backed by Quarks and thus eternally valid.
2020-03-12 19:25:12 +01:00
Sebastian Dröge
755ef9da33
Update CHANGELOG.md for 0.15.4
2020-03-10 10:57:33 +02:00
Sebastian Dröge
8e038572cb
gstreamer/caps: Assert on ANY caps in fixate() and work around bug in handling EMPTY caps
...
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/388
2020-03-09 13:02:20 +02:00
Sebastian Dröge
8d0fa62275
Minor cleanup in various places
2020-03-09 12:55:14 +02:00
Sebastian Dröge
9d5ae8ed14
gstreamer: Don't take mini objects by value for append() and similar operations
...
Compared to
let foo = Foo::bar(foo);
the new form is easier to follow
foo.bar();
2020-03-07 00:31:30 +02:00
Sebastian Dröge
b21f576430
Add #[must_use] attribute to mutex guards / stream lock
...
It's usually a mistake if creating one of these and immediately dropping
them again as that would immediately unlock the mutex again.
2020-02-28 16:29:48 +02:00
Sebastian Dröge
98ecef7153
Make sure to hold MutexGuard for the remainder of the function in various places
...
Not assigning it to a variable would cause it to be dropped immediately
and the lock to be released again immediately.
2020-02-27 12:10:14 +02:00
Sebastian Dröge
71497e77de
gstreamer/log: Allow any glib::Object as target for logging
...
gst::Object is not actually required. For plain glib::Objects only the
pointer address is printed instead of a name but it works fine.
2020-02-22 18:42:02 +02:00
Sebastian Dröge
e585b37923
Update CHANGELOG.md for 0.15.3
2020-02-15 15:23:12 +01:00
Sebastian Dröge
d58cf01e3a
Allow changing bus sync handler and appsink/src callbacks when running with 1.16.3 or newer
...
Previously it was not thread-safe to change them and could lead to
crashes but with 1.16.3 it is now.
Unsetting the bus sync handler before 1.16.3 will have no effect at all,
setting a new bus sync handler or appsink/src callbacks will panic.
This partially reverts 2f88dc6576
2020-02-15 10:25:19 +01:00
Sebastian Dröge
2f88dc6576
Only allow setting Bus sync handler and AppSrc/Sink callbacks once
...
Re-setting them is not thread-safe and can cause segfaults or worse.
See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/506
and https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/729
2020-02-09 21:37:03 +02:00
Sebastian Dröge
cddccf9502
gstreamer/promise: Add Future constructor for Promise
...
This returns a tuple that basically works like a oneshot channel: the
Promise acts as the "sender" and once the promise resolves the
"receiver" contains the result.
2020-02-09 19:08:41 +02:00
Valmir Pretto
6263922b6d
gstreamer: BusStream tests
2020-02-04 10:33:34 -03:00
Valmir Pretto
7663589d94
gstreamer: BusStream cleanup
...
A few small readability changes
2020-02-04 10:33:25 -03:00
Sebastian Dröge
8b3049d098
impl Clone for BufferPoolConfig and PlayerConfig
2020-01-30 23:10:26 +02:00
Sebastian Dröge
5102bfd324
Update CHANGELOG.md for 0.15.2
2020-01-30 00:40:56 +02:00
Sebastian Dröge
fe4f074e90
bus: Don't use the bus sync handler in the bus Stream to notify about messages being available
...
This is racy and can cause the consumer of the messages to never be
woken up anymore:
1. Waker is stored because no message on the bus
2. Sync handler is called, waker is woken up
3. Bus is polled again and no message is on it (yet),
new waker is registered
4. Bus stores the message from 2. in its queue (after
the sync handler has returned BusSyncReply::Pass)
5. No new message ever appears on the bus because all
this happened for the very last message
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/235
2020-01-28 23:39:36 +02:00
Sebastian Dröge
63a8afafa5
gstreamer: Use more accurate types for Seqnum, GroupId and MetaSeqnum
...
For the latter introduce an actual opaque type that allows using them
for comparison purposes but is not just a plain u64.
For the former represent them as opaque type around an NonZeroU32. 0 is
the invalid case and does not happen in the majority of functions. Where
it can happen, represent this case by using an Option<_> instead.
This makes it harder to mis-use these types.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/209
2020-01-25 00:07:36 +02:00
Sebastian Dröge
0bd2903896
Update CHANGELOG.md for 0.15.1
2020-01-23 08:28:19 +02:00
Sebastian Dröge
7230aee069
Switch everything from lazy_static to once_cell::Lazy
...
Fewer macros, faster compile-time and the Lazy type will likely end up
in the standard library in a similar form to this.
2020-01-22 19:57:41 +02:00
Sebastian Dröge
2b5f16391d
gstreamer/childproxy: Fix unused variable compiler warnings
2020-01-22 19:57:41 +02:00
Sebastian Dröge
196a9891cb
Regenerate with latest gir
...
This switches the RTP constant strings over to once_cell::Lazy
2020-01-22 19:57:41 +02:00
Sebastian Dröge
d3c77f400d
Don't derive Debug impls for generic types where the type parameters don't have to impl Debug themselves
...
This allows to use MappedBuffer and similar types to be properly
debug-printed.
Also change VideoFrame/VideoFrameRef/RTPBuffer from a tuple struct to a
struct with proper field names to make the code easier to understand.
2020-01-22 19:10:04 +02:00
Sebastian Dröge
280fe38fe4
gstreamer/childproxy: Don't require implementing child_added/removed() signal vfuncs
...
Most implementers will not care about default handlers for these signals
so requiring to implement them is only unnecessarily verbose.
2020-01-22 17:14:38 +02:00
Sebastian Dröge
b17f04e866
bus: Make bus Stream private and add functions on the bus directly for it
...
Also add a helper function that allows filtering the stream directly.
2020-01-22 10:05:36 +02:00
Sebastian Dröge
217bbc3e94
bus: Take the mutex before popping messages for the bus stream
...
Otherwise a message might arrive between popping, getting None and
locking the mutex for storing the waker. In that case we would never
be woken up.
2020-01-22 09:21:10 +02:00
Sebastian Dröge
aa29567171
gstreamer/element: Add call_async_future() that returns a future
...
The future would resolve into the return value of the closure that is
called asynchronously on the thread pool, and allows asynchronous
awaiting for it to finish.
let res = element.call_async(|element| {
element.set_state(gst::State::Playing)
}).await;
assert_eq!(res, Ok(gst::StateChangeSuccess::Success))
2020-01-20 12:03:59 +02:00
Guillaume Desmottes
01c4d08501
gstreamer: use thiserror crate
...
Make code simpler and fix deprecated warning when building on nightly as
Error::description is being deprecated.
2020-01-10 18:54:50 +05:30
Guillaume Desmottes
e151ee75f8
gstreamer: error: add tests
2020-01-10 18:54:50 +05:30
Guillaume Desmottes
1f79bf3e02
gstreamer: caps: Builder: prevent re-adding features
...
Rework the API to statically prevent users re-adding features or
adding features if any_features() has been previously called.
2020-01-10 15:09:06 +05:30