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 CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
16 #include "content/renderer/media/crypto/proxy_decryptor.h" | 16 #include "content/renderer/media/crypto/proxy_decryptor.h" |
17 #include "content/renderer/media/video_frame_compositor.h" | 17 #include "content/renderer/media/video_frame_compositor.h" |
18 #include "media/base/audio_renderer_sink.h" | 18 #include "media/base/audio_renderer_sink.h" |
19 #include "media/base/decryptor.h" | 19 #include "media/base/decryptor.h" |
20 // TODO(xhwang): Remove when we remove prefixed EME implementation. | 20 // TODO(xhwang): Remove when we remove prefixed EME implementation. |
21 #include "media/base/media_keys.h" | 21 #include "media/base/media_keys.h" |
22 #include "media/base/pipeline.h" | 22 #include "media/base/pipeline.h" |
23 #include "media/base/text_track.h" | 23 #include "media/base/text_track.h" |
24 #include "media/filters/skcanvas_video_renderer.h" | 24 #include "media/filters/skcanvas_video_renderer.h" |
25 #include "skia/ext/platform_canvas.h" | 25 #include "skia/ext/platform_canvas.h" |
26 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" | 26 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" |
27 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 27 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
28 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 28 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
29 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 29 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
| 30 // TODO(dcheng): Convert back to forward declare. |
| 31 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
30 #include "url/gurl.h" | 32 #include "url/gurl.h" |
31 | 33 |
32 class RenderAudioSourceProvider; | 34 class RenderAudioSourceProvider; |
33 | 35 |
34 namespace blink { | 36 namespace blink { |
35 class WebContentDecryptionModule; | 37 class WebContentDecryptionModule; |
36 class WebFrame; | |
37 } | 38 } |
38 | 39 |
39 namespace base { | 40 namespace base { |
40 class MessageLoopProxy; | 41 class MessageLoopProxy; |
41 } | 42 } |
42 | 43 |
43 namespace media { | 44 namespace media { |
44 class ChunkDemuxer; | 45 class ChunkDemuxer; |
45 class GpuVideoAcceleratorFactories; | 46 class GpuVideoAcceleratorFactories; |
46 class MediaLog; | 47 class MediaLog; |
(...skipping 14 matching lines...) Expand all Loading... |
61 | 62 |
62 // The canonical implementation of blink::WebMediaPlayer that's backed by | 63 // The canonical implementation of blink::WebMediaPlayer that's backed by |
63 // media::Pipeline. Handles normal resource loading, Media Source, and | 64 // media::Pipeline. Handles normal resource loading, Media Source, and |
64 // Encrypted Media. | 65 // Encrypted Media. |
65 class WebMediaPlayerImpl | 66 class WebMediaPlayerImpl |
66 : public blink::WebMediaPlayer, | 67 : public blink::WebMediaPlayer, |
67 public base::SupportsWeakPtr<WebMediaPlayerImpl> { | 68 public base::SupportsWeakPtr<WebMediaPlayerImpl> { |
68 public: | 69 public: |
69 // Constructs a WebMediaPlayer implementation using Chromium's media stack. | 70 // Constructs a WebMediaPlayer implementation using Chromium's media stack. |
70 // |delegate| may be null. | 71 // |delegate| may be null. |
71 WebMediaPlayerImpl( | 72 WebMediaPlayerImpl(blink::WebLocalFrame* frame, |
72 blink::WebFrame* frame, | 73 blink::WebMediaPlayerClient* client, |
73 blink::WebMediaPlayerClient* client, | 74 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
74 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 75 const WebMediaPlayerParams& params); |
75 const WebMediaPlayerParams& params); | |
76 virtual ~WebMediaPlayerImpl(); | 76 virtual ~WebMediaPlayerImpl(); |
77 | 77 |
78 virtual void load(LoadType load_type, | 78 virtual void load(LoadType load_type, |
79 const blink::WebURL& url, | 79 const blink::WebURL& url, |
80 CORSMode cors_mode); | 80 CORSMode cors_mode); |
81 | 81 |
82 // Playback controls. | 82 // Playback controls. |
83 virtual void play(); | 83 virtual void play(); |
84 virtual void pause(); | 84 virtual void pause(); |
85 virtual bool supportsSave() const; | 85 virtual bool supportsSave() const; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // Called by VideoRendererImpl on its internal thread with the new frame to be | 231 // Called by VideoRendererImpl on its internal thread with the new frame to be |
232 // painted. | 232 // painted. |
233 void FrameReady(const scoped_refptr<media::VideoFrame>& frame); | 233 void FrameReady(const scoped_refptr<media::VideoFrame>& frame); |
234 | 234 |
235 // Requests that this object notifies when a decryptor is ready through the | 235 // Requests that this object notifies when a decryptor is ready through the |
236 // |decryptor_ready_cb| provided. | 236 // |decryptor_ready_cb| provided. |
237 // If |decryptor_ready_cb| is null, the existing callback will be fired with | 237 // If |decryptor_ready_cb| is null, the existing callback will be fired with |
238 // NULL immediately and reset. | 238 // NULL immediately and reset. |
239 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); | 239 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); |
240 | 240 |
241 blink::WebFrame* frame_; | 241 blink::WebLocalFrame* frame_; |
242 | 242 |
243 // TODO(hclam): get rid of these members and read from the pipeline directly. | 243 // TODO(hclam): get rid of these members and read from the pipeline directly. |
244 blink::WebMediaPlayer::NetworkState network_state_; | 244 blink::WebMediaPlayer::NetworkState network_state_; |
245 blink::WebMediaPlayer::ReadyState ready_state_; | 245 blink::WebMediaPlayer::ReadyState ready_state_; |
246 | 246 |
247 // Keep a list of buffered time ranges. | 247 // Keep a list of buffered time ranges. |
248 blink::WebTimeRanges buffered_; | 248 blink::WebTimeRanges buffered_; |
249 | 249 |
250 // Message loops for posting tasks on Chrome's main thread. Also used | 250 // Message loops for posting tasks on Chrome's main thread. Also used |
251 // for DCHECKs so methods calls won't execute in the wrong thread. | 251 // for DCHECKs so methods calls won't execute in the wrong thread. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 WebContentDecryptionModuleImpl* web_cdm_; | 343 WebContentDecryptionModuleImpl* web_cdm_; |
344 | 344 |
345 media::DecryptorReadyCB decryptor_ready_cb_; | 345 media::DecryptorReadyCB decryptor_ready_cb_; |
346 | 346 |
347 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 347 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
348 }; | 348 }; |
349 | 349 |
350 } // namespace content | 350 } // namespace content |
351 | 351 |
352 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 352 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |