[www-doc] [Git][VideoLAN.org/websites][master] Apple Silicon ARM64 detection

Jean-Baptiste Kempf gitlab at videolan.org
Mon Jan 18 12:24:55 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN organization / websites


Commits:
bd50f0fb by Jean-Baptiste Kempf at 2021-01-18T13:24:40+01:00
Apple Silicon ARM64 detection

- - - - -


1 changed file:

- www.videolan.org/include/os-specific.php


Changes:

=====================================
www.videolan.org/include/os-specific.php
=====================================
@@ -1,7 +1,8 @@
 <?php
 $win32version = '3.0.12';
 $winArm64version = '4.0.0-dev-20180508';
-$macosxversion = '3.0.12.1';
+$macosxversion = '3.0.12';
+$macosArm64version = '3.0.12.1';
 $oldmacosxversion = '2.0.10';
 $version = '3.0.12';
 $iosversion = '3.2.13';
@@ -14,12 +15,14 @@ $windowsLocation = "$dlBase/$win32version/win32/vlc-$win32version-win32.exe";
 $windows64Location = "$dlBase/$win32version/win64/vlc-$win32version-win64.exe";
 $windowsArm64Location = "http://people.videolan.org/~jb/Builds/ARM/vlc-$winArm64version-aarch64.zip";
 $osxLocation = "$dlBase/$macosxversion/macosx/vlc-$macosxversion.dmg";
+$osxArm64Location = "$dlBase/$macosArm64version/macosx/vlc-$macosArm64version-arm64.dmg";
 
 function replaceDLinfos( $downloadButton = "#downloadButton" )
 {
     global $version;
     global $win32version;
     global $macosxversion;
+    global $macosArm64version;
     global $oldmacosxversion;
     global $iosversion;
     global $tvosversion;
@@ -71,9 +74,25 @@ function replaceDLinfos( $downloadButton = "#downloadButton" )
            }
        }
        if (navigator.appVersion.indexOf("Mac")!=-1) {
-          if (navigator.platform.indexOf("MacPPC")!= -1 || navigator.platform.indexOf("PowerPC") != -1 ) OS="osxPPC";
-          else if (navigator.userAgent.indexOf("OS X 10.5")!=-1) OS="osx32";
-          else OS="osx";
+          if (navigator.platform.indexOf("MacPPC")!= -1 || navigator.platform.indexOf("PowerPC") != -1 ) {
+              OS="osxPPC";
+          } else if (navigator.userAgent.indexOf("OS X 10.5")!=-1) {
+              OS="osx32";
+          } else {
+              var glcontext = document.createElement("canvas").getContext("webgl");
+              var debugrenderer = glcontext.getExtension('WEBGL_debug_renderer_info');
+              var renderername = d && glcontext.getParameter(d.UNMASKED_RENDERER_WEBGL) || "";
+              if (renderername.match(/Apple/) && !renderername.match(/Apple GPU/)) {
+                  OS="osxarm64";
+              } else {
+                  OS="osx";
+              }
+              if (glcontext.getSupportedExtensions().indexOf("WEBGL_compressed_texture_s3tc_srgb") == -1) {
+                  OS="osxarm64";
+              } else {
+                  OS="osx";
+              }
+          }
        }
        if (navigator.platform.indexOf("BeOS") !=-1) OS="beos";
        if (navigator.platform.indexOf("Linux")!=-1) {
@@ -132,6 +151,7 @@ function getOS($os = null, $offset = 0, $count = null, $encode = null) {
     global $windows64Location;
     global $windowsArm64Location;
     global $osxLocation;
+    global $osxArm64Location;
     global $win32version;
     global $winArm64version;
     global $version;
@@ -166,12 +186,18 @@ function getOS($os = null, $offset = 0, $count = null, $encode = null) {
             "latestVersion" => $winrtversion,
             "location"      => "/vlc/download-windowsphone.html"
         ),
-        "osx"       => array(
+        "osx"     => array(
             "name"          => "macOS",
             "size"          => "48 MB",
             "latestVersion" => $macosxversion,
             "location"      => $osxLocation
         ),
+        "osxarm64"     => array(
+            "name"          => "macOS (Apple Silicon)",
+            "size"          => "48 MB",
+            "latestVersion" => $macosArm64version,
+            "location"      => $osxArm64Location
+        ),
         "linux"     => array(
             "name"          => "Linux",
             "latestVersion" => $version,



View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/commit/bd50f0fb892a25de8a2c10c0ba4f80a7574b1f0c

-- 
View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/commit/bd50f0fb892a25de8a2c10c0ba4f80a7574b1f0c
You're receiving this email because of your account on code.videolan.org.




More information about the www-doc mailing list