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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 #if ENABLE(WEB_AUDIO) | 102 #if ENABLE(WEB_AUDIO) |
103 #include "core/platform/audio/AudioSourceProvider.h" | 103 #include "core/platform/audio/AudioSourceProvider.h" |
104 #include "modules/webaudio/MediaElementAudioSourceNode.h" | 104 #include "modules/webaudio/MediaElementAudioSourceNode.h" |
105 #endif | 105 #endif |
106 | 106 |
107 #if ENABLE(ENCRYPTED_MEDIA_V2) | 107 #if ENABLE(ENCRYPTED_MEDIA_V2) |
108 #include "MediaKeyNeededEvent.h" | 108 #include "MediaKeyNeededEvent.h" |
109 #include "MediaKeys.h" | 109 #include "MediaKeys.h" |
110 #endif | 110 #endif |
111 | 111 |
112 #if USE(PLATFORM_TEXT_TRACK_MENU) | |
113 #include "core/platform/graphics/PlatformTextTrack.h" | |
114 #endif | |
115 | |
116 using namespace std; | 112 using namespace std; |
117 | 113 |
118 namespace WebCore { | 114 namespace WebCore { |
119 | 115 |
120 #if !LOG_DISABLED | 116 #if !LOG_DISABLED |
121 static String urlForLoggingMedia(const KURL& url) | 117 static String urlForLoggingMedia(const KURL& url) |
122 { | 118 { |
123 static const unsigned maximumURLLengthForLogging = 128; | 119 static const unsigned maximumURLLengthForLogging = 128; |
124 | 120 |
125 if (url.string().length() < maximumURLLengthForLogging) | 121 if (url.string().length() < maximumURLLengthForLogging) |
(...skipping 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2580 | 2576 |
2581 // This cast is safe because we created the InbandTextTrack with the InbandT
extTrackPrivate | 2577 // This cast is safe because we created the InbandTextTrack with the InbandT
extTrackPrivate |
2582 // passed to mediaPlayerDidAddTrack. | 2578 // passed to mediaPlayerDidAddTrack. |
2583 RefPtr<InbandTextTrack> textTrack = static_cast<InbandTextTrack*>(prpTrack->
client()); | 2579 RefPtr<InbandTextTrack> textTrack = static_cast<InbandTextTrack*>(prpTrack->
client()); |
2584 if (!textTrack) | 2580 if (!textTrack) |
2585 return; | 2581 return; |
2586 | 2582 |
2587 removeTrack(textTrack.get()); | 2583 removeTrack(textTrack.get()); |
2588 } | 2584 } |
2589 | 2585 |
2590 #if USE(PLATFORM_TEXT_TRACK_MENU) | |
2591 void HTMLMediaElement::setSelectedTextTrack(PassRefPtr<PlatformTextTrack> platfo
rmTrack) | |
2592 { | |
2593 if (!m_textTracks) | |
2594 return; | |
2595 | |
2596 TrackDisplayUpdateScope scope(this); | |
2597 | |
2598 if (!platformTrack) { | |
2599 setSelectedTextTrack(0); | |
2600 return; | |
2601 } | |
2602 | |
2603 TextTrack* textTrack; | |
2604 size_t i; | |
2605 for (i = 0; i < m_textTracks->length(); ++i) { | |
2606 textTrack = m_textTracks->item(i); | |
2607 | |
2608 if (textTrack->platformTextTrack() == platformTrack) | |
2609 break; | |
2610 } | |
2611 | |
2612 if (i == m_textTracks->length()) | |
2613 return; | |
2614 setSelectedTextTrack(textTrack); | |
2615 } | |
2616 | |
2617 Vector<RefPtr<PlatformTextTrack> > HTMLMediaElement::platformTextTracks() | |
2618 { | |
2619 if (!m_textTracks || !m_textTracks->length()) | |
2620 return Vector<RefPtr<PlatformTextTrack> >(); | |
2621 | |
2622 Vector<RefPtr<PlatformTextTrack> > platformTracks; | |
2623 for (size_t i = 0; i < m_textTracks->length(); ++i) | |
2624 platformTracks.append(m_textTracks->item(i)->platformTextTrack()); | |
2625 | |
2626 return platformTracks; | |
2627 } | |
2628 | |
2629 void HTMLMediaElement::notifyMediaPlayerOfTextTrackChanges() | |
2630 { | |
2631 if (!m_textTracks || !m_textTracks->length() || !platformTextTrackMenu()) | |
2632 return; | |
2633 | |
2634 m_platformMenu->tracksDidChange(); | |
2635 } | |
2636 | |
2637 PlatformTextTrackMenuInterface* HTMLMediaElement::platformTextTrackMenu() | |
2638 { | |
2639 if (m_platformMenu) | |
2640 return m_platformMenu.get(); | |
2641 | |
2642 if (!m_player->implementsTextTrackControls()) | |
2643 return 0; | |
2644 | |
2645 m_platformMenu = m_player->textTrackMenu(); | |
2646 if (!m_platformMenu) | |
2647 return 0; | |
2648 | |
2649 m_platformMenu->setClient(this); | |
2650 | |
2651 return m_platformMenu.get(); | |
2652 } | |
2653 #endif // #if USE(PLATFORM_TEXT_TRACK_MENU) | |
2654 | |
2655 void HTMLMediaElement::closeCaptionTracksChanged() | 2586 void HTMLMediaElement::closeCaptionTracksChanged() |
2656 { | 2587 { |
2657 if (hasMediaControls()) | 2588 if (hasMediaControls()) |
2658 mediaControls()->closedCaptionTracksChanged(); | 2589 mediaControls()->closedCaptionTracksChanged(); |
2659 | |
2660 #if USE(PLATFORM_TEXT_TRACK_MENU) | |
2661 if (m_player->implementsTextTrackControls()) | |
2662 scheduleDelayedAction(TextTrackChangesNotification); | |
2663 #endif | |
2664 } | 2590 } |
2665 | 2591 |
2666 void HTMLMediaElement::addTrack(TextTrack* track) | 2592 void HTMLMediaElement::addTrack(TextTrack* track) |
2667 { | 2593 { |
2668 textTracks()->append(track); | 2594 textTracks()->append(track); |
2669 | 2595 |
2670 closeCaptionTracksChanged(); | 2596 closeCaptionTracksChanged(); |
2671 } | 2597 } |
2672 | 2598 |
2673 void HTMLMediaElement::removeTrack(TextTrack* track) | 2599 void HTMLMediaElement::removeTrack(TextTrack* track) |
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4314 info.addMember(m_mediaGroup, "mediaGroup"); | 4240 info.addMember(m_mediaGroup, "mediaGroup"); |
4315 info.addMember(m_mediaController, "mediaController"); | 4241 info.addMember(m_mediaController, "mediaController"); |
4316 | 4242 |
4317 #if ENABLE(WEB_AUDIO) | 4243 #if ENABLE(WEB_AUDIO) |
4318 info.addMember(m_audioSourceNode, "audioSourceNode"); | 4244 info.addMember(m_audioSourceNode, "audioSourceNode"); |
4319 #endif | 4245 #endif |
4320 | 4246 |
4321 } | 4247 } |
4322 | 4248 |
4323 } | 4249 } |
OLD | NEW |