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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 class MEDIA_EXPORT MP4StreamParser : public StreamParser { | 24 class MEDIA_EXPORT MP4StreamParser : public StreamParser { |
25 public: | 25 public: |
26 MP4StreamParser(); | 26 MP4StreamParser(); |
27 virtual ~MP4StreamParser(); | 27 virtual ~MP4StreamParser(); |
28 | 28 |
29 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, | 29 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, |
30 const NewBuffersCB& audio_cb, | 30 const NewBuffersCB& audio_cb, |
31 const NewBuffersCB& video_cb, | 31 const NewBuffersCB& video_cb, |
32 const NeedKeyCB& need_key_cb, | 32 const NeedKeyCB& need_key_cb, |
33 const NewMediaSegmentCB& new_segment_cb) OVERRIDE; | 33 const NewMediaSegmentCB& new_segment_cb, |
| 34 const base::Closure& end_of_segment_cb) OVERRIDE; |
34 virtual void Flush() OVERRIDE; | 35 virtual void Flush() OVERRIDE; |
35 virtual bool Parse(const uint8* buf, int size) OVERRIDE; | 36 virtual bool Parse(const uint8* buf, int size) OVERRIDE; |
36 | 37 |
37 private: | 38 private: |
38 enum State { | 39 enum State { |
39 kWaitingForInit, | 40 kWaitingForInit, |
40 kParsingBoxes, | 41 kParsingBoxes, |
41 kEmittingSamples, | 42 kEmittingSamples, |
42 kError | 43 kError |
43 }; | 44 }; |
(...skipping 13 matching lines...) Expand all Loading... |
57 bool SendAndFlushSamples(BufferQueue* audio_buffers, | 58 bool SendAndFlushSamples(BufferQueue* audio_buffers, |
58 BufferQueue* video_buffers); | 59 BufferQueue* video_buffers); |
59 | 60 |
60 State state_; | 61 State state_; |
61 InitCB init_cb_; | 62 InitCB init_cb_; |
62 NewConfigCB config_cb_; | 63 NewConfigCB config_cb_; |
63 NewBuffersCB audio_cb_; | 64 NewBuffersCB audio_cb_; |
64 NewBuffersCB video_cb_; | 65 NewBuffersCB video_cb_; |
65 NeedKeyCB need_key_cb_; | 66 NeedKeyCB need_key_cb_; |
66 NewMediaSegmentCB new_segment_cb_; | 67 NewMediaSegmentCB new_segment_cb_; |
| 68 base::Closure end_of_segment_cb_; |
67 | 69 |
68 OffsetByteQueue queue_; | 70 OffsetByteQueue queue_; |
69 | 71 |
70 // These two parameters are only valid in the |kEmittingSegments| state. | 72 // These two parameters are only valid in the |kEmittingSegments| state. |
71 // | 73 // |
72 // |moof_head_| is the offset of the start of the most recently parsed moof | 74 // |moof_head_| is the offset of the start of the most recently parsed moof |
73 // block. All byte offsets in sample information are relative to this offset, | 75 // block. All byte offsets in sample information are relative to this offset, |
74 // as mandated by the Media Source spec. | 76 // as mandated by the Media Source spec. |
75 int64 moof_head_; | 77 int64 moof_head_; |
76 // |mdat_tail_| is the stream offset of the end of the current 'mdat' box. | 78 // |mdat_tail_| is the stream offset of the end of the current 'mdat' box. |
(...skipping 14 matching lines...) Expand all Loading... |
91 AAC aac_; | 93 AAC aac_; |
92 uint8 size_of_nalu_length_; | 94 uint8 size_of_nalu_length_; |
93 | 95 |
94 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); | 96 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); |
95 }; | 97 }; |
96 | 98 |
97 } // namespace mp4 | 99 } // namespace mp4 |
98 } // namespace media | 100 } // namespace media |
99 | 101 |
100 #endif // MEDIA_MP4_MP4_STREAM_PARSER_H_ | 102 #endif // MEDIA_MP4_MP4_STREAM_PARSER_H_ |
OLD | NEW |