[Windows] Support in-band text tracks.
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Jul 2013 20:30:23 +0000 (20:30 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Jul 2013 20:30:23 +0000 (20:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=103770.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@152861 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/config.h
Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp
Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h
Source/WebCore/platform/graphics/avfoundation/cf/CoreMediaSoftLinking.h
Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.h [new file with mode: 0644]
Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.h [new file with mode: 0644]
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h
Source/WebCore/platform/win/SoftLinking.h
Tools/ChangeLog
Tools/WinLauncher/WinLauncher.cpp
Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherCF.props [new file with mode: 0644]
Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherCFLite.props [new file with mode: 0644]
Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj

index 84a6859..7b91483 100644 (file)
@@ -1,3 +1,110 @@
+2013-07-17  Brent Fulgham  <bfulgham@apple.com>
+
+        [Windows] Support in-band text tracks.
+        https://bugs.webkit.org/show_bug.cgi?id=103770
+
+        Reviewed by Eric Carlson.
+
+        Existing media tests cover these features.
+
+        * WebCore.vcxproj/WebCore.vcxproj: Add new files for Windows captions
+        * WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
+        * config.h: Make sure proper buid flags are turned on when building
+        with AVCF_LEGIBLE_OUTPUT.
+        * page/CaptionUserPreferencesMediaAF.cpp: Revise to reduce soft linking
+        duplication between Mac and Windows.
+        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: Update
+        to support Windows platform by removing compiler guards and adding
+        Windows declarations for soft-link functions.
+        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h: Ditto.
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+        Remove build guards preventing Windows from using LegibleOutput
+        features.
+        (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
+        (WebCore::MediaPlayerPrivateAVFoundation::seek):
+        (WebCore::MediaPlayerPrivateAVFoundation::seekCompleted):
+        (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
+        (WebCore::MediaPlayerPrivateAVFoundation::trackModeChanged):
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
+        (WebCore::MediaPlayerPrivateAVFoundation::contentsNeedsDisplay): Ditto
+        * platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h:
+        Add new LegibleOutput support functions, and try to reduce duplication
+        between Windows and Mac soft link declarations.
+        * platform/graphics/avfoundation/cf/CoreMediaSoftLinking.h: Ditto.
+        * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp: Added.
+        (WebCore::InbandTextTrackPrivateAVCF::InbandTextTrackPrivateAVCF):
+        (WebCore::InbandTextTrackPrivateAVCF::disconnect):
+        (WebCore::InbandTextTrackPrivateAVCF::kind):
+        (WebCore::InbandTextTrackPrivateAVCF::isClosedCaptions):
+        (WebCore::InbandTextTrackPrivateAVCF::isSDH):
+        (WebCore::InbandTextTrackPrivateAVCF::containsOnlyForcedSubtitles):
+        (WebCore::InbandTextTrackPrivateAVCF::isMainProgramContent):
+        (WebCore::InbandTextTrackPrivateAVCF::isEasyToRead):
+        (WebCore::InbandTextTrackPrivateAVCF::label):
+        (WebCore::InbandTextTrackPrivateAVCF::language):
+        (WebCore::InbandTextTrackPrivateAVCF::isDefault):
+        * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.h: Added.
+        (WebCore::InbandTextTrackPrivateAVCF::create):
+        (WebCore::InbandTextTrackPrivateAVCF::~InbandTextTrackPrivateAVCF):
+        (WebCore::InbandTextTrackPrivateAVCF::mediaSelectionOption):
+        * platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.cpp: Added.
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::InbandTextTrackPrivateLegacyAVCF):
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::disconnect):
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::kind):
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::isClosedCaptions):
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::containsOnlyForcedSubtitles):
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::isMainProgramContent):
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::isEasyToRead):
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::label):
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::language):
+        * platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.h: Added.
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::create):
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::~InbandTextTrackPrivateLegacyAVCF):
+        (WebCore::InbandTextTrackPrivateLegacyAVCF::avPlayerItemTrack):
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        Update to support LegibleOutput features for the Windows port.
+        (WebCore::AVFWrapper::currentTrack): Added.
+        (WebCore::AVFWrapper::legibleOutput): Added.
+        (WebCore::createMetadataKeyNames): Added missing key names.
+        (WebCore::avLegibleOutput): Added.
+        (WebCore::safeMediaSelectionGroupForLegibleMedia): Added.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::cancelLoad): Clear text
+        tracks when cancelling.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::setCurrentTrack): Added.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::currentTrack): Added.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::platformDuration): Revised
+        to match logic in Objective C implementation.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::currentTime): Revised
+        to match logic in Objective C implementation.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::paintCurrentFrameInContext):
+        Check presence of metadata before proceeding. Revised to match logic
+        in Objective C implementation.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::paint): Ditto.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::tracksChanged): Update for
+        in-band text tracks.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::clearTextTracks): Added.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::processLegacyClosedCaptionsTracks):
+        Added.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::processNewAndRemovedTextTracks):
+        Added.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::processMediaSelectionOptions):
+        Added.
+        (WebCore::AVFWrapper::setCurrentTrack): Added.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::languageOfPrimaryAudioTrack):
+        Added.
+        (WebCore::AVFWrapper::AVFWrapper): Add new initializers.
+        (WebCore::AVFWrapper::~AVFWrapper): Clean up text track information.
+        (WebCore::AVFWrapper::createPlayer): Add Legible Output support.
+        (WebCore::AVFWrapper::createPlayerItem): Ditto.
+        (WebCore::LegibleOutputData::LegibleOutputData): Added.
+        (WebCore::AVFWrapper::processCue): Added.
+        (WebCore::AVFWrapper::legibleOutputCallback): Added.
+        (WebCore::AVFWrapper::safeMediaSelectionGroupForLegibleMedia): Added.
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
+        Update to support LegibleOutput features for the Windows port.
+        * platform/win/SoftLinking.h: Change signature of variable accessor
+        to match Mac so reduce duplicate code.
+
 2013-07-18  Christophe Dumez  <ch.dumez@sisa.samsung.com>
 
         Make atob() / btoa() argument non optional
index 7810cb4..4a3eda4 100644 (file)
     <ClCompile Include="..\platform\FileStream.cpp" />
     <ClCompile Include="..\platform\FileSystem.cpp" />
     <ClCompile Include="..\platform\graphics\ANGLEWebKitBridge.cpp" />
+    <ClCompile Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateAVCF.cpp" />
+    <ClCompile Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateLegacyAVCF.cpp" />
+    <ClCompile Include="..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.cpp" />
     <ClCompile Include="..\platform\graphics\cairo\GLContext.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     <ClInclude Include="..\platform\FloatConversion.h" />
     <ClInclude Include="..\platform\graphics\ANGLEWebKitBridge.h" />
     <ClInclude Include="..\platform\graphics\AudioTrackPrivate.h" />
+    <ClInclude Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateAVCF.h" />
+    <ClInclude Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateLegacyAVCF.h" />
+    <ClInclude Include="..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.h" />
     <ClInclude Include="..\platform\graphics\cairo\GLContext.h" />
     <ClInclude Include="..\platform\graphics\cairo\GraphicsContext3DPrivate.h" />
     <ClInclude Include="..\platform\graphics\cg\SubimageCacheWithTimer.h">
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
index 8b371a0..e99121d 100644 (file)
     <ClCompile Include="..\platform\graphics\egl\GLContextEGL.cpp">
       <Filter>platform\graphics\egl</Filter>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj32\$(ProjectName)\DerivedSources\JSSVGGraphicsElement.cpp" />
+    <ClCompile Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateAVCF.cpp">
+      <Filter>platform\graphics\avfoundation\cf</Filter>
+    </ClCompile>
+    <ClCompile Include="..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.cpp">
+      <Filter>platform\graphics\avfoundation</Filter>
+    </ClCompile>
+    <ClCompile Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateLegacyAVCF.cpp">
+      <Filter>platform\graphics\avfoundation\cf</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\Modules\filesystem\AsyncFileWriter.h">
     <ClInclude Include="..\platform\graphics\egl\GLContextEGL.h">
       <Filter>platform\graphics\egl</Filter>
     </ClInclude>
+    <ClInclude Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateAVCF.h">
+      <Filter>platform\graphics\avfoundation\cf</Filter>
+    </ClInclude>
+    <ClInclude Include="..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.h">
+      <Filter>platform\graphics\avfoundation</Filter>
+    </ClInclude>
+    <ClInclude Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateLegacyAVCF.h">
+      <Filter>platform\graphics\avfoundation\cf</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\css\CSSGrammar.y.in">
       <Filter>rendering</Filter>
     </CustomBuildStep>
   </ItemGroup>
-</Project>
+</Project>
\ No newline at end of file
index e625a91..30bed8e 100644 (file)
@@ -140,8 +140,10 @@ typedef float CGFloat;
 #define WTF_USE_AVFOUNDATION 1
 
 #if HAVE(AVCF_LEGIBLE_OUTPUT)
+#define WTF_USE_AVFOUNDATION 1
 #define HAVE_AVFOUNDATION_MEDIA_SELECTION_GROUP 1
 #define HAVE_AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT 1
+#define HAVE_MEDIA_ACCESSIBILITY_FRAMEWORK 1
 #endif
 
 #endif
index 7b0a2c7..cd52997 100644 (file)
 #endif
 
 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
-#if !PLATFORM(WIN)
-SOFT_LINK_FRAMEWORK_OPTIONAL(MediaAccessibility)
-
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceGetDisplayType, MACaptionAppearanceDisplayType, (MACaptionAppearanceDomain domain), (domain))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceSetDisplayType, void, (MACaptionAppearanceDomain domain, MACaptionAppearanceDisplayType displayType), (domain, displayType))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceCopyForegroundColor, CGColorRef, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceCopyBackgroundColor, CGColorRef, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceCopyWindowColor, CGColorRef, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceGetForegroundOpacity, CGFloat, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceGetBackgroundOpacity, CGFloat, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceGetWindowOpacity, CGFloat, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceGetWindowRoundedCornerRadius, CGFloat, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceCopyFontDescriptorForStyle, CTFontDescriptorRef, (MACaptionAppearanceDomain domain,  MACaptionAppearanceBehavior *behavior, MACaptionAppearanceFontStyle fontStyle), (domain, behavior, fontStyle))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceGetRelativeCharacterSize, CGFloat, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceGetTextEdgeStyle, MACaptionAppearanceTextEdgeStyle, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceAddSelectedLanguage, bool, (MACaptionAppearanceDomain domain, CFStringRef language), (domain, language));
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceCopySelectedLanguages, CFArrayRef, (MACaptionAppearanceDomain domain), (domain));
-SOFT_LINK(MediaAccessibility, MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics,  CFArrayRef, (MACaptionAppearanceDomain domain), (domain));
-
-SOFT_LINK_POINTER(MediaAccessibility, kMAXCaptionAppearanceSettingsChangedNotification, CFStringRef)
-#define kMAXCaptionAppearanceSettingsChangedNotification getkMAXCaptionAppearanceSettingsChangedNotification()
 
+#if !PLATFORM(WIN)
+#define SOFT_LINK_AVF_FRAMEWORK(Lib) SOFT_LINK_FRAMEWORK_OPTIONAL(Lib)
+#define SOFT_LINK_AVF(Lib, Name, Type) SOFT_LINK(Lib, Name, Type)
+#define SOFT_LINK_AVF_POINTER(Lib, Name, Type) SOFT_LINK_POINTER_OPTIONAL(Lib, Name, Type)
+#define SOFT_LINK_AVF_FRAMEWORK_IMPORT(Lib, Fun, ReturnType, Arguments, Signature) SOFT_LINK(Lib, Fun, ReturnType, Arguments, Signature)
 #else
-SOFT_LINK_LIBRARY(MediaAccessibility)
+#define SOFT_LINK_AVF_FRAMEWORK(Lib) SOFT_LINK_LIBRARY(Lib)
+#define SOFT_LINK_AVF(Lib, Name, Type) SOFT_LINK_DLL_IMPORT(Lib, Name, Type)
+#define SOFT_LINK_AVF_POINTER(Lib, Name, Type) SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL(Lib, Name, Type)
+#define SOFT_LINK_AVF_FRAMEWORK_IMPORT(Lib, Fun, ReturnType, Arguments, Signature) SOFT_LINK_DLL_IMPORT(Lib, Fun, ReturnType, __cdecl, Arguments, Signature)
+#endif
 
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceGetDisplayType, MACaptionAppearanceDisplayType, __cdecl, (MACaptionAppearanceDomain domain), (domain))
+SOFT_LINK_AVF_FRAMEWORK(MediaAccessibility)
+SOFT_LINK_AVF_FRAMEWORK(CoreText)
+
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceGetDisplayType, MACaptionAppearanceDisplayType, (MACaptionAppearanceDomain domain), (domain))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceSetDisplayType, void, (MACaptionAppearanceDomain domain, MACaptionAppearanceDisplayType displayType), (domain, displayType))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceCopyForegroundColor, CGColorRef, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceCopyBackgroundColor, CGColorRef, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceCopyWindowColor, CGColorRef, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceGetForegroundOpacity, CGFloat, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceGetBackgroundOpacity, CGFloat, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceGetWindowOpacity, CGFloat, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceGetWindowRoundedCornerRadius, CGFloat, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceCopyFontDescriptorForStyle, CTFontDescriptorRef, (MACaptionAppearanceDomain domain,  MACaptionAppearanceBehavior *behavior, MACaptionAppearanceFontStyle fontStyle), (domain, behavior, fontStyle))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceGetRelativeCharacterSize, CGFloat, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceGetTextEdgeStyle, MACaptionAppearanceTextEdgeStyle, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceAddSelectedLanguage, bool, (MACaptionAppearanceDomain domain, CFStringRef language), (domain, language));
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceCopySelectedLanguages, CFArrayRef, (MACaptionAppearanceDomain domain), (domain));
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(MediaAccessibility, MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics,  CFArrayRef, (MACaptionAppearanceDomain domain), (domain));
+
+SOFT_LINK_AVF_FRAMEWORK_IMPORT(CoreText, CTFontDescriptorCopyAttribute,  CFTypeRef, (CTFontDescriptorRef descriptor, CFStringRef attribute), (descriptor, attribute));
+
+#if PLATFORM(WIN)
+// These are needed on Windows due to the way DLLs work. We do not need them on other platforms
 #define MACaptionAppearanceGetDisplayType softLink_MACaptionAppearanceGetDisplayType
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceSetDisplayType, void, __cdecl, (MACaptionAppearanceDomain domain, MACaptionAppearanceDisplayType displayType), (domain, displayType))
 #define MACaptionAppearanceSetDisplayType softLink_MACaptionAppearanceSetDisplayType
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceCopyForegroundColor, CGColorRef, __cdecl, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
 #define MACaptionAppearanceCopyForegroundColor softLink_MACaptionAppearanceCopyForegroundColor
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceCopyBackgroundColor, CGColorRef, __cdecl, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
 #define MACaptionAppearanceCopyBackgroundColor softLink_MACaptionAppearanceCopyBackgroundColor
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceCopyWindowColor, CGColorRef, __cdecl, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
 #define MACaptionAppearanceCopyWindowColor softLink_MACaptionAppearanceCopyWindowColor
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceGetForegroundOpacity, CGFloat, __cdecl, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
 #define MACaptionAppearanceGetForegroundOpacity softLink_MACaptionAppearanceGetForegroundOpacity
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceGetBackgroundOpacity, CGFloat, __cdecl, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
 #define MACaptionAppearanceGetBackgroundOpacity softLink_MACaptionAppearanceGetBackgroundOpacity
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceGetWindowOpacity, CGFloat, __cdecl, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
 #define MACaptionAppearanceGetWindowOpacity softLink_MACaptionAppearanceGetWindowOpacity
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceGetWindowRoundedCornerRadius, CGFloat, __cdecl, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
 #define MACaptionAppearanceGetWindowRoundedCornerRadius softLink_MACaptionAppearanceGetWindowRoundedCornerRadius
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceCopyFontDescriptorForStyle, CTFontDescriptorRef, __cdecl, (MACaptionAppearanceDomain domain,  MACaptionAppearanceBehavior *behavior, MACaptionAppearanceFontStyle fontStyle), (domain, behavior, fontStyle))
 #define MACaptionAppearanceCopyFontDescriptorForStyle softLink_MACaptionAppearanceCopyFontDescriptorForStyle
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceGetRelativeCharacterSize, CGFloat, __cdecl, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
 #define MACaptionAppearanceGetRelativeCharacterSize softLink_MACaptionAppearanceGetRelativeCharacterSize
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceGetTextEdgeStyle, MACaptionAppearanceTextEdgeStyle, __cdecl, (MACaptionAppearanceDomain domain, MACaptionAppearanceBehavior *behavior), (domain, behavior))
 #define MACaptionAppearanceGetTextEdgeStyle softLink_MACaptionAppearanceGetTextEdgeStyle
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceAddSelectedLanguage, bool, __cdecl, (MACaptionAppearanceDomain domain, CFStringRef language), (domain, language));
 #define MACaptionAppearanceAddSelectedLanguage softLink_MACaptionAppearanceAddSelectedLanguage
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceCopySelectedLanguages, CFArrayRef, __cdecl, (MACaptionAppearanceDomain domain), (domain));
 #define MACaptionAppearanceCopySelectedLanguages softLink_MACaptionAppearanceCopySelectedLanguages
-
-SOFT_LINK_DLL_IMPORT(MediaAccessibility, MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics,  CFArrayRef, __cdecl, (MACaptionAppearanceDomain domain), (domain));
 #define MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics softLink_MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics
-
-SOFT_LINK_VARIABLE_DLL_IMPORT(MediaAccessibility, kMAXCaptionAppearanceSettingsChangedNotification, CFStringRef)
-#define kMAXCaptionAppearanceSettingsChangedNotification get_kMAXCaptionAppearanceSettingsChangedNotification()
-
-SOFT_LINK_LIBRARY(CoreText)
-
-SOFT_LINK_DLL_IMPORT(CoreText, CTFontDescriptorCopyAttribute,  CFTypeRef, __cdecl, (CTFontDescriptorRef descriptor, CFStringRef attribute), (descriptor, attribute));
 #define CTFontDescriptorCopyAttribute softLink_CTFontDescriptorCopyAttribute
-
-SOFT_LINK_VARIABLE_DLL_IMPORT(CoreText, kCTFontNameAttribute, CFStringRef)
-#define kCTFontNameAttribute get_kCTFontNameAttribute()
-
 #endif
 
+SOFT_LINK_AVF_POINTER(MediaAccessibility, kMAXCaptionAppearanceSettingsChangedNotification, CFStringRef)
+#define kMAXCaptionAppearanceSettingsChangedNotification getkMAXCaptionAppearanceSettingsChangedNotification()
+
+SOFT_LINK_AVF_POINTER(CoreText, kCTFontNameAttribute, CFStringRef)
+#define kCTFontNameAttribute getkCTFontNameAttribute()
 #endif
 
 using namespace std;
index 269582a..0e932e4 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "config.h"
 
-#if ENABLE(VIDEO) && ((USE(AVFOUNDATION) && !PLATFORM(WIN)) || PLATFORM(IOS))
+#if ENABLE(VIDEO) && (USE(AVFOUNDATION) || PLATFORM(IOS))
 
 #include "InbandTextTrackPrivateAVF.h"
 
 #include <wtf/text/WTFString.h>
 #include <wtf/unicode/CharacterNames.h>
 
-SOFT_LINK_FRAMEWORK_OPTIONAL(CoreMedia)
-
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_Alignment, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAlignmentType_Start, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAlignmentType_Middle, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAlignmentType_End, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_BoldStyle, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_ItalicStyle, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_UnderlineStyle, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_TextPositionPercentageRelativeToWritingDirection, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_WritingDirectionSizePercentage, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_OrthogonalLinePositionPercentageRelativeToWritingDirection, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_VerticalLayout, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextVerticalLayout_LeftToRight, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextVerticalLayout_RightToLeft, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_RelativeFontSize, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_FontFamilyName, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_ForegroundColorARGB, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_BackgroundColorARGB, CFStringRef)
-SOFT_LINK_POINTER_OPTIONAL(CoreMedia, kCMTextMarkupAttribute_CharacterBackgroundColorARGB, CFStringRef)
+#if !PLATFORM(WIN)
+#define SOFT_LINK_AVF_FRAMEWORK(Lib) SOFT_LINK_FRAMEWORK_OPTIONAL(Lib)
+#define SOFT_LINK_AVF_POINTER(Lib, Name, Type) SOFT_LINK_POINTER_OPTIONAL(Lib, Name, Type)
+#else
+#define SOFT_LINK_AVF_FRAMEWORK(Lib) SOFT_LINK_LIBRARY(Lib)
+#define SOFT_LINK_AVF_POINTER(Lib, Name, Type) SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL(Lib, Name, Type)
+#endif
+
+SOFT_LINK_AVF_FRAMEWORK(CoreMedia)
+
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_Alignment, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAlignmentType_Start, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAlignmentType_Middle, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAlignmentType_End, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_BoldStyle, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_ItalicStyle, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_UnderlineStyle, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_TextPositionPercentageRelativeToWritingDirection, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_WritingDirectionSizePercentage, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_OrthogonalLinePositionPercentageRelativeToWritingDirection, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_VerticalLayout, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextVerticalLayout_LeftToRight, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextVerticalLayout_RightToLeft, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_RelativeFontSize, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_FontFamilyName, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_ForegroundColorARGB, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_BackgroundColorARGB, CFStringRef)
+SOFT_LINK_AVF_POINTER(CoreMedia, kCMTextMarkupAttribute_CharacterBackgroundColorARGB, CFStringRef)
 
 #define kCMTextMarkupAttribute_Alignment getkCMTextMarkupAttribute_Alignment()
 #define kCMTextMarkupAlignmentType_Start getkCMTextMarkupAlignmentType_Start()
@@ -459,4 +467,4 @@ void InbandTextTrackPrivateAVF::setMode(InbandTextTrackPrivate::Mode newMode)
 
 } // namespace WebCore
 
-#endif // ENABLE(VIDEO) && ((USE(AVFOUNDATION) && !PLATFORM(WIN)) || PLATFORM(IOS))
+#endif // ENABLE(VIDEO) && (USE(AVFOUNDATION) || PLATFORM(IOS))
index 93c6d0b..838bc26 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef InbandTextTrackPrivateAVF_h
 #define InbandTextTrackPrivateAVF_h
 
-#if ENABLE(VIDEO) && ((USE(AVFOUNDATION) && !PLATFORM(WIN)) || PLATFORM(IOS))
+#if ENABLE(VIDEO) && (USE(AVFOUNDATION) || PLATFORM(IOS))
 
 #include "InbandTextTrackPrivate.h"
 #include "InbandTextTrackPrivateClient.h"
@@ -90,6 +90,6 @@ protected:
 
 } // namespace WebCore
 
-#endif //  ENABLE(VIDEO) && ((USE(AVFOUNDATION) && !PLATFORM(WIN)) || PLATFORM(IOS))
+#endif //  ENABLE(VIDEO) && (USE(AVFOUNDATION) || PLATFORM(IOS))
 
 #endif // InbandTextTrackPrivateAVF_h
index aa9aea8..12529c3 100644 (file)
@@ -74,9 +74,7 @@ MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation(MediaPlayer* play
     , m_ignoreLoadStateChanges(false)
     , m_haveReportedFirstVideoFrame(false)
     , m_playWhenFramesAvailable(false)
-#if !PLATFORM(WIN)
     , m_inbandTrackConfigurationPending(false)
-#endif
     , m_seekCount(0)
 {
     LOG(Media, "MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation(%p)", this);
@@ -267,10 +265,8 @@ void MediaPlayerPrivateAVFoundation::seek(float time)
     if (currentTime() == time)
         return;
 
-#if !PLATFORM(WIN)
     if (currentTrack())
         currentTrack()->beginSeeking();
-#endif
     
     LOG(Media, "MediaPlayerPrivateAVFoundation::seek(%p) - seeking to %f", this, time);
     m_seekTo = time;
@@ -599,10 +595,8 @@ void MediaPlayerPrivateAVFoundation::seekCompleted(bool finished)
     if (--m_seekCount)
         return;
 
-#if !PLATFORM(WIN)
     if (currentTrack())
         currentTrack()->endSeeking();
-#endif
 
     m_seekTo = MediaPlayer::invalidTime();
     updateStates();
@@ -833,10 +827,8 @@ void MediaPlayerPrivateAVFoundation::dispatchNotification()
         contentsNeedsDisplay();
         break;
     case Notification::InbandTracksNeedConfiguration:
-#if !PLATFORM(WIN)
         m_inbandTrackConfigurationPending = false;
         configureInbandTracks();
-#endif
         break;
 
     case Notification::None:
@@ -845,7 +837,6 @@ void MediaPlayerPrivateAVFoundation::dispatchNotification()
     }
 }
 
-#if !PLATFORM(WIN)
 void MediaPlayerPrivateAVFoundation::configureInbandTracks()
 {
     RefPtr<InbandTextTrackPrivateAVF> trackToEnable;
@@ -872,7 +863,6 @@ void MediaPlayerPrivateAVFoundation::trackModeChanged()
     m_inbandTrackConfigurationPending = true;
     scheduleMainThreadNotification(Notification::InbandTracksNeedConfiguration);
 }
-#endif
 
 size_t MediaPlayerPrivateAVFoundation::extraMemoryCost() const
 {
index 65215a7..3d37807 100644 (file)
@@ -39,10 +39,7 @@ namespace WebCore {
 class InbandTextTrackPrivateAVF;
 class GenericCueData;
 
-class MediaPlayerPrivateAVFoundation : public MediaPlayerPrivateInterface
-#if !PLATFORM(WIN)
-    , public AVFInbandTrackParent
-#endif
+class MediaPlayerPrivateAVFoundation : public MediaPlayerPrivateInterface, public AVFInbandTrackParent
 {
 public:
 
@@ -56,11 +53,9 @@ public:
     virtual void seekCompleted(bool);
     virtual void didEnd();
     virtual void contentsNeedsDisplay() { }
-#if !PLATFORM(WIN)
     virtual void configureInbandTracks();
     virtual void setCurrentTrack(InbandTextTrackPrivateAVF*) { }
     virtual InbandTextTrackPrivateAVF* currentTrack() const = 0;
-#endif
 
     class Notification {
     public:
@@ -268,10 +263,8 @@ protected:
 
     virtual size_t extraMemoryCost() const OVERRIDE;
 
-#if !PLATFORM(WIN)
     virtual void trackModeChanged() OVERRIDE;
     Vector<RefPtr<InbandTextTrackPrivateAVF> > m_textTracks;
-#endif
     
 private:
     MediaPlayer* m_player;
@@ -308,9 +301,7 @@ private:
     bool m_ignoreLoadStateChanges;
     bool m_haveReportedFirstVideoFrame;
     bool m_playWhenFramesAvailable;
-#if !PLATFORM(WIN)
     bool m_inbandTrackConfigurationPending;
-#endif
     size_t m_seekCount;
 };
 
index 95b9403..a3becdc 100644 (file)
@@ -42,6 +42,9 @@ SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetCancelLoading, void, __cdecl, (AVC
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetCopyAssetTracks, CFArrayRef, __cdecl, (AVCFAssetRef asset), (asset))
 #define AVCFAssetCopyAssetTracks softLink_AVCFAssetCopyAssetTracks
 
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetCopyAvailableMediaCharacteristicsWithMediaSelectionOptions, CFArrayRef, __cdecl, (AVCFAssetRef asset), (asset))
+#define AVCFAssetCopyAvailableMediaCharacteristicsWithMediaSelectionOptions softLink_AVCFAssetCopyAvailableMediaCharacteristicsWithMediaSelectionOptions
+
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetCopyTracksWithMediaCharacteristic, CFArrayRef, __cdecl, (AVCFAssetRef asset, CFStringRef mediaCharacteristic), (asset, mediaCharacteristic))
 #define AVCFAssetCopyTracksWithMediaCharacteristic softLink_AVCFAssetCopyTracksWithMediaCharacteristic
 
@@ -87,6 +90,15 @@ SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetIsPlayable, Boolean, __cdecl, (AVC
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetLoadValuesAsynchronouslyForProperties, void, __cdecl, (AVCFAssetRef asset, CFArrayRef properties, AVCFAssetLoadValuesCompletionCallback callback, void *clientContext), (asset, properties, callback, clientContext))
 #define AVCFAssetLoadValuesAsynchronouslyForProperties softLink_AVCFAssetLoadValuesAsynchronouslyForProperties
 
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetTrackCopyCommonMetadata, CFArrayRef, __cdecl, (AVCFAssetTrackRef assetTrack), (assetTrack))
+#define AVCFAssetTrackCopyCommonMetadata softLink_AVCFAssetTrackCopyCommonMetadata
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetTrackCopyExtendedLanguageTag, CFStringRef, __cdecl, (AVCFAssetTrackRef assetTrack), (assetTrack))
+#define AVCFAssetTrackCopyExtendedLanguageTag softLink_AVCFAssetTrackCopyExtendedLanguageTag
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetTrackCopyLanguageCode, CFStringRef, __cdecl, (AVCFAssetTrackRef assetTrack), (assetTrack))
+#define AVCFAssetTrackCopyLanguageCode softLink_AVCFAssetTrackCopyLanguageCode
+
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetTrackGetMediaType, CFStringRef, __cdecl, (AVCFAssetTrackRef assetTrack), (assetTrack))
 #define AVCFAssetTrackGetMediaType softLink_AVCFAssetTrackGetMediaType
 
@@ -99,6 +111,18 @@ SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetTrackGetPreferredTransform, CGAffi
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetTrackGetTotalSampleDataLength, int64_t, __cdecl, (AVCFAssetTrackRef assetTrack), (assetTrack))
 #define AVCFAssetTrackGetTotalSampleDataLength softLink_AVCFAssetTrackGetTotalSampleDataLength
 
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMediaSelectionCopyOptionsFromArrayFilteredAndSortedAccordingToPreferredLanguages, CFArrayRef, __cdecl, (CFArrayRef selectionOptions, CFArrayRef preferredLanguages), (selectionOptions, preferredLanguages))
+#define AVCFMediaSelectionCopyOptionsFromArrayFilteredAndSortedAccordingToPreferredLanguages softLink_AVCFMediaSelectionCopyOptionsFromArrayFilteredAndSortedAccordingToPreferredLanguages
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMetadataItemCopyStringValue, CFStringRef, __cdecl, (AVCFMetadataItemRef metadataItem), (metadataItem))
+#define AVCFMetadataItemCopyStringValue softLink_AVCFMetadataItemCopyStringValue
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMetadataItemCopyItemsWithKeyAndKeySpace, CFArrayRef, __cdecl, (CFArrayRef array, CFTypeRef key, CFStringRef keySpace), (array, key, keySpace))
+#define AVCFMetadataItemCopyItemsWithKeyAndKeySpace softLink_AVCFMetadataItemCopyItemsWithKeyAndKeySpace
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMetadataItemCopyItemsWithLocale, CFArrayRef, __cdecl, (CFArrayRef items, CFLocaleRef locale), (items, locale))
+#define AVCFMetadataItemCopyItemsWithLocale softLink_AVCFMetadataItemCopyItemsWithLocale
+
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerCreatePeriodicTimeObserverForInterval, AVCFPlayerObserverRef, __cdecl, (AVCFPlayerRef player, CMTime interval, dispatch_queue_t queue, AVCFPlayerPeriodicTimeObserverCallback callback, void *clientContext), (player, interval, queue, callback, clientContext))
 #define AVCFPlayerCreatePeriodicTimeObserverForInterval softLink_AVCFPlayerCreatePeriodicTimeObserverForInterval
 
@@ -123,6 +147,9 @@ SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemGetAsset, AVCFAssetRef, __cde
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemGetCurrentTime, CMTime, __cdecl, (AVCFPlayerItemRef playerItem), (playerItem))
 #define AVCFPlayerItemGetCurrentTime softLink_AVCFPlayerItemGetCurrentTime
 
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemGetDuration, CMTime, __cdecl, (AVCFPlayerItemRef playerItem), (playerItem))
+#define AVCFPlayerItemGetDuration softLink_AVCFPlayerItemGetDuration
+
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemGetStatus, AVCFPlayerItemStatus, __cdecl, (AVCFPlayerItemRef playerItem, CFErrorRef *errorOut), (playerItem, errorOut))
 #define AVCFPlayerItemGetStatus softLink_AVCFPlayerItemGetStatus
 
@@ -135,6 +162,12 @@ SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemIsPlaybackBufferFull, Boolean
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemIsPlaybackLikelyToKeepUp, Boolean, __cdecl, (AVCFPlayerItemRef playerItem), (playerItem))
 #define AVCFPlayerItemIsPlaybackLikelyToKeepUp softLink_AVCFPlayerItemIsPlaybackLikelyToKeepUp
 
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemLegibleOutputGetTypeID, CFTypeID, __cdecl, (), ())
+#define AVCFPlayerItemLegibleOutputGetTypeID softLink_AVCFPlayerItemLegibleOutputGetTypeID
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemRemoveOutput, void, __cdecl, (AVCFPlayerItemRef playerItem, AVCFPlayerItemOutputRef output), (playerItem, output))
+#define AVCFPlayerItemRemoveOutput softLink_AVCFPlayerItemRemoveOutput
+
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemSeekToTimeWithToleranceAndCompletionCallback, AVCFAssetRef, __cdecl, (AVCFPlayerItemRef playerItem, CMTime time, CMTime toleranceBefore, CMTime toleranceAfter, AVCFPlayerItemSeekCompletionCallback completionCallback, void *context), (playerItem, time, toleranceBefore, toleranceAfter, completionCallback, context))
 #define AVCFPlayerItemSeekToTimeWithToleranceAndCompletionCallback softLink_AVCFPlayerItemSeekToTimeWithToleranceAndCompletionCallback
 
@@ -159,6 +192,9 @@ SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerLayerIsReadyForDisplay, Boolean,
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerLayerSetPlayer, void, __cdecl, (AVCFPlayerLayerRef playerLayer, AVCFPlayerRef player), (playerLayer, player))
 #define AVCFPlayerLayerSetPlayer softLink_AVCFPlayerLayerSetPlayer
 
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerPlay, void, __cdecl, (AVCFPlayerRef player), (player))
+#define AVCFPlayerPlay softLink_AVCFPlayerPlay
+
 SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerRemoveObserver, OSStatus, __cdecl, (AVCFPlayerRef player, AVCFPlayerObserverRef observer), (player, observer))
 #define AVCFPlayerRemoveObserver softLink_AVCFPlayerRemoveObserver
 
@@ -179,73 +215,168 @@ SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFURLAssetCreateWithURLAndOptions, AVCFUR
 
 SOFT_LINK_DLL_IMPORT_OPTIONAL(AVFoundationCF, AVCFPlayerSetDirect3DDevice, void, __cdecl, (AVCFPlayerRef player, IDirect3DDevice9* d3dDevice))
 
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetGetSelectionGroupForMediaCharacteristic , AVCFMediaSelectionGroupRef, __cdecl, (AVCFAssetRef asset, CFStringRef mediaCharacteristic), (asset, mediaCharacteristic))
+#define AVCFAssetGetSelectionGroupForMediaCharacteristic  softLink_AVCFAssetGetSelectionGroupForMediaCharacteristic 
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMediaSelectionCopyPlayableOptionsFromArray, CFArrayRef, __cdecl, (CFArrayRef selectionOptions), (selectionOptions))
+#define AVCFMediaSelectionCopyPlayableOptionsFromArray softLink_AVCFMediaSelectionCopyPlayableOptionsFromArray
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMediaSelectionOptionCopyCommonMetadata, CFArrayRef, __cdecl, (AVCFMediaSelectionOptionRef selectionOption), (selectionOption))
+#define AVCFMediaSelectionOptionCopyCommonMetadata softLink_AVCFMediaSelectionOptionCopyCommonMetadata
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMediaSelectionOptionCopyLocale, CFLocaleRef, __cdecl, (AVCFMediaSelectionOptionRef selectionOption), (selectionOption))
+#define AVCFMediaSelectionOptionCopyLocale softLink_AVCFMediaSelectionOptionCopyLocale
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMediaSelectionOptionGetMediaType, CFStringRef, __cdecl, (AVCFMediaSelectionOptionRef selectionOption), (selectionOption))
+#define AVCFMediaSelectionOptionGetMediaType softLink_AVCFMediaSelectionOptionGetMediaType
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMediaSelectionOptionHasMediaCharacteristic, Boolean, __cdecl, (AVCFMediaSelectionOptionRef selectionOption, CFStringRef mediaCharacteristic), (selectionOption, mediaCharacteristic))
+#define AVCFMediaSelectionOptionHasMediaCharacteristic softLink_AVCFMediaSelectionOptionHasMediaCharacteristic
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMediaSelectionGroupAllowsEmptySelection, Boolean, __cdecl, (AVCFMediaSelectionGroupRef selectionGroup), (selectionGroup))
+#define AVCFMediaSelectionGroupAllowsEmptySelection softLink_AVCFMediaSelectionGroupAllowsEmptySelection
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFMediaSelectionGroupGetOptions, CFArrayRef, __cdecl, (AVCFMediaSelectionGroupRef selectionGroup), (selectionGroup))
+#define AVCFMediaSelectionGroupGetOptions softLink_AVCFMediaSelectionGroupGetOptions
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemAddOutput, void, __cdecl, (AVCFPlayerItemRef playerItem, AVCFPlayerItemOutputRef output), (playerItem, output))
+#define AVCFPlayerItemAddOutput softLink_AVCFPlayerItemAddOutput
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemLegibleOutputCreateWithMediaSubtypesForNativeRepresentation, AVCFPlayerItemLegibleOutputRef, __cdecl, (CFAllocatorRef allocator, CFArrayRef subtypes), (allocator, subtypes))
+#define AVCFPlayerItemLegibleOutputCreateWithMediaSubtypesForNativeRepresentation softLink_AVCFPlayerItemLegibleOutputCreateWithMediaSubtypesForNativeRepresentation
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemGetSelectedMediaOptionInMediaSelectionGroup, AVCFMediaSelectionOptionRef, __cdecl, (AVCFPlayerItemRef playerItem, AVCFMediaSelectionGroupRef selectionGroup), (playerItem, selectionGroup))
+#define AVCFPlayerItemGetSelectedMediaOptionInMediaSelectionGroup softLink_AVCFPlayerItemGetSelectedMediaOptionInMediaSelectionGroup
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemLegibleOutputSetAdvanceIntervalForCallbackInvocation, void, __cdecl, (AVCFPlayerItemLegibleOutputRef legibleOutput, CFTimeInterval timeInterval), (legibleOutput, timeInterval))
+#define AVCFPlayerItemLegibleOutputSetAdvanceIntervalForCallbackInvocation softLink_AVCFPlayerItemLegibleOutputSetAdvanceIntervalForCallbackInvocation
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemLegibleOutputSetCallbacks, void, __cdecl, (AVCFPlayerItemLegibleOutputRef output, const AVCFPlayerItemLegibleOutputCallbacks* callbacks, dispatch_queue_t callbackQueue), (output, callbacks, callbackQueue))
+#define AVCFPlayerItemLegibleOutputSetCallbacks softLink_AVCFPlayerItemLegibleOutputSetCallbacks
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemLegibleOutputSetTextStylingResolution, void, __cdecl, (AVCFPlayerItemLegibleOutputRef output, CFStringRef textStylingResolution), (output, textStylingResolution))
+#define AVCFPlayerItemLegibleOutputSetTextStylingResolution softLink_AVCFPlayerItemLegibleOutputSetTextStylingResolution
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemOutputSetSuppressPlayerRendering, void, __cdecl, (AVCFPlayerItemOutputRef output, Boolean suppressed), (output, suppressed))
+#define AVCFPlayerItemOutputSetSuppressPlayerRendering softLink_AVCFPlayerItemOutputSetSuppressPlayerRendering
+
+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemSelectMediaOptionInMediaSelectionGroup, void, __cdecl, (AVCFPlayerItemRef playerItem, AVCFMediaSelectionOptionRef selectionOption, AVCFMediaSelectionGroupRef selectionGroup), (playerItem, selectionOption, selectionGroup))
+#define AVCFPlayerItemSelectMediaOptionInMediaSelectionGroup softLink_AVCFPlayerItemSelectMediaOptionInMediaSelectionGroup
+
+#endif
+
 // Variables
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetImageGeneratorApertureModeCleanAperture, const CFStringRef);
-#define AVCFAssetImageGeneratorApertureModeCleanAperture get_AVCFAssetImageGeneratorApertureModeCleanAperture()
+#define AVCFAssetImageGeneratorApertureModeCleanAperture getAVCFAssetImageGeneratorApertureModeCleanAperture()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetPropertyDuration, const CFStringRef);
-#define AVCFAssetPropertyDuration get_AVCFAssetPropertyDuration()
+#define AVCFAssetPropertyDuration getAVCFAssetPropertyDuration()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetPropertyNaturalSize, const CFStringRef);
-#define AVCFAssetPropertyNaturalSize get_AVCFAssetPropertyNaturalSize()
+#define AVCFAssetPropertyNaturalSize getAVCFAssetPropertyNaturalSize()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetPropertyPlayable, const CFStringRef);
-#define AVCFAssetPropertyPlayable get_AVCFAssetPropertyPlayable()
+#define AVCFAssetPropertyPlayable getAVCFAssetPropertyPlayable()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetPropertyPreferredRate, const CFStringRef);
-#define AVCFAssetPropertyPreferredRate get_AVCFAssetPropertyPreferredRate()
+#define AVCFAssetPropertyPreferredRate getAVCFAssetPropertyPreferredRate()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetPropertyPreferredTransform, const CFStringRef);
-#define AVCFAssetPropertyPreferredTransform get_AVCFAssetPropertyPreferredTransform()
+#define AVCFAssetPropertyPreferredTransform getAVCFAssetPropertyPreferredTransform()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetPropertyTracks, const CFStringRef);
-#define AVCFAssetPropertyTracks get_AVCFAssetPropertyTracks()
+#define AVCFAssetPropertyTracks getAVCFAssetPropertyTracks()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaCharacteristicAudible, const CFStringRef);
-#define AVCFMediaCharacteristicAudible get_AVCFMediaCharacteristicAudible()
+#define AVCFMediaCharacteristicAudible getAVCFMediaCharacteristicAudible()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaCharacteristicVisual, const CFStringRef);
-#define AVCFMediaCharacteristicVisual get_AVCFMediaCharacteristicVisual()
+#define AVCFMediaCharacteristicVisual getAVCFMediaCharacteristicVisual()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaTypeAudio, const CFStringRef);
-#define AVCFMediaTypeAudio get_AVCFMediaTypeAudio()
+#define AVCFMediaTypeAudio getAVCFMediaTypeAudio()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaTypeClosedCaption, const CFStringRef);
-#define AVCFMediaTypeClosedCaption get_AVCFMediaTypeClosedCaption()
+#define AVCFMediaTypeClosedCaption getAVCFMediaTypeClosedCaption()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaTypeVideo, const CFStringRef);
-#define AVCFMediaTypeVideo get_AVCFMediaTypeVideo()
+#define AVCFMediaTypeVideo getAVCFMediaTypeVideo()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMetadataCommonKeyTitle, const CFStringRef);
+#define AVCFMetadataCommonKeyTitle getAVCFMetadataCommonKeyTitle()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMetadataKeySpaceCommon, const CFStringRef);
+#define AVCFMetadataKeySpaceCommon getAVCFMetadataKeySpaceCommon()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemDidPlayToEndTimeNotification, const CFStringRef);
-#define AVCFPlayerItemDidPlayToEndTimeNotification get_AVCFPlayerItemDidPlayToEndTimeNotification()
+#define AVCFPlayerItemDidPlayToEndTimeNotification getAVCFPlayerItemDidPlayToEndTimeNotification()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemDurationChangedNotification, const CFStringRef);
+#define AVCFPlayerItemDurationChangedNotification getAVCFPlayerItemDurationChangedNotification()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemIsPlaybackBufferEmptyChangedNotification, const CFStringRef);
-#define AVCFPlayerItemIsPlaybackBufferEmptyChangedNotification get_AVCFPlayerItemIsPlaybackBufferEmptyChangedNotification()
+#define AVCFPlayerItemIsPlaybackBufferEmptyChangedNotification getAVCFPlayerItemIsPlaybackBufferEmptyChangedNotification()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemIsPlaybackBufferFullChangedNotification, const CFStringRef);
-#define AVCFPlayerItemIsPlaybackBufferFullChangedNotification get_AVCFPlayerItemIsPlaybackBufferFullChangedNotification()
+#define AVCFPlayerItemIsPlaybackBufferFullChangedNotification getAVCFPlayerItemIsPlaybackBufferFullChangedNotification()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemIsPlaybackLikelyToKeepUpChangedNotification, const CFStringRef);
-#define AVCFPlayerItemIsPlaybackLikelyToKeepUpChangedNotification get_AVCFPlayerItemIsPlaybackLikelyToKeepUpChangedNotification()
+#define AVCFPlayerItemIsPlaybackLikelyToKeepUpChangedNotification getAVCFPlayerItemIsPlaybackLikelyToKeepUpChangedNotification()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemLoadedTimeRangesChangedNotification, const CFStringRef);
-#define AVCFPlayerItemLoadedTimeRangesChangedNotification get_AVCFPlayerItemLoadedTimeRangesChangedNotification()
+#define AVCFPlayerItemLoadedTimeRangesChangedNotification getAVCFPlayerItemLoadedTimeRangesChangedNotification()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemPresentationSizeChangedNotification, const CFStringRef);
-#define AVCFPlayerItemPresentationSizeChangedNotification get_AVCFPlayerItemPresentationSizeChangedNotification()
+#define AVCFPlayerItemPresentationSizeChangedNotification getAVCFPlayerItemPresentationSizeChangedNotification()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemSeekableTimeRangesChangedNotification, const CFStringRef);
-#define AVCFPlayerItemSeekableTimeRangesChangedNotification get_AVCFPlayerItemSeekableTimeRangesChangedNotification()
+#define AVCFPlayerItemSeekableTimeRangesChangedNotification getAVCFPlayerItemSeekableTimeRangesChangedNotification()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemStatusChangedNotification, const CFStringRef);
-#define AVCFPlayerItemStatusChangedNotification get_AVCFPlayerItemStatusChangedNotification()
+#define AVCFPlayerItemStatusChangedNotification getAVCFPlayerItemStatusChangedNotification()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemTracksChangedNotification, const CFStringRef);
-#define AVCFPlayerItemTracksChangedNotification get_AVCFPlayerItemTracksChangedNotification()
+#define AVCFPlayerItemTracksChangedNotification getAVCFPlayerItemTracksChangedNotification()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerRateChangedNotification, const CFStringRef);
-#define AVCFPlayerRateChangedNotification get_AVCFPlayerRateChangedNotification()
+#define AVCFPlayerRateChangedNotification getAVCFPlayerRateChangedNotification()
 
 SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL(AVFoundationCF, AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey, const CFStringRef);
-#define AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey get_AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey()
+#define AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey getAVCFPlayerEnableHardwareAcceleratedVideoDecoderKey()
+
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetPropertyAvailableMediaCharacteristicsWithMediaSelectionOptions, const CFStringRef);
+#define AVCFAssetPropertyAvailableMediaCharacteristicsWithMediaSelectionOptions  getAVCFAssetPropertyAvailableMediaCharacteristicsWithMediaSelectionOptions()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaCharacteristicEasyToRead, const CFStringRef);
+#define AVCFMediaCharacteristicEasyToRead getAVCFMediaCharacteristicEasyToRead()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaCharacteristicContainsOnlyForcedSubtitles, const CFStringRef);
+#define AVCFMediaCharacteristicContainsOnlyForcedSubtitles getAVCFMediaCharacteristicContainsOnlyForcedSubtitles()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaCharacteristicDescribesMusicAndSoundForAccessibility, const CFStringRef);
+#define AVCFMediaCharacteristicDescribesMusicAndSoundForAccessibility getAVCFMediaCharacteristicDescribesMusicAndSoundForAccessibility()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaCharacteristicIsMainProgramContent, const CFStringRef);
+#define AVCFMediaCharacteristicIsMainProgramContent getAVCFMediaCharacteristicIsMainProgramContent()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaCharacteristicLegible, const CFStringRef);
+#define AVCFMediaCharacteristicLegible getAVCFMediaCharacteristicLegible()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaCharacteristicTranscribesSpokenDialogForAccessibility, const CFStringRef);
+#define AVCFMediaCharacteristicTranscribesSpokenDialogForAccessibility getAVCFMediaCharacteristicTranscribesSpokenDialogForAccessibility()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFMediaTypeSubtitle, const CFStringRef);
+#define AVCFMediaTypeSubtitle getAVCFMediaTypeSubtitle()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerAppliesMediaSelectionCriteriaAutomaticallyKey, const CFStringRef);
+#define AVCFPlayerAppliesMediaSelectionCriteriaAutomaticallyKey getAVCFPlayerAppliesMediaSelectionCriteriaAutomaticallyKey()
+
+SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly, const CFStringRef);
+#define AVCFPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly getAVCFPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly()
+
+#endif
index 0020f4b..8714ecf 100644 (file)
@@ -53,7 +53,10 @@ SOFT_LINK_DLL_IMPORT(CoreMedia, CMTimeMakeFromDictionary, CMTime, __cdecl, (CFDi
 SOFT_LINK_DLL_IMPORT(CoreMedia, CMTimeMakeWithSeconds, CMTime, __cdecl, (Float64 seconds, int32_t preferredTimeScale), (seconds, preferredTimeScale))
 #define CMTimeMakeWithSeconds softLink_CMTimeMakeWithSeconds
 
+SOFT_LINK_DLL_IMPORT(CoreMedia, CMTimeRangeGetEnd, CMTime, __cdecl, (CMTimeRange range), (range))
+#define CMTimeRangeGetEnd softLink_CMTimeRangeGetEnd
+
 // Variables
 
 SOFT_LINK_VARIABLE_DLL_IMPORT(CoreMedia, kCMTimeZero, const CMTime);
-#define kCMTimeZero get_kCMTimeZero()
+#define kCMTimeZero getkCMTimeZero()
diff --git a/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp b/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp
new file mode 100644 (file)
index 0000000..849e118
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#if PLATFORM(WIN) && ENABLE(VIDEO) && HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
+
+#include "InbandTextTrackPrivateAVCF.h"
+
+#include "FloatConversion.h"
+#include "InbandTextTrackPrivate.h"
+#include "InbandTextTrackPrivateAVF.h"
+#include "Logging.h"
+#include "SoftLinking.h"
+
+#include <AVFoundationCF/AVCFPlayerItemLegibleOutput.h>
+#include <AVFoundationCF/AVFoundationCF.h>
+
+#include <d3d9.h>
+
+// The softlink header files must be included after the AVCF and CoreMedia header files.
+#include "AVFoundationCFSoftLinking.h"
+
+namespace WebCore {
+
+InbandTextTrackPrivateAVCF::InbandTextTrackPrivateAVCF(AVFInbandTrackParent* player, AVCFMediaSelectionOptionRef selection)
+    : InbandTextTrackPrivateAVF(player)
+    , m_mediaSelectionOption(selection)
+{
+}
+
+void InbandTextTrackPrivateAVCF::disconnect()
+{
+    m_mediaSelectionOption = 0;
+    InbandTextTrackPrivateAVF::disconnect();
+}
+
+InbandTextTrackPrivate::Kind InbandTextTrackPrivateAVCF::kind() const
+{
+    if (!m_mediaSelectionOption)
+        return InbandTextTrackPrivate::None;
+
+    CFStringRef mediaType = AVCFMediaSelectionOptionGetMediaType(mediaSelectionOption());
+    
+    if (CFStringCompare(mediaType, AVCFMediaTypeClosedCaption, kCFCompareCaseInsensitive) == kCFCompareEqualTo)
+        return InbandTextTrackPrivate::Captions;
+    if (CFStringCompare(mediaType, AVCFMediaTypeSubtitle, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+        if (AVCFMediaSelectionOptionHasMediaCharacteristic(mediaSelectionOption(), AVCFMediaCharacteristicContainsOnlyForcedSubtitles))
+            return InbandTextTrackPrivate::Forced;
+
+        // An "SDH" track is a subtitle track created for the deaf or hard-of-hearing. "captions" in WebVTT are
+        // "labeled as appropriate for the hard-of-hearing", so tag SDH sutitles as "captions".
+        if (AVCFMediaSelectionOptionHasMediaCharacteristic(mediaSelectionOption(), AVCFMediaCharacteristicTranscribesSpokenDialogForAccessibility))
+            return InbandTextTrackPrivate::Captions;
+        if (AVCFMediaSelectionOptionHasMediaCharacteristic(mediaSelectionOption(), AVCFMediaCharacteristicDescribesMusicAndSoundForAccessibility))
+            return InbandTextTrackPrivate::Captions;
+        
+        return InbandTextTrackPrivate::Subtitles;
+    }
+
+    return InbandTextTrackPrivate::Captions;
+}
+
+bool InbandTextTrackPrivateAVCF::isClosedCaptions() const
+{
+    if (!m_mediaSelectionOption)
+        return false;
+
+    CFStringRef mediaType = AVCFMediaSelectionOptionGetMediaType(mediaSelectionOption());
+
+    return (CFStringCompare(mediaType, AVCFMediaTypeClosedCaption, kCFCompareCaseInsensitive) == kCFCompareEqualTo);
+}
+
+bool InbandTextTrackPrivateAVCF::isSDH() const
+{
+    if (!m_mediaSelectionOption)
+        return false;
+    
+    CFStringRef mediaType = AVCFMediaSelectionOptionGetMediaType(mediaSelectionOption());
+
+    if (CFStringCompare(mediaType, AVCFMediaTypeSubtitle, kCFCompareCaseInsensitive) != kCFCompareEqualTo)
+        return false;
+
+    if (AVCFMediaSelectionOptionHasMediaCharacteristic(mediaSelectionOption(), AVCFMediaCharacteristicTranscribesSpokenDialogForAccessibility)
+        && AVCFMediaSelectionOptionHasMediaCharacteristic(mediaSelectionOption(), AVCFMediaCharacteristicDescribesMusicAndSoundForAccessibility))
+        return true;
+
+    return false;
+}
+    
+bool InbandTextTrackPrivateAVCF::containsOnlyForcedSubtitles() const
+{
+    if (!m_mediaSelectionOption)
+        return false;
+    
+    return AVCFMediaSelectionOptionHasMediaCharacteristic(mediaSelectionOption(), AVCFMediaCharacteristicContainsOnlyForcedSubtitles);
+}
+
+bool InbandTextTrackPrivateAVCF::isMainProgramContent() const
+{
+    if (!m_mediaSelectionOption)
+        return false;
+    
+    return AVCFMediaSelectionOptionHasMediaCharacteristic(mediaSelectionOption(), AVCFMediaCharacteristicIsMainProgramContent);
+}
+
+bool InbandTextTrackPrivateAVCF::isEasyToRead() const
+{
+    if (!m_mediaSelectionOption)
+        return false;
+
+    return AVCFMediaSelectionOptionHasMediaCharacteristic(mediaSelectionOption(), AVCFMediaCharacteristicEasyToRead);
+}
+
+AtomicString InbandTextTrackPrivateAVCF::label() const
+{
+    if (!m_mediaSelectionOption)
+        return emptyAtom;
+
+    RetainPtr<CFStringRef> title;
+
+    RetainPtr<CFArrayRef> commonMetaData = adoptCF(AVCFMediaSelectionOptionCopyCommonMetadata(mediaSelectionOption()));
+    RetainPtr<CFArrayRef> titles = adoptCF(AVCFMetadataItemCopyItemsWithKeyAndKeySpace(commonMetaData.get(), AVCFMetadataCommonKeyTitle, AVCFMetadataKeySpaceCommon));
+    CFIndex titlesCount = CFArrayGetCount(titles.get());
+    if (!titlesCount)
+        return emptyAtom;
+
+    // If possible, return a title in one of the user's preferred languages.
+    RetainPtr<CFArrayRef> preferredLanguages = CFLocaleCopyPreferredLanguages();
+    RetainPtr<CFArrayRef> titlesForPreferredLanguages = AVCFMediaSelectionCopyOptionsFromArrayFilteredAndSortedAccordingToPreferredLanguages(titles.get(), preferredLanguages.get());
+    CFIndex preferredTitlesCount = CFArrayGetCount(titlesForPreferredLanguages.get());
+    if (preferredTitlesCount) {
+        AVCFMetadataItemRef titleMetadata = static_cast<AVCFMetadataItemRef>(CFArrayGetValueAtIndex(titlesForPreferredLanguages.get(), 0));
+        title = adoptCF(AVCFMetadataItemCopyStringValue(titleMetadata));
+    }
+
+    if (!title) {
+        AVCFMetadataItemRef titleMetadata = static_cast<AVCFMetadataItemRef>(CFArrayGetValueAtIndex(titles.get(), 0));
+        title = adoptCF(AVCFMetadataItemCopyStringValue(titleMetadata));
+    }
+
+    return title ? AtomicString(title.get()) : emptyAtom;
+}
+
+AtomicString InbandTextTrackPrivateAVCF::language() const
+{
+    if (!m_mediaSelectionOption)
+        return emptyAtom;
+
+    RetainPtr<CFLocaleRef> locale = adoptCF(AVCFMediaSelectionOptionCopyLocale(mediaSelectionOption()));
+    return CFLocaleGetIdentifier(locale.get());
+}
+
+bool InbandTextTrackPrivateAVCF::isDefault() const
+{
+    return false;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.h b/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.h
new file mode 100644 (file)
index 0000000..d9d70b3
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef InbandTextTrackPrivateAVCF_h
+#define InbandTextTrackPrivateAVCF_h
+
+#if PLATFORM(WIN) && ENABLE(VIDEO) && HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
+
+#include "InbandTextTrackPrivateAVF.h"
+#include <AVFoundationCF/AVCFPlayerItem.h>
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+class InbandTextTrackPrivateAVCF : public InbandTextTrackPrivateAVF {
+public:
+    static PassRefPtr<InbandTextTrackPrivateAVCF> create(AVFInbandTrackParent* player,  AVCFMediaSelectionOptionRef selection)
+    {
+        return adoptRef(new InbandTextTrackPrivateAVCF(player, selection));
+    }
+
+    ~InbandTextTrackPrivateAVCF() { }
+
+    virtual InbandTextTrackPrivate::Kind kind() const OVERRIDE;
+    virtual bool isClosedCaptions() const OVERRIDE;
+    virtual bool isSDH() const OVERRIDE;
+    virtual bool containsOnlyForcedSubtitles() const OVERRIDE;
+    virtual bool isMainProgramContent() const OVERRIDE;
+    virtual bool isEasyToRead() const OVERRIDE;
+    virtual AtomicString label() const OVERRIDE;
+    virtual AtomicString language() const OVERRIDE;
+    virtual bool isDefault() const OVERRIDE;
+
+    virtual void disconnect() OVERRIDE;
+
+    virtual bool isLegacyClosedCaptionsTrack() const OVERRIDE { return false; }
+
+    AVCFMediaSelectionOptionRef mediaSelectionOption() const { return m_mediaSelectionOption.get(); }
+
+protected:
+    InbandTextTrackPrivateAVCF(AVFInbandTrackParent*, AVCFMediaSelectionOptionRef);
+    
+    RetainPtr<AVCFMediaSelectionOptionRef> m_mediaSelectionOption;
+};
+
+}
+
+#endif
+#endif
diff --git a/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.cpp b/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.cpp
new file mode 100644 (file)
index 0000000..b526b98
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO) && USE(AVFOUNDATION) && !HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT) && !PLATFORM(IOS)
+
+#include "InbandTextTrackPrivateLegacyAVCF.h"
+
+#include "InbandTextTrackPrivateAVF.h"
+#include "Logging.h"
+#include "MediaPlayerPrivateAVFoundationCF.h"
+#include "SoftLinking.h"
+
+#include <AVFoundationCF/AVFoundationCF.h>
+
+#include <d3d9.h>
+
+// The softlink header files must be included after the AVCF and CoreMedia header files.
+#include "AVFoundationCFSoftLinking.h"
+
+namespace WebCore {
+
+InbandTextTrackPrivateLegacyAVCF::InbandTextTrackPrivateLegacyAVCF(MediaPlayerPrivateAVFoundationCF* player, AVCFPlayerItemTrackRef track)
+    : InbandTextTrackPrivateAVF(player)
+    , m_playerItemTrack(track)
+{
+}
+
+void InbandTextTrackPrivateLegacyAVCF::disconnect()
+{
+    m_playerItemTrack = 0;
+    InbandTextTrackPrivateAVF::disconnect();
+}
+
+InbandTextTrackPrivate::Kind InbandTextTrackPrivateLegacyAVCF::kind() const
+{
+    if (!m_playerItemTrack)
+        return InbandTextTrackPrivate::None;
+
+    return InbandTextTrackPrivate::Captions;
+}
+
+bool InbandTextTrackPrivateLegacyAVCF::isClosedCaptions() const
+{
+    return m_playerItemTrack;
+}
+
+bool InbandTextTrackPrivateLegacyAVCF::containsOnlyForcedSubtitles() const
+{
+    return false;
+}
+
+bool InbandTextTrackPrivateLegacyAVCF::isMainProgramContent() const
+{
+    return m_playerItemTrack;
+}
+
+bool InbandTextTrackPrivateLegacyAVCF::isEasyToRead() const
+{
+    return false;
+}
+
+AtomicString InbandTextTrackPrivateLegacyAVCF::label() const
+{
+    if (!m_playerItemTrack)
+        return emptyAtom;
+
+    RetainPtr<CFStringRef> title;
+
+    RetainPtr<AVCFAssetTrackRef> assetTrack = adoptCF(AVCFPlayerItemTrackCopyAssetTrack(m_playerItemTrack.get()));
+    RetainPtr<CFArrayRef> commonMetaData = adoptCF(AVCFAssetTrackCopyCommonMetadata(assetTrack.get()));
+    RetainPtr<CFArrayRef> titles = adoptCF(AVCFMetadataItemCopyItemsWithKeyAndKeySpace(commonMetaData.get(), AVCFMetadataCommonKeyTitle, AVCFMetadataKeySpaceCommon));
+    CFIndex titlesCount = CFArrayGetCount(titles.get());
+    if (titlesCount) {
+        RetainPtr<CFLocaleRef> currentLocale = adoptCF(CFLocaleCopyCurrent());
+        RetainPtr<CFArrayRef> titlesForPreferredLanguages = adoptCF(AVCFMetadataItemCopyItemsWithLocale(titles.get(), currentLocale.get()));
+        CFIndex preferredTitlesCount = CFArrayGetCount(titlesForPreferredLanguages.get());
+        if (preferredTitlesCount) {
+            AVCFMetadataItemRef titleMetadata = static_cast<AVCFMetadataItemRef>(CFArrayGetValueAtIndex(titlesForPreferredLanguages.get(), 0));
+            title = adoptCF(AVCFMetadataItemCopyStringValue(titleMetadata));
+        }
+
+        if (!title) {
+            AVCFMetadataItemRef titleMetadata = static_cast<AVCFMetadataItemRef>(CFArrayGetValueAtIndex(titles.get(), 0));
+            title = adoptCF(AVCFMetadataItemCopyStringValue(titleMetadata));
+        }
+    }
+
+    return title ? AtomicString(title.get()) : emptyAtom;
+}
+
+AtomicString InbandTextTrackPrivateLegacyAVCF::language() const
+{
+    if (!m_playerItemTrack)
+        return emptyAtom;
+
+    RetainPtr<AVCFAssetTrackRef> assetTrack = adoptCF(AVCFPlayerItemTrackCopyAssetTrack(m_playerItemTrack.get()));
+    RetainPtr<CFStringRef> languageCode = adoptCF(AVCFAssetTrackCopyLanguageCode(assetTrack.get()));
+    RetainPtr<CFLocaleRef> locale = adoptCF(CFLocaleCreate(kCFAllocatorDefault, languageCode.get()));
+    return CFLocaleGetIdentifier(locale.get());
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.h b/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.h
new file mode 100644 (file)
index 0000000..29cfc61
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef InbandTextTrackPrivateLegacyAVCF_h
+#define InbandTextTrackPrivateLegacyAVCF_h
+
+#if ENABLE(VIDEO) && USE(AVFOUNDATION) && !HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT) && !PLATFORM(IOS)
+
+#include "InbandTextTrackPrivateAVF.h"
+#include <AVFoundationCF/AVCFPlayerItemTrack.h>
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+class MediaPlayerPrivateAVFoundationCF;
+
+class InbandTextTrackPrivateLegacyAVCF : public InbandTextTrackPrivateAVF {
+public:
+    static PassRefPtr<InbandTextTrackPrivateLegacyAVCF> create(MediaPlayerPrivateAVFoundationCF* player, AVCFPlayerItemTrackRef track)
+    {
+        return adoptRef(new InbandTextTrackPrivateLegacyAVCF(player, track));
+    }
+
+    ~InbandTextTrackPrivateLegacyAVCF() { }
+
+    virtual InbandTextTrackPrivate::Kind kind() const OVERRIDE;
+    virtual bool isClosedCaptions() const OVERRIDE;
+    virtual bool containsOnlyForcedSubtitles() const OVERRIDE;
+    virtual bool isMainProgramContent() const OVERRIDE;
+    virtual bool isEasyToRead() const OVERRIDE;
+    virtual AtomicString label() const OVERRIDE;
+    virtual AtomicString language() const OVERRIDE;
+
+    virtual void disconnect() OVERRIDE;
+
+    virtual bool isLegacyClosedCaptionsTrack() const OVERRIDE { return true; }
+
+    AVCFPlayerItemTrackRef avPlayerItemTrack() const { return m_playerItemTrack.get(); }
+
+protected:
+    InbandTextTrackPrivateLegacyAVCF(MediaPlayerPrivateAVFoundationCF*, AVCFPlayerItemTrackRef);
+    
+    RetainPtr<AVCFPlayerItemTrackRef> m_playerItemTrack;
+};
+
+}
+
+#endif // ENABLE(VIDEO) && USE(AVFOUNDATION) && !HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT) && !PLATFORM(IOS)
+
+#endif
index 6e76f00..26535c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,7 +25,7 @@
 
 #include "config.h"
 
-#if PLATFORM(WIN)&& ENABLE(VIDEO) 
+#if PLATFORM(WIN) && ENABLE(VIDEO) 
 
 #if USE(AVFOUNDATION)
 
 #include "FloatConversion.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
+#include "InbandTextTrackPrivateAVCF.h"
 #include "KURL.h"
 #include "Logging.h"
 #include "PlatformCALayer.h"
 #include "SoftLinking.h"
 #include "TimeRanges.h"
 
+#include <AVFoundationCF/AVCFPlayerItem.h>
+#include <AVFoundationCF/AVCFPlayerItemLegibleOutput.h>
 #include <AVFoundationCF/AVCFPlayerLayer.h>
 #include <AVFoundationCF/AVFoundationCF.h>
 #include <CoreMedia/CoreMedia.h>
@@ -50,6 +53,7 @@
 #include <dispatch/dispatch.h>
 #include <wtf/HashMap.h>
 #include <wtf/Threading.h>
+#include <wtf/text/CString.h>
 
 // The softlink header files must be included after the AVCF and CoreMedia header files.
 #include "AVFoundationCFSoftLinking.h"
@@ -95,6 +99,13 @@ public:
     
     void seekToTime(float);
 
+    void setCurrentTrack(InbandTextTrackPrivateAVF*);
+    InbandTextTrackPrivateAVF* currentTrack() const { return m_currentTrack; }
+
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+    static void legibleOutputCallback(void* context, AVCFPlayerItemLegibleOutputRef, CFArrayRef attributedString, CFArrayRef nativeSampleBuffers, CMTime itemTime);
+    static void processCue(void* context);
+#endif
     static void loadMetadataCompletionCallback(AVCFAssetRef, void*);
     static void loadPlayableCompletionCallback(AVCFAssetRef, void*);
     static void periodicTimeObserverCallback(AVCFPlayerRef, CMTime, void*);
@@ -107,6 +118,10 @@ public:
     inline AVCFPlayerItemRef avPlayerItem() const { return (AVCFPlayerItemRef)m_avPlayerItem.get(); }
     inline AVCFPlayerObserverRef timeObserver() const { return (AVCFPlayerObserverRef)m_timeObserver.get(); }
     inline AVCFAssetImageGeneratorRef imageGenerator() const { return m_imageGenerator.get(); }
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+    inline AVCFPlayerItemLegibleOutputRef legibleOutput() const { return m_legibleOutput.get(); }
+    AVCFMediaSelectionGroupRef safeMediaSelectionGroupForLegibleMedia() const;
+#endif
     inline dispatch_queue_t dispatchQueue() const { return m_notificationQueue; }
 
 private:
@@ -131,6 +146,10 @@ private:
     RetainPtr<AVCFPlayerLayerRef> m_avCFVideoLayer;
     RetainPtr<AVCFPlayerObserverRef> m_timeObserver;
     RetainPtr<AVCFAssetImageGeneratorRef> m_imageGenerator;
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+    RetainPtr<AVCFPlayerItemLegibleOutputRef> m_legibleOutput;
+    RetainPtr<AVCFMediaSelectionGroupRef> m_selectionGroup;
+#endif
     dispatch_queue_t m_notificationQueue;
 
     mutable RetainPtr<CACFLayerRef> m_caVideoLayer;
@@ -138,6 +157,8 @@ private:
 
     OwnPtr<LayerClient> m_layerClient;
     COMPtr<IDirect3DDevice9Ex> m_d3dDevice;
+
+    InbandTextTrackPrivateAVF* m_currentTrack;
 };
 
 uintptr_t AVFWrapper::s_nextAVFWrapperObjectID;
@@ -182,7 +203,8 @@ static CFArrayRef createMetadataKeyNames()
         AVCFAssetPropertyPreferredTransform,
         AVCFAssetPropertyPreferredRate,
         AVCFAssetPropertyPlayable,
-        AVCFAssetPropertyTracks 
+        AVCFAssetPropertyTracks,
+        AVCFAssetPropertyAvailableMediaCharacteristicsWithMediaSelectionOptions
     };
     
     return CFArrayCreate(0, (const void**)keyNames, sizeof(keyNames) / sizeof(keyNames[0]), &kCFTypeArrayCallBacks);
@@ -242,6 +264,18 @@ inline AVCFAssetImageGeneratorRef imageGenerator(AVFWrapper* wrapper)
     return wrapper ? wrapper->imageGenerator() : 0; 
 }
 
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+inline AVCFPlayerItemLegibleOutputRef avLegibleOutput(AVFWrapper* wrapper)
+{
+    return wrapper ? wrapper->legibleOutput() : 0;
+}
+
+inline AVCFMediaSelectionGroupRef safeMediaSelectionGroupForLegibleMedia(AVFWrapper* wrapper)
+{
+    return wrapper ? wrapper->safeMediaSelectionGroupForLegibleMedia() : 0;
+}
+#endif
+
 PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateAVFoundationCF::create(MediaPlayer* player) 
 { 
     return adoptPtr(new MediaPlayerPrivateAVFoundationCF(player));
@@ -277,6 +311,8 @@ void MediaPlayerPrivateAVFoundationCF::cancelLoad()
 
     tearDownVideoRendering();
 
+    clearTextTracks();
+
     if (m_avfWrapper) {
         // The AVCF objects have to be destroyed on the same dispatch queue used for notifications, so schedule a call to 
         // disconnectAndDeleteAVFWrapper on that queue. 
@@ -335,6 +371,31 @@ bool MediaPlayerPrivateAVFoundationCF::hasAvailableVideoFrame() const
     return (m_videoFrameHasDrawn || (videoLayer(m_avfWrapper) && AVCFPlayerLayerIsReadyForDisplay(videoLayer(m_avfWrapper))));
 }
 
+void MediaPlayerPrivateAVFoundationCF::setCurrentTrack(InbandTextTrackPrivateAVF* track)
+{
+    if (m_avfWrapper)
+        m_avfWrapper->setCurrentTrack(track);
+}
+
+InbandTextTrackPrivateAVF* MediaPlayerPrivateAVFoundationCF::currentTrack() const
+{
+    if (m_avfWrapper)
+        return m_avfWrapper->currentTrack();
+
+    return 0;
+}
+
+void MediaPlayerPrivateAVFoundationCF::createAVAssetForURL(const String& url)
+{
+    ASSERT(!m_avfWrapper);
+
+    setDelayCallbacks(true);
+
+    m_avfWrapper = new AVFWrapper(this);
+    m_avfWrapper->createAssetForURL(url);
+    setDelayCallbacks(false);
+}
+
 void MediaPlayerPrivateAVFoundationCF::createAVPlayer()
 {
     ASSERT(m_avfWrapper);
@@ -350,17 +411,7 @@ void MediaPlayerPrivateAVFoundationCF::createAVPlayerItem()
     
     setDelayCallbacks(true);
     m_avfWrapper->createPlayerItem();
-    setDelayCallbacks(false);
-}
 
-void MediaPlayerPrivateAVFoundationCF::createAVAssetForURL(const String& url)
-{
-    ASSERT(!m_avfWrapper);
-
-    setDelayCallbacks(true);
-
-    m_avfWrapper = new AVFWrapper(this);
-    m_avfWrapper->createAssetForURL(url);
     setDelayCallbacks(false);
 }
 
@@ -446,34 +497,27 @@ void MediaPlayerPrivateAVFoundationCF::platformPause()
     setDelayCallbacks(false);
 }
 
-void MediaPlayerPrivateAVFoundationCF::updateRate()
-{
-    LOG(Media, "MediaPlayerPrivateAVFoundationCF::updateRate(%p)", this);
-    if (!metaDataAvailable() || !avPlayer(m_avfWrapper))
-        return;
-
-    setDelayCallbacks(true);
-    AVCFPlayerSetRate(avPlayer(m_avfWrapper), requestedRate());
-    setDelayCallbacks(false);
-}
-
 float MediaPlayerPrivateAVFoundationCF::platformDuration() const
 {
     if (!metaDataAvailable() || !avAsset(m_avfWrapper))
         return 0;
 
-    float duration;
-    CMTime cmDuration = AVCFAssetGetDuration(avAsset(m_avfWrapper));
+    CMTime cmDuration;
+
+    // Check the AVItem if we have one and it has loaded duration, some assets never report duration.
+    if (avPlayerItem(m_avfWrapper) && playerItemStatus() >= MediaPlayerAVPlayerItemStatusReadyToPlay)
+        cmDuration = AVCFPlayerItemGetDuration(avPlayerItem(m_avfWrapper));
+    else
+        cmDuration = AVCFAssetGetDuration(avAsset(m_avfWrapper));
+
     if (CMTIME_IS_NUMERIC(cmDuration))
-        duration = narrowPrecisionToFloat(CMTimeGetSeconds(cmDuration));
-    else if (CMTIME_IS_INDEFINITE(cmDuration))
-        duration = numeric_limits<float>::infinity();
-    else {
-        LOG(Media, "MediaPlayerPrivateAVFMac::duration(%p) - invalid duration, returning 0", this);
-        return 0;
-    }
+        return narrowPrecisionToFloat(CMTimeGetSeconds(cmDuration));
+
+    if (CMTIME_IS_INDEFINITE(cmDuration))
+        return numeric_limits<float>::infinity();
 
-    return duration;
+    LOG(Media, "MediaPlayerPrivateAVFoundationCF::platformDuration(%p) - invalid duration, returning %.0f", this, static_cast<float>(MediaPlayer::invalidTime()));
+    return static_cast<float>(MediaPlayer::invalidTime());
 }
 
 float MediaPlayerPrivateAVFoundationCF::currentTime() const
@@ -483,7 +527,7 @@ float MediaPlayerPrivateAVFoundationCF::currentTime() const
 
     CMTime itemTime = AVCFPlayerItemGetCurrentTime(avPlayerItem(m_avfWrapper));
     if (CMTIME_IS_NUMERIC(itemTime))
-        return narrowPrecisionToFloat(CMTimeGetSeconds(itemTime));
+        return max(narrowPrecisionToFloat(CMTimeGetSeconds(itemTime)), 0.0f);
 
     return 0;
 }
@@ -516,6 +560,17 @@ void MediaPlayerPrivateAVFoundationCF::setClosedCaptionsVisible(bool closedCapti
     AVCFPlayerSetClosedCaptionDisplayEnabled(avPlayer(m_avfWrapper), closedCaptionsVisible);
 }
 
+void MediaPlayerPrivateAVFoundationCF::updateRate()
+{
+    LOG(Media, "MediaPlayerPrivateAVFoundationCF::updateRate(%p)", this);
+    if (!metaDataAvailable() || !avPlayer(m_avfWrapper))
+        return;
+
+    setDelayCallbacks(true);
+    AVCFPlayerSetRate(avPlayer(m_avfWrapper), requestedRate());
+    setDelayCallbacks(false);
+}
+
 float MediaPlayerPrivateAVFoundationCF::rate() const
 {
     if (!metaDataAvailable() || !avPlayer(m_avfWrapper))
@@ -671,7 +726,7 @@ MediaPlayerPrivateAVFoundation::AssetStatus MediaPlayerPrivateAVFoundationCF::as
     for (CFIndex i = 0; i < keyCount; i++) {
         CFStringRef keyName = static_cast<CFStringRef>(CFArrayGetValueAtIndex(keys, i));
         AVCFPropertyValueStatus keyStatus = AVCFAssetGetStatusOfValueForProperty(avAsset(m_avfWrapper), keyName, 0);
-        
+
         if (keyStatus < AVCFPropertyValueStatusLoaded)
             return MediaPlayerAVAssetStatusLoading;
         if (keyStatus == AVCFPropertyValueStatusFailed)
@@ -688,7 +743,7 @@ MediaPlayerPrivateAVFoundation::AssetStatus MediaPlayerPrivateAVFoundationCF::as
 
 void MediaPlayerPrivateAVFoundationCF::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& rect)
 {
-    if (context->paintingDisabled())
+    if (!metaDataAvailable() || context->paintingDisabled())
         return;
 
     if (currentRenderingMode() == MediaRenderingToLayer && !imageGenerator(m_avfWrapper)) {
@@ -702,7 +757,7 @@ void MediaPlayerPrivateAVFoundationCF::paintCurrentFrameInContext(GraphicsContex
 
 void MediaPlayerPrivateAVFoundationCF::paint(GraphicsContext* context, const IntRect& rect)
 {
-    if (context->paintingDisabled() || !imageGenerator(m_avfWrapper))
+    if (!metaDataAvailable() || context->paintingDisabled() || !imageGenerator(m_avfWrapper))
         return;
 
     LOG(Media, "MediaPlayerPrivateAVFoundationCF::paint(%p)", this);
@@ -732,7 +787,7 @@ static HashSet<String> mimeTypeCache()
     if (typeListInitialized)
         return cache;
     typeListInitialized = true;
-    
+
     RetainPtr<CFArrayRef> supportedTypes = adoptCF(AVCFURLAssetCopyAudiovisualMIMETypes());
     
     ASSERT(supportedTypes);
@@ -778,9 +833,15 @@ float MediaPlayerPrivateAVFoundationCF::mediaTimeForTimeValue(float timeValue) c
 
 void MediaPlayerPrivateAVFoundationCF::tracksChanged()
 {
+    String primaryAudioTrackLanguage = m_languageOfPrimaryAudioTrack;
+    m_languageOfPrimaryAudioTrack = String();
+
     if (!avAsset(m_avfWrapper))
         return;
-    
+
+    bool haveCCTrack = false;
+    bool hasCaptions = false;
+
     // This is called whenever the tracks collection changes so cache hasVideo and hasAudio since we are
     // asked about those fairly frequently.
     if (!avPlayerItem(m_avfWrapper)) {
@@ -792,12 +853,13 @@ void MediaPlayerPrivateAVFoundationCF::tracksChanged()
         RetainPtr<CFArrayRef> audioTracks = adoptCF(AVCFAssetCopyTracksWithMediaCharacteristic(avAsset(m_avfWrapper), AVCFMediaCharacteristicAudible));
         setHasAudio(CFArrayGetCount(audioTracks.get()));
 
+#if !HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
         RetainPtr<CFArrayRef> captionTracks = adoptCF(AVCFAssetCopyTracksWithMediaType(avAsset(m_avfWrapper), AVCFMediaTypeClosedCaption));
-        setHasAudio(CFArrayGetCount(captionTracks.get()));
+        hasCaptions = CFArrayGetCount(captionTracks.get());
+#endif
     } else {
         bool hasVideo = false;
         bool hasAudio = false;
-        bool hasCaptions = false;
 
         RetainPtr<CFArrayRef> tracks = adoptCF(AVCFPlayerItemCopyTracks(avPlayerItem(m_avfWrapper)));
 
@@ -815,20 +877,43 @@ void MediaPlayerPrivateAVFoundationCF::tracksChanged()
                     hasVideo = true;
                 else if (CFStringCompare(mediaType, AVCFMediaTypeAudio, kCFCompareCaseInsensitive) == kCFCompareEqualTo)
                     hasAudio = true;
-                else if (CFStringCompare(mediaType, AVCFMediaTypeClosedCaption, kCFCompareCaseInsensitive) == kCFCompareEqualTo)
+                else if (CFStringCompare(mediaType, AVCFMediaTypeClosedCaption, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+#if !HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
                     hasCaptions = true;
+#endif
+                    haveCCTrack = true;
+                }
             }
         }
 
         setHasVideo(hasVideo);
         setHasAudio(hasAudio);
-        setHasClosedCaptions(hasCaptions);
     }
 
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
+    AVCFMediaSelectionGroupRef legibleGroup = safeMediaSelectionGroupForLegibleMedia(m_avfWrapper);
+    if (legibleGroup) {
+        RetainPtr<CFArrayRef> playableOptions = adoptCF(AVCFMediaSelectionCopyPlayableOptionsFromArray(AVCFMediaSelectionGroupGetOptions(legibleGroup)));
+        hasCaptions = CFArrayGetCount(playableOptions.get());
+        if (hasCaptions)
+            processMediaSelectionOptions();
+    }
+#endif
+
+#if !HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+    if (haveCCTrack)
+        processLegacyClosedCaptionsTracks();
+#endif
+
+    setHasClosedCaptions(hasCaptions);
+
     LOG(Media, "MediaPlayerPrivateAVFoundationCF:tracksChanged(%p) - hasVideo = %s, hasAudio = %s, hasCaptions = %s", 
         this, boolString(hasVideo()), boolString(hasAudio()), boolString(hasClosedCaptions()));
 
     sizeChanged();
+
+    if (!primaryAudioTrackLanguage.isNull() && primaryAudioTrackLanguage != languageOfPrimaryAudioTrack())
+        player()->characteristicChanged();
 }
 
 void MediaPlayerPrivateAVFoundationCF::sizeChanged()
@@ -861,6 +946,201 @@ void MediaPlayerPrivateAVFoundationCF::sizeChanged()
     setNaturalSize(IntSize(naturalSize));
 }
 
+void MediaPlayerPrivateAVFoundationCF::clearTextTracks()
+{
+    for (unsigned i = 0; i < m_textTracks.size(); ++i) {
+        RefPtr<InbandTextTrackPrivateAVF> track = m_textTracks[i];
+        player()->removeTextTrack(track);
+        track->disconnect();
+    }
+    m_textTracks.clear();
+}
+
+#if !HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+void MediaPlayerPrivateAVFoundationCF::processLegacyClosedCaptionsTracks()
+{
+    AVCFPlayerItemSelectMediaOptionInMediaSelectionGroup(avPlayerItem(m_avfWrapper), 0, safeMediaSelectionGroupForLegibleMedia(m_avfWrapper));
+
+    Vector<RefPtr<InbandTextTrackPrivateAVF> > removedTextTracks = m_textTracks;
+    RetainPtr<CFArrayRef> tracks = adoptCF(AVCFPlayerItemCopyTracks(avPlayerItem(m_avfWrapper)));
+    CFIndex trackCount = CFArrayGetCount(tracks.get());
+    for (CFIndex i = 0; i < trackCount; ++i) {
+        AVCFPlayerItemTrackRef playerItemTrack = (AVCFPlayerItemTrackRef)(CFArrayGetValueAtIndex(tracks.get(), i));
+
+        RetainPtr<AVCFAssetTrackRef> assetTrack = adoptCF(AVCFPlayerItemTrackCopyAssetTrack(playerItemTrack));
+        CFStringRef mediaType = AVCFAssetTrackGetMediaType(assetTrack.get());
+        if (!mediaType)
+            continue;
+                
+        if (CFStringCompare(mediaType, AVCFMediaTypeClosedCaption, kCFCompareCaseInsensitive) != kCFCompareEqualTo)
+            continue;
+
+        bool newCCTrack = true;
+        for (unsigned i = removedTextTracks.size(); i > 0; --i) {
+            if (!removedTextTracks[i - 1]->isLegacyClosedCaptionsTrack())
+                continue;
+
+            RefPtr<InbandTextTrackPrivateLegacyAVCF> track = static_cast<InbandTextTrackPrivateLegacyAVCF*>(m_textTracks[i - 1].get());
+            if (track->avPlayerItemTrack() == playerItemTrack) {
+                removedTextTracks.remove(i - 1);
+                newCCTrack = false;
+                break;
+            }
+        }
+
+        if (!newCCTrack)
+            continue;
+        
+        m_textTracks.append(InbandTextTrackPrivateLegacyAVCF::create(this, playerItemTrack));
+    }
+
+    processNewAndRemovedTextTracks(removedTextTracks);
+}
+#endif
+
+void MediaPlayerPrivateAVFoundationCF::processNewAndRemovedTextTracks(const Vector<RefPtr<InbandTextTrackPrivateAVF> >& removedTextTracks)
+{
+    // FIXME: Lift to parent class (https://bugs.webkit.org/show_bug.cgi?id=118801)
+    if (removedTextTracks.size()) {
+        for (unsigned i = 0; i < m_textTracks.size(); ++i) {
+            if (!removedTextTracks.contains(m_textTracks[i]))
+                continue;
+            
+            player()->removeTextTrack(removedTextTracks[i].get());
+            m_textTracks.remove(i);
+        }
+    }
+    
+    for (unsigned i = 0; i < m_textTracks.size(); ++i) {
+        RefPtr<InbandTextTrackPrivateAVF> track = m_textTracks[i];
+        
+        track->setTextTrackIndex(i);
+        if (track->hasBeenReported())
+            continue;
+        
+        track->setHasBeenReported(true);
+        player()->addTextTrack(track.get());
+    }
+    LOG(Media, "MediaPlayerPrivateAVFoundationCF::processNewAndRemovedTextTracks(%p) - found %i text tracks", this, m_textTracks.size());
+}
+
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
+void MediaPlayerPrivateAVFoundationCF::processMediaSelectionOptions()
+{
+    AVCFMediaSelectionGroupRef legibleGroup = safeMediaSelectionGroupForLegibleMedia(m_avfWrapper);
+    if (!legibleGroup) {
+        LOG(Media, "MediaPlayerPrivateAVFoundationCF::processMediaSelectionOptions(%p) - nil mediaSelectionGroup", this);
+        return;
+    }
+
+    // We enabled automatic media selection because we want alternate audio tracks to be enabled/disabled automatically,
+    // but set the selected legible track to nil so text tracks will not be automatically configured.
+    if (!m_textTracks.size()) {
+        ASSERT(AVCFMediaSelectionGroupAllowsEmptySelection(legibleGroup));
+        AVCFPlayerItemRef playerItem = avPlayerItem(m_avfWrapper);
+
+        if (playerItem)
+            AVCFPlayerItemSelectMediaOptionInMediaSelectionGroup(playerItem, 0, legibleGroup);
+    }
+
+    Vector<RefPtr<InbandTextTrackPrivateAVF> > removedTextTracks = m_textTracks;
+    RetainPtr<CFArrayRef> legibleOptions = adoptCF(AVCFMediaSelectionCopyPlayableOptionsFromArray(AVCFMediaSelectionGroupGetOptions(legibleGroup)));
+    CFIndex legibleOptionsCount = CFArrayGetCount(legibleOptions.get());
+    for (CFIndex i = 0; i < legibleOptionsCount; ++i) {
+        AVCFMediaSelectionOptionRef option = static_cast<AVCFMediaSelectionOptionRef>(CFArrayGetValueAtIndex(legibleOptions.get(), i));
+        bool newTrack = true;
+        for (unsigned i = removedTextTracks.size(); i > 0; --i) {
+            if (removedTextTracks[i - 1]->isLegacyClosedCaptionsTrack())
+                continue;
+
+            RefPtr<InbandTextTrackPrivateAVCF> track = static_cast<InbandTextTrackPrivateAVCF*>(removedTextTracks[i - 1].get());
+            if (CFEqual(track->mediaSelectionOption(), option)) {
+                removedTextTracks.remove(i - 1);
+                newTrack = false;
+                break;
+            }
+        }
+        if (!newTrack)
+            continue;
+
+        m_textTracks.append(InbandTextTrackPrivateAVCF::create(this, option));
+    }
+
+    processNewAndRemovedTextTracks(removedTextTracks);
+}
+
+#endif // HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
+
+void AVFWrapper::setCurrentTrack(InbandTextTrackPrivateAVF* track)
+{
+    if (m_currentTrack == track)
+        return;
+
+    LOG(Media, "MediaPlayerPrivateAVFoundationCF::setCurrentTrack(%p) - selecting track %p, language = %s", this, track, track ? track->language().string().utf8().data() : "");
+        
+    m_currentTrack = track;
+
+    if (track) {
+        if (track->isLegacyClosedCaptionsTrack())
+            AVCFPlayerSetClosedCaptionDisplayEnabled(avPlayer(), TRUE);
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
+        else
+            AVCFPlayerItemSelectMediaOptionInMediaSelectionGroup(avPlayerItem(), static_cast<InbandTextTrackPrivateAVCF*>(track)->mediaSelectionOption(), safeMediaSelectionGroupForLegibleMedia());
+#endif
+    } else {
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
+        AVCFPlayerItemSelectMediaOptionInMediaSelectionGroup(avPlayerItem(), 0, safeMediaSelectionGroupForLegibleMedia());
+#endif
+        AVCFPlayerSetClosedCaptionDisplayEnabled(avPlayer(), FALSE);
+    }
+}
+
+String MediaPlayerPrivateAVFoundationCF::languageOfPrimaryAudioTrack() const
+{
+    if (!m_languageOfPrimaryAudioTrack.isNull())
+        return m_languageOfPrimaryAudioTrack;
+
+    if (!avPlayerItem(m_avfWrapper))
+        return emptyString();
+
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
+    // If AVFoundation has an audible group, return the language of the currently selected audible option.
+    AVCFMediaSelectionGroupRef audibleGroup = AVCFAssetGetSelectionGroupForMediaCharacteristic(avAsset(m_avfWrapper), AVCFMediaCharacteristicAudible);
+    AVCFMediaSelectionOptionRef currentlySelectedAudibleOption = AVCFPlayerItemGetSelectedMediaOptionInMediaSelectionGroup(avPlayerItem(m_avfWrapper), audibleGroup);
+    if (currentlySelectedAudibleOption) {
+        RetainPtr<CFLocaleRef> audibleOptionLocale = adoptCF(AVCFMediaSelectionOptionCopyLocale(currentlySelectedAudibleOption));
+        m_languageOfPrimaryAudioTrack = CFLocaleGetIdentifier(audibleOptionLocale.get());
+        LOG(Media, "MediaPlayerPrivateAVFoundationCF::languageOfPrimaryAudioTrack(%p) - returning language of selected audible option: %s", this, m_languageOfPrimaryAudioTrack.utf8().data());
+
+        return m_languageOfPrimaryAudioTrack;
+    }
+#endif // HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
+
+    // AVFoundation synthesizes an audible group when there is only one ungrouped audio track if there is also a legible group (one or
+    // more in-band text tracks). It doesn't know about out-of-band tracks, so if there is a single audio track return its language.
+    RetainPtr<CFArrayRef> tracks = adoptCF(AVCFAssetCopyTracksWithMediaType(avAsset(m_avfWrapper), AVCFMediaTypeAudio));
+    CFIndex trackCount = CFArrayGetCount(tracks.get());
+    if (!tracks || trackCount != 1) {
+        m_languageOfPrimaryAudioTrack = emptyString();
+        LOG(Media, "MediaPlayerPrivateAVFoundationCF::languageOfPrimaryAudioTrack(%p) - %i audio tracks, returning emptyString()", this, (tracks ? trackCount : 0));
+        return m_languageOfPrimaryAudioTrack;
+    }
+
+    AVCFAssetTrackRef track = (AVCFAssetTrackRef)CFArrayGetValueAtIndex(tracks.get(), 0);
+    RetainPtr<CFStringRef> language = adoptCF(AVCFAssetTrackCopyExtendedLanguageTag(track));
+
+    // Some legacy tracks have "und" as a language, treat that the same as no language at all.
+    if (language && CFStringCompare(language.get(), CFSTR("und"), kCFCompareCaseInsensitive) != kCFCompareEqualTo) {
+        m_languageOfPrimaryAudioTrack = language.get();
+        LOG(Media, "MediaPlayerPrivateAVFoundationCF::languageOfPrimaryAudioTrack(%p) - returning language of single audio track: %s", this, m_languageOfPrimaryAudioTrack.utf8().data());
+        return m_languageOfPrimaryAudioTrack;
+    }
+
+    LOG(Media, "MediaPlayerPrivateAVFoundationCF::languageOfPrimaryAudioTrack(%p) - single audio track has no language, returning emptyString()", this);
+    m_languageOfPrimaryAudioTrack = emptyString();
+    return m_languageOfPrimaryAudioTrack;
+}
+
 void MediaPlayerPrivateAVFoundationCF::contentsNeedsDisplay()
 {
     if (m_avfWrapper)
@@ -870,6 +1150,7 @@ void MediaPlayerPrivateAVFoundationCF::contentsNeedsDisplay()
 AVFWrapper::AVFWrapper(MediaPlayerPrivateAVFoundationCF* owner)
     : m_owner(owner)
     , m_objectID(s_nextAVFWrapperObjectID++)
+    , m_currentTrack(0)
 {
     LOG(Media, "AVFWrapper::AVFWrapper(%p)", this);
 
@@ -892,6 +1173,14 @@ AVFWrapper::~AVFWrapper()
         m_avAsset = 0;
     }
 
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+    if (legibleOutput()) {
+        if (avPlayerItem())
+            AVCFPlayerItemRemoveOutput(avPlayerItem(), legibleOutput());
+        m_legibleOutput = 0;
+    }
+#endif
+
     m_avPlayerItem = 0;
     m_timeObserver = 0;
     m_avPlayer = 0;
@@ -1004,13 +1293,27 @@ void AVFWrapper::createPlayer(IDirect3DDevice9* d3dDevice)
     if (m_d3dDevice && AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey)
         CFDictionarySetValue(optionsRef.get(), AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey, kCFBooleanTrue);
 
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+    CFDictionarySetValue(optionsRef.get(), AVCFPlayerAppliesMediaSelectionCriteriaAutomaticallyKey, kCFBooleanTrue);
+#endif
+
     // FIXME: We need a way to create a AVPlayer without an AVPlayerItem, see <rdar://problem/9877730>.
     AVCFPlayerRef playerRef = AVCFPlayerCreateWithPlayerItemAndOptions(kCFAllocatorDefault, avPlayerItem(), optionsRef.get(), m_notificationQueue);
     m_avPlayer = adoptCF(playerRef);
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+    AVCFPlayerSetClosedCaptionDisplayEnabled(playerRef, FALSE);
+#endif
 
     if (m_d3dDevice && AVCFPlayerSetDirect3DDevicePtr())
         AVCFPlayerSetDirect3DDevicePtr()(playerRef, m_d3dDevice.get());
 
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+    // Because of a bug in AVFoundationCF, we have to wait until the player is created before we can add the legible output:
+    // Once <rdar://problem/14390466> this is fixed, we can remove the following two lines.
+    ::Sleep(1000); // FIXME: This is being fixed as part of <rdar://problem/14390466>
+    AVCFPlayerItemAddOutput(avPlayerItem(), legibleOutput());
+#endif
+
     CFNotificationCenterRef center = CFNotificationCenterGetLocalCenter();
     ASSERT(center);
 
@@ -1041,8 +1344,30 @@ void AVFWrapper::createPlayerItem()
     CFNotificationCenterAddObserver(center, callbackContext(), notificationCallback, AVCFPlayerItemIsPlaybackLikelyToKeepUpChangedNotification, itemRef, CFNotificationSuspensionBehaviorDeliverImmediately);
     CFNotificationCenterAddObserver(center, callbackContext(), notificationCallback, AVCFPlayerItemIsPlaybackBufferEmptyChangedNotification, itemRef, CFNotificationSuspensionBehaviorDeliverImmediately);
     CFNotificationCenterAddObserver(center, callbackContext(), notificationCallback, AVCFPlayerItemIsPlaybackBufferFullChangedNotification, itemRef, CFNotificationSuspensionBehaviorDeliverImmediately);
+    CFNotificationCenterAddObserver(center, callbackContext(), notificationCallback, AVCFPlayerItemDurationChangedNotification, itemRef, CFNotificationSuspensionBehaviorDeliverImmediately);
+    // FIXME: Are there other legible output things we need to register for? asset, hasEnabledAudio?
 
     CFNotificationCenterAddObserver(center, callbackContext(), notificationCallback, CACFContextNeedsFlushNotification(), 0, CFNotificationSuspensionBehaviorDeliverImmediately);
+
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+    const CFTimeInterval legibleOutputAdvanceInterval = 2;
+
+    m_legibleOutput = adoptCF(AVCFPlayerItemLegibleOutputCreateWithMediaSubtypesForNativeRepresentation(kCFAllocatorDefault, 0));
+    AVCFPlayerItemOutputSetSuppressPlayerRendering(m_legibleOutput.get(), TRUE);
+
+    AVCFPlayerItemLegibleOutputCallbacks callbackInfo;
+    callbackInfo.version = kAVCFPlayerItemLegibleOutput_CallbacksVersion_1;
+    ASSERT(callbackContext());
+    callbackInfo.context = callbackContext();
+    callbackInfo.legibleOutputCallback = AVFWrapper::legibleOutputCallback;
+
+    AVCFPlayerItemLegibleOutputSetCallbacks(m_legibleOutput.get(), &callbackInfo, dispatch_get_main_queue());
+    AVCFPlayerItemLegibleOutputSetAdvanceIntervalForCallbackInvocation(m_legibleOutput.get(), legibleOutputAdvanceInterval);
+    AVCFPlayerItemLegibleOutputSetTextStylingResolution(m_legibleOutput.get(), AVCFPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly);
+    // We cannot add the Legible Output to the player item until the player is constructed. <rdar://problem/14390466>
+    // Once this is fixed, we can uncomment the following line.
+    // AVCFPlayerItemAddOutput(m_avPlayerItem.get(), m_legibleOutput.get());
+#endif
 }
 
 void AVFWrapper::periodicTimeObserverCallback(AVCFPlayerRef, CMTime cmTime, void* context)
@@ -1171,6 +1496,59 @@ void AVFWrapper::seekToTime(float time)
         kCMTimeZero, kCMTimeZero, &seekCompletedCallback, callbackContext());
 }
 
+struct LegibleOutputData {
+    RetainPtr<CFArrayRef> m_attributedStrings;
+    double m_time;
+    void* m_context;
+
+    LegibleOutputData(CFArrayRef strings, double time, void* context)
+        : m_attributedStrings(strings), m_time(time), m_context(context)
+    {
+    }
+};
+
+void AVFWrapper::processCue(void* context)
+{
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
+    ASSERT(context);
+
+    if (!context)
+        return;
+
+    OwnPtr<LegibleOutputData> legibleOutputData = adoptPtr(reinterpret_cast<LegibleOutputData*>(context));
+
+    MutexLocker locker(mapLock());
+    AVFWrapper* self = avfWrapperForCallbackContext(legibleOutputData->m_context);
+    if (!self) {
+        LOG(Media, "AVFWrapper::processCue invoked for deleted AVFWrapper %d", reinterpret_cast<uintptr_t>(context));
+        return;
+    }
+
+    if (!self->m_currentTrack)
+        return;
+
+    self->m_currentTrack->processCue(legibleOutputData->m_attributedStrings.get(), legibleOutputData->m_time);
+}
+
+void AVFWrapper::legibleOutputCallback(void* context, AVCFPlayerItemLegibleOutputRef legibleOutput, CFArrayRef attributedStrings, CFArrayRef /*nativeSampleBuffers*/, CMTime itemTime)
+{
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
+    MutexLocker locker(mapLock());
+    AVFWrapper* self = avfWrapperForCallbackContext(context);
+    if (!self) {
+        LOG(Media, "AVFWrapper::legibleOutputCallback invoked for deleted AVFWrapper %d", reinterpret_cast<uintptr_t>(context));
+        return;
+    }
+
+    LOG(Media, "AVFWrapper::legibleOutputCallback(%p)", self);
+
+    ASSERT(legibleOutput == self->m_legibleOutput);
+
+    OwnPtr<LegibleOutputData> legibleOutputData = adoptPtr(new LegibleOutputData(attributedStrings, CMTimeGetSeconds(itemTime), context));
+
+    dispatch_async_f(dispatch_get_main_queue(), legibleOutputData.leakPtr(), processCue);
+}
+
 void AVFWrapper::setAsset(AVCFURLAssetRef asset)
 {
     if (asset == avAsset())
@@ -1283,6 +1661,19 @@ RetainPtr<CGImageRef> AVFWrapper::createImageForTimeInRect(float time, const Int
     return image;
 }
 
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+AVCFMediaSelectionGroupRef AVFWrapper::safeMediaSelectionGroupForLegibleMedia() const
+{
+    if (!avAsset())
+        return 0;
+
+    if (AVCFAssetGetStatusOfValueForProperty(avAsset(), AVCFAssetPropertyAvailableMediaCharacteristicsWithMediaSelectionOptions, 0) != AVCFPropertyValueStatusLoaded)
+        return 0;
+
+    return AVCFAssetGetSelectionGroupForMediaCharacteristic(avAsset(), AVCFMediaCharacteristicLegible);
+}
+#endif
+
 void LayerClient::platformCALayerLayoutSublayersOfLayer(PlatformCALayer* wrapperLayer)
 {
     ASSERT(m_parent);
index be0bde7..a2882e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -38,10 +38,9 @@ class MediaPlayerPrivateAVFoundationCF : public MediaPlayerPrivateAVFoundation {
 public:
     virtual ~MediaPlayerPrivateAVFoundationCF();
 
-    static void registerMediaEngine(MediaEngineRegistrar);
+    virtual void tracksChanged() OVERRIDE;
 
-    //FIXME: this needs to be implemented
-    virtual InbandTextTrackPrivateAVF* currentTrack() const { return 0; }
+    static void registerMediaEngine(MediaEngineRegistrar);
 
 private:
     MediaPlayerPrivateAVFoundationCF(MediaPlayer*);
@@ -85,7 +84,6 @@ private:
     virtual float platformDuration() const;
     virtual float platformMaxTimeLoaded() const;
     virtual void beginLoadingMetadata();
-    virtual void tracksChanged();
     virtual void sizeChanged();
 
     virtual bool hasAvailableVideoFrame() const;
@@ -101,9 +99,25 @@ private:
 
     virtual void contentsNeedsDisplay();
 
+    virtual String languageOfPrimaryAudioTrack() const OVERRIDE;
+
+#if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
+    void processMediaSelectionOptions();
+#endif
+
+    virtual void setCurrentTrack(InbandTextTrackPrivateAVF*) OVERRIDE;
+    virtual InbandTextTrackPrivateAVF* currentTrack() const OVERRIDE;
+    void processNewAndRemovedTextTracks(const Vector<RefPtr<InbandTextTrackPrivateAVF> >&);
+    void clearTextTracks();
+
+#if !HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
+    void processLegacyClosedCaptionsTracks();
+#endif
+
     friend class AVFWrapper;
     AVFWrapper* m_avfWrapper;
     
+    mutable String m_languageOfPrimaryAudioTrack;
     bool m_videoFrameHasDrawn;
 };
 
index cd5c2c1..3627d13 100644 (file)
     #define myVar get_myVar()
 */ 
 #define SOFT_LINK_VARIABLE_DLL_IMPORT(library, variableName, variableType) \
-    static variableType get_##variableName() \
+    static variableType get##variableName() \
     { \
         static variableType* ptr = reinterpret_cast<variableType*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #variableName)); \
         ASSERT(ptr); \
     Note that this will only work for variable types for which a return value of 0 can signal an error.
  */
 #define SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL(library, variableName, variableType) \
-    static variableType get_##variableName() \
+    static variableType get##variableName() \
     { \
         static variableType* ptr = reinterpret_cast<variableType*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #variableName)); \
         if (!ptr) \
index ee26937..5e41116 100644 (file)
@@ -1,3 +1,21 @@
+2013-07-16  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Support in-band text tracks.
+        https://bugs.webkit.org/show_bug.cgi?id=103770
+
+        Reviewed by Eric Carlson.
+
+        Update WinLauncher to run in a CFRunLoop (rather than a hand-written Windows event loop) so that
+        libdispatch and CFRunLoop elements are services during the run loop.
+
+        * WinLauncher/WinLauncher.cpp:
+        (dllLauncherEntryPoint): Use CFRunLoopRun (rather than a Windows message loop) if running with
+        a CoreFoundation (or CFLite) support library.
+        * WinLauncher/WinLauncher.vcxproj/WinLauncherCF.props: Added.
+        * WinLauncher/WinLauncher.vcxproj/WinLauncherCFLite.props: Added.
+        * WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj: Add references to WinLauncherCF.props
+        and WinLauncherCFLite.props.
+
 2013-07-18  Roger Fong  <roger_fong@apple.com>
 
         Unreviewed. Test enabling WinEWS tests now that queue is at a good state and NRWT with multiple processes is enabled.
index c6657e4..663a45e 100644 (file)
 #include "DOMDefaultImpl.h"
 #include "PrintWebUIDelegate.h"
 #include <WebKit/WebKitCOMAPI.h>
+#include <wtf/Platform.h>
 
+#if USE(CF)
+#include <CoreFoundation/CFPriv.h>
+#include <CoreFoundation/CFRunLoop.h>
+#endif
+
+#include <assert.h>
 #include <commctrl.h>
 #include <commdlg.h>
 #include <objbase.h>
@@ -421,12 +428,17 @@ extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(HINSTANCE, HIN
     }
 
     // Main message loop:
+#if USE(CF)
+    _CFRunLoopSetWindowsMessageQueueMask(CFRunLoopGetMain(), QS_ALLINPUT | QS_ALLPOSTMESSAGE, kCFRunLoopDefaultMode);
+    CFRunLoopRun();
+#else
     while (GetMessage(&msg, NULL, 0, 0)) {
         if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
             TranslateMessage(&msg);
             DispatchMessage(&msg);
         }
     }
+#endif
 
 exit:
     gPrintDelegate->Release();
diff --git a/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherCF.props b/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherCF.props
new file mode 100644 (file)
index 0000000..081981b
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ImportGroup Label="PropertySheets" />
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup />
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>CoreFoundation$(DebugSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup />
+</Project>
\ No newline at end of file
diff --git a/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherCFLite.props b/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherCFLite.props
new file mode 100644 (file)
index 0000000..cd3b5dd
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ImportGroup Label="PropertySheets" />
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup />
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>CFLite.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup />
+</Project>
\ No newline at end of file
index a043ce1..ef108eb 100644 (file)
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
     <Import Project="WinLauncherLibRelease.props" />\r
+    <Import Project="WinLauncherCF.props" />\r
   </ImportGroup>\r
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'" Label="PropertySheets">\r
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
     <Import Project="WinLauncherLibRelease.props" />\r
+    <Import Project="WinLauncherCFLite.props" />\r
   </ImportGroup>\r
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Production|Win32'" Label="PropertySheets">\r
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
     <Import Project="WinLauncherLibProduction.props" />\r
+    <Import Project="WinLauncherCF.props" />\r
   </ImportGroup>\r
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
     <Import Project="WinLauncherLibDebug.props" />\r
+    <Import Project="WinLauncherCF.props" />\r
   </ImportGroup>\r
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'" Label="PropertySheets">\r
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
     <Import Project="WinLauncherLibDebug.props" />\r
+    <Import Project="WinLauncherCFLite.props" />\r
   </ImportGroup>\r
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'" Label="PropertySheets">\r
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
     <Import Project="WinLauncherLibDebug.props" />\r
+    <Import Project="WinLauncherCF.props" />\r
     <Import Project="$(WebKit_Libraries)\tools\vsprops\debugsuffix.props" />\r
   </ImportGroup>\r
   <PropertyGroup Label="UserMacros" />\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r