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 Subripper 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 "merge/generic_reader.h"
19 #include "input/subtitles.h"
20 
21 class srt_reader_c: public generic_reader_c {
22 private:
23   srt_parser_cptr m_subs;
24   int64_t m_bytes_to_process{}, m_bytes_processed{};
25   std::optional<std::string> m_encoding;
26 
27 public:
get_format_type()28   virtual mtx::file_type_e get_format_type() const {
29     return mtx::file_type_e::srt;
30   }
31 
32   virtual void read_headers();
33   virtual void identify();
34   virtual void create_packetizer(int64_t tid);
35   virtual int64_t get_progress() override;
36   virtual int64_t get_maximum_progress() override;
is_simple_subtitle_container()37   virtual bool is_simple_subtitle_container() {
38     return true;
39   }
40 
41   virtual bool probe_file() override;
42 
43 protected:
44   virtual file_status_e read(generic_packetizer_c *packetizer, bool force = false) override;
45 };
46