Add logging callbacks for SLAudio and SLVideo

This commit is contained in:
Cameron Gutman
2019-04-28 11:01:54 -07:00
parent f1c7c5f02c
commit 477fa8fedf
4 changed files with 60 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ SLVideoDecoder::SLVideoDecoder(bool)
: m_VideoContext(nullptr),
m_VideoStream(nullptr)
{
SLVideo_SetLogFunction(SLVideoDecoder::slLogCallback, nullptr);
}
SLVideoDecoder::~SLVideoDecoder()
@@ -108,3 +108,30 @@ SLVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
return DR_OK;
}
void SLVideoDecoder::slLogCallback(void *context, ESLVideoLog logLevel, const char *message)
{
SDL_LogPriority priority;
switch (logLevel)
{
case k_ESLVideoLogError:
priority = SDL_LOG_PRIORITY_ERROR;
break;
case k_ESLVideoLogWarning:
priority = SDL_LOG_PRIORITY_WARN;
break;
case k_ESLVideoLogInfo:
priority = SDL_LOG_PRIORITY_INFO;
break;
default:
case k_ESLVideoLogDebug:
priority = SDL_LOG_PRIORITY_DEBUG;
break;
}
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION,
priority,
"SLVideo: %s",
message);
}