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_BASE_STREAM_PARSER_H_ | 5 #ifndef MEDIA_BASE_STREAM_PARSER_H_ |
6 #define MEDIA_BASE_STREAM_PARSER_H_ | 6 #define MEDIA_BASE_STREAM_PARSER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
| 16 #include "media/base/media_log.h" |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 | 19 |
19 class AudioDecoderConfig; | 20 class AudioDecoderConfig; |
20 class StreamParserBuffer; | 21 class StreamParserBuffer; |
21 class VideoDecoderConfig; | 22 class VideoDecoderConfig; |
22 | 23 |
23 // Abstract interface for parsing media byte streams. | 24 // Abstract interface for parsing media byte streams. |
24 class MEDIA_EXPORT StreamParser { | 25 class MEDIA_EXPORT StreamParser { |
25 public: | 26 public: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Initialize the parser with necessary callbacks. Must be called before any | 73 // Initialize the parser with necessary callbacks. Must be called before any |
73 // data is passed to Parse(). |init_cb| will be called once enough data has | 74 // data is passed to Parse(). |init_cb| will be called once enough data has |
74 // been parsed to determine the initial stream configurations, presentation | 75 // been parsed to determine the initial stream configurations, presentation |
75 // start time, and duration. | 76 // start time, and duration. |
76 virtual void Init(const InitCB& init_cb, | 77 virtual void Init(const InitCB& init_cb, |
77 const NewConfigCB& config_cb, | 78 const NewConfigCB& config_cb, |
78 const NewBuffersCB& audio_cb, | 79 const NewBuffersCB& audio_cb, |
79 const NewBuffersCB& video_cb, | 80 const NewBuffersCB& video_cb, |
80 const NeedKeyCB& need_key_cb, | 81 const NeedKeyCB& need_key_cb, |
81 const NewMediaSegmentCB& new_segment_cb, | 82 const NewMediaSegmentCB& new_segment_cb, |
82 const base::Closure& end_of_segment_cb) = 0; | 83 const base::Closure& end_of_segment_cb, |
| 84 const LogCB& log_cb) = 0; |
83 | 85 |
84 // Called when a seek occurs. This flushes the current parser state | 86 // Called when a seek occurs. This flushes the current parser state |
85 // and puts the parser in a state where it can receive data for the new seek | 87 // and puts the parser in a state where it can receive data for the new seek |
86 // point. | 88 // point. |
87 virtual void Flush() = 0; | 89 virtual void Flush() = 0; |
88 | 90 |
89 // Called when there is new data to parse. | 91 // Called when there is new data to parse. |
90 // | 92 // |
91 // Returns true if the parse succeeds. | 93 // Returns true if the parse succeeds. |
92 virtual bool Parse(const uint8* buf, int size) = 0; | 94 virtual bool Parse(const uint8* buf, int size) = 0; |
93 | 95 |
94 private: | 96 private: |
95 DISALLOW_COPY_AND_ASSIGN(StreamParser); | 97 DISALLOW_COPY_AND_ASSIGN(StreamParser); |
96 }; | 98 }; |
97 | 99 |
98 } // namespace media | 100 } // namespace media |
99 | 101 |
100 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 102 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
OLD | NEW |