Source/WebCore/ChangeLog

 12013-01-21 Eric Carlson <eric.carlson@apple.com>
 2
 3 Support non-WebVTT cues from in-band text tracks
 4 https://bugs.webkit.org/show_bug.cgi?id=107046
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * CMakeLists.txt: Add new files.
 9 * GNUmakefile.list.am: Ditto.
 10 * Target.pri: Ditto.
 11 * WebCore.gypi: Ditto.
 12 * WebCore.vcproj/WebCore.vcproj: Ditto.
 13 * WebCore.xcodeproj/project.pbxproj: Ditto.
 14
 15 * html/shadow/MediaControlElements.cpp:
 16 (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Pass video size to getDisplayTree.
 17
 18 * html/track/InbandTextTrack.cpp:
 19 (WebCore::InbandTextTrack::addGenericCue): New, create a generic cue if it doesn't already exist.
 20 (WebCore::InbandTextTrack::addWebVTTCue): Renamed from addCue.
 21 * html/track/InbandTextTrack.h:
 22
 23 * html/track/TextTrack.cpp:
 24 (WebCore::TextTrack::hasCue): Moved from InbandTextTrack.cpp, use operator == instead of inline
 25 comparison so derived TextTrackCues can be compared.
 26 * html/track/TextTrack.h:
 27
 28 * html/track/TextTrackCue.cpp:
 29 (WebCore::TextTrackCueBox::applyCSSProperties): Interface change.
 30 (WebCore::TextTrackCue::TextTrackCue): Don't create the display tree in the constructor, it may
 31 never be needed.
 32 (WebCore::TextTrackCue::createDisplayTree): New, create the display tree.
 33 (WebCore::TextTrackCue::displayTreeInternal): Display tree accessor, allows it to be created lazily.
 34 (WebCore::TextTrackCue::setAlign): Alignment -> CueAlignment.
 35 (WebCore::TextTrackCue::setIsActive): Use displayTreeInternal().
 36 (WebCore::TextTrackCue::getDisplayTree): Use displayTreeInternal(), pass video size to applyCSSProperties.
 37 (WebCore::TextTrackCue::removeDisplayTree): Use displayTreeInternal().
 38 (WebCore::TextTrackCue::operator==): New.
 39 * html/track/TextTrackCue.h:
 40 (WebCore::TextTrackCue::getAlignment): Alignment -> CueAlignment.
 41 (WebCore::TextTrackCue::operator!=): New.
 42 (WebCore::TextTrackCue::cueType): New, cue type identified needed by operator==.
 43 (WebCore::TextTrackCue::ownerDocument): New.
 44
 45 * html/track/TextTrackCueGeneric.cpp: Added.
 46 (WebCore::TextTrackCueGenericBox::create):
 47 (WebCore::TextTrackCueGenericBox::TextTrackCueGenericBox):
 48 (WebCore::TextTrackCueGenericBox::applyCSSProperties):
 49 (WebCore:::TextTrackCue):
 50 (WebCore::TextTrackCueGeneric::createDisplayTree):
 51 (WebCore::TextTrackCueGeneric::operator==):
 52 * html/track/TextTrackCueGeneric.h: Added.
 53 (WebCore::TextTrackCueGeneric::create):
 54 (WebCore::TextTrackCueGeneric::~TextTrackCueGeneric):
 55 (WebCore::TextTrackCueGeneric::baseFontSizeRelativeToVideoHeight):
 56 (WebCore::TextTrackCueGeneric::setBaseFontSizeRelativeToVideoHeight):
 57 (WebCore::TextTrackCueGeneric::fontSizeMultiplier):
 58 (WebCore::TextTrackCueGeneric::setFontSizeMultiplier):
 59 (WebCore::TextTrackCueGeneric::fontName):
 60 (WebCore::TextTrackCueGeneric::setFontName):
 61 (WebCore::TextTrackCueGeneric::operator!=):
 62 (WebCore::TextTrackCueGeneric::cueType):
 63
 64 * platform/graphics/InbandTextTrackPrivateClient.h:
 65 * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
 66 (WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Copy cue attributes into GenericCueData
 67 struct instead of trying to convert to WebVTT settings string. Process font size,font base
 68 size, font name, and vertical layout attributes,
 69 (WebCore::InbandTextTrackPrivateAVF::processCue): Create separate cues for each attributed
 70 string in the array because each one can be at a different screen location.
 71 (WebCore::InbandTextTrackPrivateAVF::resetCueValues):
 72 * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:
 73 (InbandTextTrackPrivateAVF):
 74
 75 * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
 76 (WebCore::MediaPlayerPrivateAVFoundation::seekCompleted): Reset any partially accumulated cues
 77 delivered since the seek was started.
 78 (WebCore::MediaPlayerPrivateAVFoundation::addGenericCue): Renamed from flushCurrentCue.
 79 * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
 80
 81 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
 82 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Whitespace cleanup.
 83 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Ditto.
 84 (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Tell legible output to deliver cues
 85 without any additional styling needed by the internal renderer.
 86 (WebCore::MediaPlayerPrivateAVFoundationObjC::processTextTracks):
 87 (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTrack): Do nothing if asked to change
 88 to the track that is already current.
 89 (-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):
 90 Check to make sure that the client callback isn't NULL.
 91
1922013-01-21 Vladislav Kaznacheev <kaznacheev@chromium.org>
293
394 [Inspector] Layout Elements panel in a single column when docked right.
140334

Source/WebCore/CMakeLists.txt

@@set(WebCore_SOURCES
15811581 html/track/LoadableTextTrack.cpp
15821582 html/track/TextTrack.cpp
15831583 html/track/TextTrackCue.cpp
 1584 html/track/TextTrackCueGeneric.cpp
15841585 html/track/TextTrackCueList.cpp
15851586 html/track/TextTrackList.cpp
15861587 html/track/TrackBase.cpp
140334

Source/WebCore/GNUmakefile.list.am

@@webcore_sources += \
36723672 Source/WebCore/html/track/TextTrack.h \
36733673 Source/WebCore/html/track/TextTrackCue.cpp \
36743674 Source/WebCore/html/track/TextTrackCue.h \
 3675 Source/WebCore/html/track/TextTrackCueGeneric.cpp \
 3676 Source/WebCore/html/track/TextTrackCueGeneric.h \
36753677 Source/WebCore/html/track/TextTrackCueList.cpp \
36763678 Source/WebCore/html/track/TextTrackCueList.h \
36773679 Source/WebCore/html/track/TextTrackList.cpp \
140334

Source/WebCore/Target.pri

@@HEADERS += \
19151915 html/track/LoadableTextTrack.h \
19161916 html/track/TextTrack.h \
19171917 html/track/TextTrackCue.h \
 1918 html/track/TextTrackCueGeneric.h \
19181919 html/track/TextTrackCueList.h \
19191920 html/track/TextTrackList.h \
19201921 html/track/TrackBase.h \
140334

Source/WebCore/WebCore.gypi

34573457 'html/track/TextTrack.h',
34583458 'html/track/TextTrackCue.cpp',
34593459 'html/track/TextTrackCue.h',
 3460 'html/track/TextTrackCueGeneric.cpp',
 3461 'html/track/TextTrackCueGeneric.h',
34603462 'html/track/TextTrackCueList.cpp',
34613463 'html/track/TextTrackCueList.h',
34623464 'html/track/TextTrackList.cpp',
140334

Source/WebCore/WebCore.vcproj/WebCore.vcproj

6526565265 >
6526665266 </File>
6526765267 <File
 65268 RelativePath="..\html\track\TextTrackCueGeneric.cpp"
 65269 >
 65270 </File>
 65271 <File
 65272 RelativePath="..\html\track\TextTrackCueGeneric.h"
 65273 >
 65274 </File>
 65275 <File
6526865276 RelativePath="..\html\track\TextTrackCueList.cpp"
6526965277 >
6527065278 </File>
140334

Source/WebCore/WebCore.xcodeproj/project.pbxproj

108108 070756DF14239B4E00414161 /* JSTextTrackCueList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 070756D914239B4C00414161 /* JSTextTrackCueList.cpp */; };
109109 070756E014239B4E00414161 /* JSTextTrackCueList.h in Headers */ = {isa = PBXBuildFile; fileRef = 070756DA14239B4E00414161 /* JSTextTrackCueList.h */; };
110110 0709FC4E1025DEE30059CDBA /* AccessibilitySlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 0709FC4D1025DEE30059CDBA /* AccessibilitySlider.h */; };
 111 071A9EC2168FBC43002629F9 /* TextTrackCueGeneric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 071A9EC0168FB56C002629F9 /* TextTrackCueGeneric.cpp */; };
 112 071A9EC3168FBC55002629F9 /* TextTrackCueGeneric.h in Headers */ = {isa = PBXBuildFile; fileRef = 071A9EC1168FB56C002629F9 /* TextTrackCueGeneric.h */; settings = {ATTRIBUTES = (Private, ); }; };
111113 0720B0A014D3323500642955 /* GenericEventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0720B09E14D3323500642955 /* GenericEventQueue.cpp */; };
112114 0720B0A014D3323500642956 /* GestureEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642956 /* GestureEvent.cpp */; };
113115 0720B0A114D3323500642955 /* GenericEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642955 /* GenericEventQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };

73037305 070756DA14239B4E00414161 /* JSTextTrackCueList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTextTrackCueList.h; sourceTree = "<group>"; };
73047306 0709FC4D1025DEE30059CDBA /* AccessibilitySlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySlider.h; sourceTree = "<group>"; };
73057307 070DD8F50F01868000727DEB /* mediaControls.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mediaControls.css; sourceTree = "<group>"; };
 7308 071A9EC0168FB56C002629F9 /* TextTrackCueGeneric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextTrackCueGeneric.cpp; sourceTree = "<group>"; };
 7309 071A9EC1168FB56C002629F9 /* TextTrackCueGeneric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextTrackCueGeneric.h; sourceTree = "<group>"; };
73067310 0720B09E14D3323500642955 /* GenericEventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericEventQueue.cpp; sourceTree = "<group>"; };
73077311 0720B09F14D3323500642955 /* GenericEventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericEventQueue.h; sourceTree = "<group>"; };
73087312 0720B09F14D3323500642956 /* GestureEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GestureEvent.cpp; sourceTree = "<group>"; };

1974419748 9759E93814EF1CF80026A2DD /* TextTrackCue.cpp */,
1974519749 9759E93914EF1CF80026A2DD /* TextTrackCue.h */,
1974619750 9759E93A14EF1CF80026A2DD /* TextTrackCue.idl */,
 19751 071A9EC0168FB56C002629F9 /* TextTrackCueGeneric.cpp */,
 19752 071A9EC1168FB56C002629F9 /* TextTrackCueGeneric.h */,
1974719753 9759E93B14EF1CF80026A2DD /* TextTrackCueList.cpp */,
1974819754 9759E93C14EF1CF80026A2DD /* TextTrackCueList.h */,
1974919755 9759E93D14EF1CF80026A2DD /* TextTrackCueList.idl */,

2602726033 B2C3DA4B0D006C1D00EF6F26 /* TextStream.h in Headers */,
2602826034 9759E94014EF1CF80026A2DD /* TextTrack.h in Headers */,
2602926035 9759E94314EF1CF80026A2DD /* TextTrackCue.h in Headers */,
 26036 071A9EC3168FBC55002629F9 /* TextTrackCueGeneric.h in Headers */,
2603026037 9759E94614EF1CF80026A2DD /* TextTrackCueList.h in Headers */,
2603126038 076970871463AD8700F502CF /* TextTrackList.h in Headers */,
2603226039 B1AD4E7413A12A4600846B27 /* TextTrackLoader.h in Headers */,

2921129218 B2C3DA4A0D006C1D00EF6F26 /* TextStream.cpp in Sources */,
2921229219 9759E93F14EF1CF80026A2DD /* TextTrack.cpp in Sources */,
2921329220 9759E94214EF1CF80026A2DD /* TextTrackCue.cpp in Sources */,
 29221 071A9EC2168FBC43002629F9 /* TextTrackCueGeneric.cpp in Sources */,
2921429222 9759E94514EF1CF80026A2DD /* TextTrackCueList.cpp in Sources */,
2921529223 076970861463AD8700F502CF /* TextTrackList.cpp in Sources */,
2921629224 B1AD4E7313A12A4600846B27 /* TextTrackLoader.cpp in Sources */,
140334

Source/WebCore/html/HTMLMediaElement.cpp

@@void HTMLMediaElement::clearMediaPlayer(
38193819
38203820 m_pendingLoadFlags &= ~flags;
38213821 m_loadState = WaitingForSource;
 3822
 3823#if ENABLE(VIDEO_TRACK)
 3824 if (m_textTracks)
 3825 configureTextTrackDisplay();
 3826#endif
38223827}
38233828
38243829bool HTMLMediaElement::canSuspend() const
140334

Source/WebCore/html/shadow/MediaControlElements.cpp

@@void MediaControlTextTrackContainerEleme
13041304 if (!cue->track() || !cue->track()->isRendered())
13051305 continue;
13061306
1307  RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree();
1308 
 1307 RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size());
13091308 if (displayBox->hasChildNodes() && !contains(static_cast<Node*>(displayBox.get())))
13101309 // Note: the display tree of a cue is removed when the active flag of the cue is unset.
13111310 m_cueContainer->appendChild(displayBox, ASSERT_NO_EXCEPTION, false);
140334

Source/WebCore/html/track/InbandTextTrack.cpp

3232#include "Document.h"
3333#include "Event.h"
3434#include "InbandTextTrackPrivate.h"
 35#include "Logging.h"
3536#include "MediaPlayer.h"
 37#include "TextTrackCueGeneric.h"
3638#include "TextTrackCueList.h"
37 
 39#include <math.h>
3840#include <wtf/UnusedParam.h>
3941
4042namespace WebCore {

@@size_t InbandTextTrack::inbandTrackIndex
98100 return m_private->textTrackIndex();
99101}
100102
101 void InbandTextTrack::addCue(InbandTextTrackPrivate* trackPrivate, double start, double end, const String& id, const String& content, const String& settings)
 103void InbandTextTrack::addGenericCue(InbandTextTrackPrivate* trackPrivate, GenericCueData* cueData)
102104{
103105 UNUSED_PARAM(trackPrivate);
104106 ASSERT(trackPrivate == m_private);
105107
106  RefPtr<TextTrackCue> cue = TextTrackCue::create(scriptExecutionContext(), start, end, content);
107  cue->setId(id);
108  cue->setCueSettings(settings);
109  cue->setTrack(this);
 108 RefPtr<TextTrackCueGeneric> cue = TextTrackCueGeneric::create(scriptExecutionContext(), cueData->startTime(), cueData->endTime(), cueData->content());
110109
111  if (!m_cues)
112  m_cues = TextTrackCueList::create();
113  m_cues->add(cue);
114 
115  if (client())
116  client()->textTrackAddCues(this, m_cues.get());
 110 cue->setId(cueData->id());
 111 cue->setBaseFontSizeRelativeToVideoHeight(cueData->baseFontSize());
 112 cue->setFontSizeMultiplier(cueData->relativeFontSize());
 113 cue->setFontName(cueData->fontName());
 114
 115 ExceptionCode ec;
 116 if (cueData->position() > 0)
 117 cue->setPosition(lround(cueData->position()), ec);
 118 if (cueData->line() > 0)
 119 cue->setLine(lround(cueData->line()), ec);
 120 if (cueData->size() > 0)
 121 cue->setSize(lround(cueData->size()), ec);
 122 if (cueData->align() == GenericCueData::Start)
 123 cue->setAlign(ASCIILiteral("start"), ec);
 124 else if (cueData->align() == GenericCueData::Middle)
 125 cue->setAlign(ASCIILiteral("middle"), ec);
 126 else if (cueData->align() == GenericCueData::End)
 127 cue->setAlign(ASCIILiteral("end"), ec);
 128 cue->setSnapToLines(false);
 129
 130 if (hasCue(cue.get())) {
 131 LOG(Media, "InbandTextTrack::addGenericCue ignoring already added cue: start=%.2f, end=%.2f, content=\"%s\"\n",
 132 cueData->startTime(), cueData->endTime(), cueData->content().utf8().data());
 133 return;
 134 }
 135
 136 addCue(cue);
117137}
118138
119 bool InbandTextTrack::hasCue(InbandTextTrackPrivate*, double startTime, double endTime, const String& id, const String& content, const String& settings)
 139void InbandTextTrack::addWebVTTCue(InbandTextTrackPrivate* trackPrivate, double start, double end, const String& id, const String& content, const String& settings)
120140{
 141 UNUSED_PARAM(trackPrivate);
 142 ASSERT(trackPrivate == m_private);
121143
122  if (startTime < 0 || endTime < 0)
123  return false;
124 
125  if (!cues()->length())
126  return false;
127 
128  size_t searchStart = 0;
129  size_t searchEnd = cues()->length();
130 
131  while (1) {
132  ASSERT(searchStart <= cues()->length());
133  ASSERT(searchEnd <= cues()->length());
134 
135  TextTrackCue* cue;
136 
137  // Cues in the TextTrackCueList are maintained in start time order.
138  if (searchStart == searchEnd) {
139  if (!searchStart)
140  return false;
141 
142  cue = cues()->item(searchStart - 1);
143  if (!cue)
144  return false;
145  if (cue->startTime() != startTime)
146  return false;
147  if (cue->endTime() != endTime)
148  return false;
149  if (cue->text() != content)
150  return false;
151  if (cue->cueSettings() != settings)
152  return false;
153  if (cue->id() != id)
154  return false;
155 
156  return true;
157  }
158 
159  size_t index = (searchStart + searchEnd) / 2;
160  cue = cues()->item(index);
161  if (startTime < cue->startTime() || (startTime == cue->startTime() && endTime > cue->endTime()))
162  searchEnd = index;
163  else
164  searchStart = index + 1;
165  }
 144 RefPtr<TextTrackCue> cue = TextTrackCue::create(scriptExecutionContext(), start, end, content);
 145 cue->setId(id);
 146 cue->setCueSettings(settings);
166147
167  ASSERT_NOT_REACHED();
168  return false;
 148 if (hasCue(cue.get()))
 149 return;
 150
 151 addCue(cue);
169152}
170153
171154} // namespace WebCore
140334

Source/WebCore/html/track/InbandTextTrack.h

11/*
2  * Copyright (C) 2012 Apple Inc. All rights reserved.
 2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
33 *
44 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions

@@public:
5151private:
5252 InbandTextTrack(ScriptExecutionContext*, TextTrackClient*, PassRefPtr<InbandTextTrackPrivate>);
5353
54  virtual void addCue(InbandTextTrackPrivate*, double, double, const String&, const String&, const String&) OVERRIDE;
55  virtual bool hasCue(InbandTextTrackPrivate*, double, double, const String&, const String&, const String&) OVERRIDE;
 54 virtual void addGenericCue(InbandTextTrackPrivate*, GenericCueData*) OVERRIDE;
 55 virtual void addWebVTTCue(InbandTextTrackPrivate*, double, double, const String&, const String&, const String&) OVERRIDE;
5656
5757 RefPtr<InbandTextTrackPrivate> m_private;
5858};
140334

Source/WebCore/html/track/TextTrack.cpp

11/*
22 * Copyright (C) 2011 Google Inc. All rights reserved.
3  * Copyright (C) 2011 Apple Inc. All rights reserved.
 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
44 *
55 * Redistribution and use in source and binary forms, with or without
66 * modification, are permitted provided that the following conditions are

@@int TextTrack::trackIndexRelativeToRende
339339 return m_renderedTrackIndex;
340340}
341341
 342bool TextTrack::hasCue(TextTrackCue* cue)
 343{
 344 if (cue->startTime() < 0 || cue->endTime() < 0)
 345 return false;
 346
 347 if (!m_cues || !m_cues->length())
 348 return false;
 349
 350 size_t searchStart = 0;
 351 size_t searchEnd = m_cues->length();
 352
 353 while (1) {
 354 ASSERT(searchStart <= m_cues->length());
 355 ASSERT(searchEnd <= m_cues->length());
 356
 357 TextTrackCue* existingCue;
 358
 359 // Cues in the TextTrackCueList are maintained in start time order.
 360 if (searchStart == searchEnd) {
 361 if (!searchStart)
 362 return false;
 363
 364 // If there is more than one cue with the same start time, back up to first one so we
 365 // consider all of them.
 366 while (searchStart >= 2 && cue->startTime() == m_cues->item(searchStart - 2)->startTime())
 367 --searchStart;
 368
 369 bool firstCompare = true;
 370 while (1) {
 371 if (!firstCompare)
 372 ++searchStart;
 373 firstCompare = false;
 374 if (searchStart > m_cues->length())
 375 return false;
 376
 377 existingCue = m_cues->item(searchStart - 1);
 378 if (!existingCue || cue->startTime() > existingCue->startTime())
 379 return false;
 380
 381 if (*existingCue != *cue)
 382 continue;
 383
 384 return true;
 385 }
 386 }
 387
 388 size_t index = (searchStart + searchEnd) / 2;
 389 existingCue = m_cues->item(index);
 390 if (cue->startTime() < existingCue->startTime() || (cue->startTime() == existingCue->startTime() && cue->endTime() > existingCue->endTime()))
 391 searchEnd = index;
 392 else
 393 searchStart = index + 1;
 394 }
 395
 396 ASSERT_NOT_REACHED();
 397 return false;
 398}
 399
342400} // namespace WebCore
343401
344402#endif
140334

Source/WebCore/html/track/TextTrack.h

11/*
22 * Copyright (C) 2011 Google Inc. All rights reserved.
3  * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
44 *
55 * Redistribution and use in source and binary forms, with or without
66 * modification, are permitted provided that the following conditions

@@public:
9999
100100 void addCue(PassRefPtr<TextTrackCue>);
101101 void removeCue(TextTrackCue*, ExceptionCode&);
 102 bool hasCue(TextTrackCue*);
102103
103104 void cueWillChange(TextTrackCue*);
104105 void cueDidChange(TextTrackCue*);
140334

Source/WebCore/html/track/TextTrackCue.cpp

11/*
22 * Copyright (C) 2011 Google Inc. All rights reserved.
3  * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
44 *
55 * Redistribution and use in source and binary forms, with or without
66 * modification, are permitted provided that the following conditions are

@@TextTrackCue* TextTrackCueBox::getCue()
107107 return m_cue;
108108}
109109
110 void TextTrackCueBox::applyCSSProperties()
 110void TextTrackCueBox::applyCSSProperties(const IntSize&)
111111{
112112 // FIXME: Apply all the initial CSS positioning properties. http://wkb.ug/79916
113113

@@TextTrackCue::TextTrackCue(ScriptExecuti
210210 , m_snapToLines(true)
211211 , m_allDocumentNodes(HTMLDivElement::create(static_cast<Document*>(context)))
212212 , m_displayTreeShouldChange(true)
213  , m_displayTree(TextTrackCueBox::create(static_cast<Document*>(m_scriptExecutionContext), this))
214213{
215214 ASSERT(m_scriptExecutionContext->isDocument());
216215

@@TextTrackCue::~TextTrackCue()
228227{
229228}
230229
 230PassRefPtr<TextTrackCueBox> TextTrackCue::createDisplayTree()
 231{
 232 return TextTrackCueBox::create(ownerDocument(), this);
 233}
 234
 235PassRefPtr<TextTrackCueBox> TextTrackCue::displayTreeInternal()
 236{
 237 if (!m_displayTree)
 238 m_displayTree = createDisplayTree();
 239 return m_displayTree;
 240}
 241
231242void TextTrackCue::cueWillChange()
232243{
233244 if (m_track)

@@void TextTrackCue::setAlign(const String
438449 // match for the new value, if any. If none of the values match, then the user
439450 // agent must instead throw a SyntaxError exception.
440451
441  Alignment alignment = m_cueAlignment;
 452 CueAlignment alignment = m_cueAlignment;
442453 if (value == startKeyword())
443454 alignment = Start;
444455 else if (value == middleKeyword())

@@void TextTrackCue::setIsActive(bool acti
545556
546557 if (!active) {
547558 // Remove the display tree as soon as the cue becomes inactive.
548  ExceptionCode ec;
549  m_displayTree->remove(ec);
 559 displayTreeInternal()->remove(ASSERT_NO_EXCEPTION);
550560 }
551561}
552562

@@void TextTrackCue::updateDisplayTree(flo
722732 m_allDocumentNodes->appendChild(referenceTree);
723733}
724734
725 PassRefPtr<TextTrackCueBox> TextTrackCue::getDisplayTree()
 735PassRefPtr<TextTrackCueBox> TextTrackCue::getDisplayTree(const IntSize& videoSize)
726736{
 737 RefPtr<TextTrackCueBox> displayTree = displayTreeInternal();
727738 if (!m_displayTreeShouldChange || !track()->isRendered())
728  return m_displayTree;
 739 return displayTree;
729740
730741 // 10.1 - 10.10
731742 calculateDisplayParameters();

@@PassRefPtr<TextTrackCueBox> TextTrackCue
733744 // 10.11. Apply the terms of the CSS specifications to nodes within the
734745 // following constraints, thus obtaining a set of CSS boxes positioned
735746 // relative to an initial containing block:
736  m_displayTree->removeChildren();
 747 displayTree->removeChildren();
737748
738749 // The document tree is the tree of WebVTT Node Objects rooted at nodes.
739750

@@PassRefPtr<TextTrackCueBox> TextTrackCue
743754
744755 // Note: This is contained by default in m_allDocumentNodes.
745756 m_allDocumentNodes->setPseudo(allNodesShadowPseudoId());
746  m_displayTree->appendChild(m_allDocumentNodes, ASSERT_NO_EXCEPTION, true);
 757 displayTree->appendChild(m_allDocumentNodes, ASSERT_NO_EXCEPTION, true);
747758
748759 // FIXME(BUG 79916): Runs of children of WebVTT Ruby Objects that are not
749760 // WebVTT Ruby Text Objects must be wrapped in anonymous boxes whose

@@PassRefPtr<TextTrackCueBox> TextTrackCue
756767 // is no line breaking opportunity. (Thus, normally text wraps as needed,
757768 // but if there is a particularly long word, it does not overflow as it
758769 // normally would in CSS, it is instead forcibly wrapped at the box's edge.)
759  m_displayTree->applyCSSProperties();
 770 displayTree->applyCSSProperties(videoSize);
760771
761772 m_displayTreeShouldChange = false;
762773
763774 // 10.15. Let cue's text track cue display state have the CSS boxes in
764775 // boxes.
765  return m_displayTree;
 776 return displayTree;
766777}
767778
768779void TextTrackCue::removeDisplayTree()
769780{
770  m_displayTree->remove(ASSERT_NO_EXCEPTION);
 781 displayTreeInternal()->remove(ASSERT_NO_EXCEPTION);
771782}
772783
773784std::pair<double, double> TextTrackCue::getPositionCoordinates() const

@@EventTargetData* TextTrackCue::ensureEve
10661077 return &m_eventTargetData;
10671078}
10681079
 1080bool TextTrackCue::operator==(const TextTrackCue& cue) const
 1081{
 1082 if (cueType() != cue.cueType())
 1083 return false;
 1084
 1085 if (m_endTime != cue.endTime())
 1086 return false;
 1087 if (m_startTime != cue.startTime())
 1088 return false;
 1089 if (m_content != cue.text())
 1090 return false;
 1091 if (m_settings != cue.cueSettings())
 1092 return false;
 1093 if (m_id != cue.id())
 1094 return false;
 1095 if (m_textPosition != cue.position())
 1096 return false;
 1097 if (m_linePosition != cue.line())
 1098 return false;
 1099 if (m_cueSize != cue.size())
 1100 return false;
 1101 if (align() != cue.align())
 1102 return false;
 1103
 1104 return true;
 1105}
 1106
10691107} // namespace WebCore
10701108
10711109#endif
140334

Source/WebCore/html/track/TextTrackCue.h

11/*
22 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
34 *
45 * Redistribution and use in source and binary forms, with or without
56 * modification, are permitted provided that the following conditions are

@@public:
5758 }
5859
5960 TextTrackCue* getCue() const;
60  void applyCSSProperties();
 61 virtual void applyCSSProperties(const IntSize& videoSize);
6162
6263 static const AtomicString& textTrackCueBoxShadowPseudoId();
6364
64 private:
 65protected:
6566 TextTrackCueBox(Document*, TextTrackCue*);
6667
6768 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE;

@@public:
122123 void setSnapToLines(bool);
123124
124125 int line() const { return m_linePosition; }
125  void setLine(int, ExceptionCode&);
 126 virtual void setLine(int, ExceptionCode&);
126127
127128 int position() const { return m_textPosition; }
128  void setPosition(int, ExceptionCode&);
 129 virtual void setPosition(int, ExceptionCode&);
129130
130131 int size() const { return m_cueSize; }
131  void setSize(int, ExceptionCode&);
 132 virtual void setSize(int, ExceptionCode&);
132133
133134 const String& align() const;
134135 void setAlign(const String&, ExceptionCode&);

@@public:
151152 bool isActive();
152153 void setIsActive(bool);
153154
154  PassRefPtr<TextTrackCueBox> getDisplayTree();
 155 PassRefPtr<TextTrackCueBox> getDisplayTree(const IntSize& videoSize);
155156 void updateDisplayTree(float);
156157 void removeDisplayTree();
157158 void markFutureAndPastNodes(ContainerNode*, double, double);

@@public:
173174 };
174175 WritingDirection getWritingDirection() const { return m_writingDirection; }
175176
 177 enum CueAlignment {
 178 Start,
 179 Middle,
 180 End
 181 };
 182 CueAlignment getAlignment() const { return m_cueAlignment; }
 183
 184 virtual bool operator==(const TextTrackCue&) const;
 185 virtual bool operator!=(const TextTrackCue& cue) const
 186 {
 187 return !(*this == cue);
 188 }
 189
 190 enum CueType {
 191 Generic,
 192 WebVTT
 193 };
 194 virtual CueType cueType() const { return WebVTT; }
 195
176196 DEFINE_ATTRIBUTE_EVENT_LISTENER(enter);
177197 DEFINE_ATTRIBUTE_EVENT_LISTENER(exit);
178198

@@protected:
183203 virtual EventTargetData* eventTargetData();
184204 virtual EventTargetData* ensureEventTargetData();
185205
186 private:
187206 TextTrackCue(ScriptExecutionContext*, double start, double end, const String& content);
188207
 208 Document* ownerDocument() { return static_cast<Document*>(m_scriptExecutionContext); }
 209
 210 virtual PassRefPtr<TextTrackCueBox> createDisplayTree();
 211 PassRefPtr<TextTrackCueBox> displayTreeInternal();
 212
 213private:
189214 std::pair<double, double> getPositionCoordinates() const;
190215 void parseSettings(const String&);
191216

@@private:
213238
214239 WritingDirection m_writingDirection;
215240
216  enum Alignment { Start, Middle, End };
217  Alignment m_cueAlignment;
 241 CueAlignment m_cueAlignment;
218242
219243 RefPtr<DocumentFragment> m_webVTTNodeTree;
220244 TextTrack* m_track;
140334

Source/WebCore/html/track/TextTrackCueGeneric.cpp

 1/*
 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27
 28#if ENABLE(VIDEO_TRACK)
 29
 30#include "TextTrackCueGeneric.h"
 31
 32#include "CSSPropertyNames.h"
 33#include "CSSValueKeywords.h"
 34#include "HTMLDivElement.h"
 35#include "HTMLNames.h"
 36#include "InbandTextTrackPrivateClient.h"
 37#include "RenderObject.h"
 38#include "RenderTextTrackCue.h"
 39#include "ScriptExecutionContext.h"
 40#include "TextTrackCue.h"
 41
 42namespace WebCore {
 43
 44class TextTrackCueGenericBoxElement : public TextTrackCueBox {
 45public:
 46 static PassRefPtr<TextTrackCueGenericBoxElement> create(Document* document, TextTrackCueGeneric* cue)
 47 {
 48 return adoptRef(new TextTrackCueGenericBoxElement(document, cue));
 49 }
 50
 51 virtual void applyCSSProperties(const IntSize&) OVERRIDE;
 52
 53private:
 54 TextTrackCueGenericBoxElement(Document*, TextTrackCue*);
 55};
 56
 57TextTrackCueGenericBoxElement::TextTrackCueGenericBoxElement(Document* document, TextTrackCue* cue)
 58 : TextTrackCueBox(document, cue)
 59{
 60}
 61
 62void TextTrackCueGenericBoxElement::applyCSSProperties(const IntSize& videoSize)
 63{
 64 setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
 65 setInlineStyleProperty(CSSPropertyUnicodeBidi, CSSValueWebkitPlaintext);
 66
 67 TextTrackCueGeneric* cue = static_cast<TextTrackCueGeneric*>(getCue());
 68
 69 if (cue->useDefaultPosition()) {
 70 setInlineStyleProperty(CSSPropertyBottom, "0");
 71 setInlineStyleProperty(CSSPropertyMarginBottom, 1.0, CSSPrimitiveValue::CSS_PERCENTAGE);
 72 } else {
 73 setInlineStyleProperty(CSSPropertyLeft, static_cast<float>(cue->position()), CSSPrimitiveValue::CSS_PERCENTAGE);
 74 setInlineStyleProperty(CSSPropertyTop, static_cast<float>(cue->line()), CSSPrimitiveValue::CSS_PERCENTAGE);
 75 }
 76
 77 float size = static_cast<float>(cue->getCSSSize());
 78 if (cue->getWritingDirection() == TextTrackCue::Horizontal) {
 79 setInlineStyleProperty(CSSPropertyDirection, CSSValueLtr);
 80 setInlineStyleProperty(CSSPropertyWidth, size, CSSPrimitiveValue::CSS_PERCENTAGE);
 81 setInlineStyleProperty(CSSPropertyHeight, CSSValueAuto);
 82 } else {
 83 setInlineStyleProperty(CSSPropertyWidth, CSSValueAuto);
 84 setInlineStyleProperty(CSSPropertyHeight, size, CSSPrimitiveValue::CSS_PERCENTAGE);
 85 }
 86
 87 if (cue->baseFontSizeRelativeToVideoHeight()) {
 88 double fontSize = videoSize.height() * cue->baseFontSizeRelativeToVideoHeight() / 100;
 89 if (cue->fontSizeMultiplier())
 90 fontSize *= cue->fontSizeMultiplier() / 100;
 91 setInlineStyleProperty(CSSPropertyFontSize, String::number(fontSize) + "px");
 92 }
 93
 94 if (cue->getAlignment() == TextTrackCue::Start)
 95 setInlineStyleProperty(CSSPropertyTextAlign, CSSValueStart);
 96 else if (cue->getAlignment() == TextTrackCue::End)
 97 setInlineStyleProperty(CSSPropertyTextAlign, CSSValueEnd);
 98 else
 99 setInlineStyleProperty(CSSPropertyTextAlign, CSSValueCenter);
 100
 101 setInlineStyleProperty(CSSPropertyWebkitWritingMode, cue->getCSSWritingMode(), false);
 102 setInlineStyleProperty(CSSPropertyWhiteSpace, CSSValuePreWrap);
 103 setInlineStyleProperty(CSSPropertyWordBreak, CSSValueNormal);
 104}
 105
 106TextTrackCueGeneric::TextTrackCueGeneric(ScriptExecutionContext* context, double start, double end, const String& content)
 107 : TextTrackCue(context, start, end, content)
 108 , m_baseFontSizeRelativeToVideoHeight(0)
 109 , m_fontSizeMultiplier(0)
 110 , m_defaultPosition(true)
 111{
 112}
 113
 114PassRefPtr<TextTrackCueBox> TextTrackCueGeneric::createDisplayTree()
 115{
 116 return TextTrackCueGenericBoxElement::create(ownerDocument(), this);
 117}
 118
 119void TextTrackCueGeneric::setLine(int line, ExceptionCode& ec)
 120{
 121 m_defaultPosition = false;
 122 TextTrackCue::setLine(line, ec);
 123}
 124
 125void TextTrackCueGeneric::setPosition(int position, ExceptionCode& ec)
 126{
 127 m_defaultPosition = false;
 128 TextTrackCue::setPosition(position, ec);
 129}
 130
 131bool TextTrackCueGeneric::operator==(const TextTrackCue& cue) const
 132{
 133 if (cue.cueType() != TextTrackCue::Generic)
 134 return false;
 135
 136 const TextTrackCueGeneric* other = static_cast<const TextTrackCueGeneric*>(&cue);
 137
 138 if (m_baseFontSizeRelativeToVideoHeight != other->baseFontSizeRelativeToVideoHeight())
 139 return false;
 140 if (m_fontSizeMultiplier != other->fontSizeMultiplier())
 141 return false;
 142 if (m_fontName != other->fontName())
 143 return false;
 144
 145 return TextTrackCue::operator==(cue);
 146}
 147
 148} // namespace WebCore
 149
 150#endif
0

Source/WebCore/html/track/TextTrackCueGeneric.h

 1/*
 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef TextTrackCueGeneric_h
 27#define TextTrackCueGeneric_h
 28
 29#if ENABLE(VIDEO_TRACK)
 30
 31#include "HTMLElement.h"
 32#include "TextTrackCue.h"
 33#include <wtf/RefCounted.h>
 34
 35namespace WebCore {
 36
 37class GenericCueData;
 38
 39// A "generic" cue is a non-WebVTT cue, so it is not positioned/sized with the WebVTT logic.
 40class TextTrackCueGeneric : public TextTrackCue {
 41public:
 42 static PassRefPtr<TextTrackCueGeneric> create(ScriptExecutionContext* context, double start, double end, const String& content)
 43 {
 44 return adoptRef(new TextTrackCueGeneric(context, start, end, content));
 45 }
 46
 47 virtual ~TextTrackCueGeneric() { }
 48
 49 virtual PassRefPtr<TextTrackCueBox> createDisplayTree() OVERRIDE;
 50
 51 virtual void setLine(int, ExceptionCode&) OVERRIDE;
 52 virtual void setPosition(int, ExceptionCode&) OVERRIDE;
 53
 54 bool useDefaultPosition() const { return m_defaultPosition; }
 55
 56 double baseFontSizeRelativeToVideoHeight() const { return m_baseFontSizeRelativeToVideoHeight; }
 57 void setBaseFontSizeRelativeToVideoHeight(double size) { m_baseFontSizeRelativeToVideoHeight = size; }
 58
 59 double fontSizeMultiplier() const { return m_fontSizeMultiplier; }
 60 void setFontSizeMultiplier(double size) { m_fontSizeMultiplier = size; }
 61
 62 String fontName() const { return m_fontName; }
 63 void setFontName(String name) { m_fontName = name; }
 64
 65 virtual bool operator==(const TextTrackCue&) const OVERRIDE;
 66 virtual bool operator!=(const TextTrackCue& cue) const OVERRIDE
 67 {
 68 return !(*this == cue);
 69 }
 70
 71 virtual TextTrackCue::CueType cueType() const OVERRIDE { return TextTrackCue::Generic; }
 72
 73private:
 74 TextTrackCueGeneric(ScriptExecutionContext*, double start, double end, const String&);
 75
 76 double m_baseFontSizeRelativeToVideoHeight;
 77 double m_fontSizeMultiplier;
 78 String m_fontName;
 79 bool m_defaultPosition;
 80};
 81
 82} // namespace WebCore
 83
 84#endif
 85#endif
0

Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h

11/*
2  * Copyright (C) 2012 Apple Inc. All rights reserved.
 2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
33 *
44 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions

2626#ifndef InbandTextTrackPrivateClient_h
2727#define InbandTextTrackPrivateClient_h
2828
 29#include <wtf/Noncopyable.h>
2930#include <wtf/text/WTFString.h>
3031
3132#if ENABLE(VIDEO_TRACK)

@@namespace WebCore {
3435
3536class InbandTextTrackPrivate;
3637
 38class GenericCueData {
 39 WTF_MAKE_NONCOPYABLE(GenericCueData); WTF_MAKE_FAST_ALLOCATED;
 40public:
 41 GenericCueData()
 42 : m_startTime(0)
 43 , m_endTime(0)
 44 , m_line(-1)
 45 , m_position(-1)
 46 , m_size(-1)
 47 , m_align(None)
 48 , m_baseFontSize(0)
 49 , m_relativeFontSize(0)
 50 {
 51 }
 52 virtual ~GenericCueData() { }
 53
 54 double startTime() const { return m_startTime; }
 55 void setStartTime(double startTime) { m_startTime = startTime; }
 56
 57 double endTime() const { return m_endTime; }
 58 void setEndTime(double endTime) { m_endTime = endTime; }
 59
 60 String id() const { return m_id; }
 61 void setId(String id) { m_id = id; }
 62
 63 String content() const { return m_content; }
 64 void setContent(String content) { m_content = content; }
 65
 66 double line() const { return m_line; }
 67 void setLine(double line) { m_line = line; }
 68
 69 double position() const { return m_position; }
 70 void setPosition(double position) { m_position = position; }
 71
 72 double size() const { return m_size; }
 73 void setSize(double size) { m_size = size; }
 74
 75 enum Alignment {
 76 None,
 77 Start,
 78 Middle,
 79 End
 80 };
 81 Alignment align() const { return m_align; }
 82 void setAlign(Alignment align) { m_align = align; }
 83
 84 String fontName() const { return m_fontName; }
 85 void setFontName(String fontName) { m_fontName = fontName; }
 86
 87 double baseFontSize() const { return m_baseFontSize; }
 88 void setBaseFontSize(double baseFontSize) { m_baseFontSize = baseFontSize; }
 89
 90 double relativeFontSize() const { return m_relativeFontSize; }
 91 void setRelativeFontSize(double relativeFontSize) { m_relativeFontSize = relativeFontSize; }
 92
 93private:
 94
 95 double m_startTime;
 96 double m_endTime;
 97 String m_id;
 98 String m_content;
 99 double m_line;
 100 double m_position;
 101 double m_size;
 102 Alignment m_align;
 103 String m_fontName;
 104 double m_baseFontSize;
 105 double m_relativeFontSize;
 106};
 107
37108class InbandTextTrackPrivateClient {
38109public:
39110 virtual ~InbandTextTrackPrivateClient() { }
40111
41  virtual void addCue(InbandTextTrackPrivate*, double /*start*/, double /*end*/, const String& /*id*/, const String& /*content*/, const String& /*settings*/) = 0;
42  virtual bool hasCue(InbandTextTrackPrivate*, double /*start*/, double /*end*/, const String& /*id*/, const String& /*content*/, const String& /*settings*/) = 0;
 112 virtual void addWebVTTCue(InbandTextTrackPrivate*, double /*start*/, double /*end*/, const String& /*id*/, const String& /*content*/, const String& /*settings*/) = 0;
 113 virtual void addGenericCue(InbandTextTrackPrivate*, GenericCueData*) = 0;
43114};
44115
45116} // namespace WebCore
140334

Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp

11/*
2  * Copyright (C) 2012 Apple Inc. All rights reserved.
 2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
33 *
44 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions

2929
3030#include "InbandTextTrackPrivateAVF.h"
3131
 32#include "InbandTextTrackPrivateClient.h"
3233#include "Logging.h"
3334#include "MediaPlayerPrivateAVFoundation.h"
3435#include "SoftLinking.h"

3637#include <wtf/UnusedParam.h>
3738#include <wtf/text/CString.h>
3839#include <wtf/text/WTFString.h>
 40#include <wtf/unicode/CharacterNames.h>
3941
4042SOFT_LINK_FRAMEWORK_OPTIONAL(CoreMedia)
4143

@@SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kC
5254SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_VerticalLayout, CFStringRef)
5355SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextVerticalLayout_LeftToRight, CFStringRef)
5456SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextVerticalLayout_RightToLeft, CFStringRef)
 57SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight, CFStringRef)
 58SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_RelativeFontSize, CFStringRef)
 59SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_FontFamilyName, CFStringRef)
5560
5661#define kCMTextMarkupAttribute_Alignment getkCMTextMarkupAttribute_Alignment()
5762#define kCMTextMarkupAlignmentType_Start getkCMTextMarkupAlignmentType_Start()

@@SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kC
6671#define kCMTextMarkupAttribute_VerticalLayout getkCMTextMarkupAttribute_VerticalLayout()
6772#define kCMTextVerticalLayout_LeftToRight getkCMTextVerticalLayout_LeftToRight()
6873#define kCMTextVerticalLayout_RightToLeft getkCMTextVerticalLayout_RightToLeft()
 74#define kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight getkCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight()
 75#define kCMTextMarkupAttribute_RelativeFontSize getkCMTextMarkupAttribute_RelativeFontSize()
 76#define kCMTextMarkupAttribute_FontFamilyName getkCMTextMarkupAttribute_FontFamilyName()
6977
7078using namespace std;
7179

@@InbandTextTrackPrivateAVF::~InbandTextTr
8492 disconnect();
8593}
8694
87 void InbandTextTrackPrivateAVF::processCueAttributes(CFAttributedStringRef attributedString, StringBuilder& content, StringBuilder& settings)
 95void InbandTextTrackPrivateAVF::processCueAttributes(CFAttributedStringRef attributedString, GenericCueData* cueData)
8896{
8997 // Some of the attributes we translate into per-cue WebVTT settings are are repeated on each part of an attributed string so only
9098 // process the first instance of each.

@@void InbandTextTrackPrivateAVF::processC
93101 Position = 1 << 1,
94102 Size = 1 << 2,
95103 Vertical = 1 << 3,
96  Align = 1 << 4
 104 Align = 1 << 4,
 105 FontName = 1 << 5
97106 };
98107 unsigned processed = 0;
99108
 109 StringBuilder content;
100110 String attributedStringValue = CFAttributedStringGetString(attributedString);
101111 CFIndex length = attributedStringValue.length();
102112 if (!length)

@@void InbandTextTrackPrivateAVF::processC
110120 continue;
111121
112122 StringBuilder tagStart;
 123 CFStringRef valueString;
113124 String tagEnd;
114125 CFIndex attributeCount = CFDictionaryGetCount(attributes);
115126 Vector<const void*> keys(attributeCount);

@@void InbandTextTrackPrivateAVF::processC
123134 continue;
124135
125136 if (CFStringCompare(key, kCMTextMarkupAttribute_Alignment, 0) == kCFCompareEqualTo) {
126  CFStringRef valueString = static_cast<CFStringRef>(value);
 137 valueString = static_cast<CFStringRef>(value);
127138 if (CFGetTypeID(valueString) != CFStringGetTypeID() || !CFStringGetLength(valueString))
128139 continue;
129140 if (processed & Align)

@@void InbandTextTrackPrivateAVF::processC
131142 processed |= Align;
132143
133144 if (CFStringCompare(valueString, kCMTextMarkupAlignmentType_Start, 0) == kCFCompareEqualTo)
134  settings.append("align:start ");
 145 cueData->setAlign(GenericCueData::Start);
135146 else if (CFStringCompare(valueString, kCMTextMarkupAlignmentType_Middle, 0) == kCFCompareEqualTo)
136  settings.append("align:middle ");
 147 cueData->setAlign(GenericCueData::Middle);
137148 else if (CFStringCompare(valueString, kCMTextMarkupAlignmentType_End, 0) == kCFCompareEqualTo)
138  settings.append("align:end ");
 149 cueData->setAlign(GenericCueData::End);
139150 else
140151 ASSERT_NOT_REACHED();
141152

@@void InbandTextTrackPrivateAVF::processC
170181 }
171182
172183 if (CFStringCompare(key, kCMTextMarkupAttribute_OrthogonalLinePositionPercentageRelativeToWritingDirection, 0) == kCFCompareEqualTo) {
173  // Ignore the line position if the attributes also specify "size" so we keep WebVTT's default line logic
174  if (CFDictionaryGetValue(attributes, kCMTextMarkupAttribute_WritingDirectionSizePercentage))
175  continue;
176184 if (CFGetTypeID(value) != CFNumberGetTypeID())
177185 continue;
178186 if (processed & Line)

@@void InbandTextTrackPrivateAVF::processC
180188 processed |= Line;
181189
182190 CFNumberRef valueNumber = static_cast<CFNumberRef>(value);
183  double position;
184  CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &position);
185  settings.append(String::format("line:%ld%% ", lrint(position)));
 191 double line;
 192 CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &line);
 193 cueData->setLine(line);
186194 continue;
187195 }
188196

@@void InbandTextTrackPrivateAVF::processC
196204 CFNumberRef valueNumber = static_cast<CFNumberRef>(value);
197205 double position;
198206 CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &position);
199  settings.append(String::format("position:%ld%% ", lrint(position)));
 207 cueData->setPosition(position);
200208 continue;
201209 }
202210

@@void InbandTextTrackPrivateAVF::processC
208216 processed |= Size;
209217
210218 CFNumberRef valueNumber = static_cast<CFNumberRef>(value);
211  double position;
212  CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &position);
213  settings.append(String::format("size:%ld%% ", lrint(position)));
 219 double size;
 220 CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &size);
 221 cueData->setSize(size);
 222 continue;
 223 }
 224
 225 if (CFStringCompare(key, kCMTextMarkupAttribute_VerticalLayout, 0) == kCFCompareEqualTo) {
 226 valueString = static_cast<CFStringRef>(value);
 227 if (CFGetTypeID(valueString) != CFStringGetTypeID() || !CFStringGetLength(valueString))
 228 continue;
 229
 230 if (CFStringCompare(valueString, kCMTextVerticalLayout_LeftToRight, 0) == kCFCompareEqualTo)
 231 tagStart.append(leftToRightMark);
 232 else if (CFStringCompare(valueString, kCMTextVerticalLayout_RightToLeft, 0) == kCFCompareEqualTo)
 233 tagStart.append(rightToLeftMark);
 234 continue;
 235 }
 236
 237 if (CFStringCompare(key, kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight, 0) == kCFCompareEqualTo) {
 238 if (CFGetTypeID(value) != CFNumberGetTypeID())
 239 continue;
 240
 241 CFNumberRef valueNumber = static_cast<CFNumberRef>(value);
 242 double baseFontSize;
 243 CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &baseFontSize);
 244 cueData->setBaseFontSize(baseFontSize);
 245 continue;
 246 }
 247
 248 if (CFStringCompare(key, kCMTextMarkupAttribute_RelativeFontSize, 0) == kCFCompareEqualTo) {
 249 if (CFGetTypeID(value) != CFNumberGetTypeID())
 250 continue;
 251
 252 CFNumberRef valueNumber = static_cast<CFNumberRef>(value);
 253 double relativeFontSize;
 254 CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &relativeFontSize);
 255 cueData->setRelativeFontSize(relativeFontSize);
 256 continue;
 257 }
 258
 259 if (CFStringCompare(key, kCMTextMarkupAttribute_FontFamilyName, 0) == kCFCompareEqualTo) {
 260 valueString = static_cast<CFStringRef>(value);
 261 if (CFGetTypeID(valueString) != CFStringGetTypeID() || !CFStringGetLength(valueString))
 262 continue;
 263 if (processed & FontName)
 264 continue;
 265 processed |= FontName;
 266
 267 cueData->setFontName(valueString);
214268 continue;
215269 }
216270 }
 271
217272 content.append(tagStart);
218273 content.append(attributedStringValue.substring(effectiveRange.location, effectiveRange.length));
219274 content.append(tagEnd);
220275 }
 276
 277 if (content.length())
 278 cueData->setContent(content.toString());
221279}
222280
223281void InbandTextTrackPrivateAVF::processCue(CFArrayRef attributedStrings, double time)

@@void InbandTextTrackPrivateAVF::processC
228286 if (m_havePartialCue) {
229287 // Cues do not have an explicit duration, they are displayed until the next "cue" (which might be empty) is emitted.
230288 m_currentCueEndTime = time;
231  LOG(Media, "InbandTextTrackPrivateAVF::processCue flushing cue: start=%.2f, end=%.2f, settings=\"%s\", content=\"%s\" \n",
232  m_currentCueStartTime, m_currentCueEndTime,
233  m_currentCueSettings.toString().utf8().data(), m_currentCueContent.toString().utf8().data());
234  m_player->flushCurrentCue(this);
 289
 290 if (m_currentCueEndTime >= m_currentCueStartTime) {
 291 for (size_t i = 0; i < m_cues.size(); i++) {
 292
 293 GenericCueData* cueData = m_cues[i].get();
 294
 295 LOG(Media, "InbandTextTrackPrivateAVF::processCue flushing cue: start=%.2f, end=%.2f, content=\"%s\" \n",
 296 m_currentCueStartTime, m_currentCueEndTime, cueData->content().utf8().data());
 297
 298 if (!cueData->content().length())
 299 continue;
 300
 301 cueData->setStartTime(m_currentCueStartTime);
 302 cueData->setEndTime(m_currentCueEndTime);
 303
 304 // AVFoundation cue "position" is to the center of the text so adjust relative to the edge because we will use it to
 305 // set CSS "left".
 306 if (cueData->position() >= 0 && cueData->size() > 0)
 307 cueData->setPosition( cueData->position() - cueData->size() / 2);
 308
 309 m_player->addGenericCue(this, cueData);
 310 }
 311 } else
 312 LOG(Media, "InbandTextTrackPrivateAVF::processCue negative length cue(s) ignored: start=%.2f, end=%.2f\n", m_currentCueStartTime, m_currentCueEndTime);
 313
235314 resetCueValues();
236315 }
237316
238317 CFIndex count = CFArrayGetCount(attributedStrings);
 318 if (!count)
 319 return;
 320
239321 for (CFIndex i = 0; i < count; i++) {
240322 CFAttributedStringRef attributedString = static_cast<CFAttributedStringRef>(CFArrayGetValueAtIndex(attributedStrings, i));
241323
242324 if (!attributedString || !CFAttributedStringGetLength(attributedString))
243325 continue;
244326
245  processCueAttributes(attributedString, m_currentCueContent, m_currentCueSettings);
 327 m_cues.append(adoptPtr(new GenericCueData));
 328 processCueAttributes(attributedString, m_cues[i].get());
246329 m_currentCueStartTime = time;
247330 m_havePartialCue = true;
248331 }

@@void InbandTextTrackPrivateAVF::disconne
256339
257340void InbandTextTrackPrivateAVF::resetCueValues()
258341{
259  if (m_havePartialCue && !m_currentCueEndTime) {
260  LOG(Media, "InbandTextTrackPrivateAVF::resetCueValues flushing data for cue: start=%.2f, end=%.2f, settings=\"%s\", content=\"%s\" \n",
261  m_currentCueStartTime, m_currentCueEndTime, m_currentCueSettings.toString().utf8().data(), m_currentCueContent.toString().utf8().data());
262  }
 342 if (m_havePartialCue && !m_currentCueEndTime)
 343 LOG(Media, "InbandTextTrackPrivateAVF::resetCueValues flushing data for cues: start=%.2f\n", m_currentCueStartTime);
263344
 345 m_cues.resize(0);
264346 m_havePartialCue = false;
265  m_currentCueId = String();
266347 m_currentCueStartTime = 0;
267348 m_currentCueEndTime = 0;
268  m_currentCueSettings.clear();
269  m_currentCueContent.clear();
270349}
271350
272351void InbandTextTrackPrivateAVF::setMode(InbandTextTrackPrivate::Mode newMode)
140334

Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h

11/*
2  * Copyright (C) 2012 Apple Inc. All rights reserved.
 2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
33 *
44 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions

3535namespace WebCore {
3636
3737class MediaPlayerPrivateAVFoundation;
 38class GenericCueData;
3839
3940class InbandTextTrackPrivateAVF : public InbandTextTrackPrivate {
4041public:
41  ~InbandTextTrackPrivateAVF();
42 
43  String id() const { return m_currentCueId; }
44  double start() const { return m_currentCueStartTime; }
45  double end() const { return m_currentCueEndTime; }
46  String settings() { return m_currentCueSettings.toString(); }
47  String content() { return m_currentCueContent.toString(); }
4842
49  void processCue(CFArrayRef, double);
50 
51  void resetCueValues();
 43 ~InbandTextTrackPrivateAVF();
5244
5345 virtual void setMode(InbandTextTrackPrivate::Mode) OVERRIDE;
5446

@@public:
6052 bool hasBeenReported() const { return m_hasBeenReported; }
6153 void setHasBeenReported(bool reported) { m_hasBeenReported = reported; }
6254
 55 void processCue(CFArrayRef, double);
 56 void resetCueValues();
 57
6358protected:
6459 InbandTextTrackPrivateAVF(MediaPlayerPrivateAVFoundation*);
6560
66  void processCueAttributes(CFAttributedStringRef, StringBuilder& content, StringBuilder& settings);
 61 void processCueAttributes(CFAttributedStringRef, GenericCueData*);
6762
68  String m_currentCueId;
6963 double m_currentCueStartTime;
7064 double m_currentCueEndTime;
71  StringBuilder m_currentCueSettings;
72  StringBuilder m_currentCueContent;
 65
 66 Vector<OwnPtr<GenericCueData> > m_cues;
7367
7468 MediaPlayerPrivateAVFoundation* m_player;
7569 int m_index;
140334

Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp

@@void MediaPlayerPrivateAVFoundation::see
582582 LOG(Media, "MediaPlayerPrivateAVFoundation::seekCompleted(%p) - finished = %d", this, finished);
583583 UNUSED_PARAM(finished);
584584
 585#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
 586 if (currentTrack())
 587 currentTrack()->resetCueValues();
 588#endif
 589
585590 m_seekTo = MediaPlayer::invalidTime();
586591 updateStates();
587592 m_player->timeChanged();

@@void MediaPlayerPrivateAVFoundation::dis
811816}
812817
813818#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
814 void MediaPlayerPrivateAVFoundation::flushCurrentCue(InbandTextTrackPrivateAVF* track)
 819void MediaPlayerPrivateAVFoundation::addGenericCue(InbandTextTrackPrivateAVF* track, GenericCueData* cueData)
815820{
816821 if (!track->client())
817822 return;
818823
819  // AVFoundation returns a cue every time the data is buffered, only add it once.
820  if (track->client()->hasCue(track, track->start(), track->end(), track->id(), track->content(), track->settings())) {
821  LOG(Media, "MediaPlayerPrivateAVFoundation::flushCurrentCue(%p) - already have cue for time %.2f", this, track->start());
822  return;
823  }
824 
825  LOG(Media, "MediaPlayerPrivateAVFoundation::flushCurrentCue(%p) - adding cue for time %.2f", this, track->start());
826  track->client()->addCue(track, track->start(), track->end(), track->id(), track->content(), track->settings());
 824 LOG(Media, "MediaPlayerPrivateAVFoundation::addGenericCue(%p) - adding cue for time %.2f", this, cueData->startTime());
 825 track->client()->addGenericCue(track, cueData);
827826}
828827
829828void MediaPlayerPrivateAVFoundation::configureInbandTracks()
140334

Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h

3636namespace WebCore {
3737
3838class InbandTextTrackPrivateAVF;
 39class GenericCueData;
3940
4041class MediaPlayerPrivateAVFoundation : public MediaPlayerPrivateInterface {
4142public:

@@public:
118119 void clearMainThreadPendingFlag();
119120
120121#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
121  void flushCurrentCue(InbandTextTrackPrivateAVF*);
 122 void addGenericCue(InbandTextTrackPrivateAVF*, GenericCueData*);
122123 void trackModeChanged();
123124#endif
124125
140334

Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

@@SOFT_LINK_CLASS(AVFoundation, AVMediaSel
106106SOFT_LINK_POINTER(AVFoundation, AVMediaCharacteristicLegible, NSString *)
107107SOFT_LINK_POINTER(AVFoundation, AVMediaTypeSubtitle, NSString *)
108108SOFT_LINK_POINTER(AVFoundation, AVMediaCharacteristicContainsOnlyForcedSubtitles, NSString *)
 109SOFT_LINK_POINTER(AVFoundation, AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly, NSString *)
109110
110111#define AVPlayerItemLegibleOutput getAVPlayerItemLegibleOutputClass()
111112#define AVMediaSelectionGroup getAVMediaSelectionGroupClass()

@@SOFT_LINK_POINTER(AVFoundation, AVMediaC
113114#define AVMediaCharacteristicLegible getAVMediaCharacteristicLegible()
114115#define AVMediaTypeSubtitle getAVMediaTypeSubtitle()
115116#define AVMediaCharacteristicContainsOnlyForcedSubtitles getAVMediaCharacteristicContainsOnlyForcedSubtitles()
 117#define AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly getAVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly()
116118#endif
117119
118120#define kCMTimeZero getkCMTimeZero()

@@void MediaPlayerPrivateAVFoundationObjC:
391393#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
392394 [m_avPlayer.get() setAppliesMediaSelectionCriteriaAutomatically:YES];
393395#endif
394 
395396
396397 if (m_avPlayerItem)
397398 [m_avPlayer.get() replaceCurrentItemWithPlayerItem:m_avPlayerItem.get()];

@@void MediaPlayerPrivateAVFoundationObjC:
410411
411412 // Create the player item so we can load media data.
412413 m_avPlayerItem.adoptNS([[AVPlayerItem alloc] initWithAsset:m_avAsset.get()]);
413 
 414
414415 [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(didEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:m_avPlayerItem.get()];
415416
416417 for (NSString *keyName in itemKVOProperties())

@@void MediaPlayerPrivateAVFoundationObjC:
897898
898899 [m_legibleOutput.get() setDelegate:m_objcObserver.get() queue:dispatch_get_main_queue()];
899900 [m_legibleOutput.get() setAdvanceIntervalForDelegateInvocation:NSTimeIntervalSince1970];
 901 [m_legibleOutput.get() setTextStylingResolution:AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly];
900902 [m_avPlayerItem.get() addOutput:m_legibleOutput.get()];
901903 }
902904#endif

@@void MediaPlayerPrivateAVFoundationObjC:
12121214 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::processTextTracks(%p) - nil mediaSelectionGroup", this);
12131215 return;
12141216 }
1215 
 1217
12161218 Vector<RefPtr<InbandTextTrackPrivateAVF> > removedTextTracks = m_textTracks;
12171219 NSArray *legibleOptions = [AVMediaSelectionGroup playableMediaSelectionOptionsFromArray:[legibleGroup options]];
12181220 for (AVMediaSelectionOptionType *option in legibleOptions) {

@@void MediaPlayerPrivateAVFoundationObjC:
12281230 if (!newTrack)
12291231 continue;
12301232
1231  if ([[option mediaType] isEqualToString:AVMediaTypeSubtitle]) {
1232  if (![option hasMediaCharacteristic:AVMediaCharacteristicContainsOnlyForcedSubtitles]) {
1233  AVMediaSelectionOptionType *forcedOnlyOption = [option associatedMediaSelectionOptionInMediaSelectionGroup:legibleGroup];
1234  if (forcedOnlyOption)
1235  continue;
1236  }
1237  }
 1233 if ([[option mediaType] isEqualToString:AVMediaTypeSubtitle] && [option hasMediaCharacteristic:AVMediaCharacteristicContainsOnlyForcedSubtitles])
 1234 continue;
12381235
12391236 m_textTracks.append(InbandTextTrackPrivateAVFObjC::create(this, option));
12401237 }

@@void MediaPlayerPrivateAVFoundationObjC:
12751272void MediaPlayerPrivateAVFoundationObjC::setCurrentTrack(InbandTextTrackPrivateAVF *track)
12761273{
12771274 InbandTextTrackPrivateAVFObjC* trackPrivate = static_cast<InbandTextTrackPrivateAVFObjC*>(track);
 1275 if (m_currentTrack == trackPrivate)
 1276 return;
 1277
12781278 AVMediaSelectionOptionType *mediaSelectionOption = trackPrivate ? trackPrivate->mediaSelectionOption() : 0;
12791279
12801280 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::setCurrentTrack(%p) - selecting media option %p", this, mediaSelectionOption);

@@- (void)legibleOutput:(id)output didOutp
14241424 return;
14251425
14261426 dispatch_async(dispatch_get_main_queue(), ^{
 1427 if (!m_callback)
 1428 return;
14271429 m_callback->processCue(strings, CMTimeGetSeconds(itemTime));
14281430 });
14291431}
140334