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 class definition for the WebVTT subtitle reader 10 11 Written by Moritz Bunkus <moritz@bunkus.org>. 12 */ 13 14 #pragma once 15 16 #include "common/common_pch.h" 17 18 #include "common/webvtt.h" 19 #include "merge/generic_reader.h" 20 21 class webvtt_reader_c: public generic_reader_c { 22 private: 23 mtx::webvtt::parser_cptr m_parser; 24 int64_t m_bytes_to_process{}, m_bytes_processed{}; 25 26 public: get_format_type()27 virtual mtx::file_type_e get_format_type() const { 28 return mtx::file_type_e::webvtt; 29 } 30 31 virtual void read_headers(); 32 virtual void identify(); 33 virtual void create_packetizer(int64_t tid); 34 virtual int64_t get_progress() override; 35 virtual int64_t get_maximum_progress() override; is_simple_subtitle_container()36 virtual bool is_simple_subtitle_container() { 37 return true; 38 } 39 40 virtual bool probe_file() override; 41 42 protected: 43 virtual file_status_e read(generic_packetizer_c *packetizer, bool force = false) override; 44 45 virtual void parse_file(); 46 }; 47