[FFmpeg-devel] [PATCH] configure: improve logic and checks for nvenc
Timo Rothenpieler
timo at rothenpieler.org
Wed Aug 31 11:26:34 EEST 2016
>> + echo 'NV_ENCODE_API_FUNCTION_LIST flist;'
>> + echo 'void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; }'
>
> This will most likely prevent nvenc from being enabled for msvc 2012, but not old
> mingw32, which is failing with the error:
>
> src/libavcodec/nvenc.c:115:52: error: 'ENOBUFS' undeclared here (not in a function)
> { NV_ENC_ERR_NOT_ENOUGH_BUFFER, AVERROR(ENOBUFS), "not enough buffer" },
>
> I think the easiest solution would be using AVERROR_BUFFER_TOO_SMALL if ENOBUFS is
> not defined.
Yes, if that's all that's failing, I'll just do that.
> That or just disable nvenc if using mingw32 toolchains by checking "enabled
> libc_mingw32", since disabling for target-os == mingw32 would also affect mingw-w64.
> gcc-asan fails with
>
> /usr/bin/ld: libavcodec/libavcodec.a(nvenc.o): undefined reference to symbol 'dlsym@@GLIBC_2.2.5'
> /usr/lib/../lib/libdl.so.2: error adding symbols: DSO missing from command line
> collect2: error: ld returned 1 exit status
>
> I have no idea how to deal with this.
When and how are you seeing that error?
That usually means a wrong order of libraries/object-files on linker
command line.
>> + echo 'int main(void) { f(); return 0; }'
>> + } | check_cc -I$source_path
>> + nvenc_check_res=$?
>> +
>> + if [ $nvenc_check_res != 0 ] && enabled nvenc; then
>> + die "NVENC enabled but test-compile failed"
>> + fi
>> +
>> + case $target_os in
>> + mingw32*|mingw64*|win32|win64|linux|cygwin*)
>> + [ $nvenc_check_res = 0 ] && enable nvenc
>> + ;;
>> + *)
>> + enabled nvenc && die "NVENC is only supported on Windows and Linux"
>> + disable nvenc
>> + ;;
>> + esac
>> +
>> + unset nvenc_check_res
>
> This test is different from other automatically detected features, and also
> unnecessarily complex.
> You should force enable nvenc earlier in the script like with other similar
> features (including hardware codecs and accelerators), then disable it on
> unsupported platforms and old/broken compilers with the corresponding checks
> and tests.
>
> Something like this:
> [...]
Ah, so even if calling enable nvenc, --disable-nvenc on the command line
will still override it, and the "disabled nvenc" check will still work?
I wasn't aware of that, so yes, that makes it a lot simpler.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160831/b636da75/attachment.sig>
More information about the ffmpeg-devel
mailing list