Commit cabf9349 authored by Eden Abitbol's avatar Eden Abitbol Committed by Adrien Béraud

ffnvcodec: Add nvcodec windows support

Add fetch_and_patch script for ffnvcodec.

fetch_and_patch script copies needed headers to contrib include
directory.

Patch file to adapt ffmpeg configure script for ffnvcodec package
inclusion. On linux pkg_config is used. On windows the files
need to be included manually.

config script includes path for ffnvcodec files and corresponding
flags are set.

Change-Id: Ia9daca2a49316a4373652acb718930d02f85e3f6
Reviewed-by: Philippe Gorley's avatarPhilippe Gorley <philippe.gorley@savoirfairelinux.com>
parent ebe76c51
......@@ -7,6 +7,9 @@ systems. This function is required for `alloca.c' support on those systems.
/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */
/* Define to 1 if you want hardware acceleration support. */
#define RING_ACCEL 1
/* Define to 1 if you have `alloca', as a function or macro. */
#define HAVE_ALLOCA 1
......
......@@ -767,10 +767,7 @@
<ClCompile Include="..\src\media\socket_pair.cpp" />
<ClCompile Include="..\src\media\srtp.c" />
<ClCompile Include="..\src\media\system_codec_container.cpp" />
<ClCompile Include="..\src\media\video\accel.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLib_win32|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\media\video\accel.cpp" />
<ClCompile Include="..\src\media\video\filter_transpose.cpp" />
<ClCompile Include="..\src\media\video\sinkclient.cpp" />
<ClCompile Include="..\src\media\video\uwpvideo\video_device_impl.cpp">
......@@ -931,10 +928,7 @@
<ClInclude Include="..\src\media\socket_pair.h" />
<ClInclude Include="..\src\media\srtp.h" />
<ClInclude Include="..\src\media\system_codec_container.h" />
<ClInclude Include="..\src\media\video\accel.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLib_win32|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\src\media\video\accel.h" />
<ClInclude Include="..\src\media\video\filter_transpose.h" />
<ClInclude Include="..\src\media\video\shm_header.h" />
<ClInclude Include="..\src\media\video\sinkclient.h" />
......@@ -999,6 +993,7 @@
<ClInclude Include="..\src\utf8_utils.h" />
<ClInclude Include="..\src\windirent.h" />
<ClInclude Include="..\src\winsyslog.h" />
<ClInclude Include="config.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\src\jamidht\eth\libdevcore\Makefile.am" />
......
......@@ -367,9 +367,6 @@
<ClCompile Include="..\src\jamidht\p2p.cpp">
<Filter>Source Files\jamidht</Filter>
</ClCompile>
<ClCompile Include="..\src\media\video\accel.cpp">
<Filter>Source Files\media\video</Filter>
</ClCompile>
<ClCompile Include="..\src\security\diffie-hellman.cpp">
<Filter>Source Files\security</Filter>
</ClCompile>
......@@ -409,6 +406,9 @@
<ClCompile Include="..\src\media\video\filter_transpose.cpp">
<Filter>Source Files\media\video</Filter>
</ClCompile>
<ClCompile Include="..\src\media\video\accel.cpp">
<Filter>Source Files\media\video</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\account.h">
......@@ -711,9 +711,6 @@
<ClInclude Include="..\src\media\audio\sound\tonelist.h">
<Filter>Source Files\media\audio\sound</Filter>
</ClInclude>
<ClInclude Include="..\src\media\video\accel.h">
<Filter>Source Files\media\video</Filter>
</ClInclude>
<ClInclude Include="..\src\media\video\shm_header.h">
<Filter>Source Files\media\video</Filter>
</ClInclude>
......@@ -840,6 +837,12 @@
<ClInclude Include="..\src\media\video\filter_transpose.h">
<Filter>Source Files\media\video</Filter>
</ClInclude>
<ClInclude Include="config.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\src\media\video\accel.h">
<Filter>Source Files\media\video</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\src\jamidht\eth\libdevcore\Makefile.am">
......
......@@ -21,6 +21,7 @@ if "%1"=="uwp" (
:uwpDeps
set DEPENDENCIES=( ^
ffnvcodec, ^
ffmpeg, ^
argon2, ^
zlib ^
......@@ -45,6 +46,7 @@ goto fetch
:win32Deps
set DEPENDENCIES=( ^
ffnvcodec, ^
ffmpeg, ^
argon2, ^
zlib ^
......
......@@ -31,5 +31,6 @@ set UNIXPATH=%ROOTPATH%%UNIXPATH:C:/=%
bash -c "%PATCH_CMD% %UNIXPATH%ffmpeg/change-RTCP-ratio.patch"
git apply --reject --whitespace=fix %SRC%\ffmpeg\windows-configure.patch
git apply --reject --whitespace=fix %SRC%\ffmpeg\windows-configure-ffnvcodec.patch
cd %SRC%
\ No newline at end of file
From 63d0edcee2744317fc0befad53000c206eb5ee31 Mon Sep 17 00:00:00 2001
From: Eden Abitbol <eden.abitbol@savoirfairelinux.com>
Date: Tue, 9 Jul 2019 10:52:29 -0400
Subject: [PATCH] Remove ffnvcodec linux style package check for windows
support.
---
configure | 7 -------
1 file changed, 7 deletions(-)
--- a/configure
+++ b/configure
@@ -5897,13 +5897,6 @@ check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"
check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
-if ! disabled ffnvcodec; then
- check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.2" \
- "ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" "" || \
- { test_pkg_config ffnvcodec_tmp "ffnvcodec < 8.1" "" "" && check_pkg_config ffnvcodec "ffnvcodec >= 8.0.14.2" \
- "ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" ""; }
-fi
-
check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
if ! disabled w32threads && ! enabled pthreads; then
--
2.22.0.windows.1
......@@ -142,7 +142,7 @@ if [ "$1" == "uwp" ]; then
OUTDIR=Output/Windows10/x86
fi
elif [ "$1" == "win32" ]; then
EXTRACFLAGS='-MD -D_WINDLL -I../../../../../msvc/include -I../../../../../msvc/include/opus -I../../../../../msvc/include/vpx'
EXTRACFLAGS='-MD -D_WINDLL -I../../../../../msvc/include -I../../../../../msvc/include/opus -I../../../../../msvc/include/vpx -I../../../../../msvc/include/ffnvcodec'
FFMPEGCONF+='
--enable-libvpx
--enable-encoder=libvpx_vp8
......@@ -152,6 +152,17 @@ elif [ "$1" == "win32" ]; then
--enable-indev=dshow
--enable-indev=gdigrab
--enable-dxva2'
FFMPEGCONF+='
--enable-ffnvcodec
--enable-cuvid
--enable-nvdec
--enable-nvenc
--enable-hwaccel=h264_nvdec
--enable-hwaccel=hevc_nvdec
--enable-hwaccel=vp8_nvdec
--enable-hwaccel=mjpeg_nvdec
--enable-encoder=h264_nvenc
--enable-encoder=hevc_nvenc'
if [ "$2" == "x64" ]; then
echo "configure and make ffmpeg for win32-x64..."
EXTRALDFLAGS='-APPCONTAINER:NO -MACHINE:x64 Ole32.lib Kernel32.lib Gdi32.lib User32.lib Strmiids.lib OleAut32.lib Shlwapi.lib Vfw32.lib Secur32.lib libopus.lib libx264.lib libvpx.lib -LIBPATH:../../../../../msvc/lib/x64'
......
set BUILD=%SRC%..\build
mkdir %BUILD%
cd %BUILD%
set FFNVCODEC_VERSION=5eeca8cc95267d55030e98a051effa47c45f13f3
set FFNVCODEC_GITURL=https://github.com/FFmpeg/nv-codec-headers/archive/%FFNVCODEC_VERSION%.tar.gz
if %USE_CACHE%==1 (
copy %CACHE_DIR%\%FFNVCODEC_VERSION%.tar.gz %cd%
) else (
wget --no-check-certificate %FFNVCODEC_GITURL%
)
7z -y x %FFNVCODEC_VERSION%.tar.gz && 7z -y x %FFNVCODEC_VERSION%.tar
del %FFNVCODEC_VERSION%.tar && del %FFNVCODEC_VERSION%.tar.gz && del pax_global_header
rename nv-codec-headers-%FFNVCODEC_VERSION% ffnvcodec
cd ffnvcodec\include\ffnvcodec
mkdir ..\..\..\..\msvc\include
mkdir ..\..\..\..\msvc\include\ffnvcodec
xcopy /S /Y *.h ..\..\..\..\msvc\include\ffnvcodec
cd %SRC%
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment