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 2594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2605 | 2605 |
2606 // This cast is safe because we created the InbandTextTrack with the WebInba
ndTextTrack | 2606 // This cast is safe because we created the InbandTextTrack with the WebInba
ndTextTrack |
2607 // passed to mediaPlayerDidAddTextTrack. | 2607 // passed to mediaPlayerDidAddTextTrack. |
2608 RefPtrWillBeRawPtr<InbandTextTrack> textTrack = static_cast<InbandTextTrack*
>(webTrack->client()); | 2608 RefPtrWillBeRawPtr<InbandTextTrack> textTrack = static_cast<InbandTextTrack*
>(webTrack->client()); |
2609 if (!textTrack) | 2609 if (!textTrack) |
2610 return; | 2610 return; |
2611 | 2611 |
2612 removeTextTrack(textTrack.get()); | 2612 removeTextTrack(textTrack.get()); |
2613 } | 2613 } |
2614 | 2614 |
2615 void HTMLMediaElement::closeCaptionTracksChanged() | 2615 void HTMLMediaElement::textTracksChanged() |
2616 { | 2616 { |
2617 if (hasMediaControls()) | 2617 if (hasMediaControls()) |
2618 mediaControls()->closedCaptionTracksChanged(); | 2618 mediaControls()->textTracksChanged(); |
2619 } | 2619 } |
2620 | 2620 |
2621 void HTMLMediaElement::addTextTrack(TextTrack* track) | 2621 void HTMLMediaElement::addTextTrack(TextTrack* track) |
2622 { | 2622 { |
2623 textTracks()->append(track); | 2623 textTracks()->append(track); |
2624 | 2624 |
2625 closeCaptionTracksChanged(); | 2625 textTracksChanged(); |
2626 } | 2626 } |
2627 | 2627 |
2628 void HTMLMediaElement::removeTextTrack(TextTrack* track) | 2628 void HTMLMediaElement::removeTextTrack(TextTrack* track) |
2629 { | 2629 { |
2630 TrackDisplayUpdateScope scope(this); | 2630 TrackDisplayUpdateScope scope(this); |
2631 m_textTracks->remove(track); | 2631 m_textTracks->remove(track); |
2632 | 2632 |
2633 closeCaptionTracksChanged(); | 2633 textTracksChanged(); |
2634 } | 2634 } |
2635 | 2635 |
2636 void HTMLMediaElement::forgetResourceSpecificTracks() | 2636 void HTMLMediaElement::forgetResourceSpecificTracks() |
2637 { | 2637 { |
2638 // Implements the "forget the media element's media-resource-specific tracks
" algorithm. | 2638 // Implements the "forget the media element's media-resource-specific tracks
" algorithm. |
2639 // The order is explicitly specified as text, then audio, and finally video.
Also | 2639 // The order is explicitly specified as text, then audio, and finally video.
Also |
2640 // 'removetrack' events should not be fired. | 2640 // 'removetrack' events should not be fired. |
2641 if (m_textTracks) { | 2641 if (m_textTracks) { |
2642 TrackDisplayUpdateScope scope(this); | 2642 TrackDisplayUpdateScope scope(this); |
2643 m_textTracks->removeAllInbandTracks(); | 2643 m_textTracks->removeAllInbandTracks(); |
2644 closeCaptionTracksChanged(); | 2644 textTracksChanged(); |
2645 } | 2645 } |
2646 | 2646 |
2647 m_audioTracks->removeAll(); | 2647 m_audioTracks->removeAll(); |
2648 m_videoTracks->removeAll(); | 2648 m_videoTracks->removeAll(); |
2649 | 2649 |
2650 m_audioTracksTimer.stop(); | 2650 m_audioTracksTimer.stop(); |
2651 } | 2651 } |
2652 | 2652 |
2653 PassRefPtrWillBeRawPtr<TextTrack> HTMLMediaElement::addTextTrack(const AtomicStr
ing& kind, const AtomicString& label, const AtomicString& language, ExceptionSta
te& exceptionState) | 2653 PassRefPtrWillBeRawPtr<TextTrack> HTMLMediaElement::addTextTrack(const AtomicStr
ing& kind, const AtomicString& label, const AtomicString& language, ExceptionSta
te& exceptionState) |
2654 { | 2654 { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2701 RefPtrWillBeRawPtr<TextTrack> textTrack = trackElement->track(); | 2701 RefPtrWillBeRawPtr<TextTrack> textTrack = trackElement->track(); |
2702 if (!textTrack) | 2702 if (!textTrack) |
2703 return; | 2703 return; |
2704 | 2704 |
2705 addTextTrack(textTrack.get()); | 2705 addTextTrack(textTrack.get()); |
2706 | 2706 |
2707 // Do not schedule the track loading until parsing finishes so we don't star
t before all tracks | 2707 // Do not schedule the track loading until parsing finishes so we don't star
t before all tracks |
2708 // in the markup have been added. | 2708 // in the markup have been added. |
2709 if (isFinishedParsingChildren()) | 2709 if (isFinishedParsingChildren()) |
2710 scheduleDelayedAction(LoadTextTrackResource); | 2710 scheduleDelayedAction(LoadTextTrackResource); |
2711 | |
2712 if (hasMediaControls()) | |
2713 mediaControls()->closedCaptionTracksChanged(); | |
2714 } | 2711 } |
2715 | 2712 |
2716 void HTMLMediaElement::didRemoveTrackElement(HTMLTrackElement* trackElement) | 2713 void HTMLMediaElement::didRemoveTrackElement(HTMLTrackElement* trackElement) |
2717 { | 2714 { |
2718 #if !LOG_DISABLED | 2715 #if !LOG_DISABLED |
2719 KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); | 2716 KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); |
2720 WTF_LOG(Media, "HTMLMediaElement::didRemoveTrackElement - 'src' is %s", urlF
orLoggingMedia(url).utf8().data()); | 2717 WTF_LOG(Media, "HTMLMediaElement::didRemoveTrackElement - 'src' is %s", urlF
orLoggingMedia(url).utf8().data()); |
2721 #endif | 2718 #endif |
2722 | 2719 |
2723 RefPtrWillBeRawPtr<TextTrack> textTrack = trackElement->track(); | 2720 RefPtrWillBeRawPtr<TextTrack> textTrack = trackElement->track(); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2882 configureTextTrackGroup(captionAndSubtitleTracks); | 2879 configureTextTrackGroup(captionAndSubtitleTracks); |
2883 if (descriptionTracks.tracks.size()) | 2880 if (descriptionTracks.tracks.size()) |
2884 configureTextTrackGroup(descriptionTracks); | 2881 configureTextTrackGroup(descriptionTracks); |
2885 if (chapterTracks.tracks.size()) | 2882 if (chapterTracks.tracks.size()) |
2886 configureTextTrackGroup(chapterTracks); | 2883 configureTextTrackGroup(chapterTracks); |
2887 if (metadataTracks.tracks.size()) | 2884 if (metadataTracks.tracks.size()) |
2888 configureTextTrackGroup(metadataTracks); | 2885 configureTextTrackGroup(metadataTracks); |
2889 if (otherTracks.tracks.size()) | 2886 if (otherTracks.tracks.size()) |
2890 configureTextTrackGroup(otherTracks); | 2887 configureTextTrackGroup(otherTracks); |
2891 | 2888 |
2892 if (hasMediaControls()) | 2889 textTracksChanged(); |
2893 mediaControls()->closedCaptionTracksChanged(); | |
2894 } | 2890 } |
2895 | 2891 |
2896 bool HTMLMediaElement::havePotentialSourceChild() | 2892 bool HTMLMediaElement::havePotentialSourceChild() |
2897 { | 2893 { |
2898 // Stash the current <source> node and next nodes so we can restore them aft
er checking | 2894 // Stash the current <source> node and next nodes so we can restore them aft
er checking |
2899 // to see there is another potential. | 2895 // to see there is another potential. |
2900 RefPtrWillBeRawPtr<HTMLSourceElement> currentSourceNode = m_currentSourceNod
e; | 2896 RefPtrWillBeRawPtr<HTMLSourceElement> currentSourceNode = m_currentSourceNod
e; |
2901 RefPtrWillBeRawPtr<Node> nextNode = m_nextChildNodeToConsider; | 2897 RefPtrWillBeRawPtr<Node> nextNode = m_nextChildNodeToConsider; |
2902 | 2898 |
2903 KURL nextURL = selectNextSourceChild(0, 0, DoNothing); | 2899 KURL nextURL = selectNextSourceChild(0, 0, DoNothing); |
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3989 | 3985 |
3990 #if ENABLE(WEB_AUDIO) | 3986 #if ENABLE(WEB_AUDIO) |
3991 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3987 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
3992 { | 3988 { |
3993 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 3989 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
3994 audioSourceProvider()->setClient(0); | 3990 audioSourceProvider()->setClient(0); |
3995 } | 3991 } |
3996 #endif | 3992 #endif |
3997 | 3993 |
3998 } | 3994 } |
OLD | NEW |