| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 MP4StreamParser(const std::set<int>& audio_object_types, bool has_sbr); | 30 MP4StreamParser(const std::set<int>& audio_object_types, bool has_sbr); |
| 31 ~MP4StreamParser() override; | 31 ~MP4StreamParser() override; |
| 32 | 32 |
| 33 void Init(const InitCB& init_cb, | 33 void Init(const InitCB& init_cb, |
| 34 const NewConfigCB& config_cb, | 34 const NewConfigCB& config_cb, |
| 35 const NewBuffersCB& new_buffers_cb, | 35 const NewBuffersCB& new_buffers_cb, |
| 36 bool ignore_text_tracks, | 36 bool ignore_text_tracks, |
| 37 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, | 37 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, |
| 38 const NewMediaSegmentCB& new_segment_cb, | 38 const NewMediaSegmentCB& new_segment_cb, |
| 39 const base::Closure& end_of_segment_cb, | 39 const EndMediaSegmentCB& end_of_segment_cb, |
| 40 const scoped_refptr<MediaLog>& media_log) override; | 40 const scoped_refptr<MediaLog>& media_log) override; |
| 41 void Flush() override; | 41 void Flush() override; |
| 42 bool Parse(const uint8_t* buf, int size) override; | 42 bool Parse(const uint8_t* buf, int size) override; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 enum State { | 45 enum State { |
| 46 kWaitingForInit, | 46 kWaitingForInit, |
| 47 kParsingBoxes, | 47 kParsingBoxes, |
| 48 kWaitingForSampleData, | 48 kWaitingForSampleData, |
| 49 kEmittingSamples, | 49 kEmittingSamples, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // and |moof|. Returns true if |highest_end_offset_| was successfully | 89 // and |moof|. Returns true if |highest_end_offset_| was successfully |
| 90 // computed. | 90 // computed. |
| 91 bool ComputeHighestEndOffset(const MovieFragment& moof); | 91 bool ComputeHighestEndOffset(const MovieFragment& moof); |
| 92 | 92 |
| 93 State state_; | 93 State state_; |
| 94 InitCB init_cb_; | 94 InitCB init_cb_; |
| 95 NewConfigCB config_cb_; | 95 NewConfigCB config_cb_; |
| 96 NewBuffersCB new_buffers_cb_; | 96 NewBuffersCB new_buffers_cb_; |
| 97 EncryptedMediaInitDataCB encrypted_media_init_data_cb_; | 97 EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
| 98 NewMediaSegmentCB new_segment_cb_; | 98 NewMediaSegmentCB new_segment_cb_; |
| 99 base::Closure end_of_segment_cb_; | 99 EndMediaSegmentCB end_of_segment_cb_; |
| 100 scoped_refptr<MediaLog> media_log_; | 100 scoped_refptr<MediaLog> media_log_; |
| 101 | 101 |
| 102 OffsetByteQueue queue_; | 102 OffsetByteQueue queue_; |
| 103 | 103 |
| 104 // These two parameters are only valid in the |kEmittingSegments| state. | 104 // These two parameters are only valid in the |kEmittingSegments| state. |
| 105 // | 105 // |
| 106 // |moof_head_| is the offset of the start of the most recently parsed moof | 106 // |moof_head_| is the offset of the start of the most recently parsed moof |
| 107 // block. All byte offsets in sample information are relative to this offset, | 107 // block. All byte offsets in sample information are relative to this offset, |
| 108 // as mandated by the Media Source spec. | 108 // as mandated by the Media Source spec. |
| 109 int64_t moof_head_; | 109 int64_t moof_head_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 133 // prevent log spam. | 133 // prevent log spam. |
| 134 int num_top_level_box_skipped_; | 134 int num_top_level_box_skipped_; |
| 135 | 135 |
| 136 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); | 136 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 } // namespace mp4 | 139 } // namespace mp4 |
| 140 } // namespace media | 140 } // namespace media |
| 141 | 141 |
| 142 #endif // MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ | 142 #endif // MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ |
| OLD | NEW |