OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // Delete this file when WMPI_CAST is no longer needed. | 5 // Delete this file when WMPI_CAST is no longer needed. |
6 | 6 |
7 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_CAST_H_ | 7 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_CAST_H_ |
8 #define MEDIA_BLINK_WEBMEDIAPLAYER_CAST_H_ | 8 #define MEDIA_BLINK_WEBMEDIAPLAYER_CAST_H_ |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class WebMediaPlayerDelegate; | 24 class WebMediaPlayerDelegate; |
25 class WebMediaPlayerImpl; | 25 class WebMediaPlayerImpl; |
26 | 26 |
27 // This shim allows WebMediaPlayer to act sufficiently similar to | 27 // This shim allows WebMediaPlayer to act sufficiently similar to |
28 // WebMediaPlayerAndroid (by extending RendererMediaPlayerInterface) | 28 // WebMediaPlayerAndroid (by extending RendererMediaPlayerInterface) |
29 // to implement cast functionality. | 29 // to implement cast functionality. |
30 class WebMediaPlayerCast : public RendererMediaPlayerInterface { | 30 class WebMediaPlayerCast : public RendererMediaPlayerInterface { |
31 public: | 31 public: |
32 WebMediaPlayerCast(WebMediaPlayerImpl* impl, | 32 WebMediaPlayerCast(WebMediaPlayerImpl* impl, |
33 blink::WebMediaPlayerClient* client, | 33 blink::WebMediaPlayerClient* client, |
34 const WebMediaPlayerParams::Context3DCB& context_3d_cb, | 34 const WebMediaPlayerParams::Context3DCB& context_3d_cb); |
35 base::WeakPtr<WebMediaPlayerDelegate> delegate); | |
36 ~WebMediaPlayerCast(); | 35 ~WebMediaPlayerCast(); |
37 | 36 |
38 void Initialize(const GURL& url, blink::WebLocalFrame* frame); | 37 void Initialize(const GURL& url, |
| 38 blink::WebLocalFrame* frame, |
| 39 int delegate_id); |
39 | 40 |
40 void requestRemotePlayback(); | 41 void requestRemotePlayback(); |
41 void requestRemotePlaybackControl(); | 42 void requestRemotePlaybackControl(); |
42 | 43 |
43 void SetMediaPlayerManager( | 44 void SetMediaPlayerManager( |
44 RendererMediaPlayerManagerInterface* media_player_manager); | 45 RendererMediaPlayerManagerInterface* media_player_manager); |
45 bool isRemote() const { return is_remote_; } | 46 bool isRemote() const { return is_remote_; } |
46 | 47 |
47 double currentTime() const; | 48 double currentTime() const; |
48 void play(); | 49 void play(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 bool paused() const override; | 103 bool paused() const override; |
103 bool hasVideo() const override; | 104 bool hasVideo() const override; |
104 | 105 |
105 void SetDeviceScaleFactor(float scale_factor); | 106 void SetDeviceScaleFactor(float scale_factor); |
106 scoped_refptr<VideoFrame> GetCastingBanner(); | 107 scoped_refptr<VideoFrame> GetCastingBanner(); |
107 | 108 |
108 private: | 109 private: |
109 WebMediaPlayerImpl* webmediaplayer_; | 110 WebMediaPlayerImpl* webmediaplayer_; |
110 blink::WebMediaPlayerClient* client_; | 111 blink::WebMediaPlayerClient* client_; |
111 WebMediaPlayerParams::Context3DCB context_3d_cb_; | 112 WebMediaPlayerParams::Context3DCB context_3d_cb_; |
112 base::WeakPtr<WebMediaPlayerDelegate> delegate_; | |
113 | 113 |
114 // Manages this object and delegates player calls to the browser process. | 114 // Manages this object and delegates player calls to the browser process. |
115 // Owned by RenderFrameImpl. | 115 // Owned by RenderFrameImpl. |
116 RendererMediaPlayerManagerInterface* player_manager_ = nullptr; | 116 RendererMediaPlayerManagerInterface* player_manager_ = nullptr; |
117 | 117 |
118 // Player ID assigned by the |player_manager_|. | 118 // Player ID assigned by the |player_manager_|. |
119 int player_id_; | 119 int player_id_; |
120 | 120 |
121 // Whether the browser is currently connected to a remote media player. | 121 // Whether the browser is currently connected to a remote media player. |
122 bool is_remote_ = false; | 122 bool is_remote_ = false; |
123 | 123 |
124 bool paused_ = true; | 124 bool paused_ = true; |
125 bool initializing_ = false; | 125 bool initializing_ = false; |
126 bool should_notify_time_changed_ = false; | 126 bool should_notify_time_changed_ = false; |
127 | 127 |
128 // Last reported playout time. | 128 // Last reported playout time. |
129 base::TimeDelta remote_time_; | 129 base::TimeDelta remote_time_; |
130 base::TimeTicks remote_time_at_; | 130 base::TimeTicks remote_time_at_; |
| 131 base::TimeDelta duration_; |
131 | 132 |
132 // Whether the media player has been initialized. | 133 // Whether the media player has been initialized. |
133 bool is_player_initialized_ = false; | 134 bool is_player_initialized_ = false; |
134 | 135 |
135 std::string remote_playback_message_; | 136 std::string remote_playback_message_; |
136 | 137 |
137 float device_scale_factor_ = 1.0; | 138 float device_scale_factor_ = 1.0; |
138 | 139 |
139 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerCast); | 140 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerCast); |
140 }; | 141 }; |
141 | 142 |
142 // Make a texture-backed video of the given size containing the given message. | 143 // Make a texture-backed video of the given size containing the given message. |
143 MEDIA_BLINK_EXPORT scoped_refptr<VideoFrame> MakeTextFrameForCast( | 144 MEDIA_BLINK_EXPORT scoped_refptr<VideoFrame> MakeTextFrameForCast( |
144 const std::string& remote_playback_message, | 145 const std::string& remote_playback_message, |
145 gfx::Size canvas_size, | 146 gfx::Size canvas_size, |
146 gfx::Size natural_size, | 147 gfx::Size natural_size, |
147 const base::Callback<gpu::gles2::GLES2Interface*()>& context_3d_cb); | 148 const base::Callback<gpu::gles2::GLES2Interface*()>& context_3d_cb); |
148 | 149 |
149 } // namespace media | 150 } // namespace media |
150 | 151 |
151 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_CAST_H_ | 152 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_CAST_H_ |
OLD | NEW |