Changeset 170379 in webkit


Ignore:
Timestamp:
Jun 24, 2014, 12:35:47 PM (11 years ago)
Author:
eric.carlson@apple.com
Message:

[Mac] process raw VTT in-band captions
https://bugs.webkit.org/show_bug.cgi?id=134178

Reviewed by Jer Noble.

  • CMakeLists.txt: Add ISOVTTCue.cpp|h.
  • WebCore.vcxproj/WebCore.vcxproj: Ditto.
  • WebCore.xcodeproj/project.pbxproj: Ditto.
  • html/track/BufferedLineReader.h:

(WebCore::BufferedLineReader::reset): New, empty the input buffer.

Make it possible to process WebVTT captions.

  • html/track/InbandGenericTextTrack.cpp:

(WebCore::InbandGenericTextTrack::parser): Allocate, if necessary, and return a WebVTT parser.
(WebCore::InbandGenericTextTrack::parseWebVTTCueData): Pass a cue to the parser.
(WebCore::InbandGenericTextTrack::parseWebVTTFileHeader): Pass a VTT file header to the parser.
(WebCore::InbandGenericTextTrack::newCuesParsed): Parser callback.
(WebCore::InbandGenericTextTrack::newRegionsParsed): Ditto.
(WebCore::InbandGenericTextTrack::fileFailedToParse): Ditto.

  • html/track/InbandGenericTextTrack.h:
  • html/track/InbandTextTrack.h:
  • html/track/InbandWebVTTTextTrack.cpp:

(WebCore::InbandWebVTTTextTrack::parser): New, parser accessor.
(WebCore::InbandWebVTTTextTrack::parseWebVTTCueData): New, parse VTT data in an ISOWebVTTCue

object.

(WebCore::InbandWebVTTTextTrack::newCuesParsed): Cleanup.
(WebCore::InbandWebVTTTextTrack::newRegionsParsed): Implement.
(WebCore::InbandWebVTTTextTrack::fileFailedToParse): Change the error message.

  • html/track/InbandWebVTTTextTrack.h:
  • html/track/TextTrackCueGeneric.cpp:

(WebCore::TextTrackCueGenericBoxElement::TextTrackCueGenericBoxElement): Change cue parameter

from a pointer to a reference.

(WebCore::TextTrackCueGeneric::createDisplayTree): Ditto.

  • html/track/VTTCue.cpp:

(WebCore::VTTCueBox::create): Change cue parameter from a pointer to a reference.
(WebCore::VTTCueBox::VTTCueBox): Ditto.
(WebCore::VTTCueBox::getCue): Return a reference.
(WebCore::VTTCueBox::applyCSSProperties): m_cue is a reference, not a pointer.
(WebCore::VTTCue::create): New, create a VTTCue from WebVTTCueData.
(WebCore::VTTCue::VTTCue): New, internal constructor that takes a WebVTTCueData.
(WebCore::VTTCue::initialize): New, shared constructor initialization.
(WebCore::VTTCue::createDisplayTree): m_cue is a reference, not a pointer.
(WebCore::VTTCue::markFutureAndPastNodes): Ditto.
(WebCore::VTTCue::setCueSettings): Ditto.

  • html/track/VTTCue.h:

(WebCore::VTTCueBox::create): Deleted.
(WebCore::VTTCue::create): Deleted.

  • html/track/WebVTTParser.cpp:

(WebCore::WebVTTParser::parseFileHeader): New. Reset the line reader buffer and parser state,

call the parser.

(WebCore::WebVTTParser::parseCueData): Create a cue from ISOWebVTTCue.
(WebCore::WebVTTParser::collectTimingsAndSettings): Return immediately if the string is empty.
(WebCore::WebVTTParser::collectTimeStamp): Ditto.

  • html/track/WebVTTParser.h:

(WebCore::WebVTTCueData::originalStartTime): New.
(WebCore::WebVTTCueData::setOriginalStartTime): New.
(WebCore::WebVTTCueData::WebVTTCueData):

  • loader/TextTrackLoader.cpp:

(WebCore::TextTrackLoader::getNewCues): Cleanup, use the new VTTCue::create.

Parse ISO WebVTT cue boxes.

  • platform/graphics/ISOVTTCue.cpp: Added.

(WebCore::ISOBox::ISOBox):
(WebCore::ISOBox::peekType):
(WebCore::ISOBox::peekLength):
(WebCore::ISOBox::peekString):
(WebCore::vttCueBoxType):
(WebCore::vttIdBoxType):
(WebCore::vttSettingsBoxType):
(WebCore::vttPayloadBoxType):
(WebCore::vttCurrentTimeBoxType):
(WebCore::vttCueSourceIDBoxType):
(WebCore::ISOWebVTTCue::boxType):
(WebCore::ISOWebVTTCue::ISOWebVTTCue):

  • platform/graphics/ISOVTTCue.h: Added.

(WebCore::ISOBox::boxHeaderSize):
(WebCore::ISOBox::length):
(WebCore::ISOBox::type):
(WebCore::ISOWebVTTCue::presentationTime):
(WebCore::ISOWebVTTCue::duration):
(WebCore::ISOWebVTTCue::sourceID):
(WebCore::ISOWebVTTCue::id):
(WebCore::ISOWebVTTCue::originalStartTime):
(WebCore::ISOWebVTTCue::settings):
(WebCore::ISOWebVTTCue::cueText):

  • platform/graphics/InbandTextTrackPrivateClient.h:

(WebCore::InbandTextTrackPrivateClient::parseWebVTTFileHeader): New.

  • platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:

(WebCore::InbandTextTrackPrivateAVF::InbandTextTrackPrivateAVF): Add a cue format parameter.
(WebCore::InbandTextTrackPrivateAVF::processCue): Call processNativeSamples.
(WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Add logging. Minor cleanup.
(WebCore::InbandTextTrackPrivateAVF::processNativeSamples): New, process an array of

CMSampleBuffers, create ISOWebVTTCue from the sample data.

  • platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:
  • platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:

(WebCore::InbandTextTrackPrivateAVCF::InbandTextTrackPrivateAVCF):

  • platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.h:

(WebCore::InbandTextTrackPrivateAVCF::create):

  • platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:

(WebCore::MediaPlayerPrivateAVFoundationCF::processMediaSelectionOptions):
(WebCore::LegibleOutputData::LegibleOutputData):
(WebCore::AVFWrapper::processCue):
(WebCore::AVFWrapper::legibleOutputCallback):

  • platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h:

(WebCore::InbandTextTrackPrivateAVFObjC::create): Add a cue format parameter.

  • platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:

(WebCore::InbandTextTrackPrivateAVFObjC::InbandTextTrackPrivateAVFObjC): Ditto.

  • platform/graphics/avfoundation/InbandTextTrackPrivateLegacyAVFObjC.cpp:

(WebCore::InbandTextTrackPrivateLegacyAVFObjC::InbandTextTrackPrivateLegacyAVFObjC): Pass cue

format to base class.

  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:

(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Improve logging.
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Don't leak an NSDictionary.
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Don't process media selection

options until we have tracks.

(WebCore::MediaPlayerPrivateAVFoundationObjC::processMediaSelectionOptions):
(WebCore::MediaPlayerPrivateAVFoundationObjC::processCue): Pass native samples as well as

attributed strings to track.

(-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):

  • platform/graphics/avfoundation/objc/OutOfBandTextTrackPrivateAVF.h:

(WebCore::OutOfBandTextTrackPrivateAVF::OutOfBandTextTrackPrivateAVF):

  • platform/graphics/avfoundation/objc/OutOfBandTextTrackPrivateAVF.h:

(WebCore::OutOfBandTextTrackPrivateAVF::OutOfBandTextTrackPrivateAVF):

Location:
trunk/Source/WebCore
Files:
2 added
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r170332 r170379  
    20912091    platform/graphics/IntRect.cpp
    20922092    platform/graphics/IntSize.cpp
     2093    platform/graphics/ISOVTTCue.cpp
    20932094    platform/graphics/LayoutBoxExtent.cpp
    20942095    platform/graphics/LayoutRect.cpp
  • trunk/Source/WebCore/ChangeLog

    r170377 r170379  
     12014-06-24  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [Mac] process raw VTT in-band captions
     4        https://bugs.webkit.org/show_bug.cgi?id=134178
     5
     6        Reviewed by Jer Noble.
     7
     8        * CMakeLists.txt: Add ISOVTTCue.cpp|h.
     9        * WebCore.vcxproj/WebCore.vcxproj: Ditto.
     10        * WebCore.xcodeproj/project.pbxproj: Ditto.
     11
     12        * html/track/BufferedLineReader.h:
     13        (WebCore::BufferedLineReader::reset): New, empty the input buffer.
     14
     15        Make it possible to process WebVTT captions.
     16        * html/track/InbandGenericTextTrack.cpp:
     17        (WebCore::InbandGenericTextTrack::parser): Allocate, if necessary, and return a WebVTT parser.
     18        (WebCore::InbandGenericTextTrack::parseWebVTTCueData): Pass a cue to the parser.
     19        (WebCore::InbandGenericTextTrack::parseWebVTTFileHeader): Pass a VTT file header to the parser.
     20        (WebCore::InbandGenericTextTrack::newCuesParsed): Parser callback.
     21        (WebCore::InbandGenericTextTrack::newRegionsParsed): Ditto.
     22        (WebCore::InbandGenericTextTrack::fileFailedToParse): Ditto.
     23        * html/track/InbandGenericTextTrack.h:
     24
     25        * html/track/InbandTextTrack.h:
     26
     27        * html/track/InbandWebVTTTextTrack.cpp:
     28        (WebCore::InbandWebVTTTextTrack::parser): New, parser accessor.
     29        (WebCore::InbandWebVTTTextTrack::parseWebVTTCueData): New, parse VTT data in an ISOWebVTTCue
     30            object.
     31        (WebCore::InbandWebVTTTextTrack::newCuesParsed): Cleanup.
     32        (WebCore::InbandWebVTTTextTrack::newRegionsParsed): Implement.
     33        (WebCore::InbandWebVTTTextTrack::fileFailedToParse): Change the error message.
     34        * html/track/InbandWebVTTTextTrack.h:
     35
     36        * html/track/TextTrackCueGeneric.cpp:
     37        (WebCore::TextTrackCueGenericBoxElement::TextTrackCueGenericBoxElement): Change cue parameter
     38            from a pointer to a reference.
     39        (WebCore::TextTrackCueGeneric::createDisplayTree): Ditto.
     40
     41        * html/track/VTTCue.cpp:
     42        (WebCore::VTTCueBox::create): Change cue parameter from a pointer to a reference.
     43        (WebCore::VTTCueBox::VTTCueBox): Ditto.
     44        (WebCore::VTTCueBox::getCue): Return a reference.
     45        (WebCore::VTTCueBox::applyCSSProperties): m_cue is a reference, not a pointer.
     46        (WebCore::VTTCue::create): New, create a VTTCue from WebVTTCueData.
     47        (WebCore::VTTCue::VTTCue): New, internal constructor that takes a WebVTTCueData.
     48        (WebCore::VTTCue::initialize): New, shared constructor initialization.
     49        (WebCore::VTTCue::createDisplayTree): m_cue is a reference, not a pointer.
     50        (WebCore::VTTCue::markFutureAndPastNodes): Ditto.
     51        (WebCore::VTTCue::setCueSettings): Ditto.
     52        * html/track/VTTCue.h:
     53        (WebCore::VTTCueBox::create): Deleted.
     54        (WebCore::VTTCue::create): Deleted.
     55
     56        * html/track/WebVTTParser.cpp:
     57        (WebCore::WebVTTParser::parseFileHeader): New. Reset the line reader buffer and parser state,
     58            call the parser.
     59        (WebCore::WebVTTParser::parseCueData): Create a cue from ISOWebVTTCue.
     60        (WebCore::WebVTTParser::collectTimingsAndSettings): Return immediately if the string is empty.
     61        (WebCore::WebVTTParser::collectTimeStamp): Ditto.
     62        * html/track/WebVTTParser.h:
     63        (WebCore::WebVTTCueData::originalStartTime): New.
     64        (WebCore::WebVTTCueData::setOriginalStartTime): New.
     65        (WebCore::WebVTTCueData::WebVTTCueData):
     66
     67        * loader/TextTrackLoader.cpp:
     68        (WebCore::TextTrackLoader::getNewCues): Cleanup, use the new VTTCue::create.
     69
     70        Parse ISO WebVTT cue boxes.
     71        * platform/graphics/ISOVTTCue.cpp: Added.
     72        (WebCore::ISOBox::ISOBox):
     73        (WebCore::ISOBox::peekType):
     74        (WebCore::ISOBox::peekLength):
     75        (WebCore::ISOBox::peekString):
     76        (WebCore::vttCueBoxType):
     77        (WebCore::vttIdBoxType):
     78        (WebCore::vttSettingsBoxType):
     79        (WebCore::vttPayloadBoxType):
     80        (WebCore::vttCurrentTimeBoxType):
     81        (WebCore::vttCueSourceIDBoxType):
     82        (WebCore::ISOWebVTTCue::boxType):
     83        (WebCore::ISOWebVTTCue::ISOWebVTTCue):
     84        * platform/graphics/ISOVTTCue.h: Added.
     85        (WebCore::ISOBox::boxHeaderSize):
     86        (WebCore::ISOBox::length):
     87        (WebCore::ISOBox::type):
     88        (WebCore::ISOWebVTTCue::presentationTime):
     89        (WebCore::ISOWebVTTCue::duration):
     90        (WebCore::ISOWebVTTCue::sourceID):
     91        (WebCore::ISOWebVTTCue::id):
     92        (WebCore::ISOWebVTTCue::originalStartTime):
     93        (WebCore::ISOWebVTTCue::settings):
     94        (WebCore::ISOWebVTTCue::cueText):
     95
     96        * platform/graphics/InbandTextTrackPrivateClient.h:
     97        (WebCore::InbandTextTrackPrivateClient::parseWebVTTFileHeader): New.
     98
     99        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
     100        (WebCore::InbandTextTrackPrivateAVF::InbandTextTrackPrivateAVF): Add a cue format parameter.
     101        (WebCore::InbandTextTrackPrivateAVF::processCue): Call processNativeSamples.
     102        (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Add logging. Minor cleanup.
     103        (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): New, process an array of
     104            CMSampleBuffers, create ISOWebVTTCue from the sample data.
     105        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:
     106
     107        * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
     108        (WebCore::InbandTextTrackPrivateAVCF::InbandTextTrackPrivateAVCF):
     109        * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.h:
     110        (WebCore::InbandTextTrackPrivateAVCF::create):
     111        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
     112        (WebCore::MediaPlayerPrivateAVFoundationCF::processMediaSelectionOptions):
     113        (WebCore::LegibleOutputData::LegibleOutputData):
     114        (WebCore::AVFWrapper::processCue):
     115        (WebCore::AVFWrapper::legibleOutputCallback):
     116
     117        * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h:
     118        (WebCore::InbandTextTrackPrivateAVFObjC::create): Add a cue format parameter.
     119        * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
     120        (WebCore::InbandTextTrackPrivateAVFObjC::InbandTextTrackPrivateAVFObjC): Ditto.
     121
     122        * platform/graphics/avfoundation/InbandTextTrackPrivateLegacyAVFObjC.cpp:
     123        (WebCore::InbandTextTrackPrivateLegacyAVFObjC::InbandTextTrackPrivateLegacyAVFObjC): Pass cue
     124            format to base class.
     125
     126        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
     127        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     128        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Improve logging.
     129        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Don't leak an NSDictionary.
     130        (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Don't process media selection
     131            options until we have tracks.
     132        (WebCore::MediaPlayerPrivateAVFoundationObjC::processMediaSelectionOptions):
     133        (WebCore::MediaPlayerPrivateAVFoundationObjC::processCue): Pass native samples as well as
     134            attributed strings to track.
     135        (-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):
     136        * platform/graphics/avfoundation/objc/OutOfBandTextTrackPrivateAVF.h:
     137        (WebCore::OutOfBandTextTrackPrivateAVF::OutOfBandTextTrackPrivateAVF):
     138
     139        * platform/graphics/avfoundation/objc/OutOfBandTextTrackPrivateAVF.h:
     140        (WebCore::OutOfBandTextTrackPrivateAVF::OutOfBandTextTrackPrivateAVF):
     141
    11422014-06-24  Antti Koivisto  <antti@apple.com>
    2143
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r170332 r170379  
    72577257    <ClCompile Include="..\platform\FileStream.cpp" />
    72587258    <ClCompile Include="..\platform\FileSystem.cpp" />
     7259    <ClCompile Include="..\platform\graphics\ISOVTTCue.cpp" />
    72597260    <ClCompile Include="..\platform\audio\AudioSession.cpp" />
    72607261    <ClCompile Include="..\platform\audio\MediaSession.cpp" />
     
    1943819439    <ClInclude Include="..\platform\graphics\IntSize.h" />
    1943919440    <ClInclude Include="..\platform\graphics\IntSizeHash.h" />
     19441    <ClInclude Include="..\platform\graphics\ISOVTTCue.h" />
    1944019442    <ClInclude Include="..\platform\graphics\LayoutBoxExtent.h" />
    1944119443    <ClInclude Include="..\platform\graphics\LayoutPoint.h" />
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r170374 r170379  
    315315                07AB996F18DA3C740018771E /* RTCConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AB996D18DA3C740018771E /* RTCConfigurationPrivate.h */; };
    316316                07AB997018DA3C740018771E /* RTCIceServerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AB996E18DA3C740018771E /* RTCIceServerPrivate.h */; };
     317                07AC47011952102100EE9723 /* ISOVTTCue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07AC46FF1952102100EE9723 /* ISOVTTCue.cpp */; };
     318                07AC47021952102100EE9723 /* ISOVTTCue.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AC47001952102100EE9723 /* ISOVTTCue.h */; };
    317319                07B0113F1032242200FBDC33 /* AccessibilityMediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */; };
    318320                07B442D6166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07B442D4166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp */; };
     
    72047206                07AB996D18DA3C740018771E /* RTCConfigurationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCConfigurationPrivate.h; sourceTree = "<group>"; };
    72057207                07AB996E18DA3C740018771E /* RTCIceServerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCIceServerPrivate.h; sourceTree = "<group>"; };
     7208                07AC46FF1952102100EE9723 /* ISOVTTCue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ISOVTTCue.cpp; path = ISOVTTCue.cpp; sourceTree = "<group>"; };
     7209                07AC47001952102100EE9723 /* ISOVTTCue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISOVTTCue.h; path = ISOVTTCue.h; sourceTree = "<group>"; };
    72067210                07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMediaControls.h; sourceTree = "<group>"; };
    72077211                07B442D4166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InbandTextTrackPrivateAVF.cpp; sourceTree = "<group>"; };
     
    2040420408                                B27535470B053814002CE64F /* IntSize.h */,
    2040520409                                B27535480B053814002CE64F /* IntSizeHash.h */,
     20410                                07AC46FF1952102100EE9723 /* ISOVTTCue.cpp */,
     20411                                07AC47001952102100EE9723 /* ISOVTTCue.h */,
    2040620412                                65CC6BED16014EC0000ED27D /* Latin1TextIterator.h */,
    2040720413                                141DC049164834B900371E5A /* LayoutBoxExtent.cpp */,
     
    2490824914                                B20111080AB7740500DB0E68 /* JSSVGAElement.h in Headers */,
    2490924915                                24D9129213CA951E00D21915 /* JSSVGAltGlyphDefElement.h in Headers */,
     24916                                07AC47021952102100EE9723 /* ISOVTTCue.h in Headers */,
    2491024917                                6515EC920D9723FF0063D49A /* JSSVGAltGlyphElement.h in Headers */,
    2491124918                                24D9129613CA956100D21915 /* JSSVGAltGlyphItemElement.h in Headers */,
     
    2949429501                                B2227A560D00BF220071B782 /* SVGParserUtilities.cpp in Sources */,
    2949529502                                84C6784C1214814700A92902 /* SVGPathBlender.cpp in Sources */,
     29503                                07AC47011952102100EE9723 /* ISOVTTCue.cpp in Sources */,
    2949629504                                8476C9EA11DF6A2900555B02 /* SVGPathBuilder.cpp in Sources */,
    2949729505                                8419D2A8120D92D000141F8F /* SVGPathByteStreamBuilder.cpp in Sources */,
  • trunk/Source/WebCore/html/track/BufferedLineReader.h

    r170332 r170379  
    6969    bool isAtEndOfStream() const { return m_endOfStream && m_buffer.isEmpty(); }
    7070
     71    void reset() { m_buffer.clear(); }
     72
    7173private:
    7274    // Consume the next character the buffer if it is the character |c|.
  • trunk/Source/WebCore/html/track/InbandGenericTextTrack.cpp

    r170332 r170379  
    11/*
    2  * Copyright (C) 2012 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2012-2014 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3737#include <wtf/text/CString.h>
    3838
     39#if ENABLE(WEBVTT_REGIONS)
     40#include "VTTRegionList.h"
     41#endif
     42
    3943namespace WebCore {
    4044
     
    191195}
    192196
     197WebVTTParser& InbandGenericTextTrack::parser()
     198{
     199    if (!m_webVTTParser)
     200        m_webVTTParser = std::make_unique<WebVTTParser>(static_cast<WebVTTParserClient*>(this), scriptExecutionContext());
     201    return *m_webVTTParser;
     202}
     203
     204void InbandGenericTextTrack::parseWebVTTCueData(InbandTextTrackPrivate* trackPrivate, const ISOWebVTTCue& cueData)
     205{
     206    ASSERT_UNUSED(trackPrivate, trackPrivate == m_private);
     207    parser().parseCueData(cueData);
     208}
     209
     210void InbandGenericTextTrack::parseWebVTTFileHeader(InbandTextTrackPrivate* trackPrivate, String header)
     211{
     212    ASSERT_UNUSED(trackPrivate, trackPrivate == m_private);
     213    parser().parseFileHeader(header);
     214}
     215
     216void InbandGenericTextTrack::newCuesParsed()
     217{
     218    Vector<RefPtr<WebVTTCueData>> cues;
     219    parser().getNewCues(cues);
     220
     221    for (auto& cueData : cues) {
     222        RefPtr<VTTCue> vttCue = VTTCue::create(*scriptExecutionContext(), *cueData);
     223
     224        if (hasCue(vttCue.get(), TextTrackCue::IgnoreDuration)) {
     225            LOG(Media, "InbandGenericTextTrack::newCuesParsed ignoring already added cue: start=%.2f, end=%.2f, content=\"%s\"\n", vttCue->startTime(), vttCue->endTime(), vttCue->text().utf8().data());
     226            return;
     227        }
     228        addCue(vttCue.release(), ASSERT_NO_EXCEPTION);
     229    }
     230}
     231
     232#if ENABLE(WEBVTT_REGIONS)
     233void InbandGenericTextTrack::newRegionsParsed()
     234{
     235    Vector<RefPtr<VTTRegion>> newRegions;
     236    parser().getNewRegions(newRegions);
     237
     238    for (auto& region : newRegions) {
     239        region->setTrack(this);
     240        regions()->add(region);
     241    }
     242}
     243#endif
     244
     245void InbandGenericTextTrack::fileFailedToParse()
     246{
     247    LOG(Media, "Error parsing WebVTT stream.");
     248}
     249
    193250} // namespace WebCore
    194251
  • trunk/Source/WebCore/html/track/InbandGenericTextTrack.h

    r170332 r170379  
    11/*
    2  * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131#include "InbandTextTrack.h"
    3232#include "TextTrackCueGeneric.h"
     33#include "WebVTTParser.h"
    3334#include <wtf/RefPtr.h>
    3435
     
    6061};
    6162
    62 class InbandGenericTextTrack : public InbandTextTrack {
     63class InbandGenericTextTrack : public InbandTextTrack, private WebVTTParserClient {
    6364public:
    6465    static PassRefPtr<InbandGenericTextTrack> create(ScriptExecutionContext*, TextTrackClient*, PassRefPtr<InbandTextTrackPrivate>);
     
    7677    void updateCueFromCueData(TextTrackCueGeneric*, GenericCueData*);
    7778
     79    WebVTTParser& parser();
     80    virtual void parseWebVTTCueData(InbandTextTrackPrivate*, const ISOWebVTTCue&) override;
     81    virtual void parseWebVTTFileHeader(InbandTextTrackPrivate*, String) override;
     82
     83    virtual void newCuesParsed() override;
     84#if ENABLE(WEBVTT_REGIONS)
     85    virtual void newRegionsParsed() override;
     86#endif
     87    virtual void fileFailedToParse() override;
     88
    7889    GenericTextTrackCueMap m_cueMap;
     90    std::unique_ptr<WebVTTParser> m_webVTTParser;
    7991};
    8092
  • trunk/Source/WebCore/html/track/InbandTextTrack.h

    r170332 r170379  
    8282    virtual void removeGenericCue(InbandTextTrackPrivate*, GenericCueData*) override { ASSERT_NOT_REACHED(); }
    8383
     84    virtual void parseWebVTTFileHeader(InbandTextTrackPrivate*, String) override { ASSERT_NOT_REACHED(); }
    8485    virtual void parseWebVTTCueData(InbandTextTrackPrivate*, const char*, unsigned) override { ASSERT_NOT_REACHED(); }
     86    virtual void parseWebVTTCueData(InbandTextTrackPrivate*, const ISOWebVTTCue&) override { ASSERT_NOT_REACHED(); }
     87
    8588    virtual double startTimeVariance() const;
    8689
  • trunk/Source/WebCore/html/track/InbandWebVTTTextTrack.cpp

    r170332 r170379  
    3535#include <wtf/text/CString.h>
    3636
     37#if ENABLE(WEBVTT_REGIONS)
     38#include "VTTRegionList.h"
     39#endif
     40
    3741namespace WebCore {
    3842
     
    5155}
    5256
     57WebVTTParser& InbandWebVTTTextTrack::parser()
     58{
     59    if (!m_webVTTParser)
     60        m_webVTTParser = std::make_unique<WebVTTParser>(static_cast<WebVTTParserClient*>(this), scriptExecutionContext());
     61    return *m_webVTTParser;
     62}
     63
    5364void InbandWebVTTTextTrack::parseWebVTTCueData(InbandTextTrackPrivate* trackPrivate, const char* data, unsigned length)
    5465{
    5566    ASSERT_UNUSED(trackPrivate, trackPrivate == m_private);
    56     if (!m_webVTTParser)
    57         m_webVTTParser = std::make_unique<WebVTTParser>(static_cast<WebVTTParserClient*>(this), scriptExecutionContext());
    58     m_webVTTParser->parseBytes(data, length);
     67    parser().parseBytes(data, length);
     68}
     69
     70void InbandWebVTTTextTrack::parseWebVTTCueData(InbandTextTrackPrivate* trackPrivate, const ISOWebVTTCue& cueData)
     71{
     72    ASSERT_UNUSED(trackPrivate, trackPrivate == m_private);
     73    parser().parseCueData(cueData);
    5974}
    6075
     
    6277{
    6378    Vector<RefPtr<WebVTTCueData>> cues;
    64     m_webVTTParser->getNewCues(cues);
    65     for (size_t i = 0; i < cues.size(); ++i) {
    66         RefPtr<WebVTTCueData> cueData = cues[i];
    67         RefPtr<VTTCue> cue = VTTCue::create(*scriptExecutionContext(), cueData->startTime(), cueData->endTime(), cueData->content());
    68         cue->setId(cueData->id());
    69         cue->setCueSettings(cueData->settings());
     79    parser().getNewCues(cues);
    7080
    71         if (hasCue(cue.get(), TextTrackCue::IgnoreDuration)) {
    72             LOG(Media, "InbandWebVTTTextTrack::newCuesParsed ignoring already added cue: start=%.2f, end=%.2f, content=\"%s\"\n", cueData->startTime(), cueData->endTime(), cueData->content().utf8().data());
     81    for (auto& cueData : cues) {
     82        RefPtr<VTTCue> vttCue = VTTCue::create(*scriptExecutionContext(), *cueData);
     83
     84        if (hasCue(vttCue.get(), TextTrackCue::IgnoreDuration)) {
     85            LOG(Media, "InbandWebVTTTextTrack::newCuesParsed ignoring already added cue: start=%.2f, end=%.2f, content=\"%s\"\n", vttCue->startTime(), vttCue->endTime(), vttCue->text().utf8().data());
    7386            return;
    7487        }
    75         addCue(cue.release(), ASSERT_NO_EXCEPTION);
     88        addCue(vttCue.release(), ASSERT_NO_EXCEPTION);
    7689    }
    7790}
     
    8093void InbandWebVTTTextTrack::newRegionsParsed()
    8194{
    82     notImplemented();
     95    Vector<RefPtr<VTTRegion>> newRegions;
     96    parser().getNewRegions(newRegions);
     97
     98    for (auto& region : newRegions) {
     99        region->setTrack(this);
     100        regions()->add(region);
     101    }
    83102}
    84103#endif
     
    86105void InbandWebVTTTextTrack::fileFailedToParse()
    87106{
    88     LOG(Media, "Unable to parse WebVTT stream.");
     107    LOG(Media, "Error parsing WebVTT stream.");
    89108}
    90109
  • trunk/Source/WebCore/html/track/InbandWebVTTTextTrack.h

    r170332 r170379  
    4444    InbandWebVTTTextTrack(ScriptExecutionContext*, TextTrackClient*, PassRefPtr<InbandTextTrackPrivate>);
    4545
     46    WebVTTParser& parser();
    4647    virtual void parseWebVTTCueData(InbandTextTrackPrivate*, const char* data, unsigned length) override;
     48    virtual void parseWebVTTCueData(InbandTextTrackPrivate*, const ISOWebVTTCue&) override;
    4749
    4850    virtual void newCuesParsed() override;
  • trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp

    r170332 r170379  
    4444class TextTrackCueGenericBoxElement final : public VTTCueBox {
    4545public:
    46     static PassRefPtr<TextTrackCueGenericBoxElement> create(Document& document, TextTrackCueGeneric* cue)
     46    static PassRefPtr<TextTrackCueGenericBoxElement> create(Document& document, TextTrackCueGeneric& cue)
    4747    {
    4848        return adoptRef(new TextTrackCueGenericBoxElement(document, cue));
     
    5252   
    5353private:
    54     TextTrackCueGenericBoxElement(Document&, VTTCue*);
     54    TextTrackCueGenericBoxElement(Document&, VTTCue&);
    5555};
    5656
    57 TextTrackCueGenericBoxElement::TextTrackCueGenericBoxElement(Document& document, VTTCue* cue)
     57TextTrackCueGenericBoxElement::TextTrackCueGenericBoxElement(Document& document, VTTCue& cue)
    5858    : VTTCueBox(document, cue)
    5959{
     
    119119PassRefPtr<VTTCueBox> TextTrackCueGeneric::createDisplayTree()
    120120{
    121     return TextTrackCueGenericBoxElement::create(ownerDocument(), this);
     121    return TextTrackCueGenericBoxElement::create(ownerDocument(), *this);
    122122}
    123123
  • trunk/Source/WebCore/html/track/VTTCue.cpp

    r170332 r170379  
    120120// ----------------------------
    121121
    122 VTTCueBox::VTTCueBox(Document& document, VTTCue* cue)
     122PassRefPtr<VTTCueBox> VTTCueBox::create(Document& document, VTTCue& cue)
     123{
     124    VTTCueBox* cueBox = new VTTCueBox(document, cue);
     125    cueBox->setPseudo(VTTCueBox::vttCueBoxShadowPseudoId());
     126    return adoptRef(cueBox);
     127}
     128
     129VTTCueBox::VTTCueBox(Document& document, VTTCue& cue)
    123130    : HTMLElement(divTag, document)
    124131    , m_cue(cue)
     
    129136VTTCue* VTTCueBox::getCue() const
    130137{
    131     return m_cue;
     138    return &m_cue;
    132139}
    133140
     
    136143    // FIXME: Apply all the initial CSS positioning properties. http://wkb.ug/79916
    137144#if ENABLE(WEBVTT_REGIONS)
    138     if (!m_cue->regionId().isEmpty()) {
     145    if (!m_cue.regionId().isEmpty()) {
    139146        setInlineStyleProperty(CSSPropertyPosition, CSSValueRelative);
    140147        return;
     
    151158
    152159    // the 'direction' property must be set to direction
    153     setInlineStyleProperty(CSSPropertyDirection, m_cue->getCSSWritingDirection());
     160    setInlineStyleProperty(CSSPropertyDirection, m_cue.getCSSWritingDirection());
    154161
    155162    // the 'writing-mode' property must be set to writing-mode
    156     setInlineStyleProperty(CSSPropertyWebkitWritingMode, m_cue->getCSSWritingMode(), false);
    157 
    158     std::pair<float, float> position = m_cue->getCSSPosition();
     163    setInlineStyleProperty(CSSPropertyWebkitWritingMode, m_cue.getCSSWritingMode(), false);
     164
     165    std::pair<float, float> position = m_cue.getCSSPosition();
    159166
    160167    // the 'top' property must be set to top,
     
    165172
    166173    // the 'width' property must be set to width, and the 'height' property  must be set to height
    167     if (m_cue->vertical() == horizontalKeyword()) {
    168         setInlineStyleProperty(CSSPropertyWidth, static_cast<double>(m_cue->getCSSSize()), CSSPrimitiveValue::CSS_PERCENTAGE);
     174    if (m_cue.vertical() == horizontalKeyword()) {
     175        setInlineStyleProperty(CSSPropertyWidth, static_cast<double>(m_cue.getCSSSize()), CSSPrimitiveValue::CSS_PERCENTAGE);
    169176        setInlineStyleProperty(CSSPropertyHeight, CSSValueAuto);
    170177    } else {
    171178        setInlineStyleProperty(CSSPropertyWidth, CSSValueAuto);
    172         setInlineStyleProperty(CSSPropertyHeight, static_cast<double>(m_cue->getCSSSize()),  CSSPrimitiveValue::CSS_PERCENTAGE);
     179        setInlineStyleProperty(CSSPropertyHeight, static_cast<double>(m_cue.getCSSSize()),  CSSPrimitiveValue::CSS_PERCENTAGE);
    173180    }
    174181
     
    177184    // whose first cell is the value of the corresponding cue's text track cue
    178185    // alignment:
    179     setInlineStyleProperty(CSSPropertyTextAlign, m_cue->getCSSAlignment());
    180 
    181     if (!m_cue->snapToLines()) {
     186    setInlineStyleProperty(CSSPropertyTextAlign, m_cue.getCSSAlignment());
     187
     188    if (!m_cue.snapToLines()) {
    182189        // 10.13.1 Set up x and y:
    183190        // Note: x and y are set through the CSS left and top above.
     
    210217// ----------------------------
    211218
     219PassRefPtr<VTTCue> VTTCue::create(ScriptExecutionContext& context, double start, double end, const String& content)
     220{
     221    return adoptRef(new VTTCue(context, start, end, content));
     222}
     223
     224PassRefPtr<VTTCue> VTTCue::create(ScriptExecutionContext& context, const WebVTTCueData& data)
     225{
     226    return adoptRef(new VTTCue(context, data));
     227}
     228
    212229VTTCue::VTTCue(ScriptExecutionContext& context, double start, double end, const String& content)
    213230    : TextTrackCue(context, start, end)
    214231    , m_content(content)
    215     , m_linePosition(undefinedPosition)
    216     , m_computedLinePosition(undefinedPosition)
    217     , m_textPosition(50)
    218     , m_cueSize(100)
    219     , m_writingDirection(Horizontal)
    220     , m_cueAlignment(Middle)
    221     , m_webVTTNodeTree(nullptr)
    222     , m_cueBackgroundBox(HTMLSpanElement::create(spanTag, toDocument(context)))
    223     , m_displayDirection(CSSValueLtr)
    224     , m_displaySize(0)
    225     , m_snapToLines(true)
    226     , m_displayTreeShouldChange(true)
    227     , m_notifyRegion(true)
    228 {
     232{
     233    initialize(context);
     234}
     235
     236VTTCue::VTTCue(ScriptExecutionContext& context, const WebVTTCueData& cueData)
     237    : TextTrackCue(context, 0, 0)
     238{
     239    initialize(context);
     240    setText(cueData.content());
     241    setStartTime(cueData.startTime(), IGNORE_EXCEPTION);
     242    setEndTime(cueData.endTime(), IGNORE_EXCEPTION);
     243    setId(cueData.id());
     244    setCueSettings(cueData.settings());
     245    m_originalStartTime = cueData.originalStartTime();
    229246}
    230247
     
    237254}
    238255
     256void VTTCue::initialize(ScriptExecutionContext& context)
     257{
     258    m_linePosition = undefinedPosition;
     259    m_computedLinePosition = undefinedPosition;
     260    m_textPosition = 50;
     261    m_cueSize = 100;
     262    m_writingDirection = Horizontal;
     263    m_cueAlignment = Middle;
     264    m_webVTTNodeTree = nullptr;
     265    m_cueBackgroundBox = HTMLSpanElement::create(spanTag, toDocument(context));
     266    m_displayDirection = CSSValueLtr;
     267    m_displaySize = 0;
     268    m_snapToLines = true;
     269    m_displayTreeShouldChange = true;
     270    m_notifyRegion = true;
     271    m_originalStartTime = 0;
     272}
     273
    239274PassRefPtr<VTTCueBox> VTTCue::createDisplayTree()
    240275{
    241     return VTTCueBox::create(ownerDocument(), this);
     276    return VTTCueBox::create(ownerDocument(), *this);
    242277}
    243278
     
    700735            ASSERT_UNUSED(check, check);
    701736           
     737            currentTimestamp += m_originalStartTime;
    702738            if (currentTimestamp > movieTime)
    703739                isPastNode = false;
     
    885921void VTTCue::setCueSettings(const String& inputString)
    886922{
     923    if (inputString.isEmpty())
     924        return;
     925
    887926    VTTScanner input(inputString);
    888927
  • trunk/Source/WebCore/html/track/VTTCue.h

    r170332 r170379  
    4747class VTTCue;
    4848class VTTScanner;
     49class WebVTTCueData;
    4950
    5051// ----------------------------
     
    5253class VTTCueBox : public HTMLElement {
    5354public:
    54     static PassRefPtr<VTTCueBox> create(Document& document, VTTCue* cue)
    55     {
    56         return adoptRef(new VTTCueBox(document, cue));
    57     }
     55    static PassRefPtr<VTTCueBox> create(Document&, VTTCue&);
    5856
    5957    VTTCue* getCue() const;
     
    6361
    6462protected:
    65     VTTCueBox(Document&, VTTCue*);
     63    VTTCueBox(Document&, VTTCue&);
    6664
    6765    virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
    6866
    69     VTTCue* m_cue;
     67    VTTCue& m_cue;
    7068};
    7169
     
    7472class VTTCue : public TextTrackCue {
    7573public:
    76     static PassRefPtr<VTTCue> create(ScriptExecutionContext& context, double start, double end, const String& content)
    77     {
    78         return adoptRef(new VTTCue(context, start, end, content));
    79     }
     74    static PassRefPtr<VTTCue> create(ScriptExecutionContext&, double start, double end, const String&);
     75    static PassRefPtr<VTTCue> create(ScriptExecutionContext&, const WebVTTCueData&);
    8076
    8177    virtual ~VTTCue();
     
    165161protected:
    166162    VTTCue(ScriptExecutionContext&, double start, double end, const String& content);
     163    VTTCue(ScriptExecutionContext&, const WebVTTCueData&);
    167164
    168165    virtual PassRefPtr<VTTCueBox> createDisplayTree();
     
    170167
    171168private:
     169    void initialize(ScriptExecutionContext&);
    172170    void createWebVTTNodeTree();
    173171    void copyWebVTTNodeToDOMTree(ContainerNode* WebVTTNode, ContainerNode* root);
     
    212210    std::pair<float, float> m_displayPosition;
    213211
     212    double m_originalStartTime;
     213
    214214    bool m_snapToLines : 1;
    215215    bool m_displayTreeShouldChange : 1;
  • trunk/Source/WebCore/html/track/WebVTTParser.cpp

    r170332 r170379  
    22 * Copyright (C) 2011, 2013 Google Inc.  All rights reserved.
    33 * Copyright (C) 2013 Cable Television Labs, Inc.
    4  * Copyright (C) 2014 Apple Inc.  All rights reserved.
     4 * Copyright (C) 2011-2014 Apple Inc.  All rights reserved.
    55 *
    66 * Redistribution and use in source and binary forms, with or without
     
    3737#include "WebVTTParser.h"
    3838
     39#include "ISOVTTCue.h"
    3940#include "ProcessingInstruction.h"
    4041#include "Text.h"
     
    109110#endif
    110111
     112void WebVTTParser::parseFileHeader(const String& data)
     113{
     114    m_state = Initial;
     115    m_lineReader.reset();
     116    m_lineReader.append(data);
     117    parse();
     118}
     119
    111120void WebVTTParser::parseBytes(const char* data, unsigned length)
    112121{
     
    114123    m_lineReader.append(textData);
    115124    parse();
     125}
     126
     127void WebVTTParser::parseCueData(const ISOWebVTTCue& data)
     128{
     129    RefPtr<WebVTTCueData> cue = WebVTTCueData::create();
     130
     131    double startTime = data.presentationTime().toDouble();
     132    cue->setStartTime(startTime);
     133    cue->setEndTime(startTime + data.duration().toDouble());
     134
     135    cue->setContent(data.cueText());
     136    cue->setId(data.id());
     137    cue->setSettings(data.settings());
     138
     139    double originalStartTime;
     140    if (WebVTTParser::collectTimeStamp(data.originalStartTime(), originalStartTime))
     141        cue->setOriginalStartTime(originalStartTime);
     142
     143    m_cuelist.append(cue);
     144    if (m_client)
     145        m_client->newCuesParsed();
    116146}
    117147
     
    272302WebVTTParser::ParseState WebVTTParser::collectTimingsAndSettings(const String& line)
    273303{
     304    if (line.isEmpty())
     305        return BadCue;
     306
    274307    VTTScanner input(line);
    275308
     
    435468bool WebVTTParser::collectTimeStamp(const String& line, double& timeStamp)
    436469{
     470    if (line.isEmpty())
     471        return false;
     472
    437473    VTTScanner input(line);
    438474    return collectTimeStamp(input, timeStamp);
  • trunk/Source/WebCore/html/track/WebVTTParser.h

    r170332 r170379  
    5050
    5151class Document;
     52class ISOWebVTTCue;
    5253class VTTScanner;
    5354
     
    8384    String settings() const { return m_settings; }
    8485    void setSettings(String settings) { m_settings = settings; }
     86
     87    double originalStartTime() const { return m_originalStartTime; }
     88    void setOriginalStartTime(double time) { m_originalStartTime = time; }
    8589
    8690private:
     
    8892        : m_startTime(0)
    8993        , m_endTime(0)
     94        , m_originalStartTime(0)
    9095    {
    9196    }
     
    9398    double m_startTime;
    9499    double m_endTime;
     100    double m_originalStartTime;
    95101    String m_id;
    96102    String m_content;
     
    141147
    142148    // Input data to the parser to parse.
    143     void parseBytes(const char* data, unsigned length);
     149    void parseBytes(const char*, unsigned);
     150    void parseFileHeader(const String&);
     151    void parseCueData(const ISOWebVTTCue&);
    144152    void flush();
    145153    void fileFinished();
     
    185193    StringBuilder m_currentContent;
    186194    String m_currentSettings;
    187    
     195
    188196    WebVTTParserClient* m_client;
    189197
  • trunk/Source/WebCore/loader/TextTrackLoader.cpp

    r170332 r170379  
    216216        Vector<RefPtr<WebVTTCueData>> newCues;
    217217        m_cueParser->getNewCues(newCues);
    218         for (size_t i = 0; i < newCues.size(); ++i) {
    219             RefPtr<WebVTTCueData> data = newCues[i];
    220             RefPtr<VTTCue> cue = VTTCue::create(*m_scriptExecutionContext, data->startTime(), data->endTime(), data->content());
    221             cue->setId(data->id());
    222             cue->setCueSettings(data->settings());
    223             outputCues.append(cue);
    224         }
     218
     219        for (auto& cueData : newCues)
     220            outputCues.append(VTTCue::create(*m_scriptExecutionContext, *cueData));
    225221    }
    226222}
  • trunk/Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h

    r170332 r170379  
    11/*
    2  * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3939
    4040class InbandTextTrackPrivate;
     41class ISOWebVTTCue;
    4142
    4243class GenericCueData : public RefCounted<GenericCueData> {
     
    181182    virtual void removeGenericCue(InbandTextTrackPrivate*, GenericCueData*) = 0;
    182183
     184    virtual void parseWebVTTFileHeader(InbandTextTrackPrivate*, String) { ASSERT_NOT_REACHED(); }
    183185    virtual void parseWebVTTCueData(InbandTextTrackPrivate*, const char* data, unsigned length) = 0;
     186    virtual void parseWebVTTCueData(InbandTextTrackPrivate*, const ISOWebVTTCue&) = 0;
    184187};
    185188
  • trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp

    r170332 r170379  
    11/*
    2  * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030#include "InbandTextTrackPrivateAVF.h"
    3131
     32#include "ISOVTTCue.h"
    3233#include "InbandTextTrackPrivateClient.h"
    3334#include "Logging.h"
    3435#include "SoftLinking.h"
    3536#include <CoreMedia/CoreMedia.h>
     37#include <runtime/ArrayBuffer.h>
     38#include <runtime/DataView.h>
     39#include <runtime/Int8Array.h>
     40#include <wtf/MediaTime.h>
     41#include <wtf/NeverDestroyed.h>
    3642#include <wtf/PassOwnPtr.h>
    3743#include <wtf/text/CString.h>
     44#include <wtf/text/StringBuilder.h>
    3845#include <wtf/text/WTFString.h>
    3946#include <wtf/unicode/CharacterNames.h>
     47
     48#if !PLATFORM(WIN)
     49#include "MediaTimeMac.h"
     50#endif
    4051
    4152#if !PLATFORM(WIN)
     
    5364
    5465SOFT_LINK_AVF_FRAMEWORK(CoreMedia)
     66
     67#if !PLATFORM(WIN)
     68SOFT_LINK(CoreMedia, CMSampleBufferGetDataBuffer, CMBlockBufferRef, (CMSampleBufferRef sbuf), (sbuf))
     69SOFT_LINK(CoreMedia, CMBlockBufferCopyDataBytes, OSStatus, (CMBlockBufferRef theSourceBuffer, size_t offsetToData, size_t dataLength, void* destination), (theSourceBuffer, offsetToData, dataLength, destination))
     70SOFT_LINK(CoreMedia, CMBlockBufferGetDataLength, size_t, (CMBlockBufferRef theBuffer), (theBuffer))
     71SOFT_LINK(CoreMedia, CMSampleBufferGetSampleTimingInfo, OSStatus, (CMSampleBufferRef sbuf, CMItemIndex sampleIndex, CMSampleTimingInfo* timingInfoOut), (sbuf, sampleIndex, timingInfoOut))
     72SOFT_LINK(CoreMedia, CMFormatDescriptionGetExtensions, CFDictionaryRef, (CMFormatDescriptionRef desc), (desc))
     73SOFT_LINK(CoreMedia, CMSampleBufferGetFormatDescription, CMFormatDescriptionRef, (CMSampleBufferRef sbuf), (sbuf))
     74#endif
    5575
    5676SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_Alignment, CFStringRef)
     
    7393SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_BackgroundColorARGB, CFStringRef)
    7494SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_CharacterBackgroundColorARGB, CFStringRef)
     95SOFT_LINK_AVF_POINTER(CoreMedia, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms, CFStringRef)
    7596
    7697#define kCMTextMarkupAttribute_Alignment getkCMTextMarkupAttribute_Alignment()
     
    93114#define kCMTextMarkupAttribute_BackgroundColorARGB getkCMTextMarkupAttribute_BackgroundColorARGB()
    94115#define kCMTextMarkupAttribute_CharacterBackgroundColorARGB getkCMTextMarkupAttribute_CharacterBackgroundColorARGB()
     116#define kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms getkCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms()
     117
     118namespace JSC {
     119class ArrayBuffer;
     120}
    95121
    96122namespace WebCore {
     
    100126}
    101127
    102 InbandTextTrackPrivateAVF::InbandTextTrackPrivateAVF(AVFInbandTrackParent* owner)
    103     : InbandTextTrackPrivate(Generic)
     128InbandTextTrackPrivateAVF::InbandTextTrackPrivateAVF(AVFInbandTrackParent* owner, CueFormat format)
     129    : InbandTextTrackPrivate(format)
    104130    , m_owner(owner)
    105131    , m_pendingCueStatus(None)
     
    107133    , m_hasBeenReported(false)
    108134    , m_seeking(false)
     135    , m_haveReportedVTTHeader(false)
    109136{
    110137}
     
    354381}
    355382
    356 void InbandTextTrackPrivateAVF::processCue(CFArrayRef attributedStrings, double time)
     383void InbandTextTrackPrivateAVF::processCue(CFArrayRef attributedStrings, CFArrayRef nativeSamples, double time)
    357384{
    358385    if (!client())
    359386        return;
    360387
    361     LOG(Media, "InbandTextTrackPrivateAVF::processCue - %li cues at time %.2f\n", attributedStrings ? CFArrayGetCount(attributedStrings) : 0, time);
     388    processAttributedStrings(attributedStrings, time);
     389    processNativeSamples(nativeSamples, time);
     390}
     391
     392void InbandTextTrackPrivateAVF::processAttributedStrings(CFArrayRef attributedStrings, double time)
     393{
     394    LOG(Media, "InbandTextTrackPrivateAVF::processAttributedStrings - %li attributed strings at time %.2f\n", attributedStrings ? CFArrayGetCount(attributedStrings) : 0, time);
    362395
    363396    Vector<RefPtr<GenericCueData>> arrivingCues;
     
    443476
    444477        client()->addGenericCue(this, cueData.release());
    445 
    446         m_pendingCueStatus = seeking() ? DeliveredDuringSeek : Valid;
    447     }
     478    }
     479
     480    m_pendingCueStatus = seeking() ? DeliveredDuringSeek : Valid;
    448481}
    449482
     
    514547}
    515548
     549void InbandTextTrackPrivateAVF::processNativeSamples(CFArrayRef nativeSamples, double presentationTime)
     550{
     551#if PLATFORM(WIN)
     552    UNUSED_PARAM(nativeSamples);
     553    UNUSED_PARAM(presentationTime);
     554    ASSERT_NOT_REACHED();
     555#else
     556    if (!nativeSamples)
     557        return;
     558
     559    CFIndex count = CFArrayGetCount(nativeSamples);
     560    if (!count)
     561        return;
     562
     563    LOG(Media, "InbandTextTrackPrivateAVF::processNativeSamples - %li sample buffers at time %.2f\n", count, presentationTime);
     564
     565    for (CFIndex i = 0; i < count; i++) {
     566
     567        CMSampleBufferRef sampleBuffer = (CMSampleBufferRef)CFArrayGetValueAtIndex(nativeSamples, i);
     568        if (!sampleBuffer)
     569            continue;
     570
     571        CMSampleTimingInfo timingInfo;
     572        OSStatus status = CMSampleBufferGetSampleTimingInfo(sampleBuffer, i, &timingInfo);
     573        if (status) {
     574            LOG(Media, "InbandTextTrackPrivateAVF::processNativeSamples(%p) - CMSampleBufferGetSampleTimingInfo returned error %x for sample %li", this, static_cast<SInt32>(status), i);
     575            continue;
     576        }
     577
     578        CMBlockBufferRef blockBuffer = CMSampleBufferGetDataBuffer(sampleBuffer);
     579        size_t bufferLength = CMBlockBufferGetDataLength(blockBuffer);
     580        if (bufferLength < ISOBox::boxHeaderSize()) {
     581            LOG(Media, "InbandTextTrackPrivateAVF::processNativeSamples(%p) - ERROR: CMSampleBuffer size length unexpectedly small (%zu)!!", this, bufferLength);
     582            continue;
     583        }
     584
     585        m_sampleInputBuffer.resize(m_sampleInputBuffer.size() + bufferLength);
     586        CMBlockBufferCopyDataBytes(blockBuffer, 0, bufferLength, m_sampleInputBuffer.data() + m_sampleInputBuffer.size() - bufferLength);
     587
     588        RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(m_sampleInputBuffer.data(), m_sampleInputBuffer.size());
     589
     590        String type = ISOBox::peekType(buffer.get());
     591        size_t boxLength = ISOBox::peekLength(buffer.get());
     592        if (boxLength > buffer->byteLength()) {
     593            LOG(Media, "InbandTextTrackPrivateAVF::processNativeSamples(%p) - ERROR: chunk '%s' size (%zu) larger than buffer length (%u)!!", this, type.utf8().data(), boxLength, buffer->byteLength());
     594            continue;
     595        }
     596
     597        LOG(Media, "InbandTextTrackPrivateAVF::processNativeSamples(%p) - chunk type = '%s', size = %zu", this, type.utf8().data(), boxLength);
     598
     599        if (type == ISOWebVTTCue::boxType()) {
     600#if !PLATFORM(WIN)
     601            ISOWebVTTCue cueData = ISOWebVTTCue(MediaTime::createWithDouble(presentationTime), toMediaTime(timingInfo.duration), buffer.get());
     602#else
     603            ISOWebVTTCue cueData = ISOWebVTTCue(MediaTime::createWithDouble(presentationTime), MediaTime::createWithDouble(CMTimeGetSeconds(timingInfo.duration)), buffer.get());
     604#endif
     605            LOG(Media, "    sample presentation time = %.2f, duration = %.2f", cueData.presentationTime().toDouble(), cueData.duration().toDouble());
     606            LOG(Media, "    id = \"%s\", settings = \"%s\", cue text = \"%s\"", cueData.id().utf8().data(), cueData.settings().utf8().data(), cueData.cueText().utf8().data());
     607            LOG(Media, "    sourceID = \"%s\", originalStartTime = \"%s\"", cueData.sourceID().utf8().data(), cueData.originalStartTime().utf8().data());
     608
     609            client()->parseWebVTTCueData(this, cueData);
     610        }
     611
     612        do {
     613            if (m_haveReportedVTTHeader)
     614                break;
     615
     616            CMFormatDescriptionRef formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer);
     617            if (!formatDescription)
     618                break;
     619
     620            CFDictionaryRef extensions = CMFormatDescriptionGetExtensions(formatDescription);
     621            if (!extensions)
     622                break;
     623
     624            CFDictionaryRef sampleDescriptionExtensions = static_cast<CFDictionaryRef>(CFDictionaryGetValue(extensions, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms));
     625            if (!sampleDescriptionExtensions)
     626                break;
     627           
     628            CFDataRef webvttHeaderData = static_cast<CFDataRef>(CFDictionaryGetValue(sampleDescriptionExtensions, CFSTR("vttC")));
     629            if (!webvttHeaderData)
     630                break;
     631
     632            unsigned length = CFDataGetLength(webvttHeaderData);
     633            if (!length)
     634                break;
     635
     636            // A WebVTT header is terminated by "One or more WebVTT line terminators" so append two line feeds to make sure the parser
     637            // reccognized this string as a full header.
     638            StringBuilder header;
     639            header.append(reinterpret_cast<const unsigned char*>(CFDataGetBytePtr(webvttHeaderData)), length);
     640            header.append("\n\n");
     641
     642            LOG(Media, "    vtt header = \n%s", header.toString().utf8().data());
     643            client()->parseWebVTTFileHeader(this, header.toString());
     644            m_haveReportedVTTHeader = true;
     645        } while (0);
     646
     647        m_sampleInputBuffer.remove(0, boxLength);
     648    }
     649#endif
     650}
     651
    516652} // namespace WebCore
    517653
  • trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h

    r170332 r170379  
    5656    void setHasBeenReported(bool reported) { m_hasBeenReported = reported; }
    5757
    58     virtual void processCue(CFArrayRef, double);
     58    virtual void processCue(CFArrayRef attributedStrings, CFArrayRef nativeSamples, double);
    5959    virtual void resetCueValues();
    6060
     
    6969    };
    7070    virtual Category textTrackCategory() const = 0;
    71    
     71
    7272    virtual double startTimeVariance() const override { return 0.25; }
    73    
     73
    7474protected:
    75     InbandTextTrackPrivateAVF(AVFInbandTrackParent*);
     75    InbandTextTrackPrivateAVF(AVFInbandTrackParent*, CueFormat);
    7676
    7777    void processCueAttributes(CFAttributedStringRef, GenericCueData*);
     78    void processAttributedStrings(CFArrayRef, double);
     79    void processNativeSamples(CFArrayRef, double);
    7880    void removeCompletedCues();
    7981
     
    8385    Vector<RefPtr<GenericCueData>> m_cues;
    8486    AVFInbandTrackParent* m_owner;
     87
     88    Vector<char> m_sampleInputBuffer;
    8589
    8690    enum PendingCueStatus {
     
    9498    bool m_hasBeenReported;
    9599    bool m_seeking;
     100    bool m_haveReportedVTTHeader;
    96101};
    97102
  • trunk/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp

    r170332 r170379  
    4646namespace WebCore {
    4747
    48 InbandTextTrackPrivateAVCF::InbandTextTrackPrivateAVCF(AVFInbandTrackParent* player, AVCFMediaSelectionOptionRef selection)
    49     : InbandTextTrackPrivateAVF(player)
     48InbandTextTrackPrivateAVCF::InbandTextTrackPrivateAVCF(AVFInbandTrackParent* player, AVCFMediaSelectionOptionRef selection, InbandTextTrackPrivate::CueFormat format)
     49    : InbandTextTrackPrivateAVF(player, format)
    5050    , m_mediaSelectionOption(selection)
    5151{
  • trunk/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.h

    r170332 r170379  
    3737class InbandTextTrackPrivateAVCF : public InbandTextTrackPrivateAVF {
    3838public:
    39     static PassRefPtr<InbandTextTrackPrivateAVCF> create(AVFInbandTrackParent* player,  AVCFMediaSelectionOptionRef selection)
     39    static PassRefPtr<InbandTextTrackPrivateAVCF> create(AVFInbandTrackParent* player,  AVCFMediaSelectionOptionRef selection, InbandTextTrackPrivate::CueFormat format)
    4040    {
    41         return adoptRef(new InbandTextTrackPrivateAVCF(player, selection));
     41        return adoptRef(new InbandTextTrackPrivateAVCF(player, selection, format));
    4242    }
    4343
     
    6161
    6262protected:
    63     InbandTextTrackPrivateAVCF(AVFInbandTrackParent*, AVCFMediaSelectionOptionRef);
     63    InbandTextTrackPrivateAVCF(AVFInbandTrackParent*, AVCFMediaSelectionOptionRef, InbandTextTrackPrivate::CueFormat);
    6464   
    6565    RetainPtr<AVCFMediaSelectionOptionRef> m_mediaSelectionOption;
  • trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp

    r170332 r170379  
    10941094            continue;
    10951095
    1096         m_textTracks.append(InbandTextTrackPrivateAVCF::create(this, option));
     1096        m_textTracks.append(InbandTextTrackPrivateAVCF::create(this, option, InbandTextTrackPrivate::Generic));
    10971097    }
    10981098
     
    15951595struct LegibleOutputData {
    15961596    RetainPtr<CFArrayRef> m_attributedStrings;
     1597    RetainPtr<CFArrayRef> m_samples;
    15971598    double m_time;
    15981599    void* m_context;
    15991600
    1600     LegibleOutputData(CFArrayRef strings, double time, void* context)
    1601         : m_attributedStrings(strings), m_time(time), m_context(context)
     1601    LegibleOutputData(CFArrayRef strings, CFArrayRef samples, double time, void* context)
     1602        : m_attributedStrings(strings), m_samples(samples), m_time(time), m_context(context)
    16021603    {
    16031604    }
     
    16241625        return;
    16251626
    1626     self->m_currentTextTrack->processCue(legibleOutputData->m_attributedStrings.get(), legibleOutputData->m_time);
    1627 }
    1628 
    1629 void AVFWrapper::legibleOutputCallback(void* context, AVCFPlayerItemLegibleOutputRef legibleOutput, CFArrayRef attributedStrings, CFArrayRef /*nativeSampleBuffers*/, CMTime itemTime)
     1627    self->m_currentTextTrack->processCue(legibleOutputData->m_attributedStrings.get(), legibleOutputData->m_samples.get(), legibleOutputData->m_time);
     1628}
     1629
     1630void AVFWrapper::legibleOutputCallback(void* context, AVCFPlayerItemLegibleOutputRef legibleOutput, CFArrayRef attributedStrings, CFArrayRef nativeSampleBuffers, CMTime itemTime)
    16301631{
    16311632    ASSERT(dispatch_get_main_queue() != dispatch_get_current_queue());
     
    16411642    ASSERT(legibleOutput == self->m_legibleOutput);
    16421643
    1643     OwnPtr<LegibleOutputData> legibleOutputData = adoptPtr(new LegibleOutputData(attributedStrings, CMTimeGetSeconds(itemTime), context));
     1644    OwnPtr<LegibleOutputData> legibleOutputData = adoptPtr(new LegibleOutputData(attributedStrings, nativeSampleBuffers, CMTimeGetSeconds(itemTime), context));
    16441645
    16451646    dispatch_async_f(dispatch_get_main_queue(), legibleOutputData.leakPtr(), processCue);
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h

    r170332 r170379  
    3232#include <wtf/RetainPtr.h>
    3333
     34OBJC_CLASS AVAsset;
    3435OBJC_CLASS AVMediaSelectionOption;
    3536
     
    3839class InbandTextTrackPrivateAVFObjC : public InbandTextTrackPrivateAVF {
    3940public:
    40     static PassRefPtr<InbandTextTrackPrivateAVFObjC> create(AVFInbandTrackParent* player,  AVMediaSelectionOption *selection)
     41    static PassRefPtr<InbandTextTrackPrivateAVFObjC> create(AVFInbandTrackParent* player,  AVMediaSelectionOption *selection, InbandTextTrackPrivate::CueFormat format)
    4142    {
    42         return adoptRef(new InbandTextTrackPrivateAVFObjC(player, selection));
     43        return adoptRef(new InbandTextTrackPrivateAVFObjC(player, selection, format));
    4344    }
    4445
     
    6263
    6364protected:
    64     InbandTextTrackPrivateAVFObjC(AVFInbandTrackParent*, AVMediaSelectionOption *);
     65    InbandTextTrackPrivateAVFObjC(AVFInbandTrackParent*, AVMediaSelectionOption *, InbandTextTrackPrivate::CueFormat);
    6566   
    6667    RetainPtr<AVMediaSelectionOption> m_mediaSelectionOption;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm

    r170332 r170379  
    7777namespace WebCore {
    7878
    79 InbandTextTrackPrivateAVFObjC::InbandTextTrackPrivateAVFObjC(AVFInbandTrackParent* player, AVMediaSelectionOption *selection)
    80     : InbandTextTrackPrivateAVF(player)
     79InbandTextTrackPrivateAVFObjC::InbandTextTrackPrivateAVFObjC(AVFInbandTrackParent* player, AVMediaSelectionOption *selection, InbandTextTrackPrivate::CueFormat format)
     80    : InbandTextTrackPrivateAVF(player, format)
    8181    , m_mediaSelectionOption(selection)
    8282{
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm

    r170332 r170379  
    5757
    5858InbandTextTrackPrivateLegacyAVFObjC::InbandTextTrackPrivateLegacyAVFObjC(MediaPlayerPrivateAVFoundationObjC* player, AVPlayerItemTrack* track)
    59     : InbandTextTrackPrivateAVF(player)
     59    : InbandTextTrackPrivateAVF(player, InbandTextTrackPrivate::Generic)
    6060    , m_playerItemTrack(track)
    6161{
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h

    r170332 r170379  
    7777#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
    7878    RetainPtr<AVPlayerItem> playerItem() const { return m_avPlayerItem; }
    79     void processCue(NSArray *, double);
     79    void processCue(NSArray *, NSArray *, double);
    8080    void flushCues();
    8181#endif
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r170332 r170379  
    677677        return;
    678678
    679     LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(%p)", this);
     679    LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(%p) - url = %s", this, url.utf8().data());
    680680
    681681    setDelayCallbacks(true);
     
    809809    const NSTimeInterval legibleOutputAdvanceInterval = 2;
    810810
    811     m_legibleOutput = adoptNS([[AVPlayerItemLegibleOutput alloc] initWithMediaSubtypesForNativeRepresentation:[NSArray array]]);
     811    RetainPtr<NSArray> subtypes = adoptNS([[NSArray alloc] initWithObjects:[NSNumber numberWithUnsignedInt:kCMSubtitleFormatType_WebVTT], nil]);
     812    m_legibleOutput = adoptNS([[AVPlayerItemLegibleOutput alloc] initWithMediaSubtypesForNativeRepresentation:subtypes.get()]);
    812813    [m_legibleOutput.get() setSuppressesPlayerRendering:YES];
    813814
     
    15781579
    15791580#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
    1580     if (AVMediaSelectionGroupType *legibleGroup = safeMediaSelectionGroupForLegibleMedia()) {
     1581    AVMediaSelectionGroupType *legibleGroup = safeMediaSelectionGroupForLegibleMedia();
     1582    if (legibleGroup && m_cachedTracks) {
    15811583        hasCaptions = [[AVMediaSelectionGroup playableMediaSelectionOptionsFromArray:[legibleGroup options]] count];
    15821584        if (hasCaptions)
     
    21652167#endif
    21662168
    2167         m_textTracks.append(InbandTextTrackPrivateAVFObjC::create(this, option));
     2169        m_textTracks.append(InbandTextTrackPrivateAVFObjC::create(this, option, InbandTextTrackPrivate::Generic));
    21682170    }
    21692171
     
    21812183}
    21822184
    2183 void MediaPlayerPrivateAVFoundationObjC::processCue(NSArray *attributedStrings, double time)
     2185void MediaPlayerPrivateAVFoundationObjC::processCue(NSArray *attributedStrings, NSArray *nativeSamples, double time)
    21842186{
    21852187    if (!m_currentTextTrack)
    21862188        return;
    21872189
    2188     m_currentTextTrack->processCue(reinterpret_cast<CFArrayRef>(attributedStrings), time);
     2190    m_currentTextTrack->processCue(reinterpret_cast<CFArrayRef>(attributedStrings), reinterpret_cast<CFArrayRef>(nativeSamples), time);
    21892191}
    21902192
     
    27352737    RetainPtr<WebCoreAVFMovieObserver> strongSelf = self;
    27362738    RetainPtr<NSArray> strongStrings = strings;
    2737     callOnMainThread([strongSelf, strongStrings, itemTime] {
     2739    RetainPtr<NSArray> strongSamples = nativeSamples;
     2740    callOnMainThread([strongSelf, strongStrings, strongSamples, itemTime] {
    27382741        MediaPlayerPrivateAVFoundationObjC* callback = strongSelf->m_callback;
    27392742        if (!callback)
    27402743            return;
    2741         callback->processCue(strongStrings.get(), CMTimeGetSeconds(itemTime));
     2744        callback->processCue(strongStrings.get(), strongSamples.get(), CMTimeGetSeconds(itemTime));
    27422745    });
    27432746}
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/OutOfBandTextTrackPrivateAVF.h

    r170332 r170379  
    4242    }
    4343   
    44     virtual void processCue(CFArrayRef, double) override { }
     44    virtual void processCue(CFArrayRef, CFArrayRef, double) override { }
    4545    virtual void resetCueValues() override { }
    4646   
     
    5151protected:
    5252    OutOfBandTextTrackPrivateAVF(AVFInbandTrackParent* player, AVMediaSelectionOption* selection)
    53         : InbandTextTrackPrivateAVF(player)
     53        : InbandTextTrackPrivateAVF(player, InbandTextTrackPrivate::Generic)
    5454        , m_mediaSelectionOption(selection)
    5555    {
Note: See TracChangeset for help on using the changeset viewer.