diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-10-01 15:25:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-01 15:25:44 +0200 |
commit | 8e8fcee4a55de171303ebe526d3cf051522111bf (patch) | |
tree | fef75d382fc6216a093eeaf80560473dff19d883 /media/ffvpx/libavutil/log.c | |
parent | 79b00fc33b5cb6d56d29b50efac6d62ce3a89018 (diff) | |
parent | 45c24f05d023a2cd8289ed40a13708392ce2e6a4 (diff) | |
download | UXP-8e8fcee4a55de171303ebe526d3cf051522111bf.tar UXP-8e8fcee4a55de171303ebe526d3cf051522111bf.tar.gz UXP-8e8fcee4a55de171303ebe526d3cf051522111bf.tar.lz UXP-8e8fcee4a55de171303ebe526d3cf051522111bf.tar.xz UXP-8e8fcee4a55de171303ebe526d3cf051522111bf.zip |
Merge pull request #805 from MoonchildProductions/revert-801-update-from-upstream
Revert "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, 16 insertions, 10 deletions
diff --git a/media/ffvpx/libavutil/log.c b/media/ffvpx/libavutil/log.c index 9b7d48487..be806202f 100644 --- a/media/ffvpx/libavutil/log.c +++ b/media/ffvpx/libavutil/log.c @@ -39,9 +39,11 @@ #include "common.h" #include "internal.h" #include "log.h" -#include "thread.h" -static AVMutex mutex = AV_MUTEX_INITIALIZER; +#if HAVE_PTHREADS +#include <pthread.h> +static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +#endif #define LINE_SZ 1024 @@ -55,7 +57,7 @@ static int av_log_level = AV_LOG_INFO; static int flags; #define NB_LEVELS 8 -#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE +#if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE #include <windows.h> static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = { [AV_LOG_PANIC /8] = 12, @@ -122,7 +124,7 @@ static int use_color = -1; static void check_color_terminal(void) { -#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE +#if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE CONSOLE_SCREEN_BUFFER_INFO con_info; con = GetStdHandle(STD_ERROR_HANDLE); use_color = (con != INVALID_HANDLE_VALUE) && !getenv("NO_COLOR") && @@ -157,7 +159,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) && HAVE_SETCONSOLETEXTATTRIBUTE +#if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE if (local_use_color) SetConsoleTextAttribute(con, background | color[level]); fputs(str, stderr); @@ -266,10 +268,10 @@ 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 (*print_prefix && (level > AV_LOG_QUIET) && (flags & AV_LOG_PRINT_LEVEL)) - av_bprintf(part+2, "[%s] ", get_level_str(level)); + if (flags & AV_LOG_PRINT_LEVEL) + av_bprintf(part+2, "[%s] ", get_level_str(level)); + } av_vbprintf(part+3, fmt, vl); @@ -315,7 +317,9 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) if (level > av_log_level) return; - ff_mutex_lock(&mutex); +#if HAVE_PTHREADS + pthread_mutex_lock(&mutex); +#endif 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); @@ -352,7 +356,9 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) #endif end: av_bprint_finalize(part+3, NULL); - ff_mutex_unlock(&mutex); +#if HAVE_PTHREADS + pthread_mutex_unlock(&mutex); +#endif } static void (*av_log_callback)(void*, int, const char*, va_list) = |