| 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_MP4_MP4_STREAM_PARSER_H_ | 5 #ifndef MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ |
| 6 #define MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ | 6 #define MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace mp4 { | 21 namespace mp4 { |
| 22 | 22 |
| 23 struct Movie; | 23 struct Movie; |
| 24 class BoxReader; | 24 class BoxReader; |
| 25 | 25 |
| 26 class MEDIA_EXPORT MP4StreamParser : public StreamParser { | 26 class MEDIA_EXPORT MP4StreamParser : public StreamParser { |
| 27 public: | 27 public: |
| 28 MP4StreamParser(const std::set<int>& audio_object_types, bool has_sbr); | 28 MP4StreamParser(const std::set<int>& audio_object_types, bool has_sbr); |
| 29 ~MP4StreamParser() override; | 29 ~MP4StreamParser() override; |
| 30 | 30 |
| 31 void Init( | 31 void Init(const InitCB& init_cb, |
| 32 const InitCB& init_cb, | 32 const NewConfigCB& config_cb, |
| 33 const NewConfigCB& config_cb, | 33 const NewBuffersCB& new_buffers_cb, |
| 34 const NewBuffersCB& new_buffers_cb, | 34 bool ignore_text_tracks, |
| 35 bool ignore_text_tracks, | 35 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, |
| 36 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, | 36 const NewMediaSegmentCB& new_segment_cb, |
| 37 const NewMediaSegmentCB& new_segment_cb, | 37 const base::Closure& end_of_segment_cb, |
| 38 const base::Closure& end_of_segment_cb, | 38 const scoped_refptr<MediaLog>& media_log) override; |
| 39 const LogCB& log_cb) override; | |
| 40 void Flush() override; | 39 void Flush() override; |
| 41 bool Parse(const uint8* buf, int size) override; | 40 bool Parse(const uint8* buf, int size) override; |
| 42 | 41 |
| 43 private: | 42 private: |
| 44 enum State { | 43 enum State { |
| 45 kWaitingForInit, | 44 kWaitingForInit, |
| 46 kParsingBoxes, | 45 kParsingBoxes, |
| 47 kWaitingForSampleData, | 46 kWaitingForSampleData, |
| 48 kEmittingSamples, | 47 kEmittingSamples, |
| 49 kError | 48 kError |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // computed. | 91 // computed. |
| 93 bool ComputeHighestEndOffset(const MovieFragment& moof); | 92 bool ComputeHighestEndOffset(const MovieFragment& moof); |
| 94 | 93 |
| 95 State state_; | 94 State state_; |
| 96 InitCB init_cb_; | 95 InitCB init_cb_; |
| 97 NewConfigCB config_cb_; | 96 NewConfigCB config_cb_; |
| 98 NewBuffersCB new_buffers_cb_; | 97 NewBuffersCB new_buffers_cb_; |
| 99 EncryptedMediaInitDataCB encrypted_media_init_data_cb_; | 98 EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
| 100 NewMediaSegmentCB new_segment_cb_; | 99 NewMediaSegmentCB new_segment_cb_; |
| 101 base::Closure end_of_segment_cb_; | 100 base::Closure end_of_segment_cb_; |
| 102 LogCB log_cb_; | 101 scoped_refptr<MediaLog> media_log_; |
| 103 | 102 |
| 104 OffsetByteQueue queue_; | 103 OffsetByteQueue queue_; |
| 105 | 104 |
| 106 // These two parameters are only valid in the |kEmittingSegments| state. | 105 // These two parameters are only valid in the |kEmittingSegments| state. |
| 107 // | 106 // |
| 108 // |moof_head_| is the offset of the start of the most recently parsed moof | 107 // |moof_head_| is the offset of the start of the most recently parsed moof |
| 109 // block. All byte offsets in sample information are relative to this offset, | 108 // block. All byte offsets in sample information are relative to this offset, |
| 110 // as mandated by the Media Source spec. | 109 // as mandated by the Media Source spec. |
| 111 int64 moof_head_; | 110 int64 moof_head_; |
| 112 // |mdat_tail_| is the stream offset of the end of the current 'mdat' box. | 111 // |mdat_tail_| is the stream offset of the end of the current 'mdat' box. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 135 // prevent log spam. | 134 // prevent log spam. |
| 136 int num_top_level_box_skipped_; | 135 int num_top_level_box_skipped_; |
| 137 | 136 |
| 138 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); | 137 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); |
| 139 }; | 138 }; |
| 140 | 139 |
| 141 } // namespace mp4 | 140 } // namespace mp4 |
| 142 } // namespace media | 141 } // namespace media |
| 143 | 142 |
| 144 #endif // MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ | 143 #endif // MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ |
| OLD | NEW |