Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / media / formats / mp2t / ts_section_pes.h
blob3be879c3a197faacfabfcf942ccc378febbfa33e
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_FORMATS_MP2T_TS_SECTION_PES_H_
6 #define MEDIA_FORMATS_MP2T_TS_SECTION_PES_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "media/base/byte_queue.h"
12 #include "media/formats/mp2t/ts_section.h"
14 namespace media {
15 namespace mp2t {
17 class EsParser;
18 class TimestampUnroller;
20 class TsSectionPes : public TsSection {
21 public:
22 TsSectionPes(scoped_ptr<EsParser> es_parser,
23 TimestampUnroller* timestamp_unroller);
24 ~TsSectionPes() override;
26 // TsSection implementation.
27 bool Parse(bool payload_unit_start_indicator,
28 const uint8* buf, int size) override;
29 void Flush() override;
30 void Reset() override;
32 private:
33 // Emit a reassembled PES packet.
34 // Return true if successful.
35 // |emit_for_unknown_size| is used to force emission for PES packets
36 // whose size is unknown.
37 bool Emit(bool emit_for_unknown_size);
39 // Parse a PES packet, return true if successful.
40 bool ParseInternal(const uint8* raw_pes, int raw_pes_size);
42 void ResetPesState();
44 // Bytes of the current PES.
45 ByteQueue pes_byte_queue_;
47 // ES parser.
48 scoped_ptr<EsParser> es_parser_;
50 // Do not start parsing before getting a unit start indicator.
51 bool wait_for_pusi_;
53 // Used to unroll PTS and DTS.
54 TimestampUnroller* const timestamp_unroller_;
56 DISALLOW_COPY_AND_ASSIGN(TsSectionPes);
59 } // namespace mp2t
60 } // namespace media
62 #endif