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 WEBKIT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
6 #define WEBKIT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.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/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "cc/layers/video_frame_provider.h" | 16 #include "cc/layers/video_frame_provider.h" |
| 17 #include "content/renderer/media/android/media_info_loader.h" |
| 18 #include "content/renderer/media/android/media_source_delegate.h" |
| 19 #include "content/renderer/media/android/stream_texture_factory_android.h" |
17 #include "media/base/android/media_player_android.h" | 20 #include "media/base/android/media_player_android.h" |
18 #include "media/base/demuxer_stream.h" | 21 #include "media/base/demuxer_stream.h" |
19 #include "media/base/media_keys.h" | 22 #include "media/base/media_keys.h" |
20 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 23 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
21 #include "third_party/WebKit/public/platform/WebSize.h" | 24 #include "third_party/WebKit/public/platform/WebSize.h" |
22 #include "third_party/WebKit/public/platform/WebURL.h" | 25 #include "third_party/WebKit/public/platform/WebURL.h" |
23 #include "third_party/WebKit/public/web/WebMediaPlayer.h" | 26 #include "third_party/WebKit/public/web/WebMediaPlayer.h" |
24 #include "ui/gfx/rect_f.h" | 27 #include "ui/gfx/rect_f.h" |
25 #include "webkit/renderer/media/android/media_source_delegate.h" | |
26 #include "webkit/renderer/media/android/stream_texture_factory_android.h" | |
27 #include "webkit/renderer/media/crypto/proxy_decryptor.h" | 28 #include "webkit/renderer/media/crypto/proxy_decryptor.h" |
28 #include "webkit/renderer/media/media_info_loader.h" | |
29 | 29 |
30 namespace media { | 30 namespace media { |
31 class Demuxer; | 31 class Demuxer; |
32 class MediaLog; | 32 class MediaLog; |
33 } | 33 } |
34 | 34 |
35 namespace WebKit { | 35 namespace WebKit { |
36 class WebFrame; | 36 class WebFrame; |
37 } | 37 } |
38 | 38 |
39 namespace webkit { | 39 namespace webkit { |
40 class WebLayerImpl; | 40 class WebLayerImpl; |
41 } | 41 } |
42 | 42 |
43 namespace webkit_media { | 43 namespace webkit_media { |
| 44 class WebMediaPlayerDelegate; |
| 45 } |
| 46 |
| 47 namespace content { |
44 | 48 |
45 class MediaStreamClient; | 49 class MediaStreamClient; |
46 class WebMediaPlayerDelegate; | |
47 class WebMediaPlayerManagerAndroid; | 50 class WebMediaPlayerManagerAndroid; |
48 class WebMediaPlayerProxyAndroid; | 51 class WebMediaPlayerProxyAndroid; |
49 | 52 |
50 #if defined(GOOGLE_TV) | 53 #if defined(GOOGLE_TV) |
51 class MediaStreamAudioRenderer; | 54 class MediaStreamAudioRenderer; |
52 #endif | 55 #endif |
53 | 56 |
54 // This class implements WebKit::WebMediaPlayer by keeping the android | 57 // This class implements WebKit::WebMediaPlayer by keeping the android |
55 // media player in the browser process. It listens to all the status changes | 58 // media player in the browser process. It listens to all the status changes |
56 // sent from the browser process and sends playback controls to the media | 59 // sent from the browser process and sends playback controls to the media |
57 // player. | 60 // player. |
58 class WebMediaPlayerAndroid | 61 class WebMediaPlayerAndroid |
59 : public WebKit::WebMediaPlayer, | 62 : public WebKit::WebMediaPlayer, |
60 public cc::VideoFrameProvider, | 63 public cc::VideoFrameProvider, |
61 public base::MessageLoop::DestructionObserver, | 64 public base::MessageLoop::DestructionObserver, |
62 public base::SupportsWeakPtr<WebMediaPlayerAndroid> { | 65 public base::SupportsWeakPtr<WebMediaPlayerAndroid> { |
63 public: | 66 public: |
64 // Construct a WebMediaPlayerAndroid object. This class communicates | 67 // Construct a WebMediaPlayerAndroid object. This class communicates |
65 // with the MediaPlayerAndroid object in the browser process through | 68 // with the MediaPlayerAndroid object in the browser process through |
66 // |proxy|. | 69 // |proxy|. |
67 // TODO(qinmin): |frame| argument is used to determine whether the current | 70 // TODO(qinmin): |frame| argument is used to determine whether the current |
68 // player can enter fullscreen. This logic should probably be moved into | 71 // player can enter fullscreen. This logic should probably be moved into |
69 // blink, so that enterFullscreen() will not be called if another video is | 72 // blink, so that enterFullscreen() will not be called if another video is |
70 // already in fullscreen. | 73 // already in fullscreen. |
71 WebMediaPlayerAndroid(WebKit::WebFrame* frame, | 74 WebMediaPlayerAndroid( |
72 WebKit::WebMediaPlayerClient* client, | 75 WebKit::WebFrame* frame, |
73 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 76 WebKit::WebMediaPlayerClient* client, |
74 WebMediaPlayerManagerAndroid* manager, | 77 base::WeakPtr<webkit_media::WebMediaPlayerDelegate> delegate, |
75 WebMediaPlayerProxyAndroid* proxy, | 78 WebMediaPlayerManagerAndroid* manager, |
76 StreamTextureFactory* factory, | 79 WebMediaPlayerProxyAndroid* proxy, |
77 media::MediaLog* media_log); | 80 StreamTextureFactory* factory, |
| 81 media::MediaLog* media_log); |
78 virtual ~WebMediaPlayerAndroid(); | 82 virtual ~WebMediaPlayerAndroid(); |
79 | 83 |
80 // WebKit::WebMediaPlayer implementation. | 84 // WebKit::WebMediaPlayer implementation. |
81 virtual void enterFullscreen(); | 85 virtual void enterFullscreen(); |
82 virtual void exitFullscreen(); | 86 virtual void exitFullscreen(); |
83 virtual bool canEnterFullscreen() const; | 87 virtual bool canEnterFullscreen() const; |
84 | 88 |
85 // Resource loading. | 89 // Resource loading. |
86 virtual void load(const WebKit::WebURL& url, CORSMode cors_mode); | 90 virtual void load(const WebKit::WebURL& url, CORSMode cors_mode); |
87 virtual void load(const WebKit::WebURL& url, | 91 virtual void load(const WebKit::WebURL& url, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 278 |
275 WebKit::WebFrame* const frame_; | 279 WebKit::WebFrame* const frame_; |
276 | 280 |
277 WebKit::WebMediaPlayerClient* const client_; | 281 WebKit::WebMediaPlayerClient* const client_; |
278 | 282 |
279 // |delegate_| is used to notify the browser process of the player status, so | 283 // |delegate_| is used to notify the browser process of the player status, so |
280 // that the browser process can control screen locks. | 284 // that the browser process can control screen locks. |
281 // TODO(qinmin): Currently android mediaplayer takes care of the screen | 285 // TODO(qinmin): Currently android mediaplayer takes care of the screen |
282 // lock. So this is only used for media source. Will apply this to regular | 286 // lock. So this is only used for media source. Will apply this to regular |
283 // media tag once http://crbug.com/247892 is fixed. | 287 // media tag once http://crbug.com/247892 is fixed. |
284 base::WeakPtr<WebMediaPlayerDelegate> delegate_; | 288 base::WeakPtr<webkit_media::WebMediaPlayerDelegate> delegate_; |
285 | 289 |
286 // Save the list of buffered time ranges. | 290 // Save the list of buffered time ranges. |
287 WebKit::WebTimeRanges buffered_; | 291 WebKit::WebTimeRanges buffered_; |
288 | 292 |
289 // Size of the video. | 293 // Size of the video. |
290 WebKit::WebSize natural_size_; | 294 WebKit::WebSize natural_size_; |
291 | 295 |
292 // The video frame object used for rendering by the compositor. | 296 // The video frame object used for rendering by the compositor. |
293 scoped_refptr<media::VideoFrame> current_frame_; | 297 scoped_refptr<media::VideoFrame> current_frame_; |
294 | 298 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 400 |
397 // The currently selected key system. Empty string means that no key system | 401 // The currently selected key system. Empty string means that no key system |
398 // has been selected. | 402 // has been selected. |
399 WebKit::WebString current_key_system_; | 403 WebKit::WebString current_key_system_; |
400 | 404 |
401 // Temporary for EME v0.1. In the future the init data type should be passed | 405 // Temporary for EME v0.1. In the future the init data type should be passed |
402 // through GenerateKeyRequest() directly from WebKit. | 406 // through GenerateKeyRequest() directly from WebKit. |
403 std::string init_data_type_; | 407 std::string init_data_type_; |
404 | 408 |
405 // The decryptor that manages decryption keys and decrypts encrypted frames. | 409 // The decryptor that manages decryption keys and decrypts encrypted frames. |
406 scoped_ptr<ProxyDecryptor> decryptor_; | 410 scoped_ptr<webkit_media::ProxyDecryptor> decryptor_; |
407 | 411 |
408 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 412 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
409 }; | 413 }; |
410 | 414 |
411 } // namespace webkit_media | 415 } // namespace content |
412 | 416 |
413 #endif // WEBKIT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 417 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |