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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "wtf/MathExtras.h" | 82 #include "wtf/MathExtras.h" |
83 #include "wtf/text/CString.h" | 83 #include "wtf/text/CString.h" |
84 #include <limits> | 84 #include <limits> |
85 | 85 |
86 #if ENABLE(WEB_AUDIO) | 86 #if ENABLE(WEB_AUDIO) |
87 #include "platform/audio/AudioBus.h" | 87 #include "platform/audio/AudioBus.h" |
88 #include "platform/audio/AudioSourceProviderClient.h" | 88 #include "platform/audio/AudioSourceProviderClient.h" |
89 #include "public/platform/WebAudioSourceProvider.h" | 89 #include "public/platform/WebAudioSourceProvider.h" |
90 #endif | 90 #endif |
91 | 91 |
92 using blink::WebInbandTextTrack; | |
93 using blink::WebMediaPlayer; | |
94 using blink::WebMimeRegistry; | |
95 using blink::WebMediaPlayerClient; | |
96 | |
97 namespace blink { | 92 namespace blink { |
98 | 93 |
99 #if !LOG_DISABLED | 94 #if !LOG_DISABLED |
100 static String urlForLoggingMedia(const KURL& url) | 95 static String urlForLoggingMedia(const KURL& url) |
101 { | 96 { |
102 static const unsigned maximumURLLengthForLogging = 128; | 97 static const unsigned maximumURLLengthForLogging = 128; |
103 | 98 |
104 if (url.string().length() < maximumURLLengthForLogging) | 99 if (url.string().length() < maximumURLLengthForLogging) |
105 return url.string(); | 100 return url.string(); |
106 return url.string().substring(0, maximumURLLengthForLogging) + "..."; | 101 return url.string().substring(0, maximumURLLengthForLogging) + "..."; |
(...skipping 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 Vector<WebMediaPlayer::TrackId> enabledTrackIds; | 2257 Vector<WebMediaPlayer::TrackId> enabledTrackIds; |
2263 for (unsigned i = 0; i < audioTracks().length(); ++i) { | 2258 for (unsigned i = 0; i < audioTracks().length(); ++i) { |
2264 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); | 2259 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); |
2265 if (track->enabled()) | 2260 if (track->enabled()) |
2266 enabledTrackIds.append(track->trackId()); | 2261 enabledTrackIds.append(track->trackId()); |
2267 } | 2262 } |
2268 | 2263 |
2269 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds); | 2264 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds); |
2270 } | 2265 } |
2271 | 2266 |
2272 WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, bli
nk::WebMediaPlayerClient::AudioTrackKind kind, const WebString& label, const Web
String& language, bool enabled) | 2267 WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, Web
MediaPlayerClient::AudioTrackKind kind, const WebString& label, const WebString&
language, bool enabled) |
2273 { | 2268 { |
2274 AtomicString kindString = AudioKindToString(kind); | 2269 AtomicString kindString = AudioKindToString(kind); |
2275 WTF_LOG(Media, "HTMLMediaElement::addAudioTrack(%p, '%s', '%s', '%s', '%s',
%d)", | 2270 WTF_LOG(Media, "HTMLMediaElement::addAudioTrack(%p, '%s', '%s', '%s', '%s',
%d)", |
2276 this, id.utf8().data(), kindString.ascii().data(), label.utf8().data(),
language.utf8().data(), enabled); | 2271 this, id.utf8().data(), kindString.ascii().data(), label.utf8().data(),
language.utf8().data(), enabled); |
2277 | 2272 |
2278 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) | 2273 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
2279 return 0; | 2274 return 0; |
2280 | 2275 |
2281 AudioTrack* audioTrack = AudioTrack::create(id, kindString, label, language,
enabled); | 2276 AudioTrack* audioTrack = AudioTrack::create(id, kindString, label, language,
enabled); |
2282 audioTracks().add(audioTrack); | 2277 audioTracks().add(audioTrack); |
(...skipping 23 matching lines...) Expand all Loading... |
2306 ASSERT(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 2301 ASSERT(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
2307 | 2302 |
2308 if (selectedTrackId) | 2303 if (selectedTrackId) |
2309 videoTracks().trackSelected(*selectedTrackId); | 2304 videoTracks().trackSelected(*selectedTrackId); |
2310 | 2305 |
2311 // FIXME: Add call on m_mediaSource to notify it of track changes once the S
ourceBuffer.videoTracks attribute is added. | 2306 // FIXME: Add call on m_mediaSource to notify it of track changes once the S
ourceBuffer.videoTracks attribute is added. |
2312 | 2307 |
2313 webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId); | 2308 webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId); |
2314 } | 2309 } |
2315 | 2310 |
2316 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, bli
nk::WebMediaPlayerClient::VideoTrackKind kind, const WebString& label, const Web
String& language, bool selected) | 2311 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web
MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString&
language, bool selected) |
2317 { | 2312 { |
2318 AtomicString kindString = VideoKindToString(kind); | 2313 AtomicString kindString = VideoKindToString(kind); |
2319 WTF_LOG(Media, "HTMLMediaElement::addVideoTrack(%p, '%s', '%s', '%s', '%s',
%d)", | 2314 WTF_LOG(Media, "HTMLMediaElement::addVideoTrack(%p, '%s', '%s', '%s', '%s',
%d)", |
2320 this, id.utf8().data(), kindString.ascii().data(), label.utf8().data(),
language.utf8().data(), selected); | 2315 this, id.utf8().data(), kindString.ascii().data(), label.utf8().data(),
language.utf8().data(), selected); |
2321 | 2316 |
2322 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) | 2317 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
2323 return 0; | 2318 return 0; |
2324 | 2319 |
2325 // If another track was selected (potentially by the user), leave it selecte
d. | 2320 // If another track was selected (potentially by the user), leave it selecte
d. |
2326 if (selected && videoTracks().selectedIndex() != -1) | 2321 if (selected && videoTracks().selectedIndex() != -1) |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3621 WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const | 3616 WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const |
3622 { | 3617 { |
3623 const AtomicString& crossOriginMode = fastGetAttribute(crossoriginAttr); | 3618 const AtomicString& crossOriginMode = fastGetAttribute(crossoriginAttr); |
3624 if (crossOriginMode.isNull()) | 3619 if (crossOriginMode.isNull()) |
3625 return WebMediaPlayer::CORSModeUnspecified; | 3620 return WebMediaPlayer::CORSModeUnspecified; |
3626 if (equalIgnoringCase(crossOriginMode, "use-credentials")) | 3621 if (equalIgnoringCase(crossOriginMode, "use-credentials")) |
3627 return WebMediaPlayer::CORSModeUseCredentials; | 3622 return WebMediaPlayer::CORSModeUseCredentials; |
3628 return WebMediaPlayer::CORSModeAnonymous; | 3623 return WebMediaPlayer::CORSModeAnonymous; |
3629 } | 3624 } |
3630 | 3625 |
3631 void HTMLMediaElement::setWebLayer(blink::WebLayer* webLayer) | 3626 void HTMLMediaElement::setWebLayer(WebLayer* webLayer) |
3632 { | 3627 { |
3633 if (webLayer == m_webLayer) | 3628 if (webLayer == m_webLayer) |
3634 return; | 3629 return; |
3635 | 3630 |
3636 // If either of the layers is null we need to enable or disable compositing.
This is done by triggering a style recalc. | 3631 // If either of the layers is null we need to enable or disable compositing.
This is done by triggering a style recalc. |
3637 if ((!m_webLayer || !webLayer) | 3632 if ((!m_webLayer || !webLayer) |
3638 #if ENABLE(OILPAN) | 3633 #if ENABLE(OILPAN) |
3639 && !m_isFinalizing | 3634 && !m_isFinalizing |
3640 #endif | 3635 #endif |
3641 ) | 3636 ) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3782 visitor->trace(m_client); | 3777 visitor->trace(m_client); |
3783 } | 3778 } |
3784 | 3779 |
3785 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3780 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
3786 { | 3781 { |
3787 visitor->trace(m_client); | 3782 visitor->trace(m_client); |
3788 } | 3783 } |
3789 #endif | 3784 #endif |
3790 | 3785 |
3791 } | 3786 } |
OLD | NEW |