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 13 matching lines...) Expand all Loading... |
24 | 24 |
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) OVERRIDE; | 34 const NewMediaSegmentCB& new_segment_cb, |
| 35 const base::Closure& end_of_segment_cb) OVERRIDE; |
35 virtual void Flush() OVERRIDE; | 36 virtual void Flush() OVERRIDE; |
36 virtual bool Parse(const uint8* buf, int size) OVERRIDE; | 37 virtual bool Parse(const uint8* buf, int size) OVERRIDE; |
37 | 38 |
38 private: | 39 private: |
39 enum State { | 40 enum State { |
40 kWaitingForInit, | 41 kWaitingForInit, |
41 kParsingBoxes, | 42 kParsingBoxes, |
42 kEmittingSamples, | 43 kEmittingSamples, |
43 kError | 44 kError |
44 }; | 45 }; |
(...skipping 18 matching lines...) Expand all Loading... |
63 bool SendAndFlushSamples(BufferQueue* audio_buffers, | 64 bool SendAndFlushSamples(BufferQueue* audio_buffers, |
64 BufferQueue* video_buffers); | 65 BufferQueue* video_buffers); |
65 | 66 |
66 State state_; | 67 State state_; |
67 InitCB init_cb_; | 68 InitCB init_cb_; |
68 NewConfigCB config_cb_; | 69 NewConfigCB config_cb_; |
69 NewBuffersCB audio_cb_; | 70 NewBuffersCB audio_cb_; |
70 NewBuffersCB video_cb_; | 71 NewBuffersCB video_cb_; |
71 NeedKeyCB need_key_cb_; | 72 NeedKeyCB need_key_cb_; |
72 NewMediaSegmentCB new_segment_cb_; | 73 NewMediaSegmentCB new_segment_cb_; |
| 74 base::Closure end_of_segment_cb_; |
73 | 75 |
74 OffsetByteQueue queue_; | 76 OffsetByteQueue queue_; |
75 | 77 |
76 // These two parameters are only valid in the |kEmittingSegments| state. | 78 // These two parameters are only valid in the |kEmittingSegments| state. |
77 // | 79 // |
78 // |moof_head_| is the offset of the start of the most recently parsed moof | 80 // |moof_head_| is the offset of the start of the most recently parsed moof |
79 // block. All byte offsets in sample information are relative to this offset, | 81 // block. All byte offsets in sample information are relative to this offset, |
80 // as mandated by the Media Source spec. | 82 // as mandated by the Media Source spec. |
81 int64 moof_head_; | 83 int64 moof_head_; |
82 // |mdat_tail_| is the stream offset of the end of the current 'mdat' box. | 84 // |mdat_tail_| is the stream offset of the end of the current 'mdat' box. |
83 // Valid iff it is greater than the head of the queue. | 85 // Valid iff it is greater than the head of the queue. |
84 int64 mdat_tail_; | 86 int64 mdat_tail_; |
85 | 87 |
86 scoped_ptr<mp4::Movie> moov_; | 88 scoped_ptr<mp4::Movie> moov_; |
87 scoped_ptr<mp4::TrackRunIterator> runs_; | 89 scoped_ptr<mp4::TrackRunIterator> runs_; |
88 | 90 |
89 bool has_audio_; | 91 bool has_audio_; |
90 bool has_video_; | 92 bool has_video_; |
91 uint32 audio_track_id_; | 93 uint32 audio_track_id_; |
92 uint32 video_track_id_; | 94 uint32 video_track_id_; |
93 bool has_sbr_; | 95 bool has_sbr_; |
94 | 96 |
95 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); | 97 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); |
96 }; | 98 }; |
97 | 99 |
98 } // namespace mp4 | 100 } // namespace mp4 |
99 } // namespace media | 101 } // namespace media |
100 | 102 |
101 #endif // MEDIA_MP4_MP4_STREAM_PARSER_H_ | 103 #endif // MEDIA_MP4_MP4_STREAM_PARSER_H_ |
OLD | NEW |