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 <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const BufferQueue&, | 100 const BufferQueue&, |
101 const TextBufferQueueMap&)> NewBuffersCB; | 101 const TextBufferQueueMap&)> NewBuffersCB; |
102 | 102 |
103 // Signals the beginning of a new media segment. | 103 // Signals the beginning of a new media segment. |
104 typedef base::Callback<void()> NewMediaSegmentCB; | 104 typedef base::Callback<void()> NewMediaSegmentCB; |
105 | 105 |
106 // A new potentially encrypted stream has been parsed. | 106 // A new potentially encrypted stream has been parsed. |
107 // First parameter - The type of the initialization data associated with the | 107 // First parameter - The type of the initialization data associated with the |
108 // stream. | 108 // stream. |
109 // Second parameter - The initialization data associated with the stream. | 109 // Second parameter - The initialization data associated with the stream. |
110 typedef base::Callback<void(const std::string&, | 110 typedef base::Callback<void(const std::string&, const std::vector<uint8>&)> |
111 const std::vector<uint8>&)> NeedKeyCB; | 111 EncryptedMediaInitDataCB; |
112 | 112 |
113 StreamParser(); | 113 StreamParser(); |
114 virtual ~StreamParser(); | 114 virtual ~StreamParser(); |
115 | 115 |
116 // Initializes the parser with necessary callbacks. Must be called before any | 116 // Initializes the parser with necessary callbacks. Must be called before any |
117 // data is passed to Parse(). |init_cb| will be called once enough data has | 117 // data is passed to Parse(). |init_cb| will be called once enough data has |
118 // been parsed to determine the initial stream configurations, presentation | 118 // been parsed to determine the initial stream configurations, presentation |
119 // start time, and duration. If |ignore_text_track| is true, then no text | 119 // start time, and duration. If |ignore_text_track| is true, then no text |
120 // buffers should be passed later by the parser to |new_buffers_cb|. | 120 // buffers should be passed later by the parser to |new_buffers_cb|. |
121 virtual void Init(const InitCB& init_cb, | 121 virtual void Init( |
122 const NewConfigCB& config_cb, | 122 const InitCB& init_cb, |
123 const NewBuffersCB& new_buffers_cb, | 123 const NewConfigCB& config_cb, |
124 bool ignore_text_track, | 124 const NewBuffersCB& new_buffers_cb, |
125 const NeedKeyCB& need_key_cb, | 125 bool ignore_text_track, |
126 const NewMediaSegmentCB& new_segment_cb, | 126 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, |
127 const base::Closure& end_of_segment_cb, | 127 const NewMediaSegmentCB& new_segment_cb, |
128 const LogCB& log_cb) = 0; | 128 const base::Closure& end_of_segment_cb, |
| 129 const LogCB& log_cb) = 0; |
129 | 130 |
130 // Called when a seek occurs. This flushes the current parser state | 131 // Called when a seek occurs. This flushes the current parser state |
131 // and puts the parser in a state where it can receive data for the new seek | 132 // and puts the parser in a state where it can receive data for the new seek |
132 // point. | 133 // point. |
133 virtual void Flush() = 0; | 134 virtual void Flush() = 0; |
134 | 135 |
135 // Called when there is new data to parse. | 136 // Called when there is new data to parse. |
136 // | 137 // |
137 // Returns true if the parse succeeds. | 138 // Returns true if the parse succeeds. |
138 virtual bool Parse(const uint8* buf, int size) = 0; | 139 virtual bool Parse(const uint8* buf, int size) = 0; |
(...skipping 15 matching lines...) Expand all Loading... |
154 // subtle issues with tie-breaking. See http://crbug.com/338484. | 155 // subtle issues with tie-breaking. See http://crbug.com/338484. |
155 MEDIA_EXPORT bool MergeBufferQueues( | 156 MEDIA_EXPORT bool MergeBufferQueues( |
156 const StreamParser::BufferQueue& audio_buffers, | 157 const StreamParser::BufferQueue& audio_buffers, |
157 const StreamParser::BufferQueue& video_buffers, | 158 const StreamParser::BufferQueue& video_buffers, |
158 const StreamParser::TextBufferQueueMap& text_buffers, | 159 const StreamParser::TextBufferQueueMap& text_buffers, |
159 StreamParser::BufferQueue* merged_buffers); | 160 StreamParser::BufferQueue* merged_buffers); |
160 | 161 |
161 } // namespace media | 162 } // namespace media |
162 | 163 |
163 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 164 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
OLD | NEW |