Commit graph

334 commits

Author SHA1 Message Date
Matthew Waters
0a35219c90 closedcaption: add CDP service information inject element
Overwrites the service information descriptor with the value specified in the
services property.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2043>
2025-02-17 10:25:01 +00:00
Sebastian Dröge
bb5e0c9917 closedcaption: Update to winnow 0.7
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2082>
2025-02-17 09:26:35 +02:00
Sebastian Dröge
9d6272b8e0 Update to rand 0.9
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2082>
2025-02-17 09:26:35 +02:00
Sebastian Dröge
5256f1e00c cea608tocea708: Fix SMPTE 334-1a field flag usage
If the flag is set then this is field 0, otherwise it is field 1. The
code had this inverted. See also cece286fe8.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2074>
2025-02-14 00:00:36 +00:00
Mathieu Duponchelle
de5033c3e1 transcriberbin: fix panic on successive passthrough en/dis-abling
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2071>
2025-02-12 15:38:21 +01:00
Mathieu Duponchelle
efe3a55521 cea608overlay: clear output on field switch
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2069>
2025-02-11 21:39:18 +00:00
Mathieu Duponchelle
cece286fe8 ceax08overlay: fix field lookup for s334-1a
As stated in the spec:

> Bit b7 of the LINE value is the field number (0 for field 2;
> 1 for field 1). Bits b6 and b5 are 0. Bits b4-b0 form a 5-bit unsigned
> integer which represents the offset [..]

Here, b7 is the most significant bit, this is what both cccombiner
and ccconverter agree on.

The overlay elements previously looked at the least significant bit,
which led to garbled text when both fields were actually present
in the CC meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2069>
2025-02-11 21:39:18 +00:00
Mathieu Duponchelle
71121a2380 aws: reimplement two separate wrappers for translate and transcribe
The original awstranscribe element has grown too complex when
integrating translations for reasons that in retrospect were wrong:

As awstranscribe outputs words one by one, I decided we wanted to
perform translations there with larger sentences if available, but an
alternative design where a separate translation element is composed
downstream is also possible, as long as that element accumulates words
and enough latency is set on the transcriber.

An important difference is that the new elements do not expose unsynced
pads, this use case is instead now served by simple messages on the bus.

The elements should otherwise be at feature parity with the original
element.

A higher-level bin is also provided for convenience (and usage within
transcriberbin): translationbin.

A transcriber element can be provided to this bin, which exposes an
always audio sink pad, and an always text sink pad (for the
transcripts).

Additional source pads can be requested for translations, for now the
bin always uses `awstranslate` as the translator, but this can be made
configurable.

This element is usable as a transcriber in `transcriberbin`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2055>
2025-02-10 11:16:44 +00:00
Mathieu Duponchelle
7d26990d4a tttocea608: insert carriage returns on speaker changes
This improves readability with speaker-detection capable elements
upstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2055>
2025-02-10 11:16:44 +00:00
Matthew Waters
5c7ab9b491 closedcaption: fix roll up mode not always using the correct base row
The row used in roll up mode was inconsistently referenced (row vs base_row)
and could result in incorrect output being produced.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2051>
2025-01-28 22:22:49 +00:00
Matthew Waters
12811f9bc3 closedcaption/608overlay: add some debug loggin when resets occur
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2051>
2025-01-28 22:22:49 +00:00
Matthew Waters
4f4f84a615 cea608overlay: ensure tha the list of lines remains sorted by line number
Otherwise, when iterating over the lines, they may be written out of order.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2051>
2025-01-28 22:22:49 +00:00
Mathieu Duponchelle
cf40739da9 transcriberbin: forward sticky events on unsynced source pads
This way an application can tell the language code right away at
pad-added time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2029>
2025-01-20 14:27:05 +00:00
Sebastian Dröge
3a03310dbc mccparse: Switch away from deprecated winnow API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2040>
2025-01-14 10:43:40 +02:00
Sebastian Dröge
7b4665c793 Fix some new clippy 1.84 warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2032>
2025-01-10 10:08:38 +02:00
Mathieu Duponchelle
69f927cc24 transcriberbin: expose subtitle-languages property
Similar to synthesis-languages, except that transcriberbin will not
place a textwrap element before the synthesizer, instead letting the
application do that itself if needed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2015>
2025-01-08 12:26:22 +00:00
Mathieu Duponchelle
70ed528c7a transcriberbin: fix casing of translation languages
The language should only be lowercased in order to compare it to cc1 /
cc3, but should be passed as is to the transcriber.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2027>
2025-01-06 16:59:11 +01:00
Tim-Philipp Müller
95d0563b80 closedcaption: add some docs for the new SMPTE-2038 elements
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2019>
2025-01-03 10:40:40 +00:00
Mathieu Duponchelle
35a621a53b transcriberbin: fix deadlock on taking settings lock
This fixes both a double lock in a case, and in all cases an
out-of-order lock (element settings must always be locked before
pad settings).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2004>
2024-12-20 17:13:08 +00:00
Sebastian Dröge
0d8dc1c156 cea608tott: Fix expected test output with cea608-types 0.1.4
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2001>
2024-12-20 16:57:07 +02:00
Mathieu Duponchelle
026a2a11eb transcriberbin: improve usage of framerate field
Use the framerate from our video caps as early as possible in the
pipeline, that is just downstream of the tttoceax08 elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1997>
2024-12-19 13:55:20 +01:00
Mathieu Duponchelle
666aba0a58 transcriberbin: query latency of synthesis elements ..
instead of expecting that they expose a "latency" property.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1993>
2024-12-18 18:04:53 +00:00
Matthew Waters
497b1e58bd cea708overlay: support changing the safe title area
By default it is 80% of the output size as recommended by CEA-708/608.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1985>
2024-12-18 12:57:49 +00:00
Matthew Waters
b367b38633 cea608overlay: fix rendering when roll up base row is at the top
We were ensuring that the base row was one too large for the number of roll up
rows and causing the first row to unable to be written to.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1985>
2024-12-18 12:57:48 +00:00
Edward Hervey
73663d7352 cea708mux: Don't push empty services into packets
This is invalid. Only "padding" service 0 can be empty.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1987>
2024-12-16 05:00:30 +01:00
Matthew Waters
a2279bc253 cea708mux: make sure to empty the stored pending codes
Fixes some captions being truncated if multiple of the same service is
received in the same input buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1984>
2024-12-13 00:06:11 +00:00
Matthew Waters
db8e1da65d cea708overlay: clear more things on caption timeout
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1983>
2024-12-12 23:11:00 +00:00
Mathieu Duponchelle
ae90dd4afe transcriberbin: expose language-filters property
When set, the bin will lookup the structure for either a bin description
or an element to link in when linking the transcriber to a language
tee.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1979>
2024-12-12 14:19:41 +01:00
Mathieu Duponchelle
e88db4e35d cea608tott: output generated text on carriage return
We would never output any text in roll-up mode otherwise

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1973>
2024-12-09 18:25:06 +00:00
Mathieu Duponchelle
e3e7f55a8d transcriberbin: expose mix-matrix property on audio sink pads
As the application expects to have the bin buffer the audio stream
internally and output it again unchanged, and transcribers might
expect a set number of channels, we need to expose a property to
let the user control how to downmix the audio stream teed through
the transcriber.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1969>
2024-12-09 16:26:47 +00:00
Matthew Waters
a3d114e18f cea708overlay: fix background/foreground type
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
2024-12-09 05:16:04 +00:00
Matthew Waters
01ef35eac8 cea708overlay: enable a black background by default
It is the recommended colour sceheme in CEA-608.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
2024-12-09 05:16:04 +00:00
Matthew Waters
144a0e431c cea708overlay: produce a slightly more CEA-608 layout
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
2024-12-09 05:16:04 +00:00
Matthew Waters
9787b187de deps: update cea708-types to 0.3.5
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
2024-12-09 05:16:04 +00:00
Matthew Waters
34c928e9fe tttocea708: log the bytes and times generated
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
2024-12-09 05:16:04 +00:00
Matthew Waters
b23a514657 tttocea708: don't incorrectly recode timestamp to frame conversion on gap events
Simply use the already existing generate() which will convert from a timestamp
and duration into frames for processing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
2024-12-09 05:16:04 +00:00
Matthew Waters
fe49837107 cea708mux: handle different timestamped inputs
If different inputs have different framerates, then an input buffer may need
to be combined or split.  Account for that in the aggregate loop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
2024-12-09 05:16:04 +00:00
Matthew Waters
00cb3fefe9 cea708mux: output padding by default
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
2024-12-09 05:16:04 +00:00
Matthew Waters
c0a3b0c868 tttocea708: output CEA-X08 padding by default
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
2024-12-09 05:16:04 +00:00
Matthew Waters
9eb3ad4412 cea708mux: forward CEA-608 data correctly
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
2024-12-09 05:16:04 +00:00
Mathieu Duponchelle
39a8db51de transcriberbin: register pad templates for unsynced source pads
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1963>
2024-12-06 09:38:39 +00:00
Edward Hervey
4d31001c4b cea708mux: Always pad cea708
Instead of pushing gaps, we should send out valid (empty) cea708 buffers
downstream, like we do in most other caption element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1946>
2024-12-02 10:35:45 +00:00
Mathieu Duponchelle
01b3e2a8f2 transcriberbin: take synthesis latency into account
and factor out a method to calculate the element's internal latency, to
be shared with the code for calculating the size of the passthrough
queues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1930>
2024-11-29 22:09:37 +00:00
Mathieu Duponchelle
a71fd35ebf transcriberbin: set latencies on transcribers as soon as possible
Otherwise if we wait for setup_transcription(), the transcribers might
already have reached the playing state.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1930>
2024-11-29 22:09:37 +00:00
Mathieu Duponchelle
4406851ae7 transcriberbin: add support for speech synthesis
This commit adds a new "synthesis-languages" property. Users can set it
to define a map of languages (typically translations) that should then
be routed through a "synthesis" bin, with its description specifiable
as the value of the map.

The output of this bin is then exposed as a new pad on the top-level
bin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1930>
2024-11-29 22:09:37 +00:00
Edward Hervey
8bb0a7eecc tttocea708: Fix off-by-one issue
last_frame_no is used to eventually calculate the outgoing pts. We want to
increment it *after* having created the content

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1947>
2024-11-29 09:48:17 +00:00
François Laignel
a8146f333f all: use builder conditional setters where applicable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1926>
2024-11-21 12:57:16 +00:00
François Laignel
4262a8aafe all: update due to new has_property signature
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1926>
2024-11-21 12:57:16 +00:00
Mathieu Duponchelle
29b5ccacdf transcriberbin: take passthrough state into account in more places
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/630
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1925>
2024-11-20 12:52:17 +01:00
Mathieu Duponchelle
1fc1ed2539 transcriberbin: relink transcriber more thoroughly
* Remove old transcriber from correct bin
* Remove old unsynced ghost pads and expose new ones
* Fix potential deadlock where State was locked after PadState

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1925>
2024-11-20 12:52:17 +01:00