Commit Graph

14 Commits

Author SHA1 Message Date
Marvin Scholz d67c6c7f6f lavu: use address-of operator checking clock_gettime
When targeting a recent enough macOS/iOS version that has clock_gettime
it won't be a weak symbol, in which case clang warns for this check
as it's always true:

  warning: address of function 'clock_gettime' will always
  evaluate to 'true'

This warning is silenced by using the address-of operator to make
the intent explicit.
2020-12-28 01:12:26 -03:00
Wang Bin 0e8b68a2c4 avutil/tile: check clock_gettime at runtime for apple platforms
clock_gettime is avalible since macOS 10.12 and iOS 10.0. Because of
weak linking, clock_gettime can be build without error with new
macOS/iOS sdk, but the symbol may not exist on the target system.
Explicitly checking the symbol is required.
https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html

Signed-off-by: Wang Bin <wbsecg1@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-01-09 11:52:06 +08:00
Michael Niedermayer e96ca404ea Merge commit '1bd0bdcdc236099d5c0d179696951f35f5310fa5'
* commit '1bd0bdcdc236099d5c0d179696951f35f5310fa5':
  lavu: Add av_gettime_relative

Conflicts:
	libavutil/time.c
	libavutil/time.h
	libavutil/version.h

See: 0eec06ed87
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-24 11:06:56 +02:00
Martin Storsjö 1bd0bdcdc2 lavu: Add av_gettime_relative
Since av_gettime() is used in a number of places where actual
real time clock is required, the monotonic clock introduced in
ebef9f5a5 would have consequences that are hard to handle. Instead
split it into a separate function that can be used in the cases
where only relative time is desired.

On platform where no monotonic clock is available, the difference
between the two av_gettime functions is not clear, and one could
mistakenly use the relative clock where an absolute one is
required. Therefore add an offset, to make it evident that the
time returned from av_gettime_relative never is actual current
real time, even though it is based on av_gettime.

Based on a patch by Olivier Langlois.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-24 09:53:41 +03:00
Gabriel Dume 1ec335513f time: Add missing zero
Leftover of 56d7df91e010a177a80cfc8dbe394305

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-09-08 21:46:12 +02:00
Luca Barbato ebef9f5a56 time: Use clock_gettime if the monotonic clock is available
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-09-03 02:38:03 +02:00
Olivier Langlois 0eec06ed87 lavu: add av_gettime_relative()
These functions are using the POSIX clock_gettime() function with the
CLOCK_MONOTONIC clock id. If these are not present on the targeted
platform, the new functions will fallback on using the original realtime functions
av_gettime() and av_usleep().

Monotonic support can be added on other platforms with their
equivalent native system API eventually if possible.

Whenever time is requested to measure relative time, the monotonic clock,
when available, is superior to the system realtime clock because it is
not affected by discontinuous jumps in the system time

In a future step, offering the flexibility to let the user choose between
rt and monotonic clock for avdevices packets will be investigated.

It is very easy to experience the issues that this patch attempt to address
by rewinding back in the past the system time while ffmpeg is running.

this is breaking the ffmpeg report printing (ffmepg.c:print_report()) and
the the rate emulator functionality (-re) without the patch.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-17 15:28:03 +02:00
Michael Niedermayer 803445e02c Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Drop pointless directory name prefixes from #includes in the current dir

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-11 12:51:01 +02:00
Diego Biurrun a0b901a348 Drop pointless directory name prefixes from #includes in the current dir 2013-09-10 12:38:41 +02:00
Michael Niedermayer e847f41285 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>
2012-06-22 22:34:02 +02:00
Mans Rullgard d3d3a32c9d lavu: add av_usleep() function
This function implements a delay using the first available
of the following functions:

- nanosleep()
- usleep()
- Sleep() (Windows)

The conditional #includes in time.c are simplified by including
unistd.h and windows.h whenever they are available rather than
having these lines triggered by specific functions.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-22 17:15:18 +01:00
Michael Niedermayer 104c914640 libavutil: fix author attribution
Libav.org has removed this while moving the code around

For reference, the code was originally added in:
commit 9aeeeb63f7
Author: Fabrice Bellard <fabrice@bellard.org>
Date:   Wed Dec 20 00:02:47 2000 +0000

    Initial revision

    Originally committed as revision 2 to svn://svn.ffmpeg.org/ffmpeg/trunk
--
The function name originates from:
commit 9498853132
Author: Fabrice Bellard <fabrice@bellard.org>
Date:   Thu Jul 25 16:01:46 2002 +0000

    more consistent naming

    Originally committed as revision 802 to svn://svn.ffmpeg.org/ffmpeg/trunk

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-20 23:51:02 +02:00
Mans Rullgard 61183b5ab4 av_gettime: support Win32 without gettimeofday()
Based on patch by Ronald S. Bultje.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 17:09:03 +01:00
Mans Rullgard ae0a301668 Move av_gettime() to libavutil
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 17:09:03 +01:00