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 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // Initialize the parser with necessary callbacks. Must be called before any | 68 // Initialize the parser with necessary callbacks. Must be called before any |
69 // data is passed to Parse(). |init_cb| will be called once enough data has | 69 // data is passed to Parse(). |init_cb| will be called once enough data has |
70 // been parsed to determine the initial stream configurations, presentation | 70 // been parsed to determine the initial stream configurations, presentation |
71 // start time, and duration. | 71 // start time, and duration. |
72 virtual void Init(const InitCB& init_cb, | 72 virtual void Init(const InitCB& init_cb, |
73 const NewConfigCB& config_cb, | 73 const NewConfigCB& config_cb, |
74 const NewBuffersCB& audio_cb, | 74 const NewBuffersCB& audio_cb, |
75 const NewBuffersCB& video_cb, | 75 const NewBuffersCB& video_cb, |
76 const NeedKeyCB& need_key_cb, | 76 const NeedKeyCB& need_key_cb, |
77 const NewMediaSegmentCB& new_segment_cb) = 0; | 77 const NewMediaSegmentCB& new_segment_cb, |
| 78 const base::Closure& end_of_segment_cb) = 0; |
78 | 79 |
79 // Called when a seek occurs. This flushes the current parser state | 80 // Called when a seek occurs. This flushes the current parser state |
80 // and puts the parser in a state where it can receive data for the new seek | 81 // and puts the parser in a state where it can receive data for the new seek |
81 // point. | 82 // point. |
82 virtual void Flush() = 0; | 83 virtual void Flush() = 0; |
83 | 84 |
84 // Called when there is new data to parse. | 85 // Called when there is new data to parse. |
85 // | 86 // |
86 // Returns true if the parse succeeds. | 87 // Returns true if the parse succeeds. |
87 virtual bool Parse(const uint8* buf, int size) = 0; | 88 virtual bool Parse(const uint8* buf, int size) = 0; |
88 | 89 |
89 private: | 90 private: |
90 DISALLOW_COPY_AND_ASSIGN(StreamParser); | 91 DISALLOW_COPY_AND_ASSIGN(StreamParser); |
91 }; | 92 }; |
92 | 93 |
93 } // namespace media | 94 } // namespace media |
94 | 95 |
95 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 96 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
OLD | NEW |