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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 static void removeElementFromDocumentMap(HTMLMediaElement* element, Document* do
cument) | 165 static void removeElementFromDocumentMap(HTMLMediaElement* element, Document* do
cument) |
166 { | 166 { |
167 DocumentElementSetMap& map = documentToElementSetMap(); | 167 DocumentElementSetMap& map = documentToElementSetMap(); |
168 HashSet<HTMLMediaElement*> set = map.take(document); | 168 HashSet<HTMLMediaElement*> set = map.take(document); |
169 set.remove(element); | 169 set.remove(element); |
170 if (!set.isEmpty()) | 170 if (!set.isEmpty()) |
171 map.add(document, set); | 171 map.add(document, set); |
172 } | 172 } |
173 | 173 |
174 #if ENABLE(ENCRYPTED_MEDIA) | |
175 static ExceptionCode exceptionCodeForMediaKeyException(MediaPlayer::MediaKeyExce
ption exception) | 174 static ExceptionCode exceptionCodeForMediaKeyException(MediaPlayer::MediaKeyExce
ption exception) |
176 { | 175 { |
177 switch (exception) { | 176 switch (exception) { |
178 case MediaPlayer::NoError: | 177 case MediaPlayer::NoError: |
179 return 0; | 178 return 0; |
180 case MediaPlayer::InvalidPlayerState: | 179 case MediaPlayer::InvalidPlayerState: |
181 return INVALID_STATE_ERR; | 180 return INVALID_STATE_ERR; |
182 case MediaPlayer::KeySystemNotSupported: | 181 case MediaPlayer::KeySystemNotSupported: |
183 return NOT_SUPPORTED_ERR; | 182 return NOT_SUPPORTED_ERR; |
184 } | 183 } |
185 | 184 |
186 ASSERT_NOT_REACHED(); | 185 ASSERT_NOT_REACHED(); |
187 return INVALID_STATE_ERR; | 186 return INVALID_STATE_ERR; |
188 } | 187 } |
189 #endif | |
190 | 188 |
191 class TrackDisplayUpdateScope { | 189 class TrackDisplayUpdateScope { |
192 public: | 190 public: |
193 TrackDisplayUpdateScope(HTMLMediaElement* mediaElement) | 191 TrackDisplayUpdateScope(HTMLMediaElement* mediaElement) |
194 { | 192 { |
195 m_mediaElement = mediaElement; | 193 m_mediaElement = mediaElement; |
196 m_mediaElement->beginIgnoringTrackDisplayUpdateRequests(); | 194 m_mediaElement->beginIgnoringTrackDisplayUpdateRequests(); |
197 } | 195 } |
198 ~TrackDisplayUpdateScope() | 196 ~TrackDisplayUpdateScope() |
199 { | 197 { |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 mediaControls()->updateStatusDisplay(); | 1622 mediaControls()->updateStatusDisplay(); |
1625 } | 1623 } |
1626 } | 1624 } |
1627 | 1625 |
1628 updatePlayState(); | 1626 updatePlayState(); |
1629 updateMediaController(); | 1627 updateMediaController(); |
1630 if (RuntimeEnabledFeatures::videoTrackEnabled()) | 1628 if (RuntimeEnabledFeatures::videoTrackEnabled()) |
1631 updateActiveTextTrackCues(currentTime()); | 1629 updateActiveTextTrackCues(currentTime()); |
1632 } | 1630 } |
1633 | 1631 |
1634 #if ENABLE(ENCRYPTED_MEDIA) | |
1635 void HTMLMediaElement::mediaPlayerKeyAdded(MediaPlayer*, const String& keySystem
, const String& sessionId) | 1632 void HTMLMediaElement::mediaPlayerKeyAdded(MediaPlayer*, const String& keySystem
, const String& sessionId) |
1636 { | 1633 { |
1637 MediaKeyEventInit initializer; | 1634 MediaKeyEventInit initializer; |
1638 initializer.keySystem = keySystem; | 1635 initializer.keySystem = keySystem; |
1639 initializer.sessionId = sessionId; | 1636 initializer.sessionId = sessionId; |
1640 initializer.bubbles = false; | 1637 initializer.bubbles = false; |
1641 initializer.cancelable = false; | 1638 initializer.cancelable = false; |
1642 | 1639 |
1643 RefPtr<Event> event = MediaKeyEvent::create(eventNames().webkitkeyaddedEvent
, initializer); | 1640 RefPtr<Event> event = MediaKeyEvent::create(eventNames().webkitkeyaddedEvent
, initializer); |
1644 event->setTarget(this); | 1641 event->setTarget(this); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 initializer.sessionId = sessionId; | 1707 initializer.sessionId = sessionId; |
1711 initializer.initData = Uint8Array::create(initData, initDataLength); | 1708 initializer.initData = Uint8Array::create(initData, initDataLength); |
1712 initializer.bubbles = false; | 1709 initializer.bubbles = false; |
1713 initializer.cancelable = false; | 1710 initializer.cancelable = false; |
1714 | 1711 |
1715 RefPtr<Event> event = MediaKeyEvent::create(eventNames().webkitneedkeyEvent,
initializer); | 1712 RefPtr<Event> event = MediaKeyEvent::create(eventNames().webkitneedkeyEvent,
initializer); |
1716 event->setTarget(this); | 1713 event->setTarget(this); |
1717 m_asyncEventQueue->enqueueEvent(event.release()); | 1714 m_asyncEventQueue->enqueueEvent(event.release()); |
1718 return true; | 1715 return true; |
1719 } | 1716 } |
1720 #endif | |
1721 | 1717 |
1722 #if ENABLE(ENCRYPTED_MEDIA_V2) | 1718 #if ENABLE(ENCRYPTED_MEDIA_V2) |
1723 bool HTMLMediaElement::mediaPlayerKeyNeeded(MediaPlayer*, Uint8Array* initData) | 1719 bool HTMLMediaElement::mediaPlayerKeyNeeded(MediaPlayer*, Uint8Array* initData) |
1724 { | 1720 { |
1725 if (!hasEventListeners("webkitneedkey")) { | 1721 if (!hasEventListeners("webkitneedkey")) { |
1726 m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED); | 1722 m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED); |
1727 scheduleEvent(eventNames().errorEvent); | 1723 scheduleEvent(eventNames().errorEvent); |
1728 return false; | 1724 return false; |
1729 } | 1725 } |
1730 | 1726 |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2243 | 2239 |
2244 void HTMLMediaElement::closeMediaSource() | 2240 void HTMLMediaElement::closeMediaSource() |
2245 { | 2241 { |
2246 if (!m_mediaSource) | 2242 if (!m_mediaSource) |
2247 return; | 2243 return; |
2248 | 2244 |
2249 m_mediaSource->setReadyState(WebKitMediaSource::closedKeyword()); | 2245 m_mediaSource->setReadyState(WebKitMediaSource::closedKeyword()); |
2250 m_mediaSource = 0; | 2246 m_mediaSource = 0; |
2251 } | 2247 } |
2252 | 2248 |
2253 #if ENABLE(ENCRYPTED_MEDIA) | |
2254 void HTMLMediaElement::webkitGenerateKeyRequest(const String& keySystem, PassRef
Ptr<Uint8Array> initData, ExceptionCode& ec) | 2249 void HTMLMediaElement::webkitGenerateKeyRequest(const String& keySystem, PassRef
Ptr<Uint8Array> initData, ExceptionCode& ec) |
2255 { | 2250 { |
2256 if (keySystem.isEmpty()) { | 2251 if (keySystem.isEmpty()) { |
2257 ec = SYNTAX_ERR; | 2252 ec = SYNTAX_ERR; |
2258 return; | 2253 return; |
2259 } | 2254 } |
2260 | 2255 |
2261 if (!m_player) { | 2256 if (!m_player) { |
2262 ec = INVALID_STATE_ERR; | 2257 ec = INVALID_STATE_ERR; |
2263 return; | 2258 return; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2326 | 2321 |
2327 if (!m_player) { | 2322 if (!m_player) { |
2328 ec = INVALID_STATE_ERR; | 2323 ec = INVALID_STATE_ERR; |
2329 return; | 2324 return; |
2330 } | 2325 } |
2331 | 2326 |
2332 MediaPlayer::MediaKeyException result = m_player->cancelKeyRequest(keySystem
, sessionId); | 2327 MediaPlayer::MediaKeyException result = m_player->cancelKeyRequest(keySystem
, sessionId); |
2333 ec = exceptionCodeForMediaKeyException(result); | 2328 ec = exceptionCodeForMediaKeyException(result); |
2334 } | 2329 } |
2335 | 2330 |
2336 #endif | |
2337 | |
2338 bool HTMLMediaElement::loop() const | 2331 bool HTMLMediaElement::loop() const |
2339 { | 2332 { |
2340 return fastHasAttribute(loopAttr); | 2333 return fastHasAttribute(loopAttr); |
2341 } | 2334 } |
2342 | 2335 |
2343 void HTMLMediaElement::setLoop(bool b) | 2336 void HTMLMediaElement::setLoop(bool b) |
2344 { | 2337 { |
2345 LOG(Media, "HTMLMediaElement::setLoop(%s)", boolString(b)); | 2338 LOG(Media, "HTMLMediaElement::setLoop(%s)", boolString(b)); |
2346 setBooleanAttribute(loopAttr, b); | 2339 setBooleanAttribute(loopAttr, b); |
2347 } | 2340 } |
(...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4240 info.addMember(m_mediaGroup, "mediaGroup"); | 4233 info.addMember(m_mediaGroup, "mediaGroup"); |
4241 info.addMember(m_mediaController, "mediaController"); | 4234 info.addMember(m_mediaController, "mediaController"); |
4242 | 4235 |
4243 #if ENABLE(WEB_AUDIO) | 4236 #if ENABLE(WEB_AUDIO) |
4244 info.addMember(m_audioSourceNode, "audioSourceNode"); | 4237 info.addMember(m_audioSourceNode, "audioSourceNode"); |
4245 #endif | 4238 #endif |
4246 | 4239 |
4247 } | 4240 } |
4248 | 4241 |
4249 } | 4242 } |
OLD | NEW |