Shaka Packager SDK
es_parser_dvb.h
1 // Copyright 2020 Google LLC. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_DVB_H_
8 #define PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_DVB_H_
9 
10 #include <functional>
11 #include <unordered_map>
12 
13 #include <packager/media/base/byte_queue.h>
14 #include <packager/media/formats/dvb/dvb_sub_parser.h>
15 #include <packager/media/formats/mp2t/es_parser.h>
16 #include <functional>
17 
18 namespace shaka {
19 namespace media {
20 namespace mp2t {
21 
22 class EsParserDvb : public EsParser {
23  public:
24  EsParserDvb(uint32_t pid,
25  const NewStreamInfoCB& new_stream_info_cb,
26  const EmitTextSampleCB& emit_sample_cb,
27  const uint8_t* descriptor,
28  size_t descriptor_length);
29  ~EsParserDvb() override;
30 
31  // EsParser implementation.
32  bool Parse(const uint8_t* buf, int size, int64_t pts, int64_t dts) override;
33  bool Flush() override;
34  void Reset() override;
35 
36  private:
37  EsParserDvb(const EsParserDvb&) = delete;
38  EsParserDvb& operator=(const EsParserDvb&) = delete;
39 
40  bool ParseInternal(const uint8_t* data, size_t size, int64_t pts);
41 
42  // Callbacks:
43  // - to signal a new audio configuration,
44  // - to send ES buffers.
45  NewStreamInfoCB new_stream_info_cb_;
46  EmitTextSampleCB emit_sample_cb_;
47 
48  // A map of page_id to parser.
49  std::unordered_map<uint16_t, DvbSubParser> parsers_;
50  // A map of page_id to language.
51  std::unordered_map<uint16_t, std::string> languages_;
52  bool sent_info_ = false;
53 };
54 
55 } // namespace mp2t
56 } // namespace media
57 } // namespace shaka
58 
59 #endif // PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_DVB_H_
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66