From 43c1b6870f257d6ac764027992ef25084e06a8d9 Mon Sep 17 00:00:00 2001 From: Barry <870709864@qq.com> Date: Wed, 12 Jun 2019 08:08:26 +0800 Subject: [PATCH] =?UTF-8?q?add:=E8=BD=AC=E5=8F=91ffmpeg=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QtScrcpy/decoder/decoder.cpp | 32 +++++++++++++++++++++++++++++++- TODO.txt | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/QtScrcpy/decoder/decoder.cpp b/QtScrcpy/decoder/decoder.cpp index d6d06c5..e22ff67 100644 --- a/QtScrcpy/decoder/decoder.cpp +++ b/QtScrcpy/decoder/decoder.cpp @@ -22,14 +22,44 @@ Decoder::~Decoder() } +static void avLogCallback(void *avcl, int level, const char *fmt, va_list vl) { + Q_UNUSED(avcl); + Q_UNUSED(vl); + + QString localFmt = QString::fromUtf8(fmt); + localFmt.prepend("[FFmpeg] "); + switch (level) { + case AV_LOG_PANIC: + case AV_LOG_FATAL: + qFatal(localFmt.toUtf8()); + break; + case AV_LOG_ERROR: + qCritical(localFmt.toUtf8()); + break; + case AV_LOG_WARNING: + qWarning(localFmt.toUtf8()); + break; + case AV_LOG_INFO: + qInfo(localFmt.toUtf8()); + break; + case AV_LOG_DEBUG: + //qDebug(localFmt.toUtf8()); + break; + } + + // do not forward others, which are too verbose + return; +} + bool Decoder::init() { #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); -#endif +#endif if (avformat_network_init()) { return false; } + av_log_set_callback(avLogCallback); return true; } diff --git a/TODO.txt b/TODO.txt index 02a9a54..3ef7133 100644 --- a/TODO.txt +++ b/TODO.txt @@ -8,7 +8,9 @@ Mac 最后更新scrcpy 7764a836f1ee02a4540cfc4118c20729018daaac +TODO b35733edb6df2a00b6af9b1c98627d344c377963 鼠标事件相关系列 +video window always_on_top options mark: ffmpeg编译参数详解