Re: [FFmpeg-devel] WinRT API support patch
On 21.11.2014, at 07:44, Jesse Jiang jessejiang0...@outlook.com wrote: Now, I find a function get_generic_seed() So, I use this function will work fine? It is already used as fallback so I don't see why you'd have to change the code at all. uint32_t av_get_random_seed(void){uint32_t seed; #if HAVE_CRYPTGENRANDOMHCRYPTPROV 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 HAVE_WINRTAPIreturn get_generic_seed();#endif if (read_random(seed, /dev/urandom) == sizeof(seed))return seed;if (read_random(seed, /dev/random) == sizeof(seed)) return seed;return get_generic_seed();} From: jessejiang0...@outlook.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Nov 2014 03:51:12 + Subject: Re: [FFmpeg-devel] WinRT API support patch Hi All, I did some research, rand() is pseudo random. CryptGenRandom is the system-wide seed, but it cannot be used in Windows RT. I try to use CryptographicBuffer, which is Windows RT API, but there is a problem. This API needs to link Windows.winmd. The Windows.winmd just like a DLL, but it may different from Windows RT and Windows Phone. First, the SDKs are in the different PATH,Second, the files are also different. It means that developer need to choice platform first, and then compiler for different library. I hope ffmpeg only depends on support win32 apis and CRT apis. So is there any way to instead of srand(time(0)); rand(); ? How about c++11 random or Mersenne twister Algorithmic Best regards,Jesse Date: Fri, 21 Nov 2014 02:49:59 +0100 From: michae...@gmx.at To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] WinRT API support patch On Fri, Nov 21, 2014 at 01:43:29AM +, Jesse Jiang wrote: Do you mean that we can use rand() instead of CryptGenRandom in ffmpeg? rand() is completely wrong its not even doing the correct operation rand() is pseudo random the code requires a strong (and non pseudo) random value [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] WinRT API support patch
On 20 November 2014 08:34:54 CET, Jesse Jiang jessejiang0...@outlook.com wrote: Add WinRT API supports At least 2 fairly major issues: 1) using rand() basically never is correct. Use the appropriate CryptographicBuffer function (yes, that means you need some C++ code unfortunately). 2) CreateThread is not compatible with _beginthreadex, there is a good reason why we use this. Using the other without additional changes will cause memleaks or worse. I am not even sure it is at all possible to use CreateThread correctly for us. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] WinRT API support patch
Hi Reimar, Because of Windows RT cannot use CryptographicBuffer or _beginthreadex API, so I try to use rand() instead of it, or we need to write own function instead of it. If we use WinRT api to instead of these apis, it will cause more bugs. Best regards,Jesse From: reimar.doeffin...@gmx.de Date: Thu, 20 Nov 2014 09:18:30 +0100 To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] WinRT API support patch On 20 November 2014 08:34:54 CET, Jesse Jiang jessejiang0...@outlook.com wrote: Add WinRT API supports At least 2 fairly major issues: 1) using rand() basically never is correct. Use the appropriate CryptographicBuffer function (yes, that means you need some C++ code unfortunately). 2) CreateThread is not compatible with _beginthreadex, there is a good reason why we use this. Using the other without additional changes will cause memleaks or worse. I am not even sure it is at all possible to use CreateThread correctly for us. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] WinRT API support patch
This is of course, completly wrong. The replacement is CryptographicBuffer, allowed in WinRT. On 20 Nov, Jesse Jiang wrote : Hi Reimar, Because of Windows RT cannot use CryptographicBuffer or _beginthreadex API, so I try to use rand() instead of it, or we need to write own function instead of it. If we use WinRT api to instead of these apis, it will cause more bugs. Best regards,Jesse From: reimar.doeffin...@gmx.de Date: Thu, 20 Nov 2014 09:18:30 +0100 To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] WinRT API support patch On 20 November 2014 08:34:54 CET, Jesse Jiang jessejiang0...@outlook.com wrote: Add WinRT API supports At least 2 fairly major issues: 1) using rand() basically never is correct. Use the appropriate CryptographicBuffer function (yes, that means you need some C++ code unfortunately). 2) CreateThread is not compatible with _beginthreadex, there is a good reason why we use this. Using the other without additional changes will cause memleaks or worse. I am not even sure it is at all possible to use CreateThread correctly for us. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- With my kindest regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] WinRT API support patch
On 20 Nov, Jesse Jiang wrote : Add WinRT API supports This patch is wrong on almost every level. rand() is wrong. modifying configure because your headers are broken is wrong too. doing an API rewrapper in FFmpeg is the wrong place, look at winstorecompat in mingw-w64. With my kindest regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] WinRT API support patch
Hi JB, Based on my understanding, mingw-w64 need gcc, so in this way, we need to linked gcc library into our App. I don't want a big library with our Apps. I know the mingw is a correct way, but how could it works with MSVC? Date: Thu, 20 Nov 2014 09:53:27 +0100 From: j...@videolan.org To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] WinRT API support patch On 20 Nov, Jesse Jiang wrote : Add WinRT API supports This patch is wrong on almost every level. rand() is wrong. modifying configure because your headers are broken is wrong too. doing an API rewrapper in FFmpeg is the wrong place, look at winstorecompat in mingw-w64. With my kindest regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] WinRT API support patch
1. libgcc is not big 2. MSVC 2013 has correctly defined headers to solve the rand issue and the configure part. Le 20/11/2014 11:34, Jesse Jiang a écrit : Hi JB, Based on my understanding, mingw-w64 need gcc, so in this way, we need to linked gcc library into our App. I don't want a big library with our Apps. I know the mingw is a correct way, but how could it works with MSVC? Date: Thu, 20 Nov 2014 09:53:27 +0100 From: j...@videolan.org To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] WinRT API support patch On 20 Nov, Jesse Jiang wrote : Add WinRT API supports This patch is wrong on almost every level. rand() is wrong. modifying configure because your headers are broken is wrong too. doing an API rewrapper in FFmpeg is the wrong place, look at winstorecompat in mingw-w64. With my kindest regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] WinRT API support patch
Do you mean that we can use rand() instead of CryptGenRandom in ffmpeg? Date: Thu, 20 Nov 2014 12:17:10 +0100 From: j...@videolan.org To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] WinRT API support patch 1. libgcc is not big 2. MSVC 2013 has correctly defined headers to solve the rand issue and the configure part. Le 20/11/2014 11:34, Jesse Jiang a écrit : Hi JB, Based on my understanding, mingw-w64 need gcc, so in this way, we need to linked gcc library into our App. I don't want a big library with our Apps. I know the mingw is a correct way, but how could it works with MSVC? Date: Thu, 20 Nov 2014 09:53:27 +0100 From: j...@videolan.org To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] WinRT API support patch On 20 Nov, Jesse Jiang wrote : Add WinRT API supports This patch is wrong on almost every level. rand() is wrong. modifying configure because your headers are broken is wrong too. doing an API rewrapper in FFmpeg is the wrong place, look at winstorecompat in mingw-w64. With my kindest regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] WinRT API support patch
On Fri, Nov 21, 2014 at 01:43:29AM +, Jesse Jiang wrote: Do you mean that we can use rand() instead of CryptGenRandom in ffmpeg? rand() is completely wrong its not even doing the correct operation rand() is pseudo random the code requires a strong (and non pseudo) random value [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] WinRT API support patch
Hi All, I did some research, rand() is pseudo random. CryptGenRandom is the system-wide seed, but it cannot be used in Windows RT. I try to use CryptographicBuffer, which is Windows RT API, but there is a problem. This API needs to link Windows.winmd. The Windows.winmd just like a DLL, but it may different from Windows RT and Windows Phone. First, the SDKs are in the different PATH,Second, the files are also different. It means that developer need to choice platform first, and then compiler for different library. I hope ffmpeg only depends on support win32 apis and CRT apis. So is there any way to instead of srand(time(0)); rand(); ? How about c++11 random or Mersenne twister Algorithmic Best regards,Jesse Date: Fri, 21 Nov 2014 02:49:59 +0100 From: michae...@gmx.at To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] WinRT API support patch On Fri, Nov 21, 2014 at 01:43:29AM +, Jesse Jiang wrote: Do you mean that we can use rand() instead of CryptGenRandom in ffmpeg? rand() is completely wrong its not even doing the correct operation rand() is pseudo random the code requires a strong (and non pseudo) random value [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] WinRT API support patch
Now, I find a function get_generic_seed() So, I use this function will work fine? uint32_t av_get_random_seed(void){uint32_t seed; #if HAVE_CRYPTGENRANDOMHCRYPTPROV 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 HAVE_WINRTAPIreturn get_generic_seed();#endif if (read_random(seed, /dev/urandom) == sizeof(seed))return seed; if (read_random(seed, /dev/random) == sizeof(seed))return seed; return get_generic_seed();} From: jessejiang0...@outlook.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Nov 2014 03:51:12 + Subject: Re: [FFmpeg-devel] WinRT API support patch Hi All, I did some research, rand() is pseudo random. CryptGenRandom is the system-wide seed, but it cannot be used in Windows RT. I try to use CryptographicBuffer, which is Windows RT API, but there is a problem. This API needs to link Windows.winmd. The Windows.winmd just like a DLL, but it may different from Windows RT and Windows Phone. First, the SDKs are in the different PATH,Second, the files are also different. It means that developer need to choice platform first, and then compiler for different library. I hope ffmpeg only depends on support win32 apis and CRT apis. So is there any way to instead of srand(time(0)); rand(); ? How about c++11 random or Mersenne twister Algorithmic Best regards,Jesse Date: Fri, 21 Nov 2014 02:49:59 +0100 From: michae...@gmx.at To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] WinRT API support patch On Fri, Nov 21, 2014 at 01:43:29AM +, Jesse Jiang wrote: Do you mean that we can use rand() instead of CryptGenRandom in ffmpeg? rand() is completely wrong its not even doing the correct operation rand() is pseudo random the code requires a strong (and non pseudo) random value [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel