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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
13 #include "media/base/stream_parser.h" | 13 #include "media/base/stream_parser.h" |
14 #include "media/mp4/aac.h" | 14 #include "media/mp4/aac.h" |
15 #include "media/mp4/offset_byte_queue.h" | 15 #include "media/mp4/offset_byte_queue.h" |
16 #include "media/mp4/track_run_iterator.h" | 16 #include "media/mp4/track_run_iterator.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 namespace mp4 { | 19 namespace mp4 { |
20 | 20 |
21 struct Movie; | 21 struct Movie; |
22 class BoxReader; | 22 class BoxReader; |
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 // StreamParser implementation. |
29 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, | 30 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, |
30 const NewBuffersCB& audio_cb, | 31 const NewBuffersCB& audio_cb, |
31 const NewBuffersCB& video_cb, | 32 const NewBuffersCB& video_cb, |
32 const NeedKeyCB& need_key_cb, | 33 const NeedKeyCB& need_key_cb, |
33 const NewMediaSegmentCB& new_segment_cb) OVERRIDE; | 34 const NewMediaSegmentCB& new_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; |
| 37 virtual void SetTimestampOffset(base::TimeDelta offset) OVERRIDE; |
| 38 virtual void ClearTimestampOffset() OVERRIDE; |
36 | 39 |
37 private: | 40 private: |
38 enum State { | 41 enum State { |
39 kWaitingForInit, | 42 kWaitingForInit, |
40 kParsingBoxes, | 43 kParsingBoxes, |
41 kEmittingSamples, | 44 kEmittingSamples, |
42 kError | 45 kError |
43 }; | 46 }; |
44 | 47 |
45 bool ParseBox(bool* err); | 48 bool ParseBox(bool* err); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 AAC aac_; | 94 AAC aac_; |
92 uint8 size_of_nalu_length_; | 95 uint8 size_of_nalu_length_; |
93 | 96 |
94 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); | 97 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); |
95 }; | 98 }; |
96 | 99 |
97 } // namespace mp4 | 100 } // namespace mp4 |
98 } // namespace media | 101 } // namespace media |
99 | 102 |
100 #endif // MEDIA_MP4_MP4_STREAM_PARSER_H_ | 103 #endif // MEDIA_MP4_MP4_STREAM_PARSER_H_ |
OLD | NEW |