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 <memory> | 10 #include <memory> |
(...skipping 19 matching lines...) Expand all Loading... |
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 EndMediaSegmentCB& end_of_segment_cb, | 39 const EndMediaSegmentCB& end_of_segment_cb, |
40 const scoped_refptr<MediaLog>& media_log) override; | 40 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, |
50 kError | 50 kError |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // computed. | 87 // computed. |
88 bool ComputeHighestEndOffset(const MovieFragment& moof); | 88 bool ComputeHighestEndOffset(const MovieFragment& moof); |
89 | 89 |
90 State state_; | 90 State state_; |
91 InitCB init_cb_; | 91 InitCB init_cb_; |
92 NewConfigCB config_cb_; | 92 NewConfigCB config_cb_; |
93 NewBuffersCB new_buffers_cb_; | 93 NewBuffersCB new_buffers_cb_; |
94 EncryptedMediaInitDataCB encrypted_media_init_data_cb_; | 94 EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
95 NewMediaSegmentCB new_segment_cb_; | 95 NewMediaSegmentCB new_segment_cb_; |
96 EndMediaSegmentCB end_of_segment_cb_; | 96 EndMediaSegmentCB end_of_segment_cb_; |
97 scoped_refptr<MediaLog> media_log_; | 97 MediaLog* media_log_; |
98 | 98 |
99 OffsetByteQueue queue_; | 99 OffsetByteQueue queue_; |
100 | 100 |
101 // These two parameters are only valid in the |kEmittingSegments| state. | 101 // These two parameters are only valid in the |kEmittingSegments| state. |
102 // | 102 // |
103 // |moof_head_| is the offset of the start of the most recently parsed moof | 103 // |moof_head_| is the offset of the start of the most recently parsed moof |
104 // block. All byte offsets in sample information are relative to this offset, | 104 // block. All byte offsets in sample information are relative to this offset, |
105 // as mandated by the Media Source spec. | 105 // as mandated by the Media Source spec. |
106 int64_t moof_head_; | 106 int64_t moof_head_; |
107 // |mdat_tail_| is the stream offset of the end of the current 'mdat' box. | 107 // |mdat_tail_| is the stream offset of the end of the current 'mdat' box. |
(...skipping 20 matching lines...) Expand all Loading... |
128 // Tracks the number of MEDIA_LOGS for skipping empty trun samples. | 128 // Tracks the number of MEDIA_LOGS for skipping empty trun samples. |
129 int num_empty_samples_skipped_; | 129 int num_empty_samples_skipped_; |
130 | 130 |
131 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); | 131 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); |
132 }; | 132 }; |
133 | 133 |
134 } // namespace mp4 | 134 } // namespace mp4 |
135 } // namespace media | 135 } // namespace media |
136 | 136 |
137 #endif // MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ | 137 #endif // MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ |
OLD | NEW |