OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ | 5 #ifndef WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ |
6 #define WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ | 6 #define WEBKIT_GLUE_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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); | 249 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); |
250 }; | 250 }; |
251 | 251 |
252 class BufferedDataSource : public WebDataSource { | 252 class BufferedDataSource : public WebDataSource { |
253 public: | 253 public: |
254 BufferedDataSource(MessageLoop* render_loop, | 254 BufferedDataSource(MessageLoop* render_loop, |
255 WebKit::WebFrame* frame); | 255 WebKit::WebFrame* frame); |
256 | 256 |
257 virtual ~BufferedDataSource(); | 257 virtual ~BufferedDataSource(); |
258 | 258 |
259 // media::MediaFilter implementation. | 259 // media::Filter implementation. |
260 virtual void Initialize(const std::string& url, | 260 virtual void Initialize(const std::string& url, |
261 media::FilterCallback* callback); | 261 media::FilterCallback* callback); |
262 virtual bool IsUrlSupported(const std::string& url); | 262 virtual bool IsUrlSupported(const std::string& url); |
263 virtual void Stop(media::FilterCallback* callback); | 263 virtual void Stop(media::FilterCallback* callback); |
264 virtual void SetPlaybackRate(float playback_rate); | 264 virtual void SetPlaybackRate(float playback_rate); |
265 | 265 |
266 // media::DataSource implementation. | 266 // media::DataSource implementation. |
267 // Called from demuxer thread. | 267 // Called from demuxer thread. |
268 virtual void Read(int64 position, size_t size, | 268 virtual void Read(int64 position, size_t size, |
269 uint8* data, | 269 uint8* data, |
270 media::DataSource::ReadCallback* read_callback); | 270 media::DataSource::ReadCallback* read_callback); |
271 virtual bool GetSize(int64* size_out); | 271 virtual bool GetSize(int64* size_out); |
272 virtual bool IsStreaming(); | 272 virtual bool IsStreaming(); |
273 | 273 |
274 const media::MediaFormat& media_format() { | 274 const media::MediaFormat& media_format() { |
275 return media_format_; | 275 return media_format_; |
276 } | 276 } |
277 | 277 |
278 // webkit_glue::WebDataSource implementation. | 278 // webkit_glue::WebDataSource implementation. |
279 virtual bool HasSingleOrigin(); | 279 virtual bool HasSingleOrigin(); |
280 virtual void Abort(); | 280 virtual void Abort(); |
281 | 281 |
282 protected: | 282 protected: |
283 | |
284 // A factory method to create a BufferedResourceLoader based on the read | 283 // A factory method to create a BufferedResourceLoader based on the read |
285 // parameters. We can override this file to object a mock | 284 // parameters. We can override this file to object a mock |
286 // BufferedResourceLoader for testing. | 285 // BufferedResourceLoader for testing. |
287 virtual BufferedResourceLoader* CreateResourceLoader( | 286 virtual BufferedResourceLoader* CreateResourceLoader( |
288 int64 first_byte_position, int64 last_byte_position); | 287 int64 first_byte_position, int64 last_byte_position); |
289 | 288 |
290 // Gets the number of milliseconds to declare a request timeout since | 289 // Gets the number of milliseconds to declare a request timeout since |
291 // the request was made. This method is made virtual so as to inject a | 290 // the request was made. This method is made virtual so as to inject a |
292 // different number for testing purpose. | 291 // different number for testing purpose. |
293 virtual base::TimeDelta GetTimeoutMilliseconds(); | 292 virtual base::TimeDelta GetTimeoutMilliseconds(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 // Keeps track of whether we used a Range header in the initialization | 433 // Keeps track of whether we used a Range header in the initialization |
435 // request. | 434 // request. |
436 bool using_range_request_; | 435 bool using_range_request_; |
437 | 436 |
438 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 437 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
439 }; | 438 }; |
440 | 439 |
441 } // namespace webkit_glue | 440 } // namespace webkit_glue |
442 | 441 |
443 #endif // WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ | 442 #endif // WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ |
OLD | NEW |