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