diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-06-22 22:34:02 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-06-22 22:34:02 +0200 |
commit | e847f4128543432a77fb8f85c313646a406c76f6 (patch) | |
tree | c23fd3d3cd7904fae57c6a3e7395e10e58ae5579 /libavutil/time.c | |
parent | 492cc9bcc4a50b4213648c1b8dcb7c28d17ea8f7 (diff) | |
parent | 9ee3334840c0d8564ca73dbfd6cd5a01bcdca79b (diff) | |
download | ffmpeg-e847f4128543432a77fb8f85c313646a406c76f6.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
libspeexenc: add supported sample rates and channel layouts.
Replace usleep() calls with av_usleep()
lavu: add av_usleep() function
utvideo: mark interlaced frames as such
utvideo: Fix interlaced prediction for RGB utvideo.
cosmetics: do not use full path for local headers
lavu/file: include unistd.h only when available
configure: check for unistd.h
log: include unistd.h only when needed
lavf: include libavutil/time.h instead of redeclaring av_gettime()
Conflicts:
configure
doc/APIchanges
ffmpeg.c
ffplay.c
libavcodec/utvideo.c
libavutil/avutil.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/time.c')
-rw-r--r-- | libavutil/time.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libavutil/time.c b/libavutil/time.c index 68f431e695..27feb0b758 100644 --- a/libavutil/time.c +++ b/libavutil/time.c @@ -22,13 +22,19 @@ #include <stddef.h> #include <stdint.h> +#include <time.h> #if HAVE_GETTIMEOFDAY #include <sys/time.h> -#elif HAVE_GETSYSTEMTIMEASFILETIME +#endif +#if HAVE_UNISTD_H +#include <unistd.h> +#endif +#if HAVE_WINDOWS_H #include <windows.h> #endif #include "libavutil/time.h" +#include "error.h" int64_t av_gettime(void) { @@ -46,3 +52,19 @@ int64_t av_gettime(void) return -1; #endif } + +int av_usleep(unsigned usec) +{ +#if HAVE_NANOSLEEP + struct timespec ts = { usec / 1000000, usec % 1000000 * 1000 }; + while (nanosleep(&ts, &ts) < 0 && errno == EINTR); + return 0; +#elif HAVE_USLEEP + return usleep(usec); +#elif HAVE_SLEEP + Sleep(usec / 1000); + return 0; +#else + return AVERROR(ENOSYS); +#endif +} |