| 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_ES_PARSER_H_ | 5 #ifndef MEDIA_FORMATS_MP2T_ES_PARSER_H_ |
| 6 #define MEDIA_FORMATS_MP2T_ES_PARSER_H_ | 6 #define MEDIA_FORMATS_MP2T_ES_PARSER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> |
| 11 #include <utility> | 12 #include <utility> |
| 12 | 13 |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 17 #include "media/base/media_export.h" | 18 #include "media/base/media_export.h" |
| 18 #include "media/base/stream_parser_buffer.h" | 19 #include "media/base/stream_parser_buffer.h" |
| 19 | 20 |
| 20 namespace media { | 21 namespace media { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 virtual void ResetInternal() = 0; | 62 virtual void ResetInternal() = 0; |
| 62 | 63 |
| 63 // Get the timing descriptor with the largest byte count that is less or | 64 // Get the timing descriptor with the largest byte count that is less or |
| 64 // equal to |es_byte_count|. | 65 // equal to |es_byte_count|. |
| 65 // This timing descriptor and all the ones that come before (in stream order) | 66 // This timing descriptor and all the ones that come before (in stream order) |
| 66 // are removed from list |timing_desc_list_|. | 67 // are removed from list |timing_desc_list_|. |
| 67 // If no timing descriptor is found, then the default TimingDesc is returned. | 68 // If no timing descriptor is found, then the default TimingDesc is returned. |
| 68 TimingDesc GetTimingDescriptor(int64_t es_byte_count); | 69 TimingDesc GetTimingDescriptor(int64_t es_byte_count); |
| 69 | 70 |
| 70 // Bytes of the ES stream that have not been emitted yet. | 71 // Bytes of the ES stream that have not been emitted yet. |
| 71 scoped_ptr<media::OffsetByteQueue> es_queue_; | 72 std::unique_ptr<media::OffsetByteQueue> es_queue_; |
| 72 | 73 |
| 73 private: | 74 private: |
| 74 // Anchor some timing information into the ES queue. | 75 // Anchor some timing information into the ES queue. |
| 75 // Here are two examples how this timing info is applied according to | 76 // Here are two examples how this timing info is applied according to |
| 76 // the MPEG-2 TS spec - ISO/IEC 13818: | 77 // the MPEG-2 TS spec - ISO/IEC 13818: |
| 77 // - "In the case of audio, if a PTS is present in PES packet header it shall | 78 // - "In the case of audio, if a PTS is present in PES packet header it shall |
| 78 // refer to the first access unit commencing in the PES packet. An audio | 79 // refer to the first access unit commencing in the PES packet. An audio |
| 79 // access unit commences in a PES packet if the first byte of the audio | 80 // access unit commences in a PES packet if the first byte of the audio |
| 80 // access unit is present in the PES packet." | 81 // access unit is present in the PES packet." |
| 81 // - "For AVC video streams conforming to one or more profiles defined | 82 // - "For AVC video streams conforming to one or more profiles defined |
| 82 // in Annex A of Rec. ITU-T H.264 | ISO/IEC 14496-10 video, if a PTS is | 83 // in Annex A of Rec. ITU-T H.264 | ISO/IEC 14496-10 video, if a PTS is |
| 83 // present in the PES packet header, it shall refer to the first AVC access | 84 // present in the PES packet header, it shall refer to the first AVC access |
| 84 // unit that commences in this PES packet. | 85 // unit that commences in this PES packet. |
| 85 std::list<std::pair<int64_t, TimingDesc>> timing_desc_list_; | 86 std::list<std::pair<int64_t, TimingDesc>> timing_desc_list_; |
| 86 | 87 |
| 87 DISALLOW_COPY_AND_ASSIGN(EsParser); | 88 DISALLOW_COPY_AND_ASSIGN(EsParser); |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 } // namespace mp2t | 91 } // namespace mp2t |
| 91 } // namespace media | 92 } // namespace media |
| 92 | 93 |
| 93 #endif | 94 #endif |
| OLD | NEW |