Kaynağa Gözat

update ffmpeg to 5.0.1 and add windows/mingw support (#1189)

* update ffmpeg to 5.0.1 and add windows/mingw support

* Update xmake.lua

* Fix git tag

Co-authored-by: ruki <[email protected]>
Jérôme Leclercq 3 yıl önce
ebeveyn
işleme
ab7040202b
1 değiştirilmiş dosya ile 39 ekleme ve 18 silme
  1. 39 18
      packages/f/ffmpeg/xmake.lua

+ 39 - 18
packages/f/ffmpeg/xmake.lua

@@ -2,23 +2,36 @@ package("ffmpeg")
 
     set_homepage("https://www.ffmpeg.org")
     set_description("A collection of libraries to process multimedia content such as audio, video, subtitles and related metadata.")
+    set_license("LGPL-2.1")
 
-    add_urls("https://ffmpeg.org/releases/ffmpeg-$(version).tar.bz2", {alias = "home"})
-    add_urls("https://github.com/FFmpeg/FFmpeg/archive/n$(version).zip", {alias = "github"})
-    add_urls("https://git.ffmpeg.org/ffmpeg.git", "https://github.com/FFmpeg/FFmpeg.git")
-    add_versions("home:4.0.2", "346c51735f42c37e0712e0b3d2f6476c86ac15863e4445d9e823fe396420d056")
-    add_versions("github:4.0.2", "4df1ef0bf73b7148caea1270539ef7bd06607e0ea8aa2fbf1bb34062a097f026")
+    if is_plat("windows", "mingw") then
+        add_urls("https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$(version)-full_build-shared.7z")
+        add_versions("5.0.1", "ded28435b6f04b74f5ef5a6a13761233bce9e8e9f8ecb0eabe936fd36a778b0c")
 
-    add_configs("ffprobe",          { description = "Enable ffprobe program.", default = false, type = "boolean"})
-    add_configs("ffmpeg",           { description = "Enable ffmpeg program.", default = false, type = "boolean"})
-    add_configs("ffplay",           { description = "Enable ffplay program.", default = false, type = "boolean"})
-    add_configs("zlib",             { description = "Enable zlib compression library.", default = false, type = "boolean"})
-    add_configs("lzma",             { description = "Enable liblzma compression library.", default = false, type = "boolean"})
-    add_configs("bzlib",            { description = "Enable bzlib compression library.", default = false, type = "boolean"})
-    add_configs("libx264",          { description = "Enable libx264 decoder.", default = false, type = "boolean"})
-    add_configs("libx265",          { description = "Enable libx265 decoder.", default = false, type = "boolean"})
-    add_configs("iconv",            { description = "Enable libiconv library.", default = false, type = "boolean"})
-    add_configs("hardcoded-tables", { description = "Enable hardcoded tables.", default = true, type = "boolean"})
+        add_configs("shared", {description = "Download shared binaries.", default = true, type = "boolean", readonly = true})
+        add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MD", readonly = true})
+    else
+        add_urls("https://ffmpeg.org/releases/ffmpeg-$(version).tar.bz2", {alias = "home"})
+        add_urls("https://github.com/FFmpeg/FFmpeg/archive/n$(version).zip", {alias = "github"})
+        add_urls("https://git.ffmpeg.org/ffmpeg.git", "https://github.com/FFmpeg/FFmpeg.git", {alias = "git"})
+        add_versions("home:5.0.1", "28df33d400a1c1c1b20d07a99197809a3b88ef765f5f07dc1ff067fac64c59d6")
+        add_versions("home:4.0.2", "346c51735f42c37e0712e0b3d2f6476c86ac15863e4445d9e823fe396420d056")
+        add_versions("github:5.0.1", "f9c2e06cafa4381df8d5c9c9e14d85d9afcbc10c516c6a206f821997cc7f6440")
+        add_versions("github:4.0.2", "4df1ef0bf73b7148caea1270539ef7bd06607e0ea8aa2fbf1bb34062a097f026")
+        add_versions("git:5.0.1", "n5.0.1")
+        add_versions("git:4.0.2", "n4.0.2")
+    
+        add_configs("ffprobe",          { description = "Enable ffprobe program.", default = false, type = "boolean"})
+        add_configs("ffmpeg",           { description = "Enable ffmpeg program.", default = false, type = "boolean"})
+        add_configs("ffplay",           { description = "Enable ffplay program.", default = false, type = "boolean"})
+        add_configs("zlib",             { description = "Enable zlib compression library.", default = false, type = "boolean"})
+        add_configs("lzma",             { description = "Enable liblzma compression library.", default = false, type = "boolean"})
+        add_configs("bzlib",            { description = "Enable bzlib compression library.", default = false, type = "boolean"})
+        add_configs("libx264",          { description = "Enable libx264 decoder.", default = false, type = "boolean"})
+        add_configs("libx265",          { description = "Enable libx265 decoder.", default = false, type = "boolean"})
+        add_configs("iconv",            { description = "Enable libiconv library.", default = false, type = "boolean"})
+        add_configs("hardcoded-tables", { description = "Enable hardcoded tables.", default = true, type = "boolean"})
+    end
 
     add_links("avfilter", "avdevice", "avformat", "avcodec", "swscale", "swresample", "avutil")
     if is_plat("macosx") then
@@ -31,7 +44,7 @@ package("ffmpeg")
         add_deps("yasm")
     end
 
-    on_load(function (package)
+    on_load("linux", "macos", "android", function (package)
         local configdeps = {zlib    = "zlib",
                             bzlib   = "bzip2",
                             lzma    = "xz",
@@ -45,6 +58,12 @@ package("ffmpeg")
         end
     end)
 
+    on_install("windows|x64", "mingw|x86_64", function (package)
+        os.mv("bin", package:installdir())
+        os.mv("include", package:installdir())
+        os.mv("lib", package:installdir())
+    end)
+
     on_install("linux", "macosx", "android@linux,macosx", function (package)
         local configs = {"--enable-gpl",
                          "--enable-version3",
@@ -68,8 +87,10 @@ package("ffmpeg")
         end
         if package:is_plat("android") then
             import("core.base.option")
-            local bin = get_config("bin")
-            local ndk_sdkver = get_config("ndk_sdkver")
+            import("core.tool.toolchain")
+            local ndk = toolchain.load("ndk", {plat = package:plat(), arch = package:arch()})
+            local bin = ndk:bindir()
+            local ndk_sdkver = ndk:config("ndk_sdkver")
             local arch, cpu, triple, cross_prefix
             if package:is_arch("arm64-v8a") then
                 arch = "arm64"