| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BLINK_BUFFERED_DATA_SOURCE_H_ | 5 #ifndef MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| 6 #define MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 6 #define MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "media/base/data_source.h" | 15 #include "media/base/data_source.h" |
| 16 #include "media/base/media_export.h" | |
| 17 #include "media/base/ranges.h" | 16 #include "media/base/ranges.h" |
| 18 #include "media/blink/buffered_resource_loader.h" | 17 #include "media/blink/buffered_resource_loader.h" |
| 18 #include "media/blink/media_blink_export.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace media { | 25 namespace media { |
| 26 class MediaLog; | 26 class MediaLog; |
| 27 | 27 |
| 28 class MEDIA_EXPORT BufferedDataSourceHost { | 28 class MEDIA_BLINK_EXPORT BufferedDataSourceHost { |
| 29 public: | 29 public: |
| 30 // Notify the host of the total size of the media file. | 30 // Notify the host of the total size of the media file. |
| 31 virtual void SetTotalBytes(int64 total_bytes) = 0; | 31 virtual void SetTotalBytes(int64 total_bytes) = 0; |
| 32 | 32 |
| 33 // Notify the host that byte range [start,end] has been buffered. | 33 // Notify the host that byte range [start,end] has been buffered. |
| 34 // TODO(fischman): remove this method when demuxing is push-based instead of | 34 // TODO(fischman): remove this method when demuxing is push-based instead of |
| 35 // pull-based. http://crbug.com/131444 | 35 // pull-based. http://crbug.com/131444 |
| 36 virtual void AddBufferedByteRange(int64 start, int64 end) = 0; | 36 virtual void AddBufferedByteRange(int64 start, int64 end) = 0; |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 virtual ~BufferedDataSourceHost() {} | 39 virtual ~BufferedDataSourceHost() {} |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // A data source capable of loading URLs and buffering the data using an | 42 // A data source capable of loading URLs and buffering the data using an |
| 43 // in-memory sliding window. | 43 // in-memory sliding window. |
| 44 // | 44 // |
| 45 // BufferedDataSource must be created and destroyed on the thread associated | 45 // BufferedDataSource must be created and destroyed on the thread associated |
| 46 // with the |task_runner| passed in the constructor. | 46 // with the |task_runner| passed in the constructor. |
| 47 class MEDIA_EXPORT BufferedDataSource : public DataSource { | 47 class MEDIA_BLINK_EXPORT BufferedDataSource : public DataSource { |
| 48 public: | 48 public: |
| 49 // Used to specify video preload states. They are "hints" to the browser about | 49 // Used to specify video preload states. They are "hints" to the browser about |
| 50 // how aggressively the browser should load and buffer data. | 50 // how aggressively the browser should load and buffer data. |
| 51 // Please see the HTML5 spec for the descriptions of these values: | 51 // Please see the HTML5 spec for the descriptions of these values: |
| 52 // http://www.w3.org/TR/html5/video.html#attr-media-preload | 52 // http://www.w3.org/TR/html5/video.html#attr-media-preload |
| 53 // | 53 // |
| 54 // Enum values must match the values in blink::WebMediaPlayer::Preload and | 54 // Enum values must match the values in blink::WebMediaPlayer::Preload and |
| 55 // there will be assertions at compile time if they do not match. | 55 // there will be assertions at compile time if they do not match. |
| 56 enum Preload { | 56 enum Preload { |
| 57 NONE, | 57 NONE, |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // reaching into this class from multiple threads to attain a WeakPtr. | 256 // reaching into this class from multiple threads to attain a WeakPtr. |
| 257 base::WeakPtr<BufferedDataSource> weak_ptr_; | 257 base::WeakPtr<BufferedDataSource> weak_ptr_; |
| 258 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 258 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
| 259 | 259 |
| 260 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 260 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 261 }; | 261 }; |
| 262 | 262 |
| 263 } // namespace media | 263 } // namespace media |
| 264 | 264 |
| 265 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 265 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |