OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MP4_MP4_STREAM_PARSER_H_ | 5 #ifndef MEDIA_MP4_MP4_STREAM_PARSER_H_ |
6 #define MEDIA_MP4_MP4_STREAM_PARSER_H_ | 6 #define MEDIA_MP4_MP4_STREAM_PARSER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class MEDIA_EXPORT MP4StreamParser : public StreamParser { | 25 class MEDIA_EXPORT MP4StreamParser : public StreamParser { |
26 public: | 26 public: |
27 MP4StreamParser(bool has_sbr); | 27 MP4StreamParser(bool has_sbr); |
28 virtual ~MP4StreamParser(); | 28 virtual ~MP4StreamParser(); |
29 | 29 |
30 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, | 30 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, |
31 const NewBuffersCB& audio_cb, | 31 const NewBuffersCB& audio_cb, |
32 const NewBuffersCB& video_cb, | 32 const NewBuffersCB& video_cb, |
33 const NeedKeyCB& need_key_cb, | 33 const NeedKeyCB& need_key_cb, |
34 const NewMediaSegmentCB& new_segment_cb, | 34 const NewMediaSegmentCB& new_segment_cb, |
35 const base::Closure& end_of_segment_cb) OVERRIDE; | 35 const base::Closure& end_of_segment_cb, |
| 36 const LogCB& log_cb) OVERRIDE; |
36 virtual void Flush() OVERRIDE; | 37 virtual void Flush() OVERRIDE; |
37 virtual bool Parse(const uint8* buf, int size) OVERRIDE; | 38 virtual bool Parse(const uint8* buf, int size) OVERRIDE; |
38 | 39 |
39 private: | 40 private: |
40 enum State { | 41 enum State { |
41 kWaitingForInit, | 42 kWaitingForInit, |
42 kParsingBoxes, | 43 kParsingBoxes, |
43 kEmittingSamples, | 44 kEmittingSamples, |
44 kError | 45 kError |
45 }; | 46 }; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 void Reset(); | 79 void Reset(); |
79 | 80 |
80 State state_; | 81 State state_; |
81 InitCB init_cb_; | 82 InitCB init_cb_; |
82 NewConfigCB config_cb_; | 83 NewConfigCB config_cb_; |
83 NewBuffersCB audio_cb_; | 84 NewBuffersCB audio_cb_; |
84 NewBuffersCB video_cb_; | 85 NewBuffersCB video_cb_; |
85 NeedKeyCB need_key_cb_; | 86 NeedKeyCB need_key_cb_; |
86 NewMediaSegmentCB new_segment_cb_; | 87 NewMediaSegmentCB new_segment_cb_; |
87 base::Closure end_of_segment_cb_; | 88 base::Closure end_of_segment_cb_; |
| 89 LogCB log_cb_; |
88 | 90 |
89 OffsetByteQueue queue_; | 91 OffsetByteQueue queue_; |
90 | 92 |
91 // These two parameters are only valid in the |kEmittingSegments| state. | 93 // These two parameters are only valid in the |kEmittingSegments| state. |
92 // | 94 // |
93 // |moof_head_| is the offset of the start of the most recently parsed moof | 95 // |moof_head_| is the offset of the start of the most recently parsed moof |
94 // block. All byte offsets in sample information are relative to this offset, | 96 // block. All byte offsets in sample information are relative to this offset, |
95 // as mandated by the Media Source spec. | 97 // as mandated by the Media Source spec. |
96 int64 moof_head_; | 98 int64 moof_head_; |
97 // |mdat_tail_| is the stream offset of the end of the current 'mdat' box. | 99 // |mdat_tail_| is the stream offset of the end of the current 'mdat' box. |
98 // Valid iff it is greater than the head of the queue. | 100 // Valid iff it is greater than the head of the queue. |
99 int64 mdat_tail_; | 101 int64 mdat_tail_; |
100 | 102 |
101 scoped_ptr<mp4::Movie> moov_; | 103 scoped_ptr<mp4::Movie> moov_; |
102 scoped_ptr<mp4::TrackRunIterator> runs_; | 104 scoped_ptr<mp4::TrackRunIterator> runs_; |
103 | 105 |
104 bool has_audio_; | 106 bool has_audio_; |
105 bool has_video_; | 107 bool has_video_; |
106 uint32 audio_track_id_; | 108 uint32 audio_track_id_; |
107 uint32 video_track_id_; | 109 uint32 video_track_id_; |
108 bool has_sbr_; | 110 bool has_sbr_; |
109 | 111 |
110 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); | 112 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); |
111 }; | 113 }; |
112 | 114 |
113 } // namespace mp4 | 115 } // namespace mp4 |
114 } // namespace media | 116 } // namespace media |
115 | 117 |
116 #endif // MEDIA_MP4_MP4_STREAM_PARSER_H_ | 118 #endif // MEDIA_MP4_MP4_STREAM_PARSER_H_ |
OLD | NEW |