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