From 2a610584eec06e733419a520b0ec70a6d72d4ae8 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 11 Mar 2022 19:15:36 -0600 Subject: [PATCH] Fix handling of line continuations in FFmpeg logs (for real this time) --- app/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/main.cpp b/app/main.cpp index c7e43c87..981ea87f 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -167,9 +167,14 @@ void ffmpegLogToDiskHandler(void* ptr, int level, const char* fmt, va_list vl) return; } + // We need to use the *previous* printPrefix value to determine whether to + // print the prefix this time. av_log_format_line() will set the printPrefix + // value to indicate whether the prefix should be printed *next time*. + bool shouldPrefixThisMessage = printPrefix != 0; + av_log_format_line(ptr, level, fmt, vl, lineBuffer, sizeof(lineBuffer), &printPrefix); - if (printPrefix) { + if (shouldPrefixThisMessage) { QTime logTime = QTime::fromMSecsSinceStartOfDay(s_LoggerTime.elapsed()); QString txt = QString("%1 - FFmpeg: %2").arg(logTime.toString()).arg(lineBuffer); logToLoggerStream(txt);