5 #ifndef PACKAGER_MEDIA_FORMATS_MP2T_MP2T_MEDIA_PARSER_H_
6 #define PACKAGER_MEDIA_FORMATS_MP2T_MP2T_MEDIA_PARSER_H_
14 #include <packager/macros/classes.h>
15 #include <packager/media/base/byte_queue.h>
16 #include <packager/media/base/media_parser.h>
17 #include <packager/media/base/stream_info.h>
18 #include <packager/media/formats/mp2t/ts_audio_type.h>
19 #include <packager/media/formats/mp2t/ts_stream_type.h>
35 TsAudioType audio_type;
48 KeySource* decryption_key_source)
override;
49 [[nodiscard]]
bool Flush()
override;
50 [[nodiscard]]
bool Parse(
const uint8_t* buf,
int size)
override;
56 void RegisterPmt(
int program_number,
int pmt_pid);
64 void RegisterPes(
int pmt_pid,
66 TsStreamType media_type,
68 const std::string& lang,
69 TsAudioType audio_type,
70 const uint8_t* descriptor,
71 size_t descriptor_length);
75 void OnNewStreamInfo(uint32_t pes_pid,
76 std::shared_ptr<StreamInfo> new_stream_info);
80 void OnEmitMediaSample(uint32_t pes_pid,
81 std::shared_ptr<MediaSample> new_sample);
82 void OnEmitTextSample(uint32_t pes_pid,
83 std::shared_ptr<TextSample> new_sample);
86 bool FinishInitializationIfNeeded();
88 bool EmitRemainingSamples();
92 void set_sbr_in_mime_type(
bool sbr_in_mimetype) {
93 sbr_in_mimetype_ = sbr_in_mimetype;
101 bool sbr_in_mimetype_;
108 std::map<int, std::unique_ptr<PidState>> pids_;
111 std::map<int, PesMetadata> pes_metadata_;
114 bool is_initialized_;
118 std::bitset<256> stream_type_logged_once_;
All the methods that are virtual are virtual for mocking.