shaka-packager/packager/media/base
Torbjörn Einarson 4b5e80d02c
feat: teletext formatting (#1384)
This PR adds parsing of teletext styling, and rendering of the styling
in output TTML and WebVTT subtitle tracks.

Beyond unit tests, I've used the sample
https://drive.google.com/file/d/19ZYsoeUfH85gEilQkaAdLbPhC4CxhDEh/view?usp=sharing
which has rather advanced subtitling with two separate rows at the same
time, where one is left aligned and another is right aligned. This
necessitates two parallel cues to be rendered. It also has some colored
text.

Solve #1335.

## parse teletext styling and formatting

Extend the teletext parser to parse the teletext styling and formatting.
This includes translating rows into regions, calculating alignment
from start and stop position of the text, and extracting text and
background colors.

The colors are limited to full lines.
Both lines and regions are propagated in the TextSample structures.
This is because the number of lines may differ from different sources.
For teletext, there are 24 rows, but they are essentially always
used with double height, so the number of output lines is 12
from 0 to 11.
There are also corresponding regions are denoted "ttx_R",
where R is an integer row number. A renderer can use either
the line number or the region ID to render the text.

## ttml generation for teletext to EBU-TT-D

Add support to render teletext input in EBU-TT-D (IMSC-1) format.
This includes appropriate regions ttx_0 to ttx_11 signalled
in the TextSamples, alignment and text and background colors.

The general TTML output has been changed to always include
metadata, layout, and styling nodes, even if they are empty.

EBU-TT-D is detected by the presence of "ttx_?" regions in the
samples. If detected, extra TTML elements will be added and
the EBU-TT-D linePadding used as well.

Appropriate styles for background and text colors are generated
depending on the color and backgroundColor attributes in the
text fragments.

## adapt WebVTT output to teletext TextSample.

Teletext input generates both a region with prefix ttx_
and a floating point line number (e.g. 9.5) in the
range 0 to 11.5 (due to input 0-23 as double lines).

The output is adopted to drop such regions
and convert the line number to an integer
since the standard only used floats for percent
values but not for plain line numbers.
2024-04-29 10:33:03 -07:00
..
test feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
CMakeLists.txt feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
aes_cryptor.cc fix: remove extra block assumptions in mbedtls integration (#1323) 2024-02-08 10:16:52 -08:00
aes_cryptor.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
aes_cryptor_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
aes_decryptor.cc fix: remove extra block assumptions in mbedtls integration (#1323) 2024-02-08 10:16:52 -08:00
aes_decryptor.h fix: remove extra block assumptions in mbedtls integration (#1323) 2024-02-08 10:16:52 -08:00
aes_encryptor.cc fix: remove extra block assumptions in mbedtls integration (#1323) 2024-02-08 10:16:52 -08:00
aes_encryptor.h fix: remove extra block assumptions in mbedtls integration (#1323) 2024-02-08 10:16:52 -08:00
aes_pattern_cryptor.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
aes_pattern_cryptor.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
aes_pattern_cryptor_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
audio_stream_info.cc feat: Add support for ALAC codec (#1299) 2024-02-26 13:39:30 -08:00
audio_stream_info.h feat: Parse MPEG-TS PMT ES language and maximum bitrate descriptors (#369) (#1311) 2024-02-08 11:58:26 -08:00
audio_timestamp_helper.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
audio_timestamp_helper.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
audio_timestamp_helper_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
bit_reader.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
bit_reader.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
bit_reader_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
bit_writer.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
bit_writer.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
bit_writer_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
buffer_reader.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
buffer_reader.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
buffer_writer.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
buffer_writer.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
buffer_writer_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
byte_queue.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
byte_queue.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
cc_stream_filter.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
cc_stream_filter.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
common_pssh_generator.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
common_pssh_generator.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
container_names.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
container_names.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
container_names_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
decrypt_config.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
decrypt_config.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
decryptor_source.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
decryptor_source.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
decryptor_source_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
encryption_config.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
fourccs.h feat: Add support for ALAC codec (#1299) 2024-02-26 13:39:30 -08:00
http_key_fetcher.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
http_key_fetcher.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
http_key_fetcher_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
id3_tag.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
id3_tag.h fix: Add missing <cstdint> includes (#1306) 2023-11-29 22:51:37 -08:00
id3_tag_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
key_fetcher.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
key_fetcher.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
key_source.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
key_source.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
language_utils.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
language_utils.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
limits.h Clean up #ifndef in packager/media. (#310) 2017-12-19 16:56:36 -08:00
media_handler.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
media_handler.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
media_handler_test_base.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
media_handler_test_base.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
media_parser.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
media_sample.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
media_sample.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
mock_aes_cryptor.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
muxer.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
muxer.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
muxer_options.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
muxer_options.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
muxer_util.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
muxer_util.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
muxer_util_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
offset_byte_queue.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
offset_byte_queue.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
offset_byte_queue_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
playready_key_source.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
playready_key_source.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
playready_pssh_generator.cc fix: remove extra block assumptions in mbedtls integration (#1323) 2024-02-08 10:16:52 -08:00
playready_pssh_generator.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
producer_consumer_queue.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
producer_consumer_queue_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
protection_system_ids.h fix: Restore support for legacy FairPlay system ID (#1357) 2024-02-28 15:45:03 -08:00
protection_system_specific_info.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
protection_system_specific_info.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
protection_system_specific_info_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
proto_json_util.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
proto_json_util.h Remove the usage of JsonWriter in SimpleHlsNotifier 2018-05-15 20:06:54 +00:00
pssh_generator.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
pssh_generator.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
pssh_generator_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
pssh_generator_util.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
pssh_generator_util.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
range.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
raw_key_source.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
raw_key_source.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
raw_key_source_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
rcheck.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
request_signer.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
request_signer.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
rsa_key.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
rsa_key.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
rsa_key_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
stream_info.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
stream_info.h feat: Add support for ALAC codec (#1299) 2024-02-26 13:39:30 -08:00
text_muxer.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
text_muxer.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
text_sample.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
text_sample.h feat: teletext formatting (#1384) 2024-04-29 10:33:03 -07:00
text_stream_info.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
text_stream_info.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
text_track.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
text_track_config.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
text_track_config.h Rename top level namespace to shaka 2016-05-24 21:55:55 +00:00
timestamp.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
video_stream_info.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
video_stream_info.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
video_util.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
video_util.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
video_util_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
widevine_common_encryption.proto Add a flag --video_feature for Widevine 2019-04-16 07:55:08 -07:00
widevine_key_source.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
widevine_key_source.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
widevine_key_source_unittest.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
widevine_pssh_data.proto feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
widevine_pssh_generator.cc feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00
widevine_pssh_generator.h feat!: Rewrite build system and third-party dependencies (#1310) 2023-12-01 09:32:19 -08:00