1 // Copyright 2013 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_MP2T_TS_SECTION_PES_H_
6 #define MEDIA_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/mp2t/ts_section.h"
19 class TsSectionPes
: public TsSection
{
21 explicit TsSectionPes(scoped_ptr
<EsParser
> es_parser
);
22 virtual ~TsSectionPes();
24 // TsSection implementation.
25 virtual bool Parse(bool payload_unit_start_indicator
,
26 const uint8
* buf
, int size
) OVERRIDE
;
27 virtual void Flush() OVERRIDE
;
28 virtual void Reset() OVERRIDE
;
31 // Emit a reassembled PES packet.
32 // Return true if successful.
33 // |emit_for_unknown_size| is used to force emission for PES packets
34 // whose size is unknown.
35 bool Emit(bool emit_for_unknown_size
);
37 // Parse a PES packet, return true if successful.
38 bool ParseInternal(const uint8
* raw_pes
, int raw_pes_size
);
42 // Bytes of the current PES.
43 ByteQueue pes_byte_queue_
;
46 scoped_ptr
<EsParser
> es_parser_
;
48 // Do not start parsing before getting a unit start indicator.
51 // Used to unroll PTS and DTS.
52 bool previous_pts_valid_
;
54 bool previous_dts_valid_
;
57 DISALLOW_COPY_AND_ASSIGN(TsSectionPes
);