Commit graph

44 commits

Author SHA1 Message Date
Sebastian Dröge
5abf146212 utils: streamproducer: Don't use gst_element_send_event() in another place
It can cause deadlocks thanks to taking the state lock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1342>
2023-11-10 09:47:53 +02:00
Sebastian Dröge
c2b5341b8f gstreamer: Add accessors for PadProbeDatas on PadProbeInfo
And make use of it in examples and other code.

This allows to simplify usage a bit in most cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1337>
2023-11-03 11:09:35 +02:00
Sebastian Dröge
4e9b155b90 Update versions to 0.21.1 2023-10-04 10:13:26 +03:00
Guillaume Desmottes
6c6384e9cd gst-utils: prevent dead lock when requesting key unit
Sending the UpstreamForceKeyUnitEvent using gst_element_send_event()
internally takes the state lock. If appsink is pre-rolling we are also
holding the preroll lock.

This may result in a dead lock with the thread doing the state change as
this one takes the state lock and then the pre-roll lock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1318>
2023-10-03 19:39:37 +03:00
Sebastian Dröge
cee6d20ad8 Add version = "0.21" to all local dependencies 2023-08-08 18:15:44 +03:00
Sebastian Dröge
9c6e48119c Use all-features = true instead of all-features = "true" 2023-08-08 17:46:20 +03:00
Sebastian Dröge
e95e62d871 Fix build on docs.rs and document all features
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/478

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1302>
2023-08-08 10:50:12 +03:00
Guillaume Desmottes
63852b3b19 streamproducer: forward selected sticky events when adding consumers
The consumer pipeline may rely on some sticky events (Tag in my case)
which may have already been sent.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1299>
2023-08-07 20:26:28 +00:00
Sebastian Dröge
2abf75122d Update minimum supported Rust version to 1.70
gtk-rs will update soonish too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1298>
2023-07-19 09:24:10 +03:00
Mathieu Duponchelle
88c21505d2 streamproducer: forward preroll sample from new_preroll callback
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1280>
2023-07-07 17:06:54 +02:00
Mathieu Duponchelle
a4247d5199 streamproducer: extract process_sample function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1280>
2023-07-07 14:09:35 +02:00
Bilal Elmoussaoui
f9fa7f55fc Use re-exported once_cell
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1293>
2023-07-06 16:50:35 +03:00
Sebastian Dröge
ca2fd54230 Add v1_24 feature flag everywhere
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1244>
2023-04-06 21:08:51 +03:00
Jimmi Holst Christensen
85e427345e Forward tag events to consumers in StreamProducer
Fix #386

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1045>
2023-04-04 07:31:58 +00:00
Guillaume Desmottes
32a02b51e1 utils: streamproducer: document forward_eos default value
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1226>
2023-02-28 09:48:36 +01:00
Sebastian Dröge
b6e253acbf Update minimum supported Rust version to 1.66
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1223>
2023-02-20 10:42:07 +02:00
Sebastian Dröge
13140d8b8a Update versions to 0.21.0 2023-02-09 23:42:32 +02:00
Sebastian Dröge
f24b38470b Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1203>
2023-01-25 10:18:33 +02:00
Sebastian Dröge
0f859b9029 Get README.md in sync again
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/437
2023-01-23 12:01:07 +02:00
Sebastian Dröge
c2e7abd128 utils: streamproducer: Persist ConsumptionLink state when changing producers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1189>
2023-01-16 16:16:15 +02:00
Sebastian Dröge
094d74e391 utils: streamproducer: Add ConsumptionLink::appsrc() getter
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1189>
2023-01-16 14:41:06 +02:00
Sebastian Dröge
0a6ed3c717 utils: streamproducer: Add new ConsumptionLink::disconnected() constructor
This allows constructing a new consumption link from an `appsrc` without
having it connected from the very beginning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1189>
2023-01-16 14:41:06 +02:00
Sebastian Dröge
dd284a80ea utils: streamproducer: Add ConsumptionLink::set_discard() to stop forwarding buffers for a while
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1189>
2023-01-16 14:41:06 +02:00
Sebastian Dröge
a68c37e4eb utils: streamproducer: Remove StreamProducer::forward()
Most applications forget to call `forward()` in the beginning and then
nothing works.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/433

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1189>
2023-01-16 14:41:06 +02:00
Sebastian Dröge
f8d17555c5 utils: streamproducer: Add #[must_use] attribute to add_consumer()
Simply discarding the result will immediately disconnect it again, which
was likely not intended and can easily lead to bugs.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/432

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1189>
2023-01-16 14:41:06 +02:00
Sebastian Dröge
f235dc987d Inline various trivial functions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1177>
2023-01-11 11:33:54 +02:00
Sebastian Dröge
567ce0a3bf Group and merge imports in all manual code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1182>
2023-01-04 13:25:17 +02:00
Sebastian Dröge
3d0f563111 Update minimum supported Rust version to 1.64
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1175>
2022-12-25 14:54:38 +02:00
Sebastian Dröge
92215f4a63 Add missing README.md to new crates 2022-10-22 21:12:23 +03:00
Sebastian Dröge
031133c179 Update versions to 0.20.0 2022-10-22 20:27:42 +03:00
Sebastian Dröge
35c6af424d Update minimum supported Rust version to 1.63 2022-09-04 10:37:13 +03:00
Tomasz Andrzejak
2090452e3d Update minimum supported rust version 2022-07-14 15:23:34 +02:00
Guillaume Desmottes
fbceaab941 utils: streamproducer: add API to retrieve last sample from producer
This may be used for example to easily generate thumbnails from video
producers.
2022-07-11 11:32:06 +02:00
Guillaume Desmottes
0e17878bed utils: streamproducer: add API to retrieve pushed and dropped buffers
This may be used by applications to compute statistics about the overall
pipeline health, like the ratio of buffers dropped.
2022-07-11 09:10:52 +02:00
Thibault Saunier
8c69388eff utils: Re export AddConsumerError 2022-05-17 20:19:12 +03:00
Guillaume Desmottes
5349822962 utils/streamproducer: add ConsumptionLink
Having an explicit link object makes it much easier to build complex
producers/consumers dynamics graphs.
It provides helper to switch producers and prevent accidentally keeping
broken links around as they are disconnected on Drop.
2022-05-17 11:04:35 +03:00
Guillaume Desmottes
f68efd0cab utils/streamproducer: add API to not forward eos to consumers
User may want to plug another producer when one is eos, in such case we
don't want to propagate eos to consumers.
2022-05-17 11:04:35 +03:00
Guillaume Desmottes
351f070c8e utils/streamproducer: reset callbacks when removing consumer 2022-05-12 14:56:55 +02:00
Sebastian Dröge
98cc289bcc utils/streamproducer: Add StreamProducer::error() to signal an error message to all consumers 2022-05-12 10:51:56 +03:00
Sebastian Dröge
e263bd8945 utils/streamproducer: Request keyframes without a lock held and also after an appsrc has dropped some data 2022-05-12 10:44:59 +03:00
Sebastian Dröge
d6095900e9 utils/streamproducer: Improve debug output a bit 2022-05-12 10:37:14 +03:00
Sebastian Dröge
e82d388410 utils/streamproducer: Index hashmap by appsrc instance instead of pointer
This behaves the same but requires a little bit less code.
2022-05-12 10:34:11 +03:00
Sebastian Dröge
a51235048d utils/streamproducer: Add StreamProducer::configure_consumer()
This allows configuring an `appsrc` before actually adding it as
consumer at a later time, and can be useful if the pipeline with the
source should be started earlier than adding it to a consumer.

Also use strongly-typed property API for the `appsrc` properties.
2022-05-12 10:34:06 +03:00
Thibault Saunier
f3bba21faa Introduce StreamProducer
Introduce a new `gstreamer-utils` crate where we implement a
`StreamProducer` structure that allows "producing" pipeline (Producers)
pushing their data to 0 or several "consuming" pipelines. The Producer
needs to push their data to an `appsink` which the `StreamProducer` controls
and the "consumer" pipelines need to have an AppSrc which the same
StreamProducer controls.

It allows similare behavior as a `tee` element but with a simpler to
handle addition and removal of "consumers" as well as a total decoupling
of the various consumer, both between each others and the producer
pipeline.

This has simply been extracted from
[webrtcsink](https://github.com/centricular/webrtcsink/blob/main/plugins/src/webrtcsink/utils.rs)
2022-05-11 10:14:54 -04:00