diff --git a/configure b/configure index 5aa891bac7..a304221b05 100755 --- a/configure +++ b/configure @@ -1281,6 +1281,7 @@ HAVE_LIST=" closesocket cmov cpunop + CryptGenRandom dcbzl dev_bktr_ioctl_bt848_h dev_bktr_ioctl_meteor_h @@ -3540,6 +3541,7 @@ check_func_headers windows.h PeekNamedPipe check_func_headers io.h setmode check_func_headers lzo/lzo1x.h lzo1x_999_compress check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32 +check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32 check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi check_func_headers windows.h GetProcessAffinityMask check_func_headers windows.h GetProcessTimes diff --git a/doc/faq.texi b/doc/faq.texi index 5477faf219..1158091a0c 100644 --- a/doc/faq.texi +++ b/doc/faq.texi @@ -467,8 +467,8 @@ to use them you have to append -D__STDC_CONSTANT_MACROS to your CXXFLAGS @section I have a file in memory / a API different from *open/*read/ libc how do I use it with libavformat? -You have to implement a URLProtocol, see @file{libavformat/file.c} in -FFmpeg and @file{libmpdemux/demux_lavf.c} in MPlayer sources. +You have to create a custom AVIOContext using @code{avio_alloc_context}, +see @file{libavformat/aviobuf.c} in FFmpeg and @file{libmpdemux/demux_lavf.c} in MPlayer or MPlayer2 sources. @section Where can I find libav* headers for Pascal/Delphi? diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c index 49c122001a..c674704615 100644 --- a/libavutil/random_seed.c +++ b/libavutil/random_seed.c @@ -23,6 +23,10 @@ #if HAVE_UNISTD_H #include #endif +#if HAVE_CRYPTGENRANDOM +#include +#include +#endif #include #include #include @@ -102,6 +106,17 @@ uint32_t av_get_random_seed(void) { uint32_t seed; +#if HAVE_CRYPTGENRANDOM + HCRYPTPROV provider; + if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { + BOOL ret = CryptGenRandom(provider, sizeof(seed), (PBYTE) &seed); + CryptReleaseContext(provider, 0); + if (ret) + return seed; + } +#endif + if (read_random(&seed, "/dev/urandom") == sizeof(seed)) return seed; if (read_random(&seed, "/dev/random") == sizeof(seed))