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 // Delegate calls from WebCore::MediaPlayerPrivate to Chrome's video player. | 5 // Delegate calls from WebCore::MediaPlayerPrivate to Chrome's video player. |
6 // It contains Pipeline which is the actual media player pipeline, it glues | 6 // It contains Pipeline which is the actual media player pipeline, it glues |
7 // the media player pipeline, data source, audio renderer and renderer. | 7 // the media player pipeline, data source, audio renderer and renderer. |
8 // Pipeline would creates multiple threads and access some public methods | 8 // Pipeline would creates multiple threads and access some public methods |
9 // of this class, so we need to be extra careful about concurrent access of | 9 // of this class, so we need to be extra careful about concurrent access of |
10 // methods and members. | 10 // methods and members. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 | 47 |
48 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 48 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
49 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 49 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
50 | 50 |
51 #include <string> | 51 #include <string> |
52 | 52 |
53 #include "base/memory/ref_counted.h" | 53 #include "base/memory/ref_counted.h" |
54 #include "base/memory/scoped_ptr.h" | 54 #include "base/memory/scoped_ptr.h" |
55 #include "base/memory/weak_ptr.h" | 55 #include "base/memory/weak_ptr.h" |
56 #include "base/message_loop.h" | 56 #include "base/message_loop.h" |
57 #include "base/threading/thread.h" | |
57 #include "googleurl/src/gurl.h" | 58 #include "googleurl/src/gurl.h" |
58 #include "media/base/audio_renderer_sink.h" | 59 #include "media/base/audio_renderer_sink.h" |
59 #include "media/base/decryptor.h" | 60 #include "media/base/decryptor.h" |
60 #include "media/base/message_loop_factory.h" | |
61 #include "media/base/pipeline.h" | 61 #include "media/base/pipeline.h" |
62 #include "media/filters/gpu_video_decoder.h" | |
62 #include "skia/ext/platform_canvas.h" | 63 #include "skia/ext/platform_canvas.h" |
63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide r.h" | 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide r.h" |
64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" | 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" |
65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" | 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" |
66 #include "webkit/media/crypto/key_systems.h" | 67 #include "webkit/media/crypto/key_systems.h" |
67 #include "webkit/media/crypto/proxy_decryptor.h" | 68 #include "webkit/media/crypto/proxy_decryptor.h" |
68 | 69 |
69 class RenderAudioSourceProvider; | 70 class RenderAudioSourceProvider; |
70 | 71 |
71 namespace WebKit { | 72 namespace WebKit { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 // filter if they wish to hear any sound coming out the speakers, otherwise | 106 // filter if they wish to hear any sound coming out the speakers, otherwise |
106 // audio data is discarded and media plays back based on wall clock time. | 107 // audio data is discarded and media plays back based on wall clock time. |
107 // | 108 // |
108 // When calling this, the |audio_source_provider| and | 109 // When calling this, the |audio_source_provider| and |
109 // |audio_renderer_sink| arguments should be the same object. | 110 // |audio_renderer_sink| arguments should be the same object. |
110 // | 111 // |
111 // TODO(scherkus): Remove WebAudioSourceProvider parameter once we | 112 // TODO(scherkus): Remove WebAudioSourceProvider parameter once we |
112 // refactor RenderAudioSourceProvider to live under webkit/media/ | 113 // refactor RenderAudioSourceProvider to live under webkit/media/ |
113 // instead of content/renderer/, see http://crbug.com/136442 | 114 // instead of content/renderer/, see http://crbug.com/136442 |
114 | 115 |
115 WebMediaPlayerImpl(WebKit::WebFrame* frame, | 116 WebMediaPlayerImpl( |
116 WebKit::WebMediaPlayerClient* client, | 117 WebKit::WebFrame* frame, |
117 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 118 WebKit::WebMediaPlayerClient* client, |
118 media::FilterCollection* collection, | 119 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
acolwell GONE FROM CHROMIUM
2012/12/10 18:12:16
How about we create a MediaContext object that hol
| |
119 WebKit::WebAudioSourceProvider* audio_source_provider, | 120 WebKit::WebAudioSourceProvider* audio_source_provider, |
120 media::AudioRendererSink* audio_renderer_sink, | 121 media::AudioRendererSink* audio_renderer_sink, |
121 media::MessageLoopFactory* message_loop_factory, | 122 const scoped_refptr<media::GpuVideoDecoder::Factories>& gpu_factories, |
122 MediaStreamClient* media_stream_client, | 123 MediaStreamClient* media_stream_client, |
123 media::MediaLog* media_log); | 124 media::MediaLog* media_log); |
124 virtual ~WebMediaPlayerImpl(); | 125 virtual ~WebMediaPlayerImpl(); |
125 | 126 |
126 virtual void load(const WebKit::WebURL& url, CORSMode cors_mode); | 127 virtual void load(const WebKit::WebURL& url, CORSMode cors_mode); |
127 virtual void cancelLoad(); | 128 virtual void cancelLoad(); |
128 | 129 |
129 // Playback controls. | 130 // Playback controls. |
130 virtual void play(); | 131 virtual void play(); |
131 virtual void pause(); | 132 virtual void pause(); |
132 virtual bool supportsFullscreen() const; | 133 virtual bool supportsFullscreen() const; |
133 virtual bool supportsSave() const; | 134 virtual bool supportsSave() const; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 | 299 |
299 // Keep a list of buffered time ranges. | 300 // Keep a list of buffered time ranges. |
300 WebKit::WebTimeRanges buffered_; | 301 WebKit::WebTimeRanges buffered_; |
301 | 302 |
302 // Message loops for posting tasks between Chrome's main thread. Also used | 303 // Message loops for posting tasks between Chrome's main thread. Also used |
303 // for DCHECKs so methods calls won't execute in the wrong thread. | 304 // for DCHECKs so methods calls won't execute in the wrong thread. |
304 MessageLoop* main_loop_; | 305 MessageLoop* main_loop_; |
305 | 306 |
306 scoped_ptr<media::FilterCollection> filter_collection_; | 307 scoped_ptr<media::FilterCollection> filter_collection_; |
307 scoped_refptr<media::Pipeline> pipeline_; | 308 scoped_refptr<media::Pipeline> pipeline_; |
309 base::Thread media_thread_; | |
308 | 310 |
309 // The currently selected key system. Empty string means that no key system | 311 // The currently selected key system. Empty string means that no key system |
310 // has been selected. | 312 // has been selected. |
311 WebKit::WebString current_key_system_; | 313 WebKit::WebString current_key_system_; |
312 | 314 |
313 scoped_ptr<media::MessageLoopFactory> message_loop_factory_; | |
314 | |
315 // Playback state. | 315 // Playback state. |
316 // | 316 // |
317 // TODO(scherkus): we have these because Pipeline favours the simplicity of a | 317 // TODO(scherkus): we have these because Pipeline favours the simplicity of a |
318 // single "playback rate" over worrying about paused/stopped etc... It forces | 318 // single "playback rate" over worrying about paused/stopped etc... It forces |
319 // all clients to manage the pause+playback rate externally, but is that | 319 // all clients to manage the pause+playback rate externally, but is that |
320 // really a bad thing? | 320 // really a bad thing? |
321 // | 321 // |
322 // TODO(scherkus): since SetPlaybackRate(0) is asynchronous and we don't want | 322 // TODO(scherkus): since SetPlaybackRate(0) is asynchronous and we don't want |
323 // to hang the render thread during pause(), we record the time at the same | 323 // to hang the render thread during pause(), we record the time at the same |
324 // time we pause and then return that value in currentTime(). Otherwise our | 324 // time we pause and then return that value in currentTime(). Otherwise our |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 // Temporary for EME v0.1. In the future the init data type should be passed | 367 // Temporary for EME v0.1. In the future the init data type should be passed |
368 // through GenerateKeyRequest() directly from WebKit. | 368 // through GenerateKeyRequest() directly from WebKit. |
369 std::string init_data_type_; | 369 std::string init_data_type_; |
370 | 370 |
371 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 371 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
372 }; | 372 }; |
373 | 373 |
374 } // namespace webkit_media | 374 } // namespace webkit_media |
375 | 375 |
376 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 376 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |