| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2386 } | 2386 } |
| 2387 | 2387 |
| 2388 AudioTrackList& HTMLMediaElement::audioTracks() | 2388 AudioTrackList& HTMLMediaElement::audioTracks() |
| 2389 { | 2389 { |
| 2390 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 2390 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| 2391 return *m_audioTracks; | 2391 return *m_audioTracks; |
| 2392 } | 2392 } |
| 2393 | 2393 |
| 2394 void HTMLMediaElement::audioTrackChanged(WebMediaPlayer::TrackId trackId, bool e
nabled) | 2394 void HTMLMediaElement::audioTrackChanged(WebMediaPlayer::TrackId trackId, bool e
nabled) |
| 2395 { | 2395 { |
| 2396 DVLOG(MEDIA_LOG_LEVEL) << "audioTrackChanged(" << (void*)this << ") trackId=
" << trackId << " enabled=" << boolString(enabled); | 2396 DVLOG(MEDIA_LOG_LEVEL) << "audioTrackChanged(" << (void*)this << ") trackId=
" << (String)trackId << " enabled=" << boolString(enabled); |
| 2397 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 2397 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| 2398 | 2398 |
| 2399 audioTracks().scheduleChangeEvent(); | 2399 audioTracks().scheduleChangeEvent(); |
| 2400 | 2400 |
| 2401 // FIXME: Add call on m_mediaSource to notify it of track changes once the S
ourceBuffer.audioTracks attribute is added. | 2401 // FIXME: Add call on m_mediaSource to notify it of track changes once the S
ourceBuffer.audioTracks attribute is added. |
| 2402 | 2402 |
| 2403 if (!m_audioTracksTimer.isActive()) | 2403 if (!m_audioTracksTimer.isActive()) |
| 2404 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); | 2404 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); |
| 2405 } | 2405 } |
| 2406 | 2406 |
| 2407 void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*) | 2407 void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*) |
| 2408 { | 2408 { |
| 2409 Vector<WebMediaPlayer::TrackId> enabledTrackIds; | 2409 Vector<WebMediaPlayer::TrackId> enabledTrackIds; |
| 2410 for (unsigned i = 0; i < audioTracks().length(); ++i) { | 2410 for (unsigned i = 0; i < audioTracks().length(); ++i) { |
| 2411 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); | 2411 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); |
| 2412 if (track->enabled()) | 2412 if (track->enabled()) |
| 2413 enabledTrackIds.append(track->trackId()); | 2413 enabledTrackIds.append(track->id()); |
| 2414 } | 2414 } |
| 2415 | 2415 |
| 2416 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds); | 2416 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds); |
| 2417 } | 2417 } |
| 2418 | 2418 |
| 2419 WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, Web
MediaPlayerClient::AudioTrackKind kind, const WebString& label, const WebString&
language, bool enabled) | 2419 WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, Web
MediaPlayerClient::AudioTrackKind kind, const WebString& label, const WebString&
language, bool enabled) |
| 2420 { | 2420 { |
| 2421 AtomicString kindString = AudioKindToString(kind); | 2421 AtomicString kindString = AudioKindToString(kind); |
| 2422 DVLOG(MEDIA_LOG_LEVEL) << "addAudioTrack(" << (void*)this << ", '" << (Strin
g)id << "', ' " << (AtomicString)kindString | 2422 DVLOG(MEDIA_LOG_LEVEL) << "addAudioTrack(" << (void*)this << ", '" << (Strin
g)id << "', ' " << (AtomicString)kindString |
| 2423 << "', '" << (String)label << "', '" << (String)language << "', " << boo
lString(enabled) << ")"; | 2423 << "', '" << (String)label << "', '" << (String)language << "', " << boo
lString(enabled) << ")"; |
| 2424 | 2424 |
| 2425 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) | 2425 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
| 2426 return 0; | 2426 return blink::WebMediaPlayer::TrackId(); |
| 2427 | 2427 |
| 2428 AudioTrack* audioTrack = AudioTrack::create(id, kindString, label, language,
enabled); | 2428 AudioTrack* audioTrack = AudioTrack::create(id, kindString, label, language,
enabled); |
| 2429 audioTracks().add(audioTrack); | 2429 audioTracks().add(audioTrack); |
| 2430 | 2430 |
| 2431 return audioTrack->trackId(); | 2431 return audioTrack->id(); |
| 2432 } | 2432 } |
| 2433 | 2433 |
| 2434 void HTMLMediaElement::removeAudioTrack(WebMediaPlayer::TrackId trackId) | 2434 void HTMLMediaElement::removeAudioTrack(WebMediaPlayer::TrackId trackId) |
| 2435 { | 2435 { |
| 2436 DVLOG(MEDIA_LOG_LEVEL) << "removeAudioTrack(" << (void*)this << ")"; | 2436 DVLOG(MEDIA_LOG_LEVEL) << "removeAudioTrack(" << (void*)this << ")"; |
| 2437 | 2437 |
| 2438 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) | 2438 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
| 2439 return; | 2439 return; |
| 2440 | 2440 |
| 2441 audioTracks().remove(trackId); | 2441 audioTracks().remove(trackId); |
| 2442 } | 2442 } |
| 2443 | 2443 |
| 2444 VideoTrackList& HTMLMediaElement::videoTracks() | 2444 VideoTrackList& HTMLMediaElement::videoTracks() |
| 2445 { | 2445 { |
| 2446 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 2446 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| 2447 return *m_videoTracks; | 2447 return *m_videoTracks; |
| 2448 } | 2448 } |
| 2449 | 2449 |
| 2450 void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* select
edTrackId) | 2450 void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* select
edTrackId) |
| 2451 { | 2451 { |
| 2452 DVLOG(MEDIA_LOG_LEVEL) << "selectedVideoTrackChanged(" << (void*)this << ")
selectedTrackId=" << (selectedTrackId ? String::format("%u", *selectedTrackId) :
"none"); | 2452 DVLOG(MEDIA_LOG_LEVEL) << "selectedVideoTrackChanged(" << (void*)this << ")
selectedTrackId=" << (selectedTrackId ? ((String)*selectedTrackId) : "none"); |
| 2453 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 2453 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| 2454 | 2454 |
| 2455 if (selectedTrackId) | 2455 if (selectedTrackId) |
| 2456 videoTracks().trackSelected(*selectedTrackId); | 2456 videoTracks().trackSelected(*selectedTrackId); |
| 2457 | 2457 |
| 2458 // FIXME: Add call on m_mediaSource to notify it of track changes once the S
ourceBuffer.videoTracks attribute is added. | 2458 // FIXME: Add call on m_mediaSource to notify it of track changes once the S
ourceBuffer.videoTracks attribute is added. |
| 2459 | 2459 |
| 2460 webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId); | 2460 webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId); |
| 2461 } | 2461 } |
| 2462 | 2462 |
| 2463 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web
MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString&
language, bool selected) | 2463 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web
MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString&
language, bool selected) |
| 2464 { | 2464 { |
| 2465 AtomicString kindString = VideoKindToString(kind); | 2465 AtomicString kindString = VideoKindToString(kind); |
| 2466 DVLOG(MEDIA_LOG_LEVEL) << "addVideoTrack(" << (void*)this << ", '" << (Strin
g)id << "', '" << (AtomicString)kindString | 2466 DVLOG(MEDIA_LOG_LEVEL) << "addVideoTrack(" << (void*)this << ", '" << (Strin
g)id << "', '" << (AtomicString)kindString |
| 2467 << "', '" << (String)label << "', '" << (String)language << "', " << boo
lString(selected) << ")"; | 2467 << "', '" << (String)label << "', '" << (String)language << "', " << boo
lString(selected) << ")"; |
| 2468 | 2468 |
| 2469 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) | 2469 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
| 2470 return 0; | 2470 return blink::WebMediaPlayer::TrackId(); |
| 2471 | 2471 |
| 2472 // If another track was selected (potentially by the user), leave it selecte
d. | 2472 // If another track was selected (potentially by the user), leave it selecte
d. |
| 2473 if (selected && videoTracks().selectedIndex() != -1) | 2473 if (selected && videoTracks().selectedIndex() != -1) |
| 2474 selected = false; | 2474 selected = false; |
| 2475 | 2475 |
| 2476 VideoTrack* videoTrack = VideoTrack::create(id, kindString, label, language,
selected); | 2476 VideoTrack* videoTrack = VideoTrack::create(id, kindString, label, language,
selected); |
| 2477 videoTracks().add(videoTrack); | 2477 videoTracks().add(videoTrack); |
| 2478 | 2478 |
| 2479 return videoTrack->trackId(); | 2479 return videoTrack->id(); |
| 2480 } | 2480 } |
| 2481 | 2481 |
| 2482 void HTMLMediaElement::removeVideoTrack(WebMediaPlayer::TrackId trackId) | 2482 void HTMLMediaElement::removeVideoTrack(WebMediaPlayer::TrackId trackId) |
| 2483 { | 2483 { |
| 2484 DVLOG(MEDIA_LOG_LEVEL) << "removeVideoTrack(" << (void*)this << ")"; | 2484 DVLOG(MEDIA_LOG_LEVEL) << "removeVideoTrack(" << (void*)this << ")"; |
| 2485 | 2485 |
| 2486 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) | 2486 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
| 2487 return; | 2487 return; |
| 2488 | 2488 |
| 2489 videoTracks().remove(trackId); | 2489 videoTracks().remove(trackId); |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3984 | 3984 |
| 3985 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co
nst | 3985 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co
nst |
| 3986 { | 3986 { |
| 3987 IntRect result; | 3987 IntRect result; |
| 3988 if (LayoutObject* object = m_element->layoutObject()) | 3988 if (LayoutObject* object = m_element->layoutObject()) |
| 3989 result = object->absoluteBoundingBoxRect(); | 3989 result = object->absoluteBoundingBoxRect(); |
| 3990 return result; | 3990 return result; |
| 3991 } | 3991 } |
| 3992 | 3992 |
| 3993 } // namespace blink | 3993 } // namespace blink |
| OLD | NEW |