This is cleaner, but it is also a workaround for when
the header exists, but cannot be compiled.
This will happen when the compiler has no inline asm
support.
Possibly the configure check should be improved as well.
Some of these were made possible by moving several common macros to
libavutil/macros.h.
While just at it, also improve the other headers a bit.
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Compared to ad-hoc if(printed) ... code this allows the user to disable
it by adjusting the log level
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
To make behavior the same as non-win32 code when the standard error is
redirected. Also restructure the code a bit.
Signed-off-by: Marton Balint <cus@passwd.hu>
SetConsoleTextAttribute used to be unavailable for Windows Store apps,
but is available to them now. But GetStdHandle still is unavailable,
thus make sure to check for both functions before using code that
requires both.
Signed-off-by: Martin Storsjö <martin@martin.st>
Adds the level prefix to all log messages, except those with level <=
AV_LOG_QUIET as they seem to be used for flushing the log buffer.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
w32threads and os2threads both support static mutex initialization now,
so don't limit it to pthreads only.
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
The new function behaves the same as av_log_format_line, but also forwards
the return value from the underlying snprintf call. This will allow
callers to accurately determine the size requirements for the line buffer.
Signed-off-by: Andreas Weis <github@ghulbus-inc.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Useful to understand where and in what execution state a certain message
is generated. It is enabled only when optimizations are disabled, since
function names are not printed otherwise.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Configure will detect the availability of the Windows' console functions and set
HAVE_SETCONSOLETEXTATTRIBUTE. Meaning av_log will use those functions to
control colours. When ffmpeg is run in Cygwin's mintty terminal emulator it
will not use colour highlighting in this case.
Mintty responds to the usual escape code colours (it even supports 256 colours).
Windows' cmd.exe does not. Fortunately it seems that Cygwin's emulation layer
now translates the basic 16 colours into Windows' Console command functions.
That means that we can have av_log use the standard colour commands and let
ffmpeg print colours in both mintty and cmd.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
And provide extended coloring capabilities for debugging.
The default colors do not change in 256 more to keep
supporting people using Black on White, White on Black and
Solarized terminals.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Fixes out of array read
Fixes: asan_heap-oob_19d6979_6857_mmw_deadzy.ogg
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>