5 #ifndef MEDIA_FORMATS_MP2T_ES_PARSER_H26x_H_
6 #define MEDIA_FORMATS_MP2T_ES_PARSER_H26x_H_
13 #include "packager/base/callback.h"
14 #include "packager/base/compiler_specific.h"
15 #include "packager/base/memory/scoped_ptr.h"
16 #include "packager/media/codecs/nalu_reader.h"
17 #include "packager/media/formats/mp2t/es_parser.h"
22 class H26xByteToUnitStreamConverter;
23 class OffsetByteQueue;
31 scoped_ptr<H26xByteToUnitStreamConverter> stream_converter,
33 const EmitSampleCB& emit_sample_cb);
37 bool Parse(
const uint8_t* buf,
int size, int64_t pts, int64_t dts)
override;
38 void Flush()
override;
39 void Reset()
override;
43 return stream_converter_.get();
58 uint8_t start_code_size;
63 virtual bool ProcessNalu(
const Nalu& nalu,
65 int* pps_id_for_access_unit) = 0;
69 virtual bool UpdateVideoDecoderConfig(
int pps_id) = 0;
73 bool SkipToFirstAccessUnit();
78 bool SearchForNextNalu();
82 bool ProcessAccessUnit(std::deque<NaluInfo>::iterator end);
90 bool EmitFrame(int64_t access_unit_pos,
96 EmitSampleCB emit_sample_cb_;
99 Nalu::CodecType type_;
102 scoped_ptr<media::OffsetByteQueue> es_queue_;
103 std::list<std::pair<int64_t, TimingDesc>> timing_desc_list_;
107 uint64_t current_search_position_;
111 std::deque<NaluInfo> access_unit_nalus_;
114 scoped_ptr<H26xByteToUnitStreamConverter> stream_converter_;
117 scoped_refptr<MediaSample> pending_sample_;
118 uint64_t pending_sample_duration_;
121 bool waiting_for_key_frame_;