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 "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 void WebMediaPlayerAndroid::pause() { | 108 void WebMediaPlayerAndroid::pause() { |
109 PauseInternal(); | 109 PauseInternal(); |
110 is_playing_ = false; | 110 is_playing_ = false; |
111 } | 111 } |
112 | 112 |
113 void WebMediaPlayerAndroid::seekFloat(float seconds) { | 113 void WebMediaPlayerAndroid::seekFloat(float seconds) { |
114 seek(seconds); | 114 seek(seconds); |
115 } | 115 } |
116 | 116 |
117 void WebMediaPlayerAndroid::seek(float seconds) { | 117 void WebMediaPlayerAndroid::seek(double seconds) { |
118 pending_seek_ = seconds; | 118 pending_seek_ = seconds; |
119 seeking_ = true; | 119 seeking_ = true; |
120 | 120 |
121 SeekInternal(ConvertSecondsToTimestamp(seconds)); | 121 SeekInternal(ConvertSecondsToTimestamp(seconds)); |
122 } | 122 } |
123 | 123 |
124 bool WebMediaPlayerAndroid::supportsFullscreen() const { | 124 bool WebMediaPlayerAndroid::supportsFullscreen() const { |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
128 bool WebMediaPlayerAndroid::supportsSave() const { | 128 bool WebMediaPlayerAndroid::supportsSave() const { |
129 return false; | 129 return false; |
130 } | 130 } |
131 | 131 |
132 void WebMediaPlayerAndroid::setEndTimeFloat(float seconds) { | 132 void WebMediaPlayerAndroid::setEndTimeFloat(float seconds) { |
133 setEndTime(seconds); | 133 setEndTime(seconds); |
134 } | 134 } |
135 | 135 |
136 void WebMediaPlayerAndroid::setEndTime(float seconds) { | 136 void WebMediaPlayerAndroid::setEndTime(double seconds) { |
137 // Deprecated. | 137 // Deprecated. |
138 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. | 138 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. |
139 } | 139 } |
140 | 140 |
141 void WebMediaPlayerAndroid::setRateFloat(float rate) { | 141 void WebMediaPlayerAndroid::setRateFloat(float rate) { |
142 setRate(rate); | 142 setRate(rate); |
143 } | 143 } |
144 | 144 |
145 void WebMediaPlayerAndroid::setRate(float rate) { | 145 void WebMediaPlayerAndroid::setRate(double rate) { |
146 NOTIMPLEMENTED(); | 146 NOTIMPLEMENTED(); |
147 } | 147 } |
148 | 148 |
149 void WebMediaPlayerAndroid::setVolumeFloat(float volume) { | 149 void WebMediaPlayerAndroid::setVolumeFloat(float volume) { |
150 setVolume(volume); | 150 setVolume(volume); |
151 } | 151 } |
152 | 152 |
153 void WebMediaPlayerAndroid::setVolume(float volume) { | 153 void WebMediaPlayerAndroid::setVolume(double volume) { |
154 NOTIMPLEMENTED(); | 154 NOTIMPLEMENTED(); |
155 } | 155 } |
156 | 156 |
157 void WebMediaPlayerAndroid::setVisible(bool visible) { | 157 void WebMediaPlayerAndroid::setVisible(bool visible) { |
158 // Deprecated. | 158 // Deprecated. |
159 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. | 159 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. |
160 } | 160 } |
161 | 161 |
162 bool WebMediaPlayerAndroid::totalBytesKnown() { | 162 bool WebMediaPlayerAndroid::totalBytesKnown() { |
163 NOTIMPLEMENTED(); | 163 NOTIMPLEMENTED(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 | 196 |
197 bool WebMediaPlayerAndroid::seeking() const { | 197 bool WebMediaPlayerAndroid::seeking() const { |
198 return seeking_; | 198 return seeking_; |
199 } | 199 } |
200 | 200 |
201 float WebMediaPlayerAndroid::durationFloat() const { | 201 float WebMediaPlayerAndroid::durationFloat() const { |
202 return duration(); | 202 return duration(); |
203 } | 203 } |
204 | 204 |
205 float WebMediaPlayerAndroid::duration() const { | 205 double WebMediaPlayerAndroid::duration() const { |
206 return static_cast<float>(duration_.InSecondsF()); | 206 return duration_.InSecondsF(); |
207 } | 207 } |
208 | 208 |
209 float WebMediaPlayerAndroid::currentTimeFloat() const { | 209 float WebMediaPlayerAndroid::currentTimeFloat() const { |
210 return currentTime(); | 210 return currentTime(); |
211 } | 211 } |
212 | 212 |
213 float WebMediaPlayerAndroid::currentTime() const { | 213 double WebMediaPlayerAndroid::currentTime() const { |
214 // If the player is pending for a seek, return the seek time. | 214 // If the player is pending for a seek, return the seek time. |
215 if (seeking()) | 215 if (seeking()) |
216 return pending_seek_; | 216 return pending_seek_; |
217 | 217 |
218 return GetCurrentTimeInternal(); | 218 return GetCurrentTimeInternal(); |
219 } | 219 } |
220 | 220 |
221 int WebMediaPlayerAndroid::dataRate() const { | 221 int WebMediaPlayerAndroid::dataRate() const { |
222 // Deprecated. | 222 // Deprecated. |
223 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. | 223 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. |
(...skipping 13 matching lines...) Expand all Loading... |
237 } | 237 } |
238 | 238 |
239 const WebTimeRanges& WebMediaPlayerAndroid::buffered() { | 239 const WebTimeRanges& WebMediaPlayerAndroid::buffered() { |
240 return buffered_; | 240 return buffered_; |
241 } | 241 } |
242 | 242 |
243 float WebMediaPlayerAndroid::maxTimeSeekableFloat() const { | 243 float WebMediaPlayerAndroid::maxTimeSeekableFloat() const { |
244 return maxTimeSeekable(); | 244 return maxTimeSeekable(); |
245 } | 245 } |
246 | 246 |
247 float WebMediaPlayerAndroid::maxTimeSeekable() const { | 247 double WebMediaPlayerAndroid::maxTimeSeekable() const { |
248 // TODO(hclam): If this stream is not seekable this should return 0. | 248 // TODO(hclam): If this stream is not seekable this should return 0. |
249 return duration(); | 249 return duration(); |
250 } | 250 } |
251 | 251 |
252 bool WebMediaPlayerAndroid::didLoadingProgress() const { | 252 bool WebMediaPlayerAndroid::didLoadingProgress() const { |
253 bool ret = did_loading_progress_; | 253 bool ret = did_loading_progress_; |
254 did_loading_progress_ = false; | 254 did_loading_progress_ = false; |
255 return ret; | 255 return ret; |
256 } | 256 } |
257 | 257 |
(...skipping 23 matching lines...) Expand all Loading... |
281 WebMediaPlayer::MovieLoadType WebMediaPlayerAndroid::movieLoadType() const { | 281 WebMediaPlayer::MovieLoadType WebMediaPlayerAndroid::movieLoadType() const { |
282 // Deprecated. | 282 // Deprecated. |
283 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. | 283 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. |
284 return WebMediaPlayer::MovieLoadTypeUnknown; | 284 return WebMediaPlayer::MovieLoadTypeUnknown; |
285 } | 285 } |
286 | 286 |
287 float WebMediaPlayerAndroid::mediaTimeForTimeValueFloat(float timeValue) const { | 287 float WebMediaPlayerAndroid::mediaTimeForTimeValueFloat(float timeValue) const { |
288 return mediaTimeForTimeValue(timeValue); | 288 return mediaTimeForTimeValue(timeValue); |
289 } | 289 } |
290 | 290 |
291 float WebMediaPlayerAndroid::mediaTimeForTimeValue(float timeValue) const { | 291 double WebMediaPlayerAndroid::mediaTimeForTimeValue(double timeValue) const { |
292 return ConvertSecondsToTimestamp(timeValue).InSecondsF(); | 292 return ConvertSecondsToTimestamp(timeValue).InSecondsF(); |
293 } | 293 } |
294 | 294 |
295 unsigned WebMediaPlayerAndroid::decodedFrameCount() const { | 295 unsigned WebMediaPlayerAndroid::decodedFrameCount() const { |
296 NOTIMPLEMENTED(); | 296 NOTIMPLEMENTED(); |
297 return 0; | 297 return 0; |
298 } | 298 } |
299 | 299 |
300 unsigned WebMediaPlayerAndroid::droppedFrameCount() const { | 300 unsigned WebMediaPlayerAndroid::droppedFrameCount() const { |
301 NOTIMPLEMENTED(); | 301 NOTIMPLEMENTED(); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 519 |
520 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { | 520 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { |
521 needs_establish_peer_ = needs_establish_peer; | 521 needs_establish_peer_ = needs_establish_peer; |
522 } | 522 } |
523 | 523 |
524 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { | 524 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { |
525 is_playing_ = is_playing; | 525 is_playing_ = is_playing; |
526 } | 526 } |
527 | 527 |
528 } // namespace webkit_media | 528 } // namespace webkit_media |
OLD | NEW |