summaryrefslogtreecommitdiff
path: root/media/ffvpx/libavutil/log.c
diff options
context:
space:
mode:
authortrav90 <travawine@protonmail.ch>2018-10-01 10:27:24 -0500
committertrav90 <travawine@protonmail.ch>2018-10-01 10:27:24 -0500
commitebc8d7e3ca8723d815904e6fee6c088c659d6784 (patch)
tree9e3115f44e9a09b9c71d40d72c7d5c939b2278e2 /media/ffvpx/libavutil/log.c
parent8e8fcee4a55de171303ebe526d3cf051522111bf (diff)
downloaduxp-ebc8d7e3ca8723d815904e6fee6c088c659d6784.tar.gz
[ffvpx] Update ffvp9/ffvp8 to release 4.0.2
Diffstat (limited to 'media/ffvpx/libavutil/log.c')
-rw-r--r--media/ffvpx/libavutil/log.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/media/ffvpx/libavutil/log.c b/media/ffvpx/libavutil/log.c
index be806202ff..9b7d48487f 100644
--- a/media/ffvpx/libavutil/log.c
+++ b/media/ffvpx/libavutil/log.c
@@ -39,11 +39,9 @@
#include "common.h"
#include "internal.h"
#include "log.h"
+#include "thread.h"
-#if HAVE_PTHREADS
-#include <pthread.h>
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
+static AVMutex mutex = AV_MUTEX_INITIALIZER;
#define LINE_SZ 1024
@@ -57,7 +55,7 @@ static int av_log_level = AV_LOG_INFO;
static int flags;
#define NB_LEVELS 8
-#if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE
+#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE
#include <windows.h>
static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = {
[AV_LOG_PANIC /8] = 12,
@@ -124,7 +122,7 @@ static int use_color = -1;
static void check_color_terminal(void)
{
-#if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE
+#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE
CONSOLE_SCREEN_BUFFER_INFO con_info;
con = GetStdHandle(STD_ERROR_HANDLE);
use_color = (con != INVALID_HANDLE_VALUE) && !getenv("NO_COLOR") &&
@@ -159,7 +157,7 @@ static void colored_fputs(int level, int tint, const char *str)
if (level == AV_LOG_INFO/8) local_use_color = 0;
else local_use_color = use_color;
-#if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE
+#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE
if (local_use_color)
SetConsoleTextAttribute(con, background | color[level]);
fputs(str, stderr);
@@ -268,11 +266,11 @@ static void format_line(void *avcl, int level, const char *fmt, va_list vl,
av_bprintf(part+1, "[%s @ %p] ",
avc->item_name(avcl), avcl);
if(type) type[1] = get_category(avcl);
-
- if (flags & AV_LOG_PRINT_LEVEL)
- av_bprintf(part+2, "[%s] ", get_level_str(level));
}
+ if (*print_prefix && (level > AV_LOG_QUIET) && (flags & AV_LOG_PRINT_LEVEL))
+ av_bprintf(part+2, "[%s] ", get_level_str(level));
+
av_vbprintf(part+3, fmt, vl);
if(*part[0].str || *part[1].str || *part[2].str || *part[3].str) {
@@ -317,9 +315,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
if (level > av_log_level)
return;
-#if HAVE_PTHREADS
- pthread_mutex_lock(&mutex);
-#endif
+ ff_mutex_lock(&mutex);
format_line(ptr, level, fmt, vl, part, &print_prefix, type);
snprintf(line, sizeof(line), "%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str);
@@ -356,9 +352,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
#endif
end:
av_bprint_finalize(part+3, NULL);
-#if HAVE_PTHREADS
- pthread_mutex_unlock(&mutex);
-#endif
+ ff_mutex_unlock(&mutex);
}
static void (*av_log_callback)(void*, int, const char*, va_list) =