add:转发ffmpeg log

This commit is contained in:
Barry 2019-06-12 08:08:26 +08:00
commit 43c1b6870f
2 changed files with 33 additions and 1 deletions

View file

@ -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;
}

View file

@ -8,7 +8,9 @@ Mac
最后更新scrcpy 7764a836f1ee02a4540cfc4118c20729018daaac
TODO b35733edb6df2a00b6af9b1c98627d344c377963 鼠标事件相关系列
video window always_on_top options
mark:
ffmpeg编译参数详解