From 71c175d4b8fd7dd1ebb2df8ce06c575f54666738 Mon Sep 17 00:00:00 2001 From: Cosmin Stejerean Date: Fri, 23 Feb 2024 15:31:48 -0800 Subject: [PATCH] feat: Add input support for EBU Teletext in MPEG-TS (#1344) Replaces #1181 * Add support for EBU Teletext input following Level 1.5 of the core specification ETSI EN 300 706 V1.2.1 (2003-04). * Add support for webvtt in MP4 segments output. Closes #272 --------- Co-authored-by: Marcus Spangenberg --- docs/source/tutorials/text.rst | 6 + packager/media/formats/mp2t/CMakeLists.txt | 4 + packager/media/formats/mp2t/es_parser.h | 1 + .../media/formats/mp2t/es_parser_teletext.cc | 512 ++++++++++++++++++ .../media/formats/mp2t/es_parser_teletext.h | 81 +++ .../formats/mp2t/es_parser_teletext_tables.h | 434 +++++++++++++++ .../mp2t/es_parser_teletext_unittest.cc | 267 +++++++++ .../media/formats/mp2t/mp2t_media_parser.cc | 7 + packager/media/formats/mp2t/ts_section_pmt.cc | 15 +- packager/media/formats/mp2t/ts_stream_type.h | 1 + .../formats/webvtt/webvtt_to_mp4_handler.cc | 11 +- 11 files changed, 1335 insertions(+), 4 deletions(-) create mode 100644 packager/media/formats/mp2t/es_parser_teletext.cc create mode 100644 packager/media/formats/mp2t/es_parser_teletext.h create mode 100644 packager/media/formats/mp2t/es_parser_teletext_tables.h create mode 100644 packager/media/formats/mp2t/es_parser_teletext_unittest.cc diff --git a/docs/source/tutorials/text.rst b/docs/source/tutorials/text.rst index 502c309336..8291a29794 100644 --- a/docs/source/tutorials/text.rst +++ b/docs/source/tutorials/text.rst @@ -45,3 +45,9 @@ Examples in=in_en.vtt,stream=text,language=en,output=out_en.mp4 \ in=in_sp.vtt,stream=text,language=sp,output=out_sp.mp4 \ in=in_fr.vtt,stream=text,language=fr,output=out_fr.mp4 + +* Get a single 3-digit page from DVB-teletext and set language for output formats stpp (TTML in mp4), wvtt (WebVTT in mp4) and HLS WebVTT:: + + $ packager in=input.ts,stream=text,cc_index=888,lang=en,format=ttml+mp4,output=output.mp4 + $ packager in=input.ts,stream=text,cc_index=888,lang=en,output=output.mp4 + $ packager in=input.ts,stream=text,cc_index=888,segment_template=text/$Number$.vtt,playlist_name=text/main.m3u8,hls_group_id=text,hls_name=ENGLISH diff --git a/packager/media/formats/mp2t/CMakeLists.txt b/packager/media/formats/mp2t/CMakeLists.txt index 8aa9fb95cc..a86fa017b2 100644 --- a/packager/media/formats/mp2t/CMakeLists.txt +++ b/packager/media/formats/mp2t/CMakeLists.txt @@ -22,6 +22,9 @@ add_library(mp2t STATIC es_parser_h265.h es_parser_h26x.cc es_parser_h26x.h + es_parser_teletext.cc + es_parser_teletext.h + es_parser_teletext_tables.h es_parser.h mp2t_media_parser.cc mp2t_media_parser.h @@ -69,6 +72,7 @@ ac3_header_unittest.cc adts_header_unittest.cc es_parser_h264_unittest.cc es_parser_h26x_unittest.cc +es_parser_teletext_unittest.cc mp2t_media_parser_unittest.cc mpeg1_header_unittest.cc pes_packet_generator_unittest.cc diff --git a/packager/media/formats/mp2t/es_parser.h b/packager/media/formats/mp2t/es_parser.h index 2cb6f472ea..1225260c3a 100644 --- a/packager/media/formats/mp2t/es_parser.h +++ b/packager/media/formats/mp2t/es_parser.h @@ -7,6 +7,7 @@ #include #include +#include namespace shaka { namespace media { diff --git a/packager/media/formats/mp2t/es_parser_teletext.cc b/packager/media/formats/mp2t/es_parser_teletext.cc new file mode 100644 index 0000000000..8e859d1b1d --- /dev/null +++ b/packager/media/formats/mp2t/es_parser_teletext.cc @@ -0,0 +1,512 @@ +// Copyright 2020 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#include + +#include +#include +#include +#include +#include + +namespace shaka { +namespace media { +namespace mp2t { + +namespace { + +const uint8_t EBU_TELETEXT_WITH_SUBTITLING = 0x03; +const int kPayloadSize = 40; +const int kNumTriplets = 13; + +template +constexpr T bit(T value, const size_t bit_pos) { + return (value >> bit_pos) & 0x1; +} + +uint8_t ReadHamming(BitReader& reader) { + uint8_t bits; + RCHECK(reader.ReadBits(8, &bits)); + return TELETEXT_HAMMING_8_4[bits]; +} + +bool Hamming_24_18(const uint32_t value, uint32_t& out_result) { + uint32_t result = value; + + uint8_t test = 0; + for (uint8_t i = 0; i < 23; i++) { + test ^= ((result >> i) & 0x01) * (i + 0x21); + } + test ^= ((result >> 0x17) & 0x01) * 0x20; + + if ((test & 0x1f) != 0x1f) { + if ((test & 0x20) == 0x20) { + return false; + } + result ^= 1 << (0x1e - test); + } + + out_result = (result & 0x000004) >> 2 | (result & 0x000070) >> 3 | + (result & 0x007f00) >> 4 | (result & 0x7f0000) >> 5; + return true; +} + +bool ParseSubtitlingDescriptor( + const uint8_t* descriptor, + const size_t size, + std::unordered_map& result) { + BitReader reader(descriptor, size); + RCHECK(reader.SkipBits(8)); + + size_t data_size; + RCHECK(reader.ReadBits(8, &data_size)); + RCHECK(data_size + 2 <= size); + + for (size_t i = 0; i < data_size; i += 8) { + uint32_t lang_code; + RCHECK(reader.ReadBits(24, &lang_code)); + uint8_t ignored_teletext_type; + RCHECK(reader.ReadBits(5, &ignored_teletext_type)); + uint8_t magazine_number; + RCHECK(reader.ReadBits(3, &magazine_number)); + if (magazine_number == 0) { + magazine_number = 8; + } + + uint8_t page_number_tens; + RCHECK(reader.ReadBits(4, &page_number_tens)); + uint8_t page_number_units; + RCHECK(reader.ReadBits(4, &page_number_units)); + const uint8_t page_number = page_number_tens * 10 + page_number_units; + + std::string lang(3, '\0'); + lang[0] = static_cast((lang_code >> 16) & 0xff); + lang[1] = static_cast((lang_code >> 8) & 0xff); + lang[2] = static_cast((lang_code >> 0) & 0xff); + + const uint16_t index = magazine_number * 100 + page_number; + result.emplace(index, std::move(lang)); + } + + return true; +} + +std::string RemoveTrailingSpaces(const std::string& input) { + const auto index = input.find_last_not_of(' '); + if (index == std::string::npos) { + return ""; + } + return input.substr(0, index + 1); +} + +} // namespace + +EsParserTeletext::EsParserTeletext(const uint32_t pid, + const NewStreamInfoCB& new_stream_info_cb, + const EmitTextSampleCB& emit_sample_cb, + const uint8_t* descriptor, + const size_t descriptor_length) + : EsParser(pid), + new_stream_info_cb_(new_stream_info_cb), + emit_sample_cb_(emit_sample_cb), + magazine_(0), + page_number_(0), + charset_code_(0), + current_charset_{}, + last_pts_(0) { + if (!ParseSubtitlingDescriptor(descriptor, descriptor_length, languages_)) { + LOG(ERROR) << "Unable to parse teletext_descriptor"; + } + UpdateCharset(); +} + +bool EsParserTeletext::Parse(const uint8_t* buf, + int size, + int64_t pts, + int64_t dts) { + if (!sent_info_) { + sent_info_ = true; + auto info = std::make_shared(pid(), kMpeg2Timescale, + kInfiniteDuration, kCodecText, + "", "", 0, 0, ""); + for (const auto& pair : languages_) { + info->AddSubStream(pair.first, {pair.second}); + } + + new_stream_info_cb_(info); + } + + return ParseInternal(buf, size, pts); +} + +bool EsParserTeletext::Flush() { + std::vector keys; + for (const auto& entry : page_state_) { + keys.push_back(entry.first); + } + + for (const auto key : keys) { + SendPending(key, last_pts_); + } + + return true; +} + +void EsParserTeletext::Reset() { + page_state_.clear(); + magazine_ = 0; + page_number_ = 0; + sent_info_ = false; + charset_code_ = 0; + UpdateCharset(); +} + +bool EsParserTeletext::ParseInternal(const uint8_t* data, + const size_t size, + const int64_t pts) { + BitReader reader(data, size); + RCHECK(reader.SkipBits(8)); + std::vector lines; + + while (reader.bits_available()) { + uint8_t data_unit_id; + RCHECK(reader.ReadBits(8, &data_unit_id)); + + uint8_t data_unit_length; + RCHECK(reader.ReadBits(8, &data_unit_length)); + + if (data_unit_length != 44) { + LOG(ERROR) << "Bad Teletext data length"; + break; + } + + if (data_unit_id != EBU_TELETEXT_WITH_SUBTITLING) { + RCHECK(reader.SkipBytes(44)); + continue; + } + + RCHECK(reader.SkipBits(16)); + + uint16_t address_bits; + RCHECK(reader.ReadBits(16, &address_bits)); + + uint8_t magazine = bit(address_bits, 14) + 2 * bit(address_bits, 12) + + 4 * bit(address_bits, 10); + + if (magazine == 0) { + magazine = 8; + } + + const uint8_t packet_nr = + (bit(address_bits, 8) + 2 * bit(address_bits, 6) + + 4 * bit(address_bits, 4) + 8 * bit(address_bits, 2) + + 16 * bit(address_bits, 0)); + const uint8_t* data_block = reader.current_byte_ptr(); + RCHECK(reader.SkipBytes(40)); + + std::string display_text; + if (ParseDataBlock(pts, data_block, packet_nr, magazine, display_text)) { + lines.emplace_back(std::move(display_text)); + } + } + + if (lines.empty()) { + return true; + } + + const uint16_t index = magazine_ * 100 + page_number_; + auto page_state_itr = page_state_.find(index); + if (page_state_itr == page_state_.end()) { + page_state_.emplace(index, TextBlock{std::move(lines), {}, last_pts_}); + + } else { + for (auto& line : lines) { + auto& page_state_lines = page_state_itr->second.lines; + page_state_lines.emplace_back(std::move(line)); + } + lines.clear(); + } + + return true; +} + +bool EsParserTeletext::ParseDataBlock(const int64_t pts, + const uint8_t* data_block, + const uint8_t packet_nr, + const uint8_t magazine, + std::string& display_text) { + if (packet_nr == 0) { + last_pts_ = pts; + BitReader reader(data_block, 32); + + const uint8_t page_number_units = ReadHamming(reader); + const uint8_t page_number_tens = ReadHamming(reader); + const uint8_t page_number = 10 * page_number_tens + page_number_units; + + const uint16_t index = magazine * 100 + page_number; + SendPending(index, pts); + + page_number_ = page_number; + magazine_ = magazine; + if (page_number == 0xFF) { + return false; + } + + RCHECK(reader.SkipBits(40)); + const uint8_t subcode_c11_c14 = ReadHamming(reader); + const uint8_t charset_code = subcode_c11_c14 >> 1; + if (charset_code != charset_code_) { + charset_code_ = charset_code; + UpdateCharset(); + } + + return false; + + } else if (packet_nr == 26) { + ParsePacket26(data_block); + return false; + + } else if (packet_nr > 26) { + return false; + } + + display_text = BuildText(data_block, packet_nr); + return true; +} + +void EsParserTeletext::UpdateCharset() { + memcpy(current_charset_, TELETEXT_CHARSET_G0_LATIN, sizeof(TELETEXT_CHARSET_G0_LATIN)); + if (charset_code_ > 7) { + return; + } + const auto teletext_national_subset = + static_cast(charset_code_); + + switch (teletext_national_subset) { + case TELETEXT_NATIONAL_SUBSET::ENGLISH: + UpdateNationalSubset(TELETEXT_NATIONAL_SUBSET_ENGLISH); + break; + case TELETEXT_NATIONAL_SUBSET::FRENCH: + UpdateNationalSubset(TELETEXT_NATIONAL_SUBSET_FRENCH); + break; + case TELETEXT_NATIONAL_SUBSET::SWEDISH_FINNISH_HUNGARIAN: + UpdateNationalSubset(TELETEXT_NATIONAL_SUBSET_SWEDISH_FINNISH_HUNGARIAN); + break; + case TELETEXT_NATIONAL_SUBSET::CZECH_SLOVAK: + UpdateNationalSubset(TELETEXT_NATIONAL_SUBSET_CZECH_SLOVAK); + break; + case TELETEXT_NATIONAL_SUBSET::GERMAN: + UpdateNationalSubset(TELETEXT_NATIONAL_SUBSET_GERMAN); + break; + case TELETEXT_NATIONAL_SUBSET::PORTUGUESE_SPANISH: + UpdateNationalSubset(TELETEXT_NATIONAL_SUBSET_PORTUGUESE_SPANISH); + break; + case TELETEXT_NATIONAL_SUBSET::ITALIAN: + UpdateNationalSubset(TELETEXT_NATIONAL_SUBSET_ITALIAN); + break; + case TELETEXT_NATIONAL_SUBSET::NONE: + default: + break; + } +} + +void EsParserTeletext::SendPending(const uint16_t index, const int64_t pts) { + auto page_state_itr = page_state_.find(index); + + if (page_state_itr == page_state_.end() || + page_state_itr->second.lines.empty()) { + return; + } + + const auto& pending_lines = page_state_itr->second.lines; + const auto pending_pts = page_state_itr->second.pts; + + TextFragmentStyle text_fragment_style; + TextSettings text_settings; + std::shared_ptr text_sample; + + if (pending_lines.size() == 1) { + TextFragment text_fragment(text_fragment_style, pending_lines[0].c_str()); + text_sample = std::make_shared("", pending_pts, pts, + text_settings, text_fragment); + + } else { + std::vector sub_fragments; + for (const auto& line : pending_lines) { + sub_fragments.emplace_back(text_fragment_style, line.c_str()); + sub_fragments.emplace_back(text_fragment_style, true); + } + sub_fragments.pop_back(); + TextFragment text_fragment(text_fragment_style, sub_fragments); + text_sample = std::make_shared("", pending_pts, pts, + text_settings, text_fragment); + } + + text_sample->set_sub_stream_index(index); + emit_sample_cb_(text_sample); + + page_state_.erase(index); +} + +std::string EsParserTeletext::BuildText(const uint8_t* data_block, + const uint8_t row) const { + std::string next_string; + next_string.reserve(kPayloadSize * 2); + bool leading_spaces = true; + + const uint16_t index = magazine_ * 100 + page_number_; + const auto page_state_itr = page_state_.find(index); + + const std::unordered_map* column_replacement_map = + nullptr; + if (page_state_itr != page_state_.cend()) { + const auto row_itr = + page_state_itr->second.packet_26_replacements.find(row); + if (row_itr != page_state_itr->second.packet_26_replacements.cend()) { + column_replacement_map = &(row_itr->second); + } + } + + for (size_t i = 0; i < kPayloadSize; ++i) { + if (column_replacement_map) { + const auto column_itr = column_replacement_map->find(i); + if (column_itr != column_replacement_map->cend()) { + next_string.append(column_itr->second); + leading_spaces = false; + continue; + } + } + + char next_char = + static_cast(TELETEXT_BITREVERSE_8[data_block[i]] & 0x7f); + + if (next_char < 32) { + next_char = 0x20; + } + + if (leading_spaces) { + if (next_char == 0x20) { + continue; + } + leading_spaces = false; + } + + switch (next_char) { + case '&': + next_string.append("&"); + break; + case '<': + next_string.append("<"); + break; + default: { + const std::string replacement(current_charset_[next_char - 0x20]); + next_string.append(replacement); + } break; + } + } + + return RemoveTrailingSpaces(next_string); +} + +void EsParserTeletext::ParsePacket26(const uint8_t* data_block) { + const uint16_t index = magazine_ * 100 + page_number_; + auto page_state_itr = page_state_.find(index); + if (page_state_itr == page_state_.end()) { + page_state_.emplace(index, TextBlock{{}, {}, last_pts_}); + } + auto& replacement_map = page_state_[index].packet_26_replacements; + + uint8_t row = 0; + + std::vector x26_triplets; + x26_triplets.reserve(kNumTriplets); + for (uint8_t i = 1; i < kPayloadSize; i += 3) { + const uint32_t bytes = (TELETEXT_BITREVERSE_8[data_block[i + 2]] << 16) | + (TELETEXT_BITREVERSE_8[data_block[i + 1]] << 8) | + TELETEXT_BITREVERSE_8[data_block[i]]; + uint32_t triplet; + if (Hamming_24_18(bytes, triplet)) { + x26_triplets.emplace_back(triplet); + } + } + + for (const auto triplet : x26_triplets) { + const uint8_t mode = (triplet & 0x7c0) >> 6; + const uint8_t address = triplet & 0x3f; + const uint8_t row_address_group = (address >= 0x28) && (address <= 0x3f); + + if ((mode == 0x4) && (row_address_group == 0x1)) { + row = address - 0x28; + if (row == 0x0) { + row = 0x18; + } + } + + if (mode >= 0x11 && mode <= 0x1f && row_address_group == 0x1) { + break; + } + + const uint8_t data = (triplet & 0x3f800) >> 11; + + if (mode == 0x0f && row_address_group == 0x0 && data > 0x1f) { + SetPacket26ReplacementString(replacement_map, row, address, + reinterpret_cast( + TELETEXT_CHARSET_G2_LATIN[data - 0x20])); + } + + if (mode == 0x10 && row_address_group == 0x0 && data == 0x40) { + SetPacket26ReplacementString(replacement_map, row, address, "@"); + } + + if (mode < 0x11 || mode > 0x1f || row_address_group != 0x0) { + continue; + } + + if (data >= 0x41 && data <= 0x5a) { + SetPacket26ReplacementString( + replacement_map, row, address, + reinterpret_cast( + TELETEXT_G2_LATIN_ACCENTS[mode - 0x11][data - 0x41])); + + } else if (data >= 0x61 && data <= 0x7a) { + SetPacket26ReplacementString( + replacement_map, row, address, + reinterpret_cast( + TELETEXT_G2_LATIN_ACCENTS[mode - 0x11][data - 0x47])); + + } else if ((data & 0x7f) >= 0x20) { + SetPacket26ReplacementString( + replacement_map, row, address, + reinterpret_cast( + TELETEXT_CHARSET_G0_LATIN[(data & 0x7f) - 0x20])); + } + } +} + +void EsParserTeletext::UpdateNationalSubset( + const uint8_t national_subset[13][3]) { + for (size_t i = 0; i < 13; ++i) { + const size_t position = TELETEXT_NATIONAL_CHAR_INDEX_G0[i]; + memcpy(current_charset_[position], national_subset[i], 3); + } +} + +void EsParserTeletext::SetPacket26ReplacementString( + RowColReplacementMap& replacement_map, + const uint8_t row, + const uint8_t column, + std::string&& replacement_string) { + auto replacement_map_itr = replacement_map.find(row); + if (replacement_map_itr == replacement_map.cend()) { + replacement_map.emplace(row, std::unordered_map{}); + } + auto& column_map = replacement_map[row]; + column_map.emplace(column, std::move(replacement_string)); +} + +} // namespace mp2t +} // namespace media +} // namespace shaka diff --git a/packager/media/formats/mp2t/es_parser_teletext.h b/packager/media/formats/mp2t/es_parser_teletext.h new file mode 100644 index 0000000000..dda578bf21 --- /dev/null +++ b/packager/media/formats/mp2t/es_parser_teletext.h @@ -0,0 +1,81 @@ +// Copyright 2020 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#ifndef PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_TELETEXT_H_ +#define PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_TELETEXT_H_ + +#include +#include +#include +#include + +#include + +namespace shaka { +namespace media { +namespace mp2t { + +class EsParserTeletext : public EsParser { + public: + EsParserTeletext(const uint32_t pid, + const NewStreamInfoCB& new_stream_info_cb, + const EmitTextSampleCB& emit_sample_cb, + const uint8_t* descriptor, + const size_t descriptor_length); + + EsParserTeletext(const EsParserTeletext&) = delete; + EsParserTeletext& operator=(const EsParserTeletext&) = delete; + + bool Parse(const uint8_t* buf, int size, int64_t pts, int64_t dts) override; + bool Flush() override; + void Reset() override; + + private: + using RowColReplacementMap = + std::unordered_map>; + + struct TextBlock { + std::vector lines; + RowColReplacementMap packet_26_replacements; + int64_t pts; + }; + + bool ParseInternal(const uint8_t* data, const size_t size, const int64_t pts); + bool ParseDataBlock(const int64_t pts, + const uint8_t* data_block, + const uint8_t packet_nr, + const uint8_t magazine, + std::string& display_text); + void UpdateCharset(); + void SendPending(const uint16_t index, const int64_t pts); + std::string BuildText(const uint8_t* data_block, const uint8_t row) const; + void ParsePacket26(const uint8_t* data_block); + void UpdateNationalSubset(const uint8_t national_subset[13][3]); + + static void SetPacket26ReplacementString( + RowColReplacementMap& replacement_map, + const uint8_t row, + const uint8_t column, + std::string&& replacement_string); + + NewStreamInfoCB new_stream_info_cb_; + EmitTextSampleCB emit_sample_cb_; + + std::unordered_map languages_; + bool sent_info_ = false; + uint8_t magazine_; + uint8_t page_number_; + std::unordered_map page_state_; + uint8_t charset_code_; + char current_charset_[96][3]; + int64_t last_pts_; +}; + +} // namespace mp2t +} // namespace media +} // namespace shaka + +#endif // PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_TELETEXT_H_ diff --git a/packager/media/formats/mp2t/es_parser_teletext_tables.h b/packager/media/formats/mp2t/es_parser_teletext_tables.h new file mode 100644 index 0000000000..25e7560a6b --- /dev/null +++ b/packager/media/formats/mp2t/es_parser_teletext_tables.h @@ -0,0 +1,434 @@ +// Copyright 2020 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#ifndef PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_TELETEXT_TABLES_H_ +#define PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_TELETEXT_TABLES_H_ + +#include + +namespace shaka { +namespace media { +namespace mp2t { + +const uint8_t TELETEXT_BITREVERSE_8[] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, + 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, + 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, + 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, + 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, + 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, + 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, + 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, + 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, + 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, + 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, + 0x3f, 0xbf, 0x7f, 0xff}; + +const uint8_t TELETEXT_HAMMING_8_4[] = { + 0x00, 0x08, 0x00, 0x08, 0x04, 0x0c, 0x04, 0x0c, 0x00, 0x08, 0x00, 0x08, + 0x04, 0x0c, 0x04, 0x0c, 0x02, 0x0a, 0x02, 0x0a, 0x06, 0x0e, 0x06, 0x0e, + 0x02, 0x0a, 0x02, 0x0a, 0x06, 0x0e, 0x06, 0x0e, 0x00, 0x08, 0x00, 0x08, + 0x04, 0x0c, 0x04, 0x0c, 0x00, 0x08, 0x00, 0x08, 0x04, 0x0c, 0x04, 0x0c, + 0x02, 0x0a, 0x02, 0x0a, 0x06, 0x0e, 0x06, 0x0e, 0x02, 0x0a, 0x02, 0x0a, + 0x06, 0x0e, 0x06, 0x0e, 0x01, 0x09, 0x01, 0x09, 0x05, 0x0d, 0x05, 0x0d, + 0x01, 0x09, 0x01, 0x09, 0x05, 0x0d, 0x05, 0x0d, 0x03, 0x0b, 0x03, 0x0b, + 0x07, 0x0f, 0x07, 0x0f, 0x03, 0x0b, 0x03, 0x0b, 0x07, 0x0f, 0x07, 0x0f, + 0x01, 0x09, 0x01, 0x09, 0x05, 0x0d, 0x05, 0x0d, 0x01, 0x09, 0x01, 0x09, + 0x05, 0x0d, 0x05, 0x0d, 0x03, 0x0b, 0x03, 0x0b, 0x07, 0x0f, 0x07, 0x0f, + 0x03, 0x0b, 0x03, 0x0b, 0x07, 0x0f, 0x07, 0x0f, 0x00, 0x08, 0x00, 0x08, + 0x04, 0x0c, 0x04, 0x0c, 0x00, 0x08, 0x00, 0x08, 0x04, 0x0c, 0x04, 0x0c, + 0x02, 0x0a, 0x02, 0x0a, 0x06, 0x0e, 0x06, 0x0e, 0x02, 0x0a, 0x02, 0x0a, + 0x06, 0x0e, 0x06, 0x0e, 0x00, 0x08, 0x00, 0x08, 0x04, 0x0c, 0x04, 0x0c, + 0x00, 0x08, 0x00, 0x08, 0x04, 0x0c, 0x04, 0x0c, 0x02, 0x0a, 0x02, 0x0a, + 0x06, 0x0e, 0x06, 0x0e, 0x02, 0x0a, 0x02, 0x0a, 0x06, 0x0e, 0x06, 0x0e, + 0x01, 0x09, 0x01, 0x09, 0x05, 0x0d, 0x05, 0x0d, 0x01, 0x09, 0x01, 0x09, + 0x05, 0x0d, 0x05, 0x0d, 0x03, 0x0b, 0x03, 0x0b, 0x07, 0x0f, 0x07, 0x0f, + 0x03, 0x0b, 0x03, 0x0b, 0x07, 0x0f, 0x07, 0x0f, 0x01, 0x09, 0x01, 0x09, + 0x05, 0x0d, 0x05, 0x0d, 0x01, 0x09, 0x01, 0x09, 0x05, 0x0d, 0x05, 0x0d, + 0x03, 0x0b, 0x03, 0x0b, 0x07, 0x0f, 0x07, 0x0f, 0x03, 0x0b, 0x03, 0x0b, + 0x07, 0x0f, 0x07, 0x0f}; + +const uint8_t TELETEXT_CHARSET_G0_LATIN[96][3] = { + {0x20, 0x0, 0x0}, {0x21, 0x0, 0x0}, {0x22, 0x0, 0x0}, {0xc2, 0xa3, 0x0}, + {0x24, 0x0, 0x0}, {0x25, 0x0, 0x0}, {0x26, 0x0, 0x0}, {0x27, 0x0, 0x0}, + {0x28, 0x0, 0x0}, {0x29, 0x0, 0x0}, {0x2a, 0x0, 0x0}, {0x2b, 0x0, 0x0}, + {0x2c, 0x0, 0x0}, {0x2d, 0x0, 0x0}, {0x2e, 0x0, 0x0}, {0x2f, 0x0, 0x0}, + {0x30, 0x0, 0x0}, {0x31, 0x0, 0x0}, {0x32, 0x0, 0x0}, {0x33, 0x0, 0x0}, + {0x34, 0x0, 0x0}, {0x35, 0x0, 0x0}, {0x36, 0x0, 0x0}, {0x37, 0x0, 0x0}, + {0x38, 0x0, 0x0}, {0x39, 0x0, 0x0}, {0x3a, 0x0, 0x0}, {0x3b, 0x0, 0x0}, + {0x3c, 0x0, 0x0}, {0x3d, 0x0, 0x0}, {0x3e, 0x0, 0x0}, {0x3f, 0x0, 0x0}, + {0x40, 0x0, 0x0}, {0x41, 0x0, 0x0}, {0x42, 0x0, 0x0}, {0x43, 0x0, 0x0}, + {0x44, 0x0, 0x0}, {0x45, 0x0, 0x0}, {0x46, 0x0, 0x0}, {0x47, 0x0, 0x0}, + {0x48, 0x0, 0x0}, {0x49, 0x0, 0x0}, {0x4a, 0x0, 0x0}, {0x4b, 0x0, 0x0}, + {0x4c, 0x0, 0x0}, {0x4d, 0x0, 0x0}, {0x4e, 0x0, 0x0}, {0x4f, 0x0, 0x0}, + {0x50, 0x0, 0x0}, {0x51, 0x0, 0x0}, {0x52, 0x0, 0x0}, {0x53, 0x0, 0x0}, + {0x54, 0x0, 0x0}, {0x55, 0x0, 0x0}, {0x56, 0x0, 0x0}, {0x57, 0x0, 0x0}, + {0x58, 0x0, 0x0}, {0x59, 0x0, 0x0}, {0x5a, 0x0, 0x0}, {0xc2, 0xab, 0x0}, + {0xc2, 0xbd, 0x0}, {0xc2, 0xbb, 0x0}, {0x5e, 0x0, 0x0}, {0x23, 0x0, 0x0}, + {0x2d, 0x0, 0x0}, {0x61, 0x0, 0x0}, {0x62, 0x0, 0x0}, {0x63, 0x0, 0x0}, + {0x64, 0x0, 0x0}, {0x65, 0x0, 0x0}, {0x66, 0x0, 0x0}, {0x67, 0x0, 0x0}, + {0x68, 0x0, 0x0}, {0x69, 0x0, 0x0}, {0x6a, 0x0, 0x0}, {0x6b, 0x0, 0x0}, + {0x6c, 0x0, 0x0}, {0x6d, 0x0, 0x0}, {0x6e, 0x0, 0x0}, {0x6f, 0x0, 0x0}, + {0x70, 0x0, 0x0}, {0x71, 0x0, 0x0}, {0x72, 0x0, 0x0}, {0x73, 0x0, 0x0}, + {0x74, 0x0, 0x0}, {0x75, 0x0, 0x0}, {0x76, 0x0, 0x0}, {0x77, 0x0, 0x0}, + {0x78, 0x0, 0x0}, {0x79, 0x0, 0x0}, {0x7a, 0x0, 0x0}, {0xc2, 0xbc, 0x0}, + {0xc2, 0xa6, 0x0}, {0xc2, 0xbe, 0x0}, {0xc3, 0xb7, 0x0}, {0x7f, 0x0, 0x0}}; + +const size_t TELETEXT_NATIONAL_CHAR_INDEX_G0[13] = { + 0x03, 0x04, 0x20, 0x3b, 0x3c, 0x3d, 0x3e, + 0x3f, 0x40, 0x5b, 0x5c, 0x5d, 0x5e}; + +const uint8_t TELETEXT_NATIONAL_SUBSET_ENGLISH[13][3] = { + {0xc2, 0xa3, 0x0}, {0x24, 0x0, 0x0}, {0x40, 0x0, 0x0}, {0xc2, 0xab, 0x0}, + {0xc2, 0xbd, 0x0}, {0xc2, 0xbb, 0x0}, {0x5e, 0x0, 0x0}, {0x23, 0x0, 0x0}, + {0x2d, 0x0, 0x0}, {0xc2, 0xbc, 0x0}, {0xc2, 0xa6, 0x0}, {0xc2, 0xbe, 0x0}, + {0xc3, 0xb7, 0x0}}; + +const uint8_t TELETEXT_NATIONAL_SUBSET_FRENCH[13][3] = { + {0xc3, 0xa9, 0x0}, {0xc3, 0xaf, 0x0}, {0xc3, 0xa0, 0x0}, {0xc3, 0xab, 0x0}, + {0xc3, 0xaa, 0x0}, {0xc3, 0xb9, 0x0}, {0xc3, 0xae, 0x0}, {0x23, 0x0, 0x0}, + {0xc3, 0xa8, 0x0}, {0xc3, 0xa2, 0x0}, {0xc3, 0xb4, 0x0}, {0xc3, 0xbb, 0x0}, + {0xc3, 0xa7, 0x0}}; + +const uint8_t TELETEXT_NATIONAL_SUBSET_SWEDISH_FINNISH_HUNGARIAN[13][3] = { + {0x23, 0x0, 0x0}, {0xc2, 0xa4, 0x0}, {0xc3, 0x89, 0x0}, {0xc3, 0x84, 0x0}, + {0xc3, 0x96, 0x0}, {0xc3, 0x85, 0x0}, {0xc3, 0x9c, 0x0}, {0x5f, 0x0, 0x0}, + {0xc3, 0xa9, 0x0}, {0xc3, 0xa4, 0x0}, {0xc3, 0xb6, 0x0}, {0xc3, 0xa5, 0x0}, + {0xc3, 0xbc, 0x0}}; + +const uint8_t TELETEXT_NATIONAL_SUBSET_CZECH_SLOVAK[13][3] = { + {0x23, 0x0, 0x0}, {0xc5, 0xaf, 0x0}, {0xc4, 0x8d, 0x0}, {0xc5, 0xa5, 0x0}, + {0xc5, 0xbe, 0x0}, {0xc3, 0xbd, 0x0}, {0xc3, 0xad, 0x0}, {0xc5, 0x99, 0x0}, + {0xc3, 0xa9, 0x0}, {0xc3, 0xa1, 0x0}, {0xc4, 0x9b, 0x0}, {0xc3, 0xba, 0x0}, + {0xc5, 0xa1, 0x0}}; + +const uint8_t TELETEXT_NATIONAL_SUBSET_GERMAN[13][3] = { + {0x23, 0x0, 0x0}, {0x24, 0x0, 0x0}, {0xc2, 0xa7, 0x0}, {0xc3, 0x84, 0x0}, + {0xc3, 0x96, 0x0}, {0xc3, 0x9c, 0x0}, {0x5e, 0x0, 0x0}, {0x5f, 0x0, 0x0}, + {0xc2, 0xb0, 0x0}, {0xc3, 0xa4, 0x0}, {0xc3, 0xb6, 0x0}, {0xc3, 0xbc, 0x0}, + {0xc3, 0x9f, 0x0}}; + +const uint8_t TELETEXT_NATIONAL_SUBSET_PORTUGUESE_SPANISH[13][3] = { + {0xc3, 0xa7, 0x0}, {0x24, 0x0, 0x0}, {0xc2, 0xa1, 0x0}, {0xc3, 0xa1, 0x0}, + {0xc3, 0xa9, 0x0}, {0xc3, 0xad, 0x0}, {0xc3, 0xb3, 0x0}, {0xc3, 0xba, 0x0}, + {0xc2, 0xbf, 0x0}, {0xc3, 0xbc, 0x0}, {0xc3, 0xb1, 0x0}, {0xc3, 0xa8, 0x0}, + {0xc3, 0xa0, 0x0}}; + +const uint8_t TELETEXT_NATIONAL_SUBSET_ITALIAN[13][3] = { + {0xc2, 0xa3, 0x0}, {0x24, 0x0, 0x0}, {0xc3, 0xa9, 0x0}, {0xc2, 0xb0, 0x0}, + {0xc3, 0xa7, 0x0}, {0xc2, 0xbb, 0x0}, {0x5e, 0x0, 0x0}, {0x23, 0x0, 0x0}, + {0xc3, 0xb9, 0x0}, {0xc3, 0xa0, 0x0}, {0xc3, 0xb2, 0x0}, {0xc3, 0xa8, 0x0}, + {0xc3, 0xac, 0x0}}; + +enum class TELETEXT_NATIONAL_SUBSET : uint8_t { + ENGLISH = 0, + FRENCH = 1, + SWEDISH_FINNISH_HUNGARIAN = 2, + CZECH_SLOVAK = 3, + GERMAN = 4, + PORTUGUESE_SPANISH = 5, + ITALIAN = 6, + NONE = 7 +}; + +const uint8_t TELETEXT_CHARSET_G2_LATIN[96][3] = { + {0x20, 0x0, 0x0}, {0xc2, 0xa1, 0x0}, {0xc2, 0xa2, 0x0}, {0xc2, 0xa3, 0x0}, + {0x24, 0x0, 0x0}, {0xc2, 0xa5, 0x0}, {0x23, 0x0, 0x0}, {0xc2, 0xa7, 0x0}, + {0xc2, 0xa4, 0x0}, {0x20, 0x18, 0x0}, {0x20, 0x1c, 0x0}, {0xc2, 0xab, 0x0}, + {0x21, 0x90, 0x0}, {0x21, 0x91, 0x0}, {0x21, 0x92, 0x0}, {0x21, 0x93, 0x0}, + {0xc2, 0xb0, 0x0}, {0xc2, 0xb1, 0x0}, {0xc2, 0xb2, 0x0}, {0xc2, 0xb3, 0x0}, + {0xc3, 0x97, 0x0}, {0xc2, 0xb5, 0x0}, {0xc2, 0xb6, 0x0}, {0xc2, 0xb7, 0x0}, + {0xc3, 0xb7, 0x0}, {0x20, 0x19, 0x0}, {0x20, 0x1d, 0x0}, {0xc2, 0xbb, 0x0}, + {0xc2, 0xbc, 0x0}, {0xc2, 0xbd, 0x0}, {0xc2, 0xbe, 0x0}, {0xbf, 0x0, 0x0}, + {0x20, 0x0, 0x0}, {0xcc, 0x80, 0x0}, {0xcc, 0x81, 0x0}, {0xcc, 0x82, 0x0}, + {0xcc, 0x83, 0x0}, {0xcc, 0x84, 0x0}, {0xcc, 0x86, 0x0}, {0xcc, 0x87, 0x0}, + {0xcc, 0x88, 0x0}, {0x0, 0x0, 0x0}, {0xcc, 0x8a, 0x0}, {0xcc, 0xa7, 0x0}, + {0x5f, 0x0, 0x0}, {0xcc, 0x8b, 0x0}, {0xcc, 0xa8, 0x0}, {0xcc, 0x8c, 0x0}, + {0x20, 0x15, 0x0}, {0xc2, 0xb9, 0x0}, {0xc2, 0xae, 0x0}, {0xc2, 0xa9, 0x0}, + {0x21, 0x22, 0x0}, {0x26, 0x6a, 0x0}, {0x20, 0xac, 0x0}, {0x20, 0x30, 0x0}, + {0xce, 0xb1, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, + {0x21, 0x5b, 0x0}, {0x21, 0x5c, 0x0}, {0x21, 0x5d, 0x0}, {0x21, 0x5e, 0x0}, + {0xce, 0xa9, 0x0}, {0xc3, 0x86, 0x0}, {0xc4, 0x90, 0x0}, {0xc2, 0xaa, 0x0}, + {0xc4, 0xa6, 0x0}, {0x0, 0x0, 0x0}, {0xc4, 0xb2, 0x0}, {0xc4, 0xbf, 0x0}, + {0xc5, 0x81, 0x0}, {0xc3, 0x98, 0x0}, {0xc5, 0x92, 0x0}, {0xc2, 0xba, 0x0}, + {0xc3, 0x9e, 0x0}, {0xc5, 0xa6, 0x0}, {0xc5, 0x8a, 0x0}, {0xc5, 0x89, 0x0}, + {0xc4, 0xb8, 0x0}, {0xc3, 0xa6, 0x0}, {0xc4, 0x91, 0x0}, {0xc3, 0xb0, 0x0}, + {0xc4, 0xa7, 0x0}, {0xc4, 0xb1, 0x0}, {0xc4, 0xb3, 0x0}, {0xc5, 0x80, 0x0}, + {0xc5, 0x82, 0x0}, {0xc3, 0xb8, 0x0}, {0xc5, 0x93, 0x0}, {0xc3, 0x9f, 0x0}, + {0xc3, 0xbe, 0x0}, {0xc5, 0xa7, 0x0}, {0xc5, 0x8b, 0x0}, {0x20, 0x0, 0x0}}; + +const uint8_t TELETEXT_G2_LATIN_ACCENTS[15][52][3] = { + { + {0xc3, 0x80, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, + {0xc3, 0x88, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, + {0xc3, 0x8c, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, + {0x0, 0x0, 0x0}, {0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, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, + {0x0, 0x0, 0x0}, {0xc5, 0xbd, 0x0}, {0x0, 0x0, 0x0}, + {0x0, 0x0, 0x0}, {0xc4, 0x8d, 0x0}, {0xc4, 0x8f, 0x0}, + {0xc4, 0x9b, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, + {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, + {0x0, 0x0, 0x0}, {0xc4, 0xbe, 0x0}, {0x0, 0x0, 0x0}, + {0xc5, 0x88, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, + {0x0, 0x0, 0x0}, {0xc5, 0x99, 0x0}, {0xc5, 0xa1, 0x0}, + {0xc5, 0xa5, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, + {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, + {0xc5, 0xbe, 0x0}, + }}; + +} // namespace mp2t +} // namespace media +} // namespace shaka + +#endif // PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_TELETEXT_TABLES_H_ diff --git a/packager/media/formats/mp2t/es_parser_teletext_unittest.cc b/packager/media/formats/mp2t/es_parser_teletext_unittest.cc new file mode 100644 index 0000000000..3cb9d59f48 --- /dev/null +++ b/packager/media/formats/mp2t/es_parser_teletext_unittest.cc @@ -0,0 +1,267 @@ +// Copyright 2016 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#include +#include +#include + +#include "packager/media/base/text_sample.h" +#include "packager/media/base/text_stream_info.h" +#include "packager/media/formats/mp2t/es_parser_teletext.h" + +namespace shaka { +namespace media { +namespace mp2t { + +namespace { + +const uint8_t DESCRIPTOR[] = {0x56, 0x0a, 0x63, 0x61, 0x74, 0x09, + 0x00, 0x63, 0x61, 0x74, 0x10, 0x88}; + +const uint8_t PES_283413[] = { + 0x10, 0x02, 0x2c, 0xe7, 0xe4, 0x92, 0x85, 0x80, 0xfe, 0x6b, 0x97, 0xce, + 0x97, 0x2f, 0xa7, 0xce, 0x40, 0xfe, 0x0b, 0xfb, 0x46, 0x37, 0x97, 0xc7, + 0xc1, 0x04, 0xfe, 0x32, 0x86, 0x04, 0x43, 0xf7, 0x2f, 0x97, 0xe6, 0x86, + 0x61, 0xfe, 0x05, 0x76, 0x26, 0xa7, 0x1f, 0x04, 0x2a, 0x6b, 0xc2, 0x03, + 0x2c, 0xe8, 0xe4, 0xa8, 0xa8, 0x0b, 0x0b, 0xa8, 0x0b, 0xa8, 0x0b, 0xf4, + 0xd9, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x23, 0xc7, 0x75, 0x8c, 0x1c, 0x04, 0x04, + 0x04, 0x8c, 0x8c, 0x8c, 0x04, 0x8c, 0x6d, 0x5d, 0x0d, 0x03, 0x2c, 0xe9, + 0xe4, 0xa8, 0xa8, 0x0b, 0x0b, 0xa8, 0x0b, 0xa8, 0x0b, 0xf4, 0xd9, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x23, 0xc7, 0x75, 0x8c, 0x1c, 0x04, 0x04, 0x04, 0x8c, + 0x8c, 0x8c, 0x04, 0x8c, 0x6d, 0x5d, 0x0d, 0x03, 0x2c, 0xea, 0xe4, 0xa8, + 0xa8, 0x0b, 0x0b, 0xa8, 0x0b, 0xa8, 0x0b, 0xf4, 0xd9, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x23, 0xc7, 0x75, 0x8c, 0x1c, 0x04, 0x04, 0x04, 0x8c, 0x8c, 0x8c, + 0x04, 0x8c, 0x6d, 0x5d, 0x0d, 0x03, 0x2c, 0xc7, 0xe4, 0xa8, 0x6d, 0xa8, + 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, + 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, + 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, + 0xb7, 0xc0, 0x00, 0x03, 0x2c, 0xc8, 0xe4, 0x0b, 0x6d, 0xa8, 0x57, 0x57, + 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, + 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, + 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, 0xa8, 0xec, + 0x82, 0x03, 0x2c, 0xc9, 0xe4, 0xa8, 0xd9, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xb0, 0xd0, 0xd0, + 0x43, 0xf7, 0x76, 0x04, 0x26, 0x97, 0x86, 0x85, 0x51, 0x51, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}; + +const uint8_t PES_407876[] = { + 0x10, 0x02, 0x2c, 0xe7, 0xe4, 0x7a, 0x85, 0x80, 0xfe, 0x0b, 0x7f, 0xe6, + 0x75, 0xd5, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x61, 0xfe, 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 0xff, 0x2e, 0xfe, 0xff, + 0xf9, 0x2d, 0x00, 0x03, 0x2c, 0xc8, 0xe4, 0x0b, 0x6d, 0xa8, 0x57, 0x57, + 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, + 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, + 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, 0xa8, 0x00, + 0x00, 0x02, 0x2c, 0xc9, 0xe4, 0x40, 0xa8, 0xa8, 0xa8, 0x40, 0x0b, 0xa8, + 0xa8, 0xa8, 0x31, 0x2a, 0x6b, 0xcd, 0x2a, 0xa2, 0x1a, 0x2a, 0xc1, 0x2a, + 0x6b, 0xcd, 0xe0, 0x8c, 0x0d, 0x0d, 0x04, 0x23, 0xc7, 0x75, 0x8c, 0x1c, + 0xc1, 0x04, 0x04, 0x04, 0x8c, 0x6d, 0x5d, 0x0d, 0xcd, 0x5d, 0x4c}; + +const uint8_t PES_8768632[] = { + 0x10, 0x02, 0x2c, 0xe7, 0xe4, 0x92, 0x0b, 0xc8, 0x34, 0x34, 0x34, 0x34, + 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, + 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, + 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x02, + 0x2c, 0xe8, 0xe4, 0x92, 0xe3, 0x40, 0x73, 0xf7, 0x2f, 0xba, 0xc7, 0x97, + 0xa7, 0xce, 0x04, 0xa7, 0xce, 0x0e, 0xf7, 0x4f, 0x2f, 0x97, 0x6e, 0xa7, + 0xce, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x8c, 0xad, 0x0d, 0x02, 0x2c, 0xe9, + 0xe4, 0x31, 0x31, 0xc8, 0xb9, 0x01, 0xb0, 0x0b, 0x4f, 0xf7, 0xe6, 0x4f, + 0x86, 0xb6, 0x86, 0xc7, 0x97, 0x7a, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x75, 0x75, 0x75, 0x75, 0xcd, 0x0d, 0x0d, 0x02, 0x2c, 0xea, 0xe4, 0x31, + 0xd9, 0xe0, 0xb9, 0x01, 0x04, 0x92, 0x76, 0x67, 0xf7, 0x4f, 0xb6, 0x86, + 0xc7, 0x97, 0x7a, 0x04, 0x2a, 0x6b, 0xc2, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x75, 0x75, 0x4c, 0x1c, 0x0d, 0x02, 0x2c, 0xc7, 0xe4, 0x92, 0x85, 0x80, + 0xfe, 0x62, 0x75, 0xcb, 0x86, 0x37, 0x86, 0x04, 0xb6, 0x86, 0xce, 0x75, + 0x04, 0x40, 0xfe, 0x43, 0x7f, 0xce, 0x8f, 0xae, 0xa7, 0x2f, 0xc1, 0xfe, + 0x62, 0xae, 0x2f, 0x46, 0xf7, 0x37, 0x61, 0xfe, 0xa2, 0xce, 0x0e, 0xf7, + 0x4f, 0x2f, 0xce, 0x03, 0x2c, 0xc8, 0xe4, 0xa8, 0xa8, 0x0b, 0x0b, 0xa8, + 0x0b, 0xa8, 0x0b, 0xf4, 0xd9, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x23, 0xc7, 0x75, + 0x8c, 0x1c, 0x04, 0x04, 0x04, 0x97, 0x2f, 0xae, 0x37, 0x86, 0x4f, 0xce, + 0x75, 0x03, 0x2c, 0xc9, 0xe4, 0xa8, 0xa8, 0x0b, 0x0b, 0xa8, 0x0b, 0xa8, + 0x0b, 0xf4, 0xd9, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x23, 0xc7, 0x75, 0x8c, 0x1c, + 0x04, 0x04, 0x04, 0x97, 0x2f, 0xae, 0x37, 0x86, 0x4f, 0xce, 0x75}; + +const uint8_t PES_8773087[] = { + 0x10, 0x03, 0x2c, 0xe7, 0xe4, 0xa8, 0x6d, 0xa8, 0x2e, 0xfe, 0xff, 0x2e, + 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, + 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, + 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0x2e, 0xfe, 0xff, 0xdc, 0x08, 0x00, 0x03, + 0x2c, 0xe8, 0xe4, 0x0b, 0x6d, 0xa8, 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, + 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, + 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, + 0x57, 0x57, 0x57, 0xf4, 0x57, 0x7a, 0xa8, 0x25, 0xee, 0x03, 0x2c, 0xe9, + 0xe4, 0xa8, 0x31, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xb0, 0xd0, 0xd0, 0xb5, 0xcb, + 0xba, 0xfd, 0x51, 0x51, 0x04, 0x04, 0x04, 0x04, 0x04, 0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+ 0xc1, 0x04, 0x04, 0x2f, 0xae, 0x37, 0x86, 0x4f, 0xce, 0x75, 0x75}; + +const uint8_t PES_8937764[] = { + 0x10, 0x02, 0x2c, 0xe7, 0xe4, 0x31, 0xe3, 0x04, 0x61, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x86, 0xc7, 0x86, 0xce, 0x86, + 0xce, 0x15, 0x86, 0x94, 0x2f, 0x6e, 0xcd, 0x75, 0xc7, 0x86, 0x2f, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x02, + 0x2c, 0xe8, 0xe4, 0x92, 0x31, 0x04, 0x80, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x15, 0x86, + 0x94, 0xbc, 0x86, 0x4f, 0x4f, 0xf7, 0x6e, 0x86, 0x04, 0x02, 0x2c, 0xe9, + 0xe4, 0x31, 0x31, 0x80, 0xb9, 0x01, 0xb0, 0xa2, 0x37, 0x04, 0x2f, 0xa7, + 0xb6, 0x0e, 0xce, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x75, 0x75, 0x75, 0x75, 0x8c, 0x6d, 0x0d, 0x02, 0x2c, 0xea, 0xe4, 0x31, + 0xd9, 0xe0, 0xb9, 0x01, 0x04, 0x05, 0x76, 0x26, 0xa7, 0x1f, 0x04, 0x4f, + 0x7f, 0x0e, 0x97, 0x26, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x75, 0x75, 0x4c, 0x1c, 0x4c, 0x02, 0x2c, 0xc7, 0xe4, 0x92, 0x85, 0x80, + 0xfe, 0x05, 0x76, 0x26, 0xa7, 0x1f, 0x40, 0xfe, 0x0b, 0x4f, 0xf7, 0xe6, + 0x4f, 0x86, 0xb6, 0x86, 0xc7, 0x97, 0x7a, 0xc1, 0xfe, 0xa2, 0xce, 0x0e, + 0xf7, 0x4f, 0x2f, 0xce, 0x61, 0xfe, 0x32, 0xf7, 0x2f, 0xa7, 0x4f, 0x97, + 0xa7, 0xce, 0x04, 0x03, 0x2c, 0xc8, 0xe4, 0xa8, 0xa8, 0x0b, 0x0b, 0xa8, + 0x0b, 0xa8, 0x0b, 0xf4, 0xd9, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x23, 0xc7, 0x75, + 0x8c, 0x1c, 0x04, 0x04, 0x04, 0x86, 0x4f, 0xce, 0x75, 0x75, 0x75, 0x8c, + 0x8c, 0x03, 0x2c, 0xc9, 0xe4, 0xa8, 0xa8, 0x0b, 0x0b, 0xa8, 0x0b, 0xa8, + 0x0b, 0xf4, 0xd9, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x23, 0xc7, 0x75, 0x8c, 0x1c, + 0x04, 0x04, 0x04, 0x86, 0x4f, 0xce, 0x75, 0x75, 0x75, 0x8c, 0x8c}; + +const uint32_t kPesPid = 123; + +} // namespace + +class EsParserTeletextTest : public ::testing::Test { + public: + void OnNewStreamInfo(uint32_t pes_pid, + std::shared_ptr stream_info) { + stream_info_ = stream_info; + } + void OnEmitTextSample(uint32_t pes_pid, + std::shared_ptr text_sample) { + text_sample_ = text_sample; + } + + protected: + std::shared_ptr stream_info_; + std::shared_ptr text_sample_; +}; + +TEST_F(EsParserTeletextTest, descriptor_substreams_has_index_888_language_cat) { + auto on_new_stream = std::bind(&EsParserTeletextTest::OnNewStreamInfo, this, + kPesPid, std::placeholders::_1); + auto on_emit_text = std::bind(&EsParserTeletextTest::OnEmitTextSample, this, + kPesPid, std::placeholders::_1); + + std::unique_ptr es_parser_teletext(new EsParserTeletext( + kPesPid, on_new_stream, on_emit_text, DESCRIPTOR, 12)); + + const auto parse_result = + es_parser_teletext->Parse(PES_283413, sizeof(PES_283413), 283413, 0); + EXPECT_TRUE(parse_result); + + EXPECT_NE(nullptr, stream_info_.get()); + auto text_stream_info = static_cast(stream_info_.get()); + auto& sub_streams = text_stream_info->sub_streams(); + + EXPECT_EQ(2, sub_streams.size()); + auto sub_streams_itr = sub_streams.find(888); + EXPECT_NE(sub_streams.end(), sub_streams_itr); + EXPECT_EQ("cat", sub_streams_itr->second.language); +} + +TEST_F(EsParserTeletextTest, pes_283413_line_emitted_on_next_pes) { + auto on_new_stream = std::bind(&EsParserTeletextTest::OnNewStreamInfo, this, + kPesPid, std::placeholders::_1); + auto on_emit_text = std::bind(&EsParserTeletextTest::OnEmitTextSample, this, + kPesPid, std::placeholders::_1); + + std::unique_ptr es_parser_teletext(new EsParserTeletext( + kPesPid, on_new_stream, on_emit_text, DESCRIPTOR, 12)); + + auto parse_result = + es_parser_teletext->Parse(PES_283413, sizeof(PES_283413), 283413, 0); + EXPECT_TRUE(parse_result); + + parse_result = + es_parser_teletext->Parse(PES_407876, sizeof(PES_407876), 407876, 0); + EXPECT_TRUE(parse_result); + + EXPECT_NE(nullptr, text_sample_.get()); + EXPECT_EQ(283413, text_sample_->start_time()); + EXPECT_EQ(407876, text_sample_->EndTime()); + EXPECT_EQ("Bon dia!", text_sample_->body().body); +} + +TEST_F(EsParserTeletextTest, multiple_lines_with_same_pts) { + auto on_new_stream = std::bind(&EsParserTeletextTest::OnNewStreamInfo, this, + kPesPid, std::placeholders::_1); + auto on_emit_text = std::bind(&EsParserTeletextTest::OnEmitTextSample, this, + kPesPid, std::placeholders::_1); + + std::unique_ptr es_parser_teletext(new EsParserTeletext( + kPesPid, on_new_stream, on_emit_text, DESCRIPTOR, 12)); + + auto parse_result = + es_parser_teletext->Parse(PES_8768632, sizeof(PES_8768632), 8768632, 0); + EXPECT_TRUE(parse_result); + + parse_result = + es_parser_teletext->Parse(PES_8773087, sizeof(PES_8773087), 8773087, 0); + EXPECT_TRUE(parse_result); + + parse_result = + es_parser_teletext->Parse(PES_8937764, sizeof(PES_8937764), 8937764, 0); + EXPECT_TRUE(parse_result); + + EXPECT_NE(nullptr, text_sample_.get()); + EXPECT_EQ(8768632, text_sample_->start_time()); + EXPECT_EQ(8937764, text_sample_->EndTime()); + EXPECT_EQ(3, text_sample_->body().sub_fragments.size()); + EXPECT_EQ("-Sí?", text_sample_->body().sub_fragments[0].body); + EXPECT_TRUE(text_sample_->body().sub_fragments[1].newline); + EXPECT_EQ("-Sí.", text_sample_->body().sub_fragments[2].body); +} + +} // namespace mp2t +} // namespace media +} // namespace shaka diff --git a/packager/media/formats/mp2t/mp2t_media_parser.cc b/packager/media/formats/mp2t/mp2t_media_parser.cc index a7e4ed5adc..0683d954a3 100644 --- a/packager/media/formats/mp2t/mp2t_media_parser.cc +++ b/packager/media/formats/mp2t/mp2t_media_parser.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -329,6 +330,12 @@ void Mp2tMediaParser::RegisterPes(int pmt_pid, descriptor, descriptor_length)); pid_type = PidState::kPidTextPes; break; + case TsStreamType::kTeletextSubtitles: + es_parser.reset(new EsParserTeletext(pes_pid, on_new_stream, on_emit_text, + descriptor, descriptor_length)); + pid_type = PidState::kPidTextPes; + break; + default: { auto type = static_cast(stream_type); DCHECK(type <= 0xff); diff --git a/packager/media/formats/mp2t/ts_section_pmt.cc b/packager/media/formats/mp2t/ts_section_pmt.cc index f8748017e0..6c3b8895c2 100644 --- a/packager/media/formats/mp2t/ts_section_pmt.cc +++ b/packager/media/formats/mp2t/ts_section_pmt.cc @@ -21,6 +21,7 @@ namespace { const int kISO639LanguageDescriptor = 0x0A; const int kMaximumBitrateDescriptor = 0x0E; +const int kTeletextDescriptor = 0x56; const int kSubtitlingDescriptor = 0x59; } // namespace @@ -125,9 +126,17 @@ bool TsSectionPmt::ParsePsiSection(BitReader* bit_reader) { es_info_length -= 2; // See ETSI EN 300 468 Section 6.1 - if (stream_type == TsStreamType::kPesPrivateData && - descriptor_tag == kSubtitlingDescriptor) { - pid_info.back().stream_type = TsStreamType::kDvbSubtitles; + if (stream_type == TsStreamType::kPesPrivateData) { + switch (descriptor_tag) { + case kTeletextDescriptor: + pid_info.back().stream_type = TsStreamType::kTeletextSubtitles; + break; + case kSubtitlingDescriptor: + pid_info.back().stream_type = TsStreamType::kDvbSubtitles; + break; + default: + break; + } } else if (descriptor_tag == kISO639LanguageDescriptor && descriptor_length >= 4) { // See section 2.6.19 of ISO-13818 diff --git a/packager/media/formats/mp2t/ts_stream_type.h b/packager/media/formats/mp2t/ts_stream_type.h index 459311da0d..27abbb9e85 100644 --- a/packager/media/formats/mp2t/ts_stream_type.h +++ b/packager/media/formats/mp2t/ts_stream_type.h @@ -45,6 +45,7 @@ enum class TsStreamType { // Below are internal values used to select other stream types based on other // info in headers. kDvbSubtitles = 0x100, + kTeletextSubtitles = 0x101, }; } // namespace mp2t diff --git a/packager/media/formats/webvtt/webvtt_to_mp4_handler.cc b/packager/media/formats/webvtt/webvtt_to_mp4_handler.cc index 3eeabaec1b..280dadd582 100644 --- a/packager/media/formats/webvtt/webvtt_to_mp4_handler.cc +++ b/packager/media/formats/webvtt/webvtt_to_mp4_handler.cc @@ -132,7 +132,16 @@ Status WebVttToMp4Handler::OnStreamInfo( DCHECK(stream_data); DCHECK(stream_data->stream_info); - return Dispatch(std::move(stream_data)); + auto clone = stream_data->stream_info->Clone(); + clone->set_codec(kCodecWebVtt); + clone->set_codec_string("wvtt"); + + if (clone->stream_type() != kStreamText) { + return Status(error::MUXER_FAILURE, "Incorrect stream type"); + } + + return Dispatch( + StreamData::FromStreamInfo(stream_data->stream_index, std::move(clone))); } Status WebVttToMp4Handler::OnCueEvent(std::unique_ptr stream_data) {