From a3788162c5ffa348f43cdaed3c173052cd8040c8 Mon Sep 17 00:00:00 2001 From: oioitff Date: Wed, 5 Jun 2013 00:27:22 +0800 Subject: [PATCH] Add ffmpeg logs for MediaEngine in debug mode --- Core/HW/MediaEngine.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index f7f26fa04b..e873f3b78a 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -160,8 +160,22 @@ int64_t _MpegSeekbuffer(void *opaque, int64_t offset, int whence) return offset; } +#ifdef _DEBUG +void ffmpeg_logger(void *, int, const char *format, va_list va_args) { + char tmp[1024]; + vsprintf(tmp, format, va_args); + INFO_LOG(HLE, tmp); +} +#endif + bool MediaEngine::openContext() { #ifdef USE_FFMPEG + +#ifdef _DEBUG + av_log_set_level(AV_LOG_VERBOSE); + av_log_set_callback(&ffmpeg_logger); +#endif + u8* tempbuf = (u8*)av_malloc(m_bufSize); AVFormatContext *pFormatCtx = avformat_alloc_context(); @@ -176,9 +190,6 @@ bool MediaEngine::openContext() { if(avformat_find_stream_info(pFormatCtx, NULL) < 0) return false; - // Dump information about file onto standard error - av_dump_format(pFormatCtx, 0, NULL, 0); - // Find the first video stream for(int i = 0; i < (int)pFormatCtx->nb_streams; i++) { if(pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { @@ -568,4 +579,3 @@ s64 MediaEngine::getLastTimeStamp() { int lastTimeStamp = bswap32(*(int*)(m_pdata + 92)); return lastTimeStamp - firstTimeStamp; } -