From 47aaf438f6d2eaff5a6291666440bc8efad60b71 Mon Sep 17 00:00:00 2001 From: Daniel Stankewitz Date: Sun, 25 Sep 2022 16:47:24 +0200 Subject: [PATCH] Update test.yml --- .github/workflows/test.yml | 72 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 570d9e0..5e4348e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: mfx +name: 'Build FFmpeg MFX' on: workflow_dispatch: @@ -35,9 +35,24 @@ on: default: 'release/5.1' description: 'FFmpeg refId' + workflow_call: + inputs: + system: + type: string + required: true + type: + type: string + required: true + config: + type: string + required: true + ffmpegRef: + type: string + required: true + env: vsPath: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\ - COMPONENTS: "--enable-mfx " + COMPONENTS: "--enable-libmfx " NASM_EXECUTABLE: nasm cFlags: ${{ inputs.config == 'release' && '-MD' || '-MDd' }} variant: ${{ inputs.type == 'static' && ' --pkg-config-flags="--static" --disable-shared --enable-static' || ' --disable-static --enable-shared' }} @@ -50,5 +65,56 @@ jobs: - uses: actions/checkout@v3 - uses: ./.github/actions/libmfx with: - refId: v1.2.0 + refId: master config: ${{ inputs.config }} + + ffmpeg: + runs-on: ${{ inputs.system }} + needs: [libmfx] + steps: + - name: Set up MSYS2 + uses: msys2/setup-msys2@v2 + with: + install: base-devel binutils mingw-w64-x86_64-cmake nasm + path-type: inherit + - name: Set up GIT + run: | + git config --global core.autocrlf false + git config --global core.eol lf + git config --global user.email "daniel.stankewitz@gmail.com" + git config --global user.name "Daniel Stankewitz" + - name: Checkout patches + uses: actions/checkout@v3.0.0 + - name: Checkout FFmpeg + uses: actions/checkout@v3.0.0 + with: + repository: FFmpeg/FFmpeg.git + ref: ${{ inputs.ffmpegRef }} + path: ffmpeg + - name: Checkout NvEnc + uses: actions/checkout@v3.0.0 + with: + repository: FFmpeg/nv-codec-headers + ref: master + path: nvenc + - name: Checkout AMF + uses: actions/checkout@v3.0.0 + with: + repository: GPUOpen-LibrariesAndSDKs/AMF + ref: master + path: amf + - name: Set up artifacts + uses: actions/download-artifact@v3 + with: + path: build_artifacts + - name: Build FFmpeg + shell: cmd + run: | + call "${{ env.vsPath }}VC\Auxiliary\Build\vcvars64.bat" + md build dist 0001-dynamic-loading-of-shared-fdk-aac-library-cw-5.0.patch + D:\a\_temp\setup-msys2\msys2.cmd -c 'cd ffmpeg ; git apply --ignore-whitespace --verbose ../libfdkaac-dynlib-5.1.patch ; sed -i "s/#define X264_API_IMPORTS 1/\/\/#define X264_API_IMPORTS 1/g" libavcodec/libx264.c ; cd ../build ; for file in `ls ../build_artifacts/**/*.tgz`; do tar -xzf $file; done ; rm -f bin/*.dll ; cd ../nvenc ; make PREFIX=../build install ; cp -a ../amf/amf/public/include ../build/include/AMF ; cd ../ffmpeg ; PKG_CONFIG_PATH=../build/lib/pkgconfig ./configure --toolchain=msvc --extra-cflags="${{ env.cFlags }} -I../build/include" --extra-ldflags="-LIBPATH:../build/lib" --prefix=../build --extra-libs=Ole32.lib --extra-libs=Advapi32.lib --disable-doc ${{ env.variant }} --enable-runtime-cpudetect --enable-w32threads --enable-gpl ${{ env.COMPONENTS }} ; make -j 2 ; make install ; cd ../build/lib ; for file in *.a; do mv "$file" "`basename "$file" .a`.lib" ; done ; rm -rf fdk-aac.lib cmake pkgconfig *.la ../share ; cd .. ; tar czf ../dist/ffmpeg-win64-${{ inputs.type }}-${{ inputs.config }}.tar.gz *' + - name: Publish FFmpeg artifacts + uses: actions/upload-artifact@v3 + with: + name: FFmpeg ${{ inputs.system }} ${{ inputs.config }}${{ inputs.config }} package build + path: dist/ffmpeg-win64-${{ inputs.type }}-${{ inputs.config }}.tar.gz