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 #ifndef WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define WEBKIT_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/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #if defined(GOOGLE_TV) | |
16 #include "media/base/demuxer_stream.h" | |
17 #endif | |
18 #include "cc/layers/video_frame_provider.h" | 15 #include "cc/layers/video_frame_provider.h" |
16 #include "media/base/android/media_player_bridge.h" | |
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" |
20 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
21 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" | 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" |
23 #include "ui/gfx/rect_f.h" | 21 #include "ui/gfx/rect_f.h" |
24 #include "webkit/media/android/stream_texture_factory_android.h" | 22 #include "webkit/media/android/stream_texture_factory_android.h" |
25 | 23 |
24 #if defined(GOOGLE_TV) | |
25 #include "webkit/media/android/media_source_delegate.h" | |
26 #endif | |
27 | |
26 namespace media { | 28 namespace media { |
29 class Demuxer; | |
27 class MediaLog; | 30 class MediaLog; |
28 } | 31 } |
29 | 32 |
30 namespace WebKit { | 33 namespace WebKit { |
31 class WebFrame; | 34 class WebFrame; |
32 } | 35 } |
33 | 36 |
34 namespace webkit { | 37 namespace webkit { |
35 class WebLayerImpl; | 38 class WebLayerImpl; |
36 } | 39 } |
37 | 40 |
38 namespace webkit_media { | 41 namespace webkit_media { |
39 | 42 |
40 #if defined(GOOGLE_TV) | 43 #if defined(GOOGLE_TV) |
41 class MediaSourceDelegate; | 44 class MediaStreamAudioRenderer; |
42 #endif | 45 #endif |
46 class MediaStreamClient; | |
43 class WebMediaPlayerManagerAndroid; | 47 class WebMediaPlayerManagerAndroid; |
44 class WebMediaPlayerProxyAndroid; | 48 class WebMediaPlayerProxyAndroid; |
45 | 49 |
46 // This class implements WebKit::WebMediaPlayer by keeping the android | 50 // This class implements WebKit::WebMediaPlayer by keeping the android |
47 // media player in the browser process. It listens to all the status changes | 51 // media player in the browser process. It listens to all the status changes |
48 // sent from the browser process and sends playback controls to the media | 52 // sent from the browser process and sends playback controls to the media |
49 // player. | 53 // player. |
50 class WebMediaPlayerAndroid | 54 class WebMediaPlayerAndroid |
51 : public WebKit::WebMediaPlayer, | 55 : public WebKit::WebMediaPlayer, |
52 public cc::VideoFrameProvider, | 56 public cc::VideoFrameProvider, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 unsigned key_length, | 202 unsigned key_length, |
199 const unsigned char* init_data, | 203 const unsigned char* init_data, |
200 unsigned init_data_length, | 204 unsigned init_data_length, |
201 const WebKit::WebString& session_id) OVERRIDE; | 205 const WebKit::WebString& session_id) OVERRIDE; |
202 virtual MediaKeyException cancelKeyRequest( | 206 virtual MediaKeyException cancelKeyRequest( |
203 const WebKit::WebString& key_system, | 207 const WebKit::WebString& key_system, |
204 const WebKit::WebString& session_id) OVERRIDE; | 208 const WebKit::WebString& session_id) OVERRIDE; |
205 | 209 |
206 // Called when DemuxerStreamPlayer needs to read data from ChunkDemuxer. | 210 // Called when DemuxerStreamPlayer needs to read data from ChunkDemuxer. |
207 void OnReadFromDemuxer(media::DemuxerStream::Type type, bool seek_done); | 211 void OnReadFromDemuxer(media::DemuxerStream::Type type, bool seek_done); |
212 | |
213 bool InjectMediaStream(MediaStreamClient* media_stream_client, | |
214 media::Demuxer* demuxer, | |
215 const base::Closure& destroy_demuxer_cb); | |
208 #endif | 216 #endif |
209 | 217 |
210 protected: | 218 protected: |
211 // Helper method to update the playing state. | 219 // Helper method to update the playing state. |
212 void UpdatePlayingState(bool is_playing_); | 220 void UpdatePlayingState(bool is_playing_); |
213 | 221 |
214 // Helper methods for posting task for setting states and update WebKit. | 222 // Helper methods for posting task for setting states and update WebKit. |
215 void UpdateNetworkState(WebKit::WebMediaPlayer::NetworkState state); | 223 void UpdateNetworkState(WebKit::WebMediaPlayer::NetworkState state); |
216 void UpdateReadyState(WebKit::WebMediaPlayer::ReadyState state); | 224 void UpdateReadyState(WebKit::WebMediaPlayer::ReadyState state); |
217 | 225 |
218 // Helper method to reestablish the surface texture peer for android | 226 // Helper method to reestablish the surface texture peer for android |
219 // media player. | 227 // media player. |
220 void EstablishSurfaceTexturePeer(); | 228 void EstablishSurfaceTexturePeer(); |
221 | 229 |
222 // Requesting whether the surface texture peer needs to be reestablished. | 230 // Requesting whether the surface texture peer needs to be reestablished. |
223 void SetNeedsEstablishPeer(bool needs_establish_peer); | 231 void SetNeedsEstablishPeer(bool needs_establish_peer); |
224 | 232 |
233 void InitializeMediaPlayer( | |
234 const WebKit::WebURL& url, | |
235 media::MediaPlayerAndroid::SourceType media_source_type); | |
acolwell GONE FROM CHROMIUM
2013/05/20 21:23:22
nit:s/media_// here and everywhere else SourceType
wonsik
2013/05/21 10:09:29
Done.
| |
236 | |
225 #if defined(GOOGLE_TV) | 237 #if defined(GOOGLE_TV) |
226 // Request external surface for out-of-band composition. | 238 // Request external surface for out-of-band composition. |
227 void RequestExternalSurface(); | 239 void RequestExternalSurface(); |
228 #endif | 240 #endif |
229 | 241 |
230 private: | 242 private: |
231 void ReallocateVideoFrame(); | 243 void ReallocateVideoFrame(); |
232 | 244 |
233 WebKit::WebFrame* const frame_; | 245 WebKit::WebFrame* const frame_; |
234 | 246 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 // not NULL while the compositor is actively using this webmediaplayer. | 312 // not NULL while the compositor is actively using this webmediaplayer. |
301 cc::VideoFrameProvider::Client* video_frame_provider_client_; | 313 cc::VideoFrameProvider::Client* video_frame_provider_client_; |
302 | 314 |
303 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; | 315 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; |
304 | 316 |
305 #if defined(GOOGLE_TV) | 317 #if defined(GOOGLE_TV) |
306 // A rectangle represents the geometry of video frame, when computed last | 318 // A rectangle represents the geometry of video frame, when computed last |
307 // time. | 319 // time. |
308 gfx::RectF last_computed_rect_; | 320 gfx::RectF last_computed_rect_; |
309 | 321 |
322 // Media Source / Media Stream related fields. | |
310 scoped_ptr<MediaSourceDelegate> media_source_delegate_; | 323 scoped_ptr<MediaSourceDelegate> media_source_delegate_; |
324 media::Demuxer* demuxer_; | |
325 base::Closure destroy_demuxer_cb_; | |
311 #endif | 326 #endif |
312 | 327 |
313 // Proxy object that delegates method calls on Render Thread. | 328 // Proxy object that delegates method calls on Render Thread. |
314 // This object is created on the Render Thread and is only called in the | 329 // This object is created on the Render Thread and is only called in the |
315 // destructor. | 330 // destructor. |
316 WebMediaPlayerProxyAndroid* proxy_; | 331 WebMediaPlayerProxyAndroid* proxy_; |
317 | 332 |
318 // The current playing time. Because the media player is in the browser | 333 // The current playing time. Because the media player is in the browser |
319 // process, it will regularly update the |current_time_| by calling | 334 // process, it will regularly update the |current_time_| by calling |
320 // OnTimeUpdate(). | 335 // OnTimeUpdate(). |
321 float current_time_; | 336 float current_time_; |
322 | 337 |
323 media::MediaLog* media_log_; | 338 media::MediaLog* media_log_; |
339 MediaStreamClient* media_stream_client_; | |
324 | 340 |
325 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 341 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
326 }; | 342 }; |
327 | 343 |
328 } // namespace webkit_media | 344 } // namespace webkit_media |
329 | 345 |
330 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 346 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |