1 /* 2 mkvmerge -- utility for splicing together matroska files 3 from component media subtypes 4 5 Distributed under the GPL v2 6 see the file COPYING for details 7 or visit https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 8 9 WebVTT subtitle packetizer 10 11 Written by Moritz Bunkus <moritz@bunkus.org>. 12 */ 13 14 #include "common/common_pch.h" 15 16 #include "common/codec.h" 17 #include "common/strings/editing.h" 18 #include "merge/connection_checks.h" 19 #include "output/p_webvtt.h" 20 webvtt_packetizer_c(generic_reader_c * p_reader,track_info_c & p_ti)21webvtt_packetizer_c::webvtt_packetizer_c(generic_reader_c *p_reader, 22 track_info_c &p_ti) 23 : textsubs_packetizer_c{p_reader, p_ti, MKV_S_TEXTWEBVTT} 24 { 25 m_line_ending_style = mtx::string::line_ending_style_e::lf; 26 } 27 ~webvtt_packetizer_c()28webvtt_packetizer_c::~webvtt_packetizer_c() { 29 } 30 31 void process_impl(packet_cptr const & packet)32webvtt_packetizer_c::process_impl(packet_cptr const &packet) { 33 for (auto &addition : packet->data_adds) 34 addition = memory_c::clone(mtx::string::normalize_line_endings(addition->to_string())); 35 textsubs_packetizer_c::process_impl(packet); 36 } 37 38 connection_result_e can_connect_to(generic_packetizer_c * src,std::string & error_message)39webvtt_packetizer_c::can_connect_to(generic_packetizer_c *src, 40 std::string &error_message) { 41 auto psrc = dynamic_cast<webvtt_packetizer_c *>(src); 42 if (!psrc) 43 return CAN_CONNECT_NO_FORMAT; 44 45 connect_check_codec_private(src); 46 47 return CAN_CONNECT_YES; 48 } 49