Commit graph

8 commits

Author SHA1 Message Date
Mathieu Duponchelle
f95b5ee666 closedcaption/caption.c: fix deletion
Trying to write "" in order to erase characters in the caption
frame simply fails silently, the proper way to implement
delete_to_end_of_row and backspace was to memset the relevant
cells.
2021-04-15 14:35:22 +00:00
Seungha Yang
3dda2aebe9 closedcaption: Fix build with MSVC
Undefined ssize_t is used in eia608.h file as well
2021-04-01 05:13:24 +00:00
Mathieu Duponchelle
6267e00c20 libcaption: implement eia608_to_text 2021-01-19 16:40:00 +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
Mathieu Duponchelle
a3dafea688 libcaption: fix parity code calculation
A misplaced parenthesis was causing the odd parity bit to
be set based on an incomplete version of the preamble
2021-01-19 16:40:00 +01:00
Mathieu Duponchelle
0bb626c653 closedcaption: implement cea608overlay
Useful complement to cea708overlay, that can only render native
708.

The element isn't an aggregator, and simply parses and renders
closed caption meta on its input video buffers.

No property is exposed, the rendering is done using a monospace
font, over a 32 x 15 grid with the font size fitted to fill as
much of the viewport as possible.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/343>
2020-06-04 16:53:04 +02:00
Sebastian Dröge
f1e3212477 closedcaption: Convert bitfields to uint8_t for portability reasons
Contrary to what one might believe, this actually reduces the size of
the structs due to alignment constraints. On Linux x86-64 clang/gcc it
reduces the size of the caption_frame_t struct from 7760 bytes to 6800
bytes, on Windows x86-64 MSVC from 11600 bytes to 6800 bytes.

It also causes simpler and potentially faster assembly to be generated
as the values can be directly accessed as uint8_t instead of having to
extract the corresponding bits with bitwise operations.

It also gives us the same ABI with clang/gcc and MSVC.
2020-04-14 20:01:30 +03:00
Arun Raghavan
dc3c8fd049 Drop gst-plugin- prefix in plugin directory name 2020-04-05 19:10:47 +00:00