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