OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "media/base/filter_factories.h" | 13 #include "media/base/filter_factories.h" |
14 #include "media/base/filters.h" | 14 #include "media/base/data_source.h" |
15 #include "webkit/media/buffered_resource_loader.h" | 15 #include "webkit/media/buffered_resource_loader.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 class MediaLog; | 18 class MediaLog; |
19 } | 19 } |
20 | 20 |
21 namespace webkit_media { | 21 namespace webkit_media { |
22 | 22 |
23 // This class may be created on any thread, and is callable from the render | 23 // This class may be created on any thread, and is callable from the render |
24 // thread as well as media-specific threads. | 24 // thread as well as media-specific threads. |
25 class BufferedDataSource : public WebDataSource { | 25 class BufferedDataSource : public WebDataSource { |
26 public: | 26 public: |
27 // Creates a DataSourceFactory for building BufferedDataSource objects. | 27 // Creates a DataSourceFactory for building BufferedDataSource objects. |
28 static media::DataSourceFactory* CreateFactory( | 28 static media::DataSourceFactory* CreateFactory( |
29 MessageLoop* render_loop, | 29 MessageLoop* render_loop, |
30 WebKit::WebFrame* frame, | 30 WebKit::WebFrame* frame, |
31 media::MediaLog* media_log, | 31 media::MediaLog* media_log, |
32 const WebDataSourceBuildObserverHack& build_observer); | 32 const WebDataSourceBuildObserverHack& build_observer); |
33 | 33 |
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(); | 38 virtual ~BufferedDataSource(); |
39 | 39 |
40 // media::Filter implementation. | 40 // media::DataSource implementation. |
41 virtual void set_host(media::FilterHost* host) OVERRIDE; | 41 // Called from demuxer thread. |
| 42 virtual void set_host(media::DataSourceHost* host) OVERRIDE; |
42 virtual void Stop(const base::Closure& callback) OVERRIDE; | 43 virtual void Stop(const base::Closure& callback) OVERRIDE; |
43 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; | 44 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; |
44 | 45 |
45 // media::DataSource implementation. | |
46 // Called from demuxer thread. | |
47 virtual void Read( | 46 virtual void Read( |
48 int64 position, | 47 int64 position, |
49 size_t size, | 48 size_t size, |
50 uint8* data, | 49 uint8* data, |
51 const media::DataSource::ReadCallback& read_callback) OVERRIDE; | 50 const media::DataSource::ReadCallback& read_callback) OVERRIDE; |
52 virtual bool GetSize(int64* size_out) OVERRIDE; | 51 virtual bool GetSize(int64* size_out) OVERRIDE; |
53 virtual bool IsStreaming() OVERRIDE; | 52 virtual bool IsStreaming() OVERRIDE; |
54 virtual void SetPreload(media::Preload preload) OVERRIDE; | 53 virtual void SetPreload(media::Preload preload) OVERRIDE; |
55 virtual void SetBitrate(int bitrate) OVERRIDE; | 54 virtual void SetBitrate(int bitrate) OVERRIDE; |
56 | 55 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 float playback_rate_; | 222 float playback_rate_; |
224 | 223 |
225 scoped_refptr<media::MediaLog> media_log_; | 224 scoped_refptr<media::MediaLog> media_log_; |
226 | 225 |
227 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 226 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
228 }; | 227 }; |
229 | 228 |
230 } // namespace webkit_media | 229 } // namespace webkit_media |
231 | 230 |
232 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ | 231 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ |
OLD | NEW |