| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 #include "core/rendering/RenderVideo.h" | 63 #include "core/rendering/RenderVideo.h" |
| 64 #include "core/rendering/RenderView.h" | 64 #include "core/rendering/RenderView.h" |
| 65 #include "modules/mediastream/MediaStreamRegistry.h" | 65 #include "modules/mediastream/MediaStreamRegistry.h" |
| 66 #include "platform/ContentType.h" | 66 #include "platform/ContentType.h" |
| 67 #include "platform/Language.h" | 67 #include "platform/Language.h" |
| 68 #include "platform/Logging.h" | 68 #include "platform/Logging.h" |
| 69 #include "platform/MIMETypeFromURL.h" | 69 #include "platform/MIMETypeFromURL.h" |
| 70 #include "platform/MIMETypeRegistry.h" | 70 #include "platform/MIMETypeRegistry.h" |
| 71 #include "platform/NotImplemented.h" | 71 #include "platform/NotImplemented.h" |
| 72 #include "platform/UserGestureIndicator.h" | 72 #include "platform/UserGestureIndicator.h" |
| 73 #include "platform/graphics/media/InbandTextTrackPrivate.h" | |
| 74 #include "platform/graphics/media/MediaPlayer.h" | 73 #include "platform/graphics/media/MediaPlayer.h" |
| 75 #include "public/platform/Platform.h" | 74 #include "public/platform/Platform.h" |
| 75 #include "public/platform/WebInbandTextTrack.h" |
| 76 #include "weborigin/SecurityOrigin.h" | 76 #include "weborigin/SecurityOrigin.h" |
| 77 #include "wtf/CurrentTime.h" | 77 #include "wtf/CurrentTime.h" |
| 78 #include "wtf/MathExtras.h" | 78 #include "wtf/MathExtras.h" |
| 79 #include "wtf/NonCopyingSort.h" | 79 #include "wtf/NonCopyingSort.h" |
| 80 #include "wtf/Uint8Array.h" | 80 #include "wtf/Uint8Array.h" |
| 81 #include "wtf/text/CString.h" | 81 #include "wtf/text/CString.h" |
| 82 | 82 |
| 83 #if ENABLE(WEB_AUDIO) | 83 #if ENABLE(WEB_AUDIO) |
| 84 #include "platform/audio/AudioSourceProvider.h" | 84 #include "platform/audio/AudioSourceProvider.h" |
| 85 #include "modules/webaudio/MediaElementAudioSourceNode.h" | 85 #include "modules/webaudio/MediaElementAudioSourceNode.h" |
| 86 #endif | 86 #endif |
| 87 | 87 |
| 88 #if ENABLE(ENCRYPTED_MEDIA_V2) | 88 #if ENABLE(ENCRYPTED_MEDIA_V2) |
| 89 // FIXME: Remove dependency on modules/encryptedmedia (http://crbug.com/242754). | 89 // FIXME: Remove dependency on modules/encryptedmedia (http://crbug.com/242754). |
| 90 #include "modules/encryptedmedia/MediaKeyNeededEvent.h" | 90 #include "modules/encryptedmedia/MediaKeyNeededEvent.h" |
| 91 #include "modules/encryptedmedia/MediaKeys.h" | 91 #include "modules/encryptedmedia/MediaKeys.h" |
| 92 #endif | 92 #endif |
| 93 | 93 |
| 94 using namespace std; | 94 using namespace std; |
| 95 using blink::WebInbandTextTrack; |
| 95 using blink::WebMimeRegistry; | 96 using blink::WebMimeRegistry; |
| 96 | 97 |
| 97 namespace WebCore { | 98 namespace WebCore { |
| 98 | 99 |
| 99 #if !LOG_DISABLED | 100 #if !LOG_DISABLED |
| 100 static String urlForLoggingMedia(const KURL& url) | 101 static String urlForLoggingMedia(const KURL& url) |
| 101 { | 102 { |
| 102 static const unsigned maximumURLLengthForLogging = 128; | 103 static const unsigned maximumURLLengthForLogging = 128; |
| 103 | 104 |
| 104 if (url.string().length() < maximumURLLengthForLogging) | 105 if (url.string().length() < maximumURLLengthForLogging) |
| (...skipping 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2435 double buffered = 0; | 2436 double buffered = 0; |
| 2436 RefPtr<TimeRanges> timeRanges = m_player->buffered(); | 2437 RefPtr<TimeRanges> timeRanges = m_player->buffered(); |
| 2437 for (unsigned i = 0; i < timeRanges->length(); ++i) { | 2438 for (unsigned i = 0; i < timeRanges->length(); ++i) { |
| 2438 double start = timeRanges->start(i, IGNORE_EXCEPTION); | 2439 double start = timeRanges->start(i, IGNORE_EXCEPTION); |
| 2439 double end = timeRanges->end(i, IGNORE_EXCEPTION); | 2440 double end = timeRanges->end(i, IGNORE_EXCEPTION); |
| 2440 buffered += end - start; | 2441 buffered += end - start; |
| 2441 } | 2442 } |
| 2442 return buffered / duration; | 2443 return buffered / duration; |
| 2443 } | 2444 } |
| 2444 | 2445 |
| 2445 void HTMLMediaElement::mediaPlayerDidAddTrack(PassRefPtr<InbandTextTrackPrivate>
prpTrack) | 2446 void HTMLMediaElement::mediaPlayerDidAddTrack(WebInbandTextTrack* webTrack) |
| 2446 { | 2447 { |
| 2447 if (!RuntimeEnabledFeatures::videoTrackEnabled()) | 2448 if (!RuntimeEnabledFeatures::videoTrackEnabled()) |
| 2448 return; | 2449 return; |
| 2449 | 2450 |
| 2450 // 4.8.10.12.2 Sourcing in-band text tracks | 2451 // 4.8.10.12.2 Sourcing in-band text tracks |
| 2451 // 1. Associate the relevant data with a new text track and its correspondin
g new TextTrack object. | 2452 // 1. Associate the relevant data with a new text track and its correspondin
g new TextTrack object. |
| 2452 RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(document(), this
, prpTrack); | 2453 RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(document(), this
, webTrack); |
| 2453 | 2454 |
| 2454 // 2. Set the new text track's kind, label, and language based on the semant
ics of the relevant data, | 2455 // 2. Set the new text track's kind, label, and language based on the semant
ics of the relevant data, |
| 2455 // as defined by the relevant specification. If there is no label in that da
ta, then the label must | 2456 // as defined by the relevant specification. If there is no label in that da
ta, then the label must |
| 2456 // be set to the empty string. | 2457 // be set to the empty string. |
| 2457 // 3. Associate the text track list of cues with the rules for updating the
text track rendering appropriate | 2458 // 3. Associate the text track list of cues with the rules for updating the
text track rendering appropriate |
| 2458 // for the format in question. | 2459 // for the format in question. |
| 2459 // 4. If the new text track's kind is metadata, then set the text track in-b
and metadata track dispatch type | 2460 // 4. If the new text track's kind is metadata, then set the text track in-b
and metadata track dispatch type |
| 2460 // as follows, based on the type of the media resource: | 2461 // as follows, based on the type of the media resource: |
| 2461 // 5. Populate the new text track's list of cues with the cues parsed so far
, folllowing the guidelines for exposing | 2462 // 5. Populate the new text track's list of cues with the cues parsed so far
, folllowing the guidelines for exposing |
| 2462 // cues, and begin updating it dynamically as necessary. | 2463 // cues, and begin updating it dynamically as necessary. |
| 2463 // - Thess are all done by the media engine. | 2464 // - Thess are all done by the media engine. |
| 2464 | 2465 |
| 2465 // 6. Set the new text track's readiness state to loaded. | 2466 // 6. Set the new text track's readiness state to loaded. |
| 2466 textTrack->setReadinessState(TextTrack::Loaded); | 2467 textTrack->setReadinessState(TextTrack::Loaded); |
| 2467 | 2468 |
| 2468 // 7. Set the new text track's mode to the mode consistent with the user's p
references and the requirements of | 2469 // 7. Set the new text track's mode to the mode consistent with the user's p
references and the requirements of |
| 2469 // the relevant specification for the data. | 2470 // the relevant specification for the data. |
| 2470 // - This will happen in configureTextTracks() | 2471 // - This will happen in configureTextTracks() |
| 2471 scheduleDelayedAction(LoadTextTrackResource); | 2472 scheduleDelayedAction(LoadTextTrackResource); |
| 2472 | 2473 |
| 2473 // 8. Add the new text track to the media element's list of text tracks. | 2474 // 8. Add the new text track to the media element's list of text tracks. |
| 2474 // 9. Fire an event with the name addtrack, that does not bubble and is not
cancelable, and that uses the TrackEvent | 2475 // 9. Fire an event with the name addtrack, that does not bubble and is not
cancelable, and that uses the TrackEvent |
| 2475 // interface, with the track attribute initialized to the text track's TextT
rack object, at the media element's | 2476 // interface, with the track attribute initialized to the text track's TextT
rack object, at the media element's |
| 2476 // textTracks attribute's TextTrackList object. | 2477 // textTracks attribute's TextTrackList object. |
| 2477 addTrack(textTrack.get()); | 2478 addTrack(textTrack.get()); |
| 2478 } | 2479 } |
| 2479 | 2480 |
| 2480 void HTMLMediaElement::mediaPlayerDidRemoveTrack(PassRefPtr<InbandTextTrackPriva
te> prpTrack) | 2481 void HTMLMediaElement::mediaPlayerDidRemoveTrack(WebInbandTextTrack* webTrack) |
| 2481 { | 2482 { |
| 2482 if (!RuntimeEnabledFeatures::videoTrackEnabled()) | 2483 if (!RuntimeEnabledFeatures::videoTrackEnabled()) |
| 2483 return; | 2484 return; |
| 2484 | 2485 |
| 2485 if (!m_textTracks) | 2486 if (!m_textTracks) |
| 2486 return; | 2487 return; |
| 2487 | 2488 |
| 2488 // This cast is safe because we created the InbandTextTrack with the InbandT
extTrackPrivate | 2489 // This cast is safe because we created the InbandTextTrack with the WebInba
ndTextTrack |
| 2489 // passed to mediaPlayerDidAddTrack. | 2490 // passed to mediaPlayerDidAddTrack. |
| 2490 RefPtr<InbandTextTrack> textTrack = static_cast<InbandTextTrack*>(prpTrack->
client()); | 2491 RefPtr<InbandTextTrack> textTrack = static_cast<InbandTextTrack*>(webTrack->
client()); |
| 2491 if (!textTrack) | 2492 if (!textTrack) |
| 2492 return; | 2493 return; |
| 2493 | 2494 |
| 2494 removeTrack(textTrack.get()); | 2495 removeTrack(textTrack.get()); |
| 2495 } | 2496 } |
| 2496 | 2497 |
| 2497 void HTMLMediaElement::closeCaptionTracksChanged() | 2498 void HTMLMediaElement::closeCaptionTracksChanged() |
| 2498 { | 2499 { |
| 2499 if (hasMediaControls()) | 2500 if (hasMediaControls()) |
| 2500 mediaControls()->closedCaptionTracksChanged(); | 2501 mediaControls()->closedCaptionTracksChanged(); |
| (...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3871 { | 3872 { |
| 3872 scheduleLayerUpdate(); | 3873 scheduleLayerUpdate(); |
| 3873 } | 3874 } |
| 3874 | 3875 |
| 3875 bool HTMLMediaElement::isInteractiveContent() const | 3876 bool HTMLMediaElement::isInteractiveContent() const |
| 3876 { | 3877 { |
| 3877 return fastHasAttribute(controlsAttr); | 3878 return fastHasAttribute(controlsAttr); |
| 3878 } | 3879 } |
| 3879 | 3880 |
| 3880 } | 3881 } |
| OLD | NEW |