Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: webkit/api/src/WebMediaPlayerClientImpl.cpp

Issue 199037: Buffered time ranges for <video> (Closed)
Patch Set: DEPS Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/api/src/WebMediaPlayerClientImpl.h ('k') | webkit/glue/webmediaplayer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "config.h" 5 #include "config.h"
6 #include "WebMediaPlayerClientImpl.h" 6 #include "WebMediaPlayerClientImpl.h"
7 7
8 #if ENABLE(VIDEO) 8 #if ENABLE(VIDEO)
9 9
10 #include "TemporaryGlue.h" 10 #include "TemporaryGlue.h"
11 #include "TimeRanges.h"
11 #include "WebCanvas.h" 12 #include "WebCanvas.h"
12 #include "WebCString.h" 13 #include "WebCString.h"
13 #include "WebKit.h" 14 #include "WebKit.h"
14 #include "WebKitClient.h" 15 #include "WebKitClient.h"
15 #include "WebMediaPlayer.h" 16 #include "WebMediaPlayer.h"
16 #include "WebMimeRegistry.h" 17 #include "WebMimeRegistry.h"
17 #include "WebRect.h" 18 #include "WebRect.h"
18 #include "WebSize.h" 19 #include "WebSize.h"
19 #include "WebString.h" 20 #include "WebString.h"
20 #include "WebURL.h" 21 #include "WebURL.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 return MediaPlayer::HaveNothing; 247 return MediaPlayer::HaveNothing;
247 } 248 }
248 249
249 float WebMediaPlayerClientImpl::maxTimeSeekable() const 250 float WebMediaPlayerClientImpl::maxTimeSeekable() const
250 { 251 {
251 if (m_webMediaPlayer.get()) 252 if (m_webMediaPlayer.get())
252 return m_webMediaPlayer->maxTimeSeekable(); 253 return m_webMediaPlayer->maxTimeSeekable();
253 return 0.0f; 254 return 0.0f;
254 } 255 }
255 256
256 float WebMediaPlayerClientImpl::maxTimeBuffered() const 257 WTF::PassRefPtr<WebCore::TimeRanges> WebMediaPlayerClientImpl::buffered() const
257 { 258 {
258 if (m_webMediaPlayer.get()) 259 if (m_webMediaPlayer.get()) {
259 return m_webMediaPlayer->maxTimeBuffered(); 260 WebTimeRanges webRanges = m_webMediaPlayer->buffered();
260 return 0.0f; 261
262 // FIXME: Save the time ranges in a member variable and update it when needed.
263 WTF::RefPtr<TimeRanges> ranges = TimeRanges::create();
264 for (size_t i = 0; i < webRanges.size(); ++i)
265 ranges->add(webRanges[i].start, webRanges[i].end);
266 return ranges.release();
267 }
268 return TimeRanges::create();
261 } 269 }
262 270
263 int WebMediaPlayerClientImpl::dataRate() const 271 int WebMediaPlayerClientImpl::dataRate() const
264 { 272 {
265 if (m_webMediaPlayer.get()) 273 if (m_webMediaPlayer.get())
266 return m_webMediaPlayer->dataRate(); 274 return m_webMediaPlayer->dataRate();
267 return 0; 275 return 0;
268 } 276 }
269 277
270 bool WebMediaPlayerClientImpl::totalBytesKnown() const 278 bool WebMediaPlayerClientImpl::totalBytesKnown() const
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 372 }
365 373
366 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl() 374 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl()
367 : m_mediaPlayer(0) 375 : m_mediaPlayer(0)
368 { 376 {
369 } 377 }
370 378
371 } // namespace WebKit 379 } // namespace WebKit
372 380
373 #endif // ENABLE(VIDEO) 381 #endif // ENABLE(VIDEO)
OLDNEW
« no previous file with comments | « webkit/api/src/WebMediaPlayerClientImpl.h ('k') | webkit/glue/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698