[FFmpeg-devel] [PATCH] Use hi-res timer under win32 builds
Mon Oct 15 09:54:56 CEST 2007
Fred Rothganger <fred at rothganger.org> writes:
> I am compiling ffmpeg under cygwin with -mno-cygwin, and then linking
> the resulting static libs under MSVC 2005 edition. There are three
> symbols that remain undefined at link time:
> This patch addresses _gettimeofday. It is supplying a microsecond
> resolution time value for general use. Under cygwin, the resolution
> of _gettimeofday is much more coarse, on the order of 10ms. Also, as
> noted above, this breaks linkage with the MSVC runtime. Instead, we
> can use a high resolution timer calls in the win32 api.
> -- Fred
> Index: utils.c
> --- utils.c (revision 10737)
> +++ utils.c (working copy)
> @@ -22,8 +22,12 @@
> #include "opt.h"
> #include "avstring.h"
> #include "riff.h"
> -#include <sys/time.h>
> -#include <time.h>
> +#if defined(WIN32) || defined(__CYGWIN__)
> +# include <windows.h>
> +# include <sys/time.h>
> +# include <time.h>
You really haven't been paying much attention recently, have you?
We've worked long and hard to get rid of all such #ifdeffery, and
we're not likely to start accepting such patches again.
> #undef NDEBUG
> #include <assert.h>
> @@ -2579,9 +2583,21 @@
> int64_t av_gettime(void)
> +# if defined(WIN32) || defined(__CYGWIN__)
> + LARGE_INTEGER count;
> + LARGE_INTEGER frequency;
> + QueryPerformanceCounter (&count);
> + QueryPerformanceFrequency (&frequency);
> + return count.QuadPart * 1000000 / frequency.QuadPart;
> +# else
> struct timeval tv;
> return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
> +# endif
Why is it that everything in Windows is so hideously, appallingly,
mans at mansr.com
More information about the ffmpeg-devel