Unreviewed, roll out http://trac.webkit.org/changeset/186903. It broke the build.
[WebKit-https.git] / Source / WebCore / AVFoundationSupport.py
index 5c1bb2f..7a42187 100644 (file)
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+import re
 import sys
 import os
 
-
 def lookFor(relativePath):
-    return os.path.isfile(os.environ['WEBKIT_LIBRARIES'] + relativePath) or os.path.isfile(os.environ['WEBKITLIBRARIESDIR'] + relativePath)
+    return os.path.isfile(os.environ['WEBKIT_LIBRARIES'] + relativePath)
+
+
+def fileContains(relativePath, regexp):
+    with open(os.environ['WEBKIT_LIBRARIES'] + relativePath) as file:
+        for line in file:
+            if regexp.search(line):
+                return True
+    return False
+
 
 print "/* Identifying AVFoundation Support */"
 if lookFor("/include/AVFoundationCF/AVCFBase.h"):
@@ -40,3 +49,15 @@ if lookFor("/include/AVFoundationCF/AVCFPlayerItemLegibleOutput.h"):
     print "#define HAVE_AVCF_LEGIBLE_OUTPUT 1"
 if lookFor("/include/AVFoundationCF/AVCFAssetResourceLoader.h"):
     print "#define HAVE_AVFOUNDATION_LOADER_DELEGATE 1"
+if lookFor("/include/AVFoundationCF/AVCFAsset.h"):
+    regexp = re.compile("AVCFURLAssetIsPlayableExtendedMIMEType")
+    if fileContains("/include/AVFoundationCF/AVCFAsset.h", regexp):
+        print "#define HAVE_AVCFURL_PLAYABLE_MIMETYPE 1"
+if lookFor("/include/QuartzCore/CACFLayer.h"):
+    regexp = re.compile("CACFLayerSetContentsScale")
+    if fileContains("/include/QuartzCore/CACFLayer.h", regexp):
+        print "#define HAVE_CACFLAYER_SETCONTENTSSCALE 1"
+if lookFor("/include/AVFoundationCF/AVCFPlayerItemLegibleOutput.h"):
+    regexp = re.compile("kAVCFPlayerItemLegibleOutput_CallbacksVersion_2")
+    if fileContains("/include/AVFoundationCF/AVCFPlayerItemLegibleOutput.h", regexp):
+        print "#define HAVE_AVCFPLAYERITEM_CALLBACK_VERSION_2 1"