Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: third_party/WebKit/Source/core/html/track/AutomaticTrackSelection.cpp

Issue 1976183002: Add TextTrack::isVisualKind helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/track/AutomaticTrackSelection.h" 5 #include "core/html/track/AutomaticTrackSelection.h"
6 6
7 #include "core/html/track/TextTrack.h" 7 #include "core/html/track/TextTrack.h"
8 #include "core/html/track/TextTrackList.h" 8 #include "core/html/track/TextTrackList.h"
9 #include "platform/Language.h" 9 #include "platform/Language.h"
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 Vector<AtomicString> languages = userPreferredLanguages(); 43 Vector<AtomicString> languages = userPreferredLanguages();
44 size_t languageMatchIndex = indexOfBestMatchingLanguageInList(track.language (), languages); 44 size_t languageMatchIndex = indexOfBestMatchingLanguageInList(track.language (), languages);
45 if (languageMatchIndex >= languages.size()) 45 if (languageMatchIndex >= languages.size())
46 return 0; 46 return 0;
47 47
48 return languages.size() - languageMatchIndex; 48 return languages.size() - languageMatchIndex;
49 } 49 }
50 50
51 static int textTrackSelectionScore(const TextTrack& track) 51 static int textTrackSelectionScore(const TextTrack& track)
52 { 52 {
53 if (track.kind() != TextTrack::captionsKeyword() && track.kind() != TextTrac k::subtitlesKeyword()) 53 if (!track.isVisualKind())
54 return 0; 54 return 0;
55 55
56 return textTrackLanguageSelectionScore(track); 56 return textTrackLanguageSelectionScore(track);
57 } 57 }
58 58
59 AutomaticTrackSelection::AutomaticTrackSelection(const Configuration& configurat ion) 59 AutomaticTrackSelection::AutomaticTrackSelection(const Configuration& configurat ion)
60 : m_configuration(configuration) 60 : m_configuration(configuration)
61 { 61 {
62 } 62 }
63 63
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 performAutomaticTextTrackSelection(captionAndSubtitleTracks); 207 performAutomaticTextTrackSelection(captionAndSubtitleTracks);
208 if (descriptionTracks.tracks.size()) 208 if (descriptionTracks.tracks.size())
209 performAutomaticTextTrackSelection(descriptionTracks); 209 performAutomaticTextTrackSelection(descriptionTracks);
210 if (chapterTracks.tracks.size()) 210 if (chapterTracks.tracks.size())
211 performAutomaticTextTrackSelection(chapterTracks); 211 performAutomaticTextTrackSelection(chapterTracks);
212 if (metadataTracks.tracks.size()) 212 if (metadataTracks.tracks.size())
213 enableDefaultMetadataTextTracks(metadataTracks); 213 enableDefaultMetadataTextTracks(metadataTracks);
214 } 214 }
215 215
216 } // namespace blink 216 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | third_party/WebKit/Source/core/html/track/TextTrack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698