diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 40d74eb..bcc9542 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -7,6 +7,8 @@ inputs: tests: description: Unit tests. default: false + ffmpeg-path: + description: Path to ffmpeg platform: description: Target platform. required: false @@ -29,8 +31,9 @@ runs: SCONSFLAGS: ${{ inputs.sconsflags }} SCONS_CACHE: ${{ inputs.scons-cache }} SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }} + FFMPEG_PATH: ${{ inputs.ffmpeg-path }} run: | cd gdextension_build - echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} ${{ env.SCONSFLAGS }} - scons platform=${{ inputs.platform }} target=${{ inputs.target }} ${{ env.SCONSFLAGS }} + echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} ffmpeg_path=${{ env.FFMPEG_PATH }} ${{ env.SCONSFLAGS }} + scons platform=${{ inputs.platform }} target=${{ inputs.target }} ffmpeg_path=${{ env.FFMPEG_PATH }} ${{ env.SCONSFLAGS }} ls -l build/addons/ffmpeg/ diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index a3b8544..6b0238b 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -35,6 +35,11 @@ jobs: with: submodules: recursive + - name: Download ffmpeg + run: | + wget https://github.com/EIRTeam/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-lgpl-godot.tar.xz + tar xvf ffmpeg-master-latest-linux64-lgpl-godot.tar.xz + - name: Setup python and scons uses: ./.github/actions/deps @@ -42,6 +47,7 @@ jobs: uses: ./.github/actions/build with: sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} + ffmpeg-path: "../ffmpeg-master-latest-linux64-lgpl-godot/" platform: linux target: ${{ matrix.target }} tests: ${{ matrix.tests }} diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index b38cd03..f5b70d3 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -42,10 +42,24 @@ jobs: - name: Setup MSVC problem matcher uses: ammaraskar/msvc-problem-matcher@master + - uses: suisei-cn/actions-download-file@v1 + id: downloadfile + name: Download the file + with: + url: "https://github.com/EIRTeam/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-lgpl-godot.tar.xz" + target: . + + - name: Extract tgz + uses: ihiroky/extract-action@v1 + with: + file_path: ffmpeg-master-latest-win64-lgpl-godot.tar.xz + extract_dir: . + - name: Compilation uses: ./.github/actions/build with: sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} + ffmpeg-path: "../ffmpeg-master-latest-win64-lgpl-godot/" platform: windows target: ${{ matrix.target }} tests: ${{ matrix.tests }} diff --git a/gdextension_build/SConstruct b/gdextension_build/SConstruct index 351b115..b333321 100644 --- a/gdextension_build/SConstruct +++ b/gdextension_build/SConstruct @@ -55,9 +55,13 @@ else: opts = Variables([], ARGUMENTS) opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False)) +opts.Add(("ffmpeg_path", "Path to FFmpeg", "")) opts.Update(env) +if not "ffmpeg_path" in env or not env["ffmpeg_path"]: + raise RuntimeError("ffmpeg path not found") + if not env["verbose"]: methods.no_verbose(sys, env) @@ -65,12 +69,13 @@ env.Append(CPPDEFINES=["GDEXTENSION"]) env.Append(CPPPATH=["../"]) sources = Glob("../*.cpp") sources.extend(Glob("*.cpp")) +ffmpeg_path = env["ffmpeg_path"] -env.Prepend(CPPPATH="../thirdparty/ffmpeg/include") -env.Append(LIBPATH="../thirdparty/ffmpeg/lib") ffmpeg_libs = ["avcodec", "avfilter", "avformat", "avutil", "swresample", "swscale"] env.Append(LIBS=ffmpeg_libs) +env.Prepend(CPPPATH=f"{ffmpeg_path}/include") +env.Append(LIBPATH=[f"{ffmpeg_path}/lib"]) if env["platform"] == "windows" and sys.platform == "win32" and not env.get("is_msvc", False): # Workaround for https://github.com/godotengine/godot-cpp/issues/1064 @@ -100,13 +105,9 @@ else: source=sources, ) -FFMPEG_DUMMY = "../thirdparty/ffmpeg/LICENSE.txt" -ffmpeg_download_action = ffmpeg_download.ffmpeg_download_builder(env, FFMPEG_DUMMY, "ffmpeg_download.py") -ffmpeg_install_action = ffmpeg_download.ffmpeg_install(env, f"#{addon_platform_dir}", "../thirdparty/ffmpeg") +ffmpeg_install_action = ffmpeg_download.ffmpeg_install(env, f"#{addon_platform_dir}", ffmpeg_path) env.Depends(sources, env.Install(addon_base_dir, "ffmpeg.gdextension")) -license_install_action = env.InstallAs(f"{addon_base_dir}LICENSE-ffmpeg.txt", FFMPEG_DUMMY) env.Depends(sources, ffmpeg_install_action) -env.Depends(sources, license_install_action) env.GLSL_HEADER("../yuv_to_rgb.glsl") env.Depends(Glob("../*.glsl.gen.h"), ["#glsl_builders.py"]) diff --git a/gdextension_build/command_queue_mt.cpp b/gdextension_build/command_queue_mt.cpp index 4d4cff1..d3770e4 100644 --- a/gdextension_build/command_queue_mt.cpp +++ b/gdextension_build/command_queue_mt.cpp @@ -71,10 +71,8 @@ CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() { return &sync_sems[idx]; } -CommandQueueMT::CommandQueueMT(bool p_sync) { - if (p_sync) { - sync = memnew(Semaphore); - } +CommandQueueMT::CommandQueueMT() { + sync = memnew(Semaphore); } CommandQueueMT::~CommandQueueMT() { diff --git a/gdextension_build/command_queue_mt.h b/gdextension_build/command_queue_mt.h index 4c4f77c..f4f1260 100644 --- a/gdextension_build/command_queue_mt.h +++ b/gdextension_build/command_queue_mt.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef ET_COMMAND_QUEUE_MT_H -#define ET_COMMAND_QUEUE_MT_H +#ifndef COMMAND_QUEUE_MT_H +#define COMMAND_QUEUE_MT_H #ifdef GDEXTENSION @@ -418,7 +418,7 @@ class CommandQueueMT { _flush(); } - CommandQueueMT(bool p_sync); + CommandQueueMT(); ~CommandQueueMT(); }; @@ -440,4 +440,4 @@ class CommandQueueMT { #endif -#endif // ET_COMMAND_QUEUE_MT_H +#endif // COMMAND_QUEUE_MT_H