| 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_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| 6 #define CONTENT_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 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "media/base/android/media_player_android.h" | 25 #include "media/base/android/media_player_android.h" |
| 26 #include "media/base/demuxer_stream.h" | 26 #include "media/base/demuxer_stream.h" |
| 27 #include "media/base/media_keys.h" | 27 #include "media/base/media_keys.h" |
| 28 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 28 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 29 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 29 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 30 #include "third_party/WebKit/public/platform/WebSize.h" | 30 #include "third_party/WebKit/public/platform/WebSize.h" |
| 31 #include "third_party/WebKit/public/platform/WebURL.h" | 31 #include "third_party/WebKit/public/platform/WebURL.h" |
| 32 #include "ui/gfx/rect_f.h" | 32 #include "ui/gfx/rect_f.h" |
| 33 | 33 |
| 34 namespace media { | 34 namespace media { |
| 35 class Demuxer; | |
| 36 class MediaLog; | 35 class MediaLog; |
| 37 } | 36 } |
| 38 | 37 |
| 39 namespace blink { | 38 namespace blink { |
| 40 class WebFrame; | 39 class WebFrame; |
| 41 } | 40 } |
| 42 | 41 |
| 43 namespace webkit { | 42 namespace webkit { |
| 44 class WebLayerImpl; | 43 class WebLayerImpl; |
| 45 } | 44 } |
| 46 | 45 |
| 47 namespace content { | 46 namespace content { |
| 48 class WebMediaPlayerDelegate; | 47 class WebMediaPlayerDelegate; |
| 49 class RendererMediaPlayerManager; | 48 class RendererMediaPlayerManager; |
| 50 | 49 |
| 51 #if defined(GOOGLE_TV) | |
| 52 class MediaStreamAudioRenderer; | |
| 53 class MediaStreamClient; | |
| 54 #endif | |
| 55 | |
| 56 // This class implements blink::WebMediaPlayer by keeping the android | 50 // This class implements blink::WebMediaPlayer by keeping the android |
| 57 // 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 |
| 58 // 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 |
| 59 // player. | 53 // player. |
| 60 class WebMediaPlayerAndroid | 54 class WebMediaPlayerAndroid |
| 61 : public blink::WebMediaPlayer, | 55 : public blink::WebMediaPlayer, |
| 62 public cc::VideoFrameProvider, | 56 public cc::VideoFrameProvider, |
| 63 public base::MessageLoop::DestructionObserver, | 57 public base::MessageLoop::DestructionObserver, |
| 64 public base::SupportsWeakPtr<WebMediaPlayerAndroid> { | 58 public base::SupportsWeakPtr<WebMediaPlayerAndroid> { |
| 65 public: | 59 public: |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 int system_code); | 212 int system_code); |
| 219 void OnKeyMessage(const std::string& session_id, | 213 void OnKeyMessage(const std::string& session_id, |
| 220 const std::vector<uint8>& message, | 214 const std::vector<uint8>& message, |
| 221 const std::string& destination_url); | 215 const std::string& destination_url); |
| 222 | 216 |
| 223 void OnMediaSourceOpened(blink::WebMediaSource* web_media_source); | 217 void OnMediaSourceOpened(blink::WebMediaSource* web_media_source); |
| 224 | 218 |
| 225 void OnNeedKey(const std::string& type, | 219 void OnNeedKey(const std::string& type, |
| 226 const std::vector<uint8>& init_data); | 220 const std::vector<uint8>& init_data); |
| 227 | 221 |
| 228 #if defined(GOOGLE_TV) | |
| 229 bool InjectMediaStream(MediaStreamClient* media_stream_client, | |
| 230 media::Demuxer* demuxer, | |
| 231 const base::Closure& destroy_demuxer_cb); | |
| 232 #endif | |
| 233 | |
| 234 // Can be called on any thread. | 222 // Can be called on any thread. |
| 235 static void OnReleaseRemotePlaybackTexture( | 223 static void OnReleaseRemotePlaybackTexture( |
| 236 const scoped_refptr<base::MessageLoopProxy>& main_loop, | 224 const scoped_refptr<base::MessageLoopProxy>& main_loop, |
| 237 const base::WeakPtr<WebMediaPlayerAndroid>& player, | 225 const base::WeakPtr<WebMediaPlayerAndroid>& player, |
| 238 uint32 sync_point); | 226 uint32 sync_point); |
| 239 | 227 |
| 240 protected: | 228 protected: |
| 241 // Helper method to update the playing state. | 229 // Helper method to update the playing state. |
| 242 void UpdatePlayingState(bool is_playing_); | 230 void UpdatePlayingState(bool is_playing_); |
| 243 | 231 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 cc::VideoFrameProvider::Client* video_frame_provider_client_; | 383 cc::VideoFrameProvider::Client* video_frame_provider_client_; |
| 396 | 384 |
| 397 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; | 385 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; |
| 398 | 386 |
| 399 #if defined(VIDEO_HOLE) | 387 #if defined(VIDEO_HOLE) |
| 400 // A rectangle represents the geometry of video frame, when computed last | 388 // A rectangle represents the geometry of video frame, when computed last |
| 401 // time. | 389 // time. |
| 402 gfx::RectF last_computed_rect_; | 390 gfx::RectF last_computed_rect_; |
| 403 #endif // defined(VIDEO_HOLE) | 391 #endif // defined(VIDEO_HOLE) |
| 404 | 392 |
| 405 #if defined(GOOGLE_TV) | |
| 406 // Pixel threshold for external surface usage. Negative value means that the | |
| 407 // threshold is not defined, so that external surface is never used. | |
| 408 int external_surface_threshold_; | |
| 409 | |
| 410 // Media Stream related fields. | |
| 411 media::Demuxer* demuxer_; | |
| 412 base::Closure destroy_demuxer_cb_; | |
| 413 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; | |
| 414 MediaStreamClient* media_stream_client_; | |
| 415 #endif | |
| 416 | |
| 417 scoped_ptr<MediaSourceDelegate, | 393 scoped_ptr<MediaSourceDelegate, |
| 418 MediaSourceDelegate::Destroyer> media_source_delegate_; | 394 MediaSourceDelegate::Destroyer> media_source_delegate_; |
| 419 | 395 |
| 420 // Internal pending playback state. | 396 // Internal pending playback state. |
| 421 // Store a playback request that cannot be started immediately. | 397 // Store a playback request that cannot be started immediately. |
| 422 bool pending_playback_; | 398 bool pending_playback_; |
| 423 | 399 |
| 424 MediaPlayerHostMsg_Initialize_Type player_type_; | 400 MediaPlayerHostMsg_Initialize_Type player_type_; |
| 425 | 401 |
| 426 // The current playing time. Because the media player is in the browser | 402 // The current playing time. Because the media player is in the browser |
| (...skipping 20 matching lines...) Expand all Loading... |
| 447 scoped_ptr<ProxyDecryptor> decryptor_; | 423 scoped_ptr<ProxyDecryptor> decryptor_; |
| 448 | 424 |
| 449 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 425 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
| 450 | 426 |
| 451 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 427 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
| 452 }; | 428 }; |
| 453 | 429 |
| 454 } // namespace content | 430 } // namespace content |
| 455 | 431 |
| 456 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 432 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| OLD | NEW |