| 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 17 matching lines...) Expand all Loading... |
| 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 BufferedDataSource(MessageLoop* render_loop, | 34 BufferedDataSource(MessageLoop* render_loop, |
| 35 WebKit::WebFrame* frame, | 35 WebKit::WebFrame* frame, |
| 36 media::MediaLog* media_log); | 36 media::MediaLog* media_log); |
| 37 | 37 |
| 38 virtual ~BufferedDataSource(); | |
| 39 | |
| 40 // Initialize this object using |url|. This object calls |status_cb| when | 38 // Initialize this object using |url|. This object calls |status_cb| when |
| 41 // initialization has completed. | 39 // initialization has completed. |
| 42 // | 40 // |
| 43 // Method called on the render thread. | 41 // Method called on the render thread. |
| 44 void Initialize(const GURL& url, | 42 void Initialize(const GURL& url, |
| 45 const media::PipelineStatusCB& status_cb); | 43 const media::PipelineStatusCB& status_cb); |
| 46 | 44 |
| 47 // Adjusts the buffering algorithm based on the given preload value. | 45 // Adjusts the buffering algorithm based on the given preload value. |
| 48 void SetPreload(Preload preload); | 46 void SetPreload(Preload preload); |
| 49 | 47 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 66 virtual void Stop(const base::Closure& closure) OVERRIDE; | 64 virtual void Stop(const base::Closure& closure) OVERRIDE; |
| 67 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; | 65 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; |
| 68 | 66 |
| 69 virtual void Read(int64 position, int size, uint8* data, | 67 virtual void Read(int64 position, int size, uint8* data, |
| 70 const media::DataSource::ReadCB& read_cb) OVERRIDE; | 68 const media::DataSource::ReadCB& read_cb) OVERRIDE; |
| 71 virtual bool GetSize(int64* size_out) OVERRIDE; | 69 virtual bool GetSize(int64* size_out) OVERRIDE; |
| 72 virtual bool IsStreaming() OVERRIDE; | 70 virtual bool IsStreaming() OVERRIDE; |
| 73 virtual void SetBitrate(int bitrate) OVERRIDE; | 71 virtual void SetBitrate(int bitrate) OVERRIDE; |
| 74 | 72 |
| 75 protected: | 73 protected: |
| 74 virtual ~BufferedDataSource(); |
| 75 |
| 76 // A factory method to create a BufferedResourceLoader based on the read | 76 // A factory method to create a BufferedResourceLoader based on the read |
| 77 // parameters. We can override this file to object a mock | 77 // parameters. We can override this file to object a mock |
| 78 // BufferedResourceLoader for testing. | 78 // BufferedResourceLoader for testing. |
| 79 virtual BufferedResourceLoader* CreateResourceLoader( | 79 virtual BufferedResourceLoader* CreateResourceLoader( |
| 80 int64 first_byte_position, int64 last_byte_position); | 80 int64 first_byte_position, int64 last_byte_position); |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 friend class BufferedDataSourceTest; | 83 friend class BufferedDataSourceTest; |
| 84 | 84 |
| 85 // Task posted to perform actual reading on the render thread. | 85 // Task posted to perform actual reading on the render thread. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 float playback_rate_; | 215 float playback_rate_; |
| 216 | 216 |
| 217 scoped_refptr<media::MediaLog> media_log_; | 217 scoped_refptr<media::MediaLog> media_log_; |
| 218 | 218 |
| 219 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 219 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 } // namespace webkit_media | 222 } // namespace webkit_media |
| 223 | 223 |
| 224 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ | 224 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |