[FFmpeg-devel] [PATCH] avcodec/nvenc: Include nvEncodeAPI v7 SDK header

James Almer jamrial at gmail.com
Tue Aug 30 05:28:23 EEST 2016


On 8/29/2016 7:13 PM, James Almer wrote:
> On 8/29/2016 5:31 PM, Timo Rothenpieler wrote:
>> On 8/29/2016 8:43 PM, James Almer wrote:
>>> On 8/27/2016 9:58 AM, Timo Rothenpieler wrote:
>>>> @@ -5996,6 +5992,22 @@ enabled vdpau && enabled xlib &&
>>>>      check_lib2 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
>>>>      enable vdpau_x11
>>>>  
>>>> +case $target_os in
>>>> +    mingw32*|mingw64*|win32|win64|linux|cygwin*)
>>>> +        disabled nvenc || enable nvenc
>>>> +        ;;
>>>> +    *)
>>>> +        disable nvenc
>>>> +        ;;
>>>> +esac
>>>> +
>>>> +if enabled nvenc; then
>>>> +    {
>>>> +        echo '#include "compat/nvenc/nvEncodeAPI.h"'
>>>> +        echo 'int main(void) { return 0; }'
>>>> +    } | check_cc -I$source_path || disable nvenc
>>>
>>> In what situation could this test fail? nvenc is only enabled if $target_os
>>> is one of the supported ones, and the test does nothing but compile the
>>> header.
>>
>> Strange/broken compiler like ancient MinGW or Cygwin, or old MSVC.
> 
> I don't think anything in those could break compilation of this header. It
> doesn't seem to use any api, define or struct from windows only headers
> aside from RECT, GUID and __stdcall.
> If any of the nvenc files from libavcodec depends on something that could
> be missing in old and broken compilers then a more specific check should
> be done for it.

Indeed, the fact this test succeeds on pretty much every target revealed
that nvenc.c isn't compiling with msvc 2012, probably because of c99-to-89.
http://fate.ffmpeg.org/log.cgi?time=20160829225456&log=compile&slot=x86_32-msvc11-windows-native

And mingw32 (Not mingw-w64) but in this case because of missing defines.
http://fate.ffmpeg.org/log.cgi?time=20160829044509&log=compile&slot=x86_64-freebsd10-mingw32

It also broke gcc-asan on linux x86.
http://fate.ffmpeg.org/log.cgi?time=20160830020159&log=compile&slot=x86_64-archlinux-gcc-asan

> 
>>
>>> If it only supports x86 then you can just check "enabled x86" instead.
>>
>> NVENC is not supported on FreeBSD or OSX for example.
> 
> I figured as much seeing the OS list above. What i meant was that if the
> check was meant to make sure it's only enabled on x86 linux/windows
> targets, and not for example ARM like when building for WinRT, then you
> could simply check for supported OSes and x86 arch.
> 
> This test succeeds on every Linux/Windows target. It includes only
> stdint.h, stdlib.h, windows.h if necessary, and defines RECT and GUID
> on non-Windows platforms.
> See http://fate.ffmpeg.org/. All the nvenc files are being compiled on
> every platform (arm, aarch64, alpha, mips, etc).
> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
> 



More information about the ffmpeg-devel mailing list