diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-10-01 14:34:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-01 14:34:26 +0200 |
commit | 79b00fc33b5cb6d56d29b50efac6d62ce3a89018 (patch) | |
tree | 77d8179bb3d9d76d9ec4fcfe396a35afcc8f73cd /media/ffvpx/libavutil/log.c | |
parent | ab881a3bf513e591b6cc2966560cdab2b63a0f2a (diff) | |
parent | 7d1ee0e5e4958175ccde5d153b025f97a17caeb2 (diff) | |
download | UXP-79b00fc33b5cb6d56d29b50efac6d62ce3a89018.tar UXP-79b00fc33b5cb6d56d29b50efac6d62ce3a89018.tar.gz UXP-79b00fc33b5cb6d56d29b50efac6d62ce3a89018.tar.lz UXP-79b00fc33b5cb6d56d29b50efac6d62ce3a89018.tar.xz UXP-79b00fc33b5cb6d56d29b50efac6d62ce3a89018.zip |
Merge pull request #801 from trav90/update-from-upstream
Update ffvpx code to 4.0.2
Diffstat (limited to 'media/ffvpx/libavutil/log.c')
-rw-r--r-- | media/ffvpx/libavutil/log.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/media/ffvpx/libavutil/log.c b/media/ffvpx/libavutil/log.c index be806202f..9b7d48487 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) = |