5 #ifndef MEDIA_FORMATS_MP2T_ES_PARSER_H26x_H_
6 #define MEDIA_FORMATS_MP2T_ES_PARSER_H26x_H_
12 #include "packager/base/callback.h"
13 #include "packager/base/compiler_specific.h"
14 #include "packager/base/memory/scoped_ptr.h"
15 #include "packager/media/codecs/nalu_reader.h"
16 #include "packager/media/formats/mp2t/es_parser.h"
21 class H26xByteToUnitStreamConverter;
22 class OffsetByteQueue;
30 scoped_ptr<H26xByteToUnitStreamConverter> stream_converter,
32 const EmitSampleCB& emit_sample_cb);
36 bool Parse(
const uint8_t* buf,
int size, int64_t pts, int64_t dts)
override;
37 void Flush()
override;
38 void Reset()
override;
42 return stream_converter_.get();
53 virtual bool ProcessNalu(
const Nalu& nalu,
55 int* pps_id_for_access_unit) = 0;
59 virtual bool UpdateVideoDecoderConfig(
int pps_id) = 0;
65 bool FindNextAccessUnit(int64_t stream_pos, int64_t* next_unit_start);
73 bool EmitFrame(int64_t access_unit_pos,
79 EmitSampleCB emit_sample_cb_;
82 Nalu::CodecType type_;
85 scoped_ptr<media::OffsetByteQueue> es_queue_;
86 std::list<std::pair<int64_t, TimingDesc>> timing_desc_list_;
91 int64_t current_access_unit_pos_;
92 bool found_access_unit_;
95 scoped_ptr<H26xByteToUnitStreamConverter> stream_converter_;
98 scoped_refptr<MediaSample> pending_sample_;
99 uint64_t pending_sample_duration_;
102 bool waiting_for_key_frame_;