Commit graph

288 commits

Author SHA1 Message Date
Mathieu Duponchelle
7ec9469ae3 cea608overlay: clear output on field switch
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2075>
2025-02-14 00:04:26 +00:00
Mathieu Duponchelle
805e0f66af 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/2075>
2025-02-14 00:04:26 +00:00
Matthew Waters
403462d64e 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/2053>
2025-01-29 00:36:39 +00:00
Matthew Waters
b36bddb058 closedcaption/608overlay: add some debug loggin when resets occur
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2053>
2025-01-29 00:36:39 +00:00
Matthew Waters
eacbda5d6e 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/2053>
2025-01-29 00:36:39 +00:00
Edward Hervey
0a7d2406f0 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/2009>
2024-12-24 10:34:20 +00:00
Matthew Waters
13a860c56c 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/2014>
2024-12-23 22:36:28 +00:00
Matthew Waters
b348f17a07 cea708overlay: clear more things on caption timeout
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2013>
2024-12-23 21:54:59 +00:00
Sebastian Dröge
d79eac417d cea608tott: Fix expected test output with cea608-types 0.1.4
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2007>
2024-12-23 18:42:44 +02:00
Matthew Waters
f88da03f11 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/2007>
2024-12-23 18:41:54 +02:00
Edward Hervey
cd8d2d6d04 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/1989>
2024-12-16 08:03:34 +00:00
Matthew Waters
85a84ea854 deps: update cea708-types to 0.3.5
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1976>
2024-12-11 23:05:16 +11:00
Matthew Waters
b46a060a74 cea708overlay: fix background/foreground type
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1976>
2024-12-11 22:57:47 +11:00
Matthew Waters
70c6fb6228 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/1976>
2024-12-11 22:57:45 +11:00
Matthew Waters
1e04c11eb6 cea708overlay: produce a slightly more CEA-608 layout
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1976>
2024-12-11 22:57:42 +11:00
Matthew Waters
9a614f68f8 tttocea708: log the bytes and times generated
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1976>
2024-12-11 22:57:40 +11:00
Matthew Waters
56afb23f75 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/1976>
2024-12-11 22:57:38 +11:00
Matthew Waters
897352fa91 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/1976>
2024-12-11 22:57:35 +11:00
Matthew Waters
237460598f cea708mux: output padding by default
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1976>
2024-12-11 22:57:33 +11:00
Matthew Waters
54d9ffac7c tttocea708: output CEA-X08 padding by default
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1976>
2024-12-11 22:57:31 +11:00
Matthew Waters
f22b738c5a cea708mux: forward CEA-608 data correctly
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1976>
2024-12-11 22:57:29 +11:00
Edward Hervey
37d5a2495d 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/1952>
2024-11-29 10:49:37 +00:00
Mathieu Duponchelle
5501eacb6c transcriberbin: fix linking of user-provided transcriber
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1836>
2024-10-15 15:58:57 +00:00
Mathieu Duponchelle
ed32f96fa3 transcriberbin: support both latency and transcribe-latency properties
Also don't set translate-latency property if not present

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1836>
2024-10-15 15:58:57 +00:00
Mathieu Duponchelle
36f6097e62 transcriberbin: add debug
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1836>
2024-10-15 15:58:57 +00:00
Sebastian Dröge
acd0a54b4a cea708mux: Fix off-by-one in deciding whether a buffer belongs to this or the next frame
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1790>
2024-09-20 06:33:25 +00:00
Sebastian Dröge
585b6b53d4 cea708mux: Stop with EOS if all pads are EOS instead of continuing forever
Also don't drop buffers if multiple tries are needed for aggregating
because some pads are not ready yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1790>
2024-09-20 06:33:25 +00:00
Sebastian Dröge
a3c4ad7015 cea708mux: Don't create a separate source pad and actually push gap events downstream
The aggregator base class is already creating the source pad and the
source pad that was created here internally was never added to the
element at all. As such all gap events pushed on it never went anywhere.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1790>
2024-09-20 06:33:25 +00:00
Sebastian Dröge
b532fdbca0 closedcaption: cea608utils: Avoid overflow when deciding which lines to retain
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1778>
2024-09-19 10:05:14 +02:00
Seungha Yang
2ca2a8e0f6 transcriberbin: Fix passthrough state change
Sync state of child bin appropriately when passthrough is disabled

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1759>
2024-08-30 15:10:31 +00:00
Mathieu Duponchelle
27770324c7 transcriberbin: fix inspect with missing elements
Relax the dependency on `awstranscriber` by still building the initial
state when it is absent, this also means an alternative transcriber can
be linked even when `awstranscriber` was not available during
construction.

Also fix property getter / setters to avoid unwrapping the pad state,
and bubble up channel bin construction errors instead of unwrapping (eg
when textwrap was not available).

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/584
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1681>
2024-07-30 12:41:35 +01:00
Sebastian Dröge
98b28d69ce Update for new debug log macro syntax
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1658>
2024-07-08 11:25:23 +03:00
Mathieu Duponchelle
0ef886ea16 transcriberbin: fix internal ghost pad name regression
As part of https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1593
source pad names on inner transcription bins were appended a suffix, but
other pieces of the code were not updated to account for that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1645>
2024-07-01 11:47:39 +02:00
Mathieu Duponchelle
f0df6874d8 transcriberbin: fix property proxying
As part of https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1546
the element started implementing the GstChildProxy interface in order to
expose properties on its sink pads, but the implementation was
incorrect and broke proxying to children elements.

In addition, an intermediary bin was introduced with no name, making it
hard to set the properties of the inner elements through the child
proxy interface, it is now named according to the name of the pad it
corresponds to.

Finally, the default transcriber is back to being named "transcriber".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1642>
2024-06-28 14:24:08 +00:00
Sebastian Dröge
9b323a6519 Use Option::is_some_and(...) instead of Option::map_or(false, ...)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1630>
2024-06-19 13:03:37 +00:00
Sebastian Dröge
69c3c2ae46 Fix various new clippy 1.79 warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1620>
2024-06-14 08:33:49 +03:00
Mathieu Duponchelle
7cec628c43 transcriberbin: make sure to always record pad property changes
When the pad isn't parented yet we should still record user choices,
either in our settings or in our state.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1593>
2024-06-06 15:42:21 +00:00
Mathieu Duponchelle
0e85973e94 transcriberbin: fix regression with > 1 translation languages
By making sure to expose uniquely named pads on the inner transcription
bins.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/552
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1593>
2024-06-06 15:42:21 +00:00
Seungha Yang
ebdcc403cf transcriberbin: Fix mux-method=cea708
* Update "translation-languages" property to include G_PARAM_CONSTRUCT
so that it can be applied to initial state.

* Change default "translation-languages" value to be None instead of
cea608 specific one. Transcriberbin will be able to configure initia
state depending on selected mux method if "translation-languages" is
unspecified.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1589>
2024-05-30 04:40:09 +09:00
Matthew Waters
45800d7636 tttocea708: ensure periodic sync points in roll up mode
Otherwise, without the relevant DefineWindow, then a receiver cannot
begin to display the captions from the middle of a stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1591>
2024-05-29 11:15:10 +00:00
Sebastian Dröge
be3ae583bc Fix new Rust 1.78 clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1559>
2024-05-02 18:36:23 +03:00
Mathieu Duponchelle
17d7997137 transcriberbin: add support for consuming secondary audio streams
In some situations, a translated alternate audio stream for a content
might be available.

Instead of going through transcription and translation of the original
audio stream, it may be preferrable for accuracy purposes to simply
transcribe the secondary audio stream.

This MR adds support for doing just that:

* Secondary audio sink pads can be requested as "sink_audio_%u"

* Sometimes audio source pads are added at that point to pass through
  the audio, as "src_audio_%u"

* The main transcription bin now contains per-input stream transcription
  bins. Those can be individually controlled through properties on the
  sink pads, for instance translation-languages can be dynamically set
  per audio stream

* Some properties that originally existed on the main element still
  remain, but are now simply mapped to the always audio sink pad

* Releasing of secondary sink pads is nominally implemented, but not
  tested in states other than NULL

An example launch line for this would be:

```
$ gst-launch-1.0 transcriberbin name=transcriberbin latency=8000 accumulate-time=0 \
      cc-caps="closedcaption/x-cea-708, format=cc_data" sink_audio_0::language-code="es-US" \
      sink_audio_0::translation-languages="languages, transcript=cc3"
    uridecodebin uri=file:///home/meh/Music/chaplin.mkv name=d
      d. ! videoconvert ! transcriberbin.sink_video
      d. ! clocksync ! audioconvert ! transcriberbin.sink_audio
      transcriberbin.src_video ! cea608overlay field=1 ! videoconvert ! autovideosink \
      transcriberbin.src_audio ! audioconvert ! fakesink \
    uridecodebin uri=file:///home/meh/Music/chaplin-spanish.webm name=d2 \
      d2. ! audioconvert ! transcriberbin.sink_audio_0 \
      transcriberbin.src_audio_0 ! fakesink
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1546>
2024-04-25 11:56:01 +02:00
Seungha Yang
b3d3895ae7 cea608overlay: Fix black-background setting
Apply the property to newly created renderer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1542>
2024-04-15 15:38:31 +00:00
Matthew Waters
4dcc44687a cea608overlay: move Send impl lower in the stack
Try to avoid hiding another non-Send object in the State struct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1519>
2024-04-10 06:55:34 +00:00
Matthew Waters
fbce73f6fc closedcaption: implement cea708overlay element
Can overlay any single CEA-708 service or any single CEA-608 channel.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1519>
2024-04-10 06:55:34 +00:00
Matthew Waters
f0c38621c1 cea608overlay: also print bytes that failed to decode
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1519>
2024-04-10 06:55:34 +00:00
Matthew Waters
7f6929b98d closedcaption: remove libcaption code entirely
It is now unused.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1517>
2024-04-05 19:29:24 +11:00
Matthew Waters
2575013faa cea608tott: use our own CEA-608 frame handling instead of libcaption
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1517>
2024-04-05 19:29:24 +11:00
Matthew Waters
d8fe1c64f1 cea608overlay: use or own CEA-608 caption frame handling instead of libcaption
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1517>
2024-04-05 19:29:24 +11:00
Matthew Waters
fea85ff9c8 closedcaption: use cea608-types for parsing 608 captions instead of libcaption
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1517>
2024-04-05 19:29:24 +11:00