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 #include "webkit/media/android/webmediaplayer_android.h" | 5 #include "webkit/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "cc/layers/video_layer.h" | 10 #include "cc/layers/video_layer.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 PlayInternal(); | 108 PlayInternal(); |
109 is_playing_ = true; | 109 is_playing_ = true; |
110 } | 110 } |
111 | 111 |
112 void WebMediaPlayerAndroid::pause() { | 112 void WebMediaPlayerAndroid::pause() { |
113 PauseInternal(); | 113 PauseInternal(); |
114 is_playing_ = false; | 114 is_playing_ = false; |
115 } | 115 } |
116 | 116 |
| 117 void WebMediaPlayerAndroid::seekFloat(float seconds) { |
| 118 seek(seconds); |
| 119 } |
| 120 |
117 void WebMediaPlayerAndroid::seek(float seconds) { | 121 void WebMediaPlayerAndroid::seek(float seconds) { |
118 pending_seek_ = seconds; | 122 pending_seek_ = seconds; |
119 seeking_ = true; | 123 seeking_ = true; |
120 | 124 |
121 SeekInternal(ConvertSecondsToTimestamp(seconds)); | 125 SeekInternal(ConvertSecondsToTimestamp(seconds)); |
122 } | 126 } |
123 | 127 |
124 bool WebMediaPlayerAndroid::supportsFullscreen() const { | 128 bool WebMediaPlayerAndroid::supportsFullscreen() const { |
125 return true; | 129 return true; |
126 } | 130 } |
127 | 131 |
128 bool WebMediaPlayerAndroid::supportsSave() const { | 132 bool WebMediaPlayerAndroid::supportsSave() const { |
129 return false; | 133 return false; |
130 } | 134 } |
131 | 135 |
| 136 void WebMediaPlayerAndroid::setEndTimeFloat(float seconds) { |
| 137 setEndTime(seconds); |
| 138 } |
| 139 |
132 void WebMediaPlayerAndroid::setEndTime(float seconds) { | 140 void WebMediaPlayerAndroid::setEndTime(float seconds) { |
133 // Deprecated. | 141 // Deprecated. |
134 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. | 142 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. |
135 } | 143 } |
136 | 144 |
| 145 void WebMediaPlayerAndroid::setRateFloat(float rate) { |
| 146 setRate(rate); |
| 147 } |
| 148 |
137 void WebMediaPlayerAndroid::setRate(float rate) { | 149 void WebMediaPlayerAndroid::setRate(float rate) { |
138 NOTIMPLEMENTED(); | 150 NOTIMPLEMENTED(); |
139 } | 151 } |
140 | 152 |
| 153 void WebMediaPlayerAndroid::setVolumeFloat(float volume) { |
| 154 setVolume(volume); |
| 155 } |
| 156 |
141 void WebMediaPlayerAndroid::setVolume(float volume) { | 157 void WebMediaPlayerAndroid::setVolume(float volume) { |
142 NOTIMPLEMENTED(); | 158 NOTIMPLEMENTED(); |
143 } | 159 } |
144 | 160 |
145 void WebMediaPlayerAndroid::setVisible(bool visible) { | 161 void WebMediaPlayerAndroid::setVisible(bool visible) { |
146 // Deprecated. | 162 // Deprecated. |
147 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. | 163 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. |
148 } | 164 } |
149 | 165 |
150 bool WebMediaPlayerAndroid::totalBytesKnown() { | 166 bool WebMediaPlayerAndroid::totalBytesKnown() { |
(...skipping 28 matching lines...) Expand all Loading... |
179 } | 195 } |
180 | 196 |
181 bool WebMediaPlayerAndroid::paused() const { | 197 bool WebMediaPlayerAndroid::paused() const { |
182 return !is_playing_; | 198 return !is_playing_; |
183 } | 199 } |
184 | 200 |
185 bool WebMediaPlayerAndroid::seeking() const { | 201 bool WebMediaPlayerAndroid::seeking() const { |
186 return seeking_; | 202 return seeking_; |
187 } | 203 } |
188 | 204 |
| 205 float WebMediaPlayerAndroid::durationFloat() const { |
| 206 return duration(); |
| 207 } |
| 208 |
189 float WebMediaPlayerAndroid::duration() const { | 209 float WebMediaPlayerAndroid::duration() const { |
190 return static_cast<float>(duration_.InSecondsF()); | 210 return static_cast<float>(duration_.InSecondsF()); |
191 } | 211 } |
192 | 212 |
| 213 float WebMediaPlayerAndroid::currentTimeFloat() const { |
| 214 return currentTime(); |
| 215 } |
| 216 |
193 float WebMediaPlayerAndroid::currentTime() const { | 217 float WebMediaPlayerAndroid::currentTime() const { |
194 // If the player is pending for a seek, return the seek time. | 218 // If the player is pending for a seek, return the seek time. |
195 if (seeking()) | 219 if (seeking()) |
196 return pending_seek_; | 220 return pending_seek_; |
197 | 221 |
198 return GetCurrentTimeInternal(); | 222 return GetCurrentTimeInternal(); |
199 } | 223 } |
200 | 224 |
201 int WebMediaPlayerAndroid::dataRate() const { | 225 int WebMediaPlayerAndroid::dataRate() const { |
202 // Deprecated. | 226 // Deprecated. |
(...skipping 10 matching lines...) Expand all Loading... |
213 } | 237 } |
214 | 238 |
215 WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { | 239 WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { |
216 return ready_state_; | 240 return ready_state_; |
217 } | 241 } |
218 | 242 |
219 const WebTimeRanges& WebMediaPlayerAndroid::buffered() { | 243 const WebTimeRanges& WebMediaPlayerAndroid::buffered() { |
220 return buffered_; | 244 return buffered_; |
221 } | 245 } |
222 | 246 |
| 247 float WebMediaPlayerAndroid::maxTimeSeekableFloat() const { |
| 248 return maxTimeSeekable(); |
| 249 } |
| 250 |
223 float WebMediaPlayerAndroid::maxTimeSeekable() const { | 251 float WebMediaPlayerAndroid::maxTimeSeekable() const { |
224 // TODO(hclam): If this stream is not seekable this should return 0. | 252 // TODO(hclam): If this stream is not seekable this should return 0. |
225 return duration(); | 253 return duration(); |
226 } | 254 } |
227 | 255 |
228 bool WebMediaPlayerAndroid::didLoadingProgress() const { | 256 bool WebMediaPlayerAndroid::didLoadingProgress() const { |
229 bool ret = did_loading_progress_; | 257 bool ret = did_loading_progress_; |
230 did_loading_progress_ = false; | 258 did_loading_progress_ = false; |
231 return ret; | 259 return ret; |
232 } | 260 } |
(...skipping 20 matching lines...) Expand all Loading... |
253 bool WebMediaPlayerAndroid::didPassCORSAccessCheck() const { | 281 bool WebMediaPlayerAndroid::didPassCORSAccessCheck() const { |
254 return false; | 282 return false; |
255 } | 283 } |
256 | 284 |
257 WebMediaPlayer::MovieLoadType WebMediaPlayerAndroid::movieLoadType() const { | 285 WebMediaPlayer::MovieLoadType WebMediaPlayerAndroid::movieLoadType() const { |
258 // Deprecated. | 286 // Deprecated. |
259 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. | 287 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. |
260 return WebMediaPlayer::MovieLoadTypeUnknown; | 288 return WebMediaPlayer::MovieLoadTypeUnknown; |
261 } | 289 } |
262 | 290 |
| 291 float WebMediaPlayerAndroid::mediaTimeForTimeValueFloat(float timeValue) const { |
| 292 return mediaTimeForTimeValue(timeValue); |
| 293 } |
| 294 |
263 float WebMediaPlayerAndroid::mediaTimeForTimeValue(float timeValue) const { | 295 float WebMediaPlayerAndroid::mediaTimeForTimeValue(float timeValue) const { |
264 return ConvertSecondsToTimestamp(timeValue).InSecondsF(); | 296 return ConvertSecondsToTimestamp(timeValue).InSecondsF(); |
265 } | 297 } |
266 | 298 |
267 unsigned WebMediaPlayerAndroid::decodedFrameCount() const { | 299 unsigned WebMediaPlayerAndroid::decodedFrameCount() const { |
268 NOTIMPLEMENTED(); | 300 NOTIMPLEMENTED(); |
269 return 0; | 301 return 0; |
270 } | 302 } |
271 | 303 |
272 unsigned WebMediaPlayerAndroid::droppedFrameCount() const { | 304 unsigned WebMediaPlayerAndroid::droppedFrameCount() const { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 506 |
475 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { | 507 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { |
476 needs_establish_peer_ = needs_establish_peer; | 508 needs_establish_peer_ = needs_establish_peer; |
477 } | 509 } |
478 | 510 |
479 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { | 511 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { |
480 is_playing_ = is_playing; | 512 is_playing_ = is_playing; |
481 } | 513 } |
482 | 514 |
483 } // namespace webkit_media | 515 } // namespace webkit_media |
OLD | NEW |