| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "media/base/byte_queue.h" | 14 #include "media/base/byte_queue.h" |
| 14 #include "media/formats/mp2t/ts_section.h" | 15 #include "media/formats/mp2t/ts_section.h" |
| 15 | 16 |
| 16 namespace media { | 17 namespace media { |
| 17 namespace mp2t { | 18 namespace mp2t { |
| 18 | 19 |
| 19 class EsParser; | 20 class EsParser; |
| 20 class TimestampUnroller; | 21 class TimestampUnroller; |
| 21 | 22 |
| 22 class TsSectionPes : public TsSection { | 23 class TsSectionPes : public TsSection { |
| 23 public: | 24 public: |
| 24 TsSectionPes(scoped_ptr<EsParser> es_parser, | 25 TsSectionPes(std::unique_ptr<EsParser> es_parser, |
| 25 TimestampUnroller* timestamp_unroller); | 26 TimestampUnroller* timestamp_unroller); |
| 26 ~TsSectionPes() override; | 27 ~TsSectionPes() override; |
| 27 | 28 |
| 28 // TsSection implementation. | 29 // TsSection implementation. |
| 29 bool Parse(bool payload_unit_start_indicator, | 30 bool Parse(bool payload_unit_start_indicator, |
| 30 const uint8_t* buf, | 31 const uint8_t* buf, |
| 31 int size) override; | 32 int size) override; |
| 32 void Flush() override; | 33 void Flush() override; |
| 33 void Reset() override; | 34 void Reset() override; |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 // Emit a reassembled PES packet. | 37 // Emit a reassembled PES packet. |
| 37 // Return true if successful. | 38 // Return true if successful. |
| 38 // |emit_for_unknown_size| is used to force emission for PES packets | 39 // |emit_for_unknown_size| is used to force emission for PES packets |
| 39 // whose size is unknown. | 40 // whose size is unknown. |
| 40 bool Emit(bool emit_for_unknown_size); | 41 bool Emit(bool emit_for_unknown_size); |
| 41 | 42 |
| 42 // Parse a PES packet, return true if successful. | 43 // Parse a PES packet, return true if successful. |
| 43 bool ParseInternal(const uint8_t* raw_pes, int raw_pes_size); | 44 bool ParseInternal(const uint8_t* raw_pes, int raw_pes_size); |
| 44 | 45 |
| 45 void ResetPesState(); | 46 void ResetPesState(); |
| 46 | 47 |
| 47 // Bytes of the current PES. | 48 // Bytes of the current PES. |
| 48 ByteQueue pes_byte_queue_; | 49 ByteQueue pes_byte_queue_; |
| 49 | 50 |
| 50 // ES parser. | 51 // ES parser. |
| 51 scoped_ptr<EsParser> es_parser_; | 52 std::unique_ptr<EsParser> es_parser_; |
| 52 | 53 |
| 53 // Do not start parsing before getting a unit start indicator. | 54 // Do not start parsing before getting a unit start indicator. |
| 54 bool wait_for_pusi_; | 55 bool wait_for_pusi_; |
| 55 | 56 |
| 56 // Used to unroll PTS and DTS. | 57 // Used to unroll PTS and DTS. |
| 57 TimestampUnroller* const timestamp_unroller_; | 58 TimestampUnroller* const timestamp_unroller_; |
| 58 | 59 |
| 59 DISALLOW_COPY_AND_ASSIGN(TsSectionPes); | 60 DISALLOW_COPY_AND_ASSIGN(TsSectionPes); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 } // namespace mp2t | 63 } // namespace mp2t |
| 63 } // namespace media | 64 } // namespace media |
| 64 | 65 |
| 65 #endif | 66 #endif |
| 66 | 67 |
| OLD | NEW |