Shaka Packager SDK
es_parser_dvb.h
1 // Copyright 2020 Google Inc. 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 <unordered_map>
11 
12 #include "packager/base/callback.h"
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 
17 namespace shaka {
18 namespace media {
19 namespace mp2t {
20 
21 class EsParserDvb : public EsParser {
22  public:
23  EsParserDvb(uint32_t pid,
24  const NewStreamInfoCB& new_stream_info_cb,
25  const EmitTextSampleCB& emit_sample_cb,
26  const uint8_t* descriptor,
27  size_t descriptor_length);
28  ~EsParserDvb() override;
29 
30  // EsParser implementation.
31  bool Parse(const uint8_t* buf, int size, int64_t pts, int64_t dts) override;
32  bool Flush() override;
33  void Reset() override;
34 
35  private:
36  EsParserDvb(const EsParserDvb&) = delete;
37  EsParserDvb& operator=(const EsParserDvb&) = delete;
38 
39  bool ParseInternal(const uint8_t* data, size_t size, int64_t pts);
40 
41  // Callbacks:
42  // - to signal a new audio configuration,
43  // - to send ES buffers.
44  NewStreamInfoCB new_stream_info_cb_;
45  EmitTextSampleCB emit_sample_cb_;
46 
47  // A map of page_id to parser.
48  std::unordered_map<uint16_t, DvbSubParser> parsers_;
49  // A map of page_id to language.
50  std::unordered_map<uint16_t, std::string> languages_;
51  bool sent_info_ = false;
52 };
53 
54 } // namespace mp2t
55 } // namespace media
56 } // namespace shaka
57 
58 #endif // PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_DVB_H_
shaka::media::mp2t::EsParser
Definition: es_parser.h:21
shaka::media::mp2t::EsParserDvb
Definition: es_parser_dvb.h:21
shaka
All the methods that are virtual are virtual for mocking.
Definition: gflags_hex_bytes.cc:11