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 WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ | 5 #ifndef WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ |
6 #define WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ | 6 #define WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 namespace webkit_media { | 25 namespace webkit_media { |
26 | 26 |
27 // A data source capable of loading URLs and buffering the data using an | 27 // A data source capable of loading URLs and buffering the data using an |
28 // in-memory sliding window. | 28 // in-memory sliding window. |
29 // | 29 // |
30 // BufferedDataSource must be created and initialized on the render thread | 30 // BufferedDataSource must be created and initialized on the render thread |
31 // before being passed to other threads. It may be deleted on any thread. | 31 // before being passed to other threads. It may be deleted on any thread. |
32 class BufferedDataSource : public media::DataSource { | 32 class BufferedDataSource : public media::DataSource { |
33 public: | 33 public: |
| 34 typedef base::Callback<void(bool)> DownloadingCB; |
| 35 |
| 36 // |downloading_cb| will be called whenever the downloading/paused state of |
| 37 // the source changes. |
34 BufferedDataSource(MessageLoop* render_loop, | 38 BufferedDataSource(MessageLoop* render_loop, |
35 WebKit::WebFrame* frame, | 39 WebKit::WebFrame* frame, |
36 media::MediaLog* media_log); | 40 media::MediaLog* media_log, |
| 41 const DownloadingCB& downloading_cb); |
37 | 42 |
38 // Initialize this object using |url| and |cors_mode|, and call |status_cb| | 43 // Initialize this object using |url| and |cors_mode|, and call |status_cb| |
39 // when initialization has completed. | 44 // when initialization has completed. |
40 // | 45 // |
41 // Method called on the render thread. | 46 // Method called on the render thread. |
42 void Initialize( | 47 void Initialize( |
43 const GURL& url, | 48 const GURL& url, |
44 BufferedResourceLoader::CORSMode cors_mode, | 49 BufferedResourceLoader::CORSMode cors_mode, |
45 const media::PipelineStatusCB& status_cb); | 50 const media::PipelineStatusCB& status_cb); |
46 | 51 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 int cache_miss_retries_left_; | 222 int cache_miss_retries_left_; |
218 | 223 |
219 // Bitrate of the content, 0 if unknown. | 224 // Bitrate of the content, 0 if unknown. |
220 int bitrate_; | 225 int bitrate_; |
221 | 226 |
222 // Current playback rate. | 227 // Current playback rate. |
223 float playback_rate_; | 228 float playback_rate_; |
224 | 229 |
225 scoped_refptr<media::MediaLog> media_log_; | 230 scoped_refptr<media::MediaLog> media_log_; |
226 | 231 |
| 232 DownloadingCB downloading_cb_; |
| 233 |
227 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 234 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
228 }; | 235 }; |
229 | 236 |
230 } // namespace webkit_media | 237 } // namespace webkit_media |
231 | 238 |
232 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ | 239 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ |
OLD | NEW |