Commit graph

32 commits

Author SHA1 Message Date
François Laignel
5c5c15d36a Simplify Formatted value handling
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1059
2022-07-11 21:21:54 +02:00
Sebastian Dröge
326449b3e6 Re-license LGPL-2.1 plugins to MPL-2
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/168
2022-01-15 21:05:11 +02:00
Sebastian Dröge
c46901d150 Fix or silence various new 1.57 clippy warnings 2021-11-30 16:31:50 +02:00
Sebastian Dröge
55aad51141 Update for glib constructor renames
See https://github.com/gtk-rs/gtk-rs-core/pull/384
2021-11-20 14:31:06 +02:00
Bilal Elmoussaoui
82be7b3ac5 adapt to ObjectExt improvements 2021-11-08 14:43:53 +02:00
Sebastian Dröge
d9bda62a47 Update for GLib/GStreamer API changes
And clean up a lot of related property/caps/structure code.
2021-11-06 09:34:10 +02:00
Sebastian Dröge
0a7d1639e7 Update to Rust edition 2021 and minimum supported Rust version to 1.56 2021-10-31 17:40:05 +02:00
Sebastian Dröge
96d86eaa06 Clean up clippy warnings and CI configuration
Put clippy overrides into the sources files instead of the CI
configuration, and fix various warnings / clean up code.
2021-09-08 12:35:41 +00:00
Sebastian Dröge
434fe8e56f closedcaption/mccenc: Fix unit test to not require changing the version number in the output every time 2021-09-03 09:12:25 +03:00
Mathieu Duponchelle
715418c005 tttocea608: don't erase display memory before loading new pop-on
There is no point to that, the code is already factored in such
a way that erase_display_memory is inserted at the correct time,
including while loading the next pop-on captions in non displayed
memory.
2021-09-02 00:21:24 +02:00
Sebastian Dröge
f733f90333 closedcaption/mccenc: Fix unit test
The expected output contains the plugin version.
2021-07-09 14:14:51 +03:00
Mathieu Duponchelle
23219c3c09 tttocea608: don't pad up to first input timestamp
When receiving data from a live upstream element, the first buffer
may have a non-0 timestamp (running time), and the element incorrectly
pushed padding buffers up to that timestamp, resulting in much confusion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/527>
2021-06-25 23:26:30 +00:00
François Laignel
e16cad7c8f video: migrate to new ClockTime design 2021-06-05 10:36:21 +02:00
François Laignel
8dfc872544 use gst::glib where applicable 2021-06-03 20:53:16 +02:00
Mathieu Duponchelle
7923e26545 tttocea608: implement word wrapping in roll-up modes.
In roll-up modes, we open new lines when the last column is reached.
This commit implements lookahead on a word basis, in order to avoid
splitting words unless absolutely necessary (when a word won't fit
on a full row)
2021-04-20 17:53:12 +00:00
François Laignel
67c5871957 fix-getters-calls 0.3.0 pass 2021-04-20 18:19:58 +02:00
François Laignel
06accc8d98 fix-getters-{def,calls} pass 2021-04-12 15:57:19 +02:00
Sebastian Dröge
bb8931c39b closedcaption: Don't needlessly create a full-range subslice of a slice 2021-03-25 22:59:14 +02:00
Mathieu Duponchelle
11238579a5 tttocea608: pad immediately for the duration of the input buffer
Pushing the pending padding once we receive the following gap
or buffer means we will push it too late otherwise.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/480>
2021-03-12 11:20:44 +01:00
Mathieu Duponchelle
42b4defb5c tttocea608: in-depth refactoring, support for new input format
Up to now, tttocea608 supported text/utf8, and no interface to
control the positioning of closed captions apart from new lines
in the input text.

CEA 608 supports a larger set of features than that, such as
positioning CC precisely in its 32 x 15 grid, styling text,
switching from one mode to another, resetting the base row
in roll-up mode etc ..

A custom, JSON-based format is now supported by the element
(caps application/x-json, format=cea608), allowing users to
control those features in a pretty advanced manner.

A side effect of this is that the approach previously used
by the element to ensure frame-accurate CC display is now
untenable: where we knew before that an input buffer would
at most span 74 buffers and calculate a somewhat reasonable
latency based on that, this is no longer possible. Instead
we pick the approach most CC encoders seem to pick, and
accept a certain latency at display time: for example the
flipping of the back buffer to the display buffer for a
10-character text buffer will occur 7 frames after its
PTS. This has obvious benefits in terms of code complexity
and should generally be acceptable.

+ Removes a now irrelevant test, updates other tests

+ Extracts the Mode enum to the root of the crate, it will
  be used by another element in a follow-up commit
2021-01-20 02:29:19 +01:00
Mathieu Duponchelle
a7180e3995 libcaption: fix bit set on indent preambles
style preambles look like:

|P|0|0|1|C|0|ROW| |P|1|N|0|STYLE|U|

and column preambles look like:

|P|0|0|1|C|0|ROW| |P|1|N|1|CURSR|U|

Both preambles go through eia608_row_pramble(), the value they
pass as the x parameter is supposed to hold 4 bits, either
0|STYLE

or 1|CURSR

This value then gets bit-shifted by 1 and or'd in the second byte.

The value is also and' with 0x1E to ensure it can't leak into
the upper bits.

The previous code resulted in x being a 5-bit value, 0x10 (0b10000).
This resulted in outputting a style preamble, as 0x10 << 1 & 0x1E
is 0b00000. When the indent was 0 (the usual case), this went
undetected, but with any other value it resulted in no indent being
applied, but the text getting colored or italicized.

This patch fixes x to have the correct value of 0x8 | indent.
2021-01-19 16:40:00 +01:00
Sebastian Dröge
84896e6468 Update to rand 0.8 2021-01-09 12:34:42 +02:00
Sebastian Dröge
38ecd43074 Use typed integer literals instead of casting 2020-12-29 17:29:46 +02:00
Sebastian Dröge
005c62425b closedcaption: Update for glib::DateTime API changes 2020-12-24 13:36:07 +02:00
Seungha Yang
58786fa0b5 sccparse: Add support for seeking
Only pull mode can support seeking for now and reverse playback
is not implemented yet. Note that this restriction is the same as that of
mccparse.
2020-12-01 11:07:34 +00:00
Sebastian Dröge
f81d7b61b5 video: Update to 2018 edition 2020-11-23 10:28:35 +02:00
Matthew Waters
dc8b722f72 video/closedcaption: add a ccdetect element
Detects whether valid closed caption data is available in CC708 data.
2020-09-10 20:54:09 +10:00
François Laignel
e40267e95d event,message,query: update instantiation
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/532
2020-06-25 11:26:32 +02:00
Mathieu Duponchelle
ed4fa7fde4 tttocea608: insert preambles in roll-up mode
I thought I could spare some bandwidth by letting renderers pick
the base row, but it turns out this triggers some unwanted behaviours
with compliant renderers.

Instead, we now follow the protocol laid out in EIA/CEA-608-B,
section B.8.1

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/355>
2020-06-10 22:05:02 +02:00
Mathieu Duponchelle
83b0596242 tttocea608: add roll-up modes
In roll-up mode, the element expects input text without layout
(eg new lines), and the characters it outputs are displayed
immediately, without double-buffering as in pop-on mode.

Once the last column is reached, the element simply outputs
a carriage return and the text scrolls up, potentially splitting
words with no hyphenation.

The main advantage of this mode is its simplicity and the near-zero
latency it introduces.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/347>
2020-05-30 01:36:11 +02:00
Mathieu Duponchelle
de796c95f0 tttocea608: refactor to fit more scenarios
- Report a latency:
  By design, tttocea608 will output buffers in the "past" when
  receiving an input buffer: we want the second to last buffer
  in the buffer list that we output to have the same pts as the
  input buffer, as it contains the end_of_caption control code
  which determines when the current closed caption actually gets
  displayed in pop_on mode. The previous buffers have timestamps
  decreasing as a function of the framerate, for up to potentially
  74 byte pairs (the breakdown is detailed in a comment).

  The element thus has to report a latency, at 30 frames per second
  it represents around 2.5 seconds.

- Refactor timestamping:
  Stop using a frame duration, but rather base our timestamps on
  a scaled frame index. This is to avoid rounding errors, and
  allow for exactly one byte pair per buffer if the proper framerate
  is set on the closed caption branch, and the video branch has
  perfect timestamps, eg videorate. In practice, that one byte
  pair per frame requirement should only matter for line 21 encoding,
  but we have to think about this use case too.

- Splice in erase_display_memory:
  When there is a gap between the end of a buffer and the start
  of the next one, we want to erase the display memory (this
  is unnecessary otherwise, as the end_of_caption control code
  will in effect ensure that the display is erased when the
  new caption is displayed). The previous implementation only
  supported this imperfectly, as it could cause timestamps to
  go backwards.

- Output last erase_display_memory:
  The previous implementation was missing the final
  erase_display_memory on EOS

- Output gaps

- Write more tests

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/314>
2020-04-23 20:10:42 +02:00
Arun Raghavan
dc3c8fd049 Drop gst-plugin- prefix in plugin directory name 2020-04-05 19:10:47 +00:00