Browse Source

improve x264, x265 and ffmpeg

ruki 6 years ago
parent
commit
be4d1286fd
3 changed files with 17 additions and 2 deletions
  1. 9 2
      packages/f/ffmpeg/xmake.lua
  2. 4 0
      packages/x/x264/xmake.lua
  3. 4 0
      packages/x/x265/xmake.lua

+ 9 - 2
packages/f/ffmpeg/xmake.lua

@@ -14,6 +14,9 @@ package("ffmpeg")
 
     add_links("avfilter", "avdevice", "avformat", "avcodec", "swscale", "swresample", "avutil")
 
+    add_configs("libx264", {description = "Enable libx264 decoder.", default = false, type = "boolean"})
+    add_configs("libx265", {description = "Enable libx265 decoder.", default = false, type = "boolean"})
+
     on_install("linux", "macosx", function (package)
         local configs = {"--disable-ffmpeg", 
                          "--disable-ffplay", 
@@ -25,11 +28,15 @@ package("ffmpeg")
         if is_plat("macosx") and macos.version():ge("10.8") then
             table.insert(configs, "--enable-videotoolbox")
         end
-        if package:config("x264") ~= false and package:dep("x264"):exists() then
+        if package:config("libx264") and package:dep("x264"):exists() then
             table.insert(configs, "--enable-libx264")
         end
-        if package:config("x265") ~= false and package:dep("x265"):exists() then
+        if package:config("libx265") and package:dep("x265"):exists() then
             table.insert(configs, "--enable-libx265")
         end
         import("package.tools.autoconf").install(package, configs)
     end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("avformat_open_input", {includes = "libavformat/avformat.h"}))
+    end)

+ 4 - 0
packages/x/x264/xmake.lua

@@ -12,3 +12,7 @@ package("x264")
     on_install("linux", "macosx", function (package)
         import("package.tools.autoconf").install(package, {"--disable-lsmash", "--enable-static", "--enable-strip"})
     end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("x264_encoder_open", {includes = {"stdint.h", "x264.h"}}))
+    end)

+ 4 - 0
packages/x/x265/xmake.lua

@@ -20,3 +20,7 @@ package("x265")
         os.cp("8bit/x265_config.h", package:installdir("include"))
         os.cp("../../source/x265.h", package:installdir("include"))
     end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("x265_api_get", {includes = "x265.h"}))
+    end)