From 0da54d18200aabcfdc89ea444ab191fd0365674c Mon Sep 17 00:00:00 2001 From: fritsch Date: Tue, 11 Nov 2014 21:34:44 +0100 Subject: [PATCH 1/5] VAAPI: Use Component Logging --- .../cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 55 ++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp index a5e560a6eea08..ed7bd74853ebd 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp @@ -30,6 +30,7 @@ #include "settings/Settings.h" #include "guilib/GraphicContext.h" #include "settings/MediaSettings.h" +#include "settings/AdvancedSettings.h" #include extern "C" { @@ -142,7 +143,8 @@ bool CVAAPIContext::CreateContext() return false; } - CLog::Log(LOGDEBUG, "VAAPI - initialize version %d.%d", major_version, minor_version); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "VAAPI - initialize version %d.%d", major_version, minor_version); QueryCaps(); @@ -174,13 +176,16 @@ void CVAAPIContext::QueryCaps() for(int i = 0; i < m_attributeCount; i++) { VADisplayAttribute * const display_attr = &m_attributes[i]; - CLog::Log(LOGDEBUG, "VAAPI - attrib %d (%s/%s) min %d max %d value 0x%x\n" - , display_attr->type - ,(display_attr->flags & VA_DISPLAY_ATTRIB_GETTABLE) ? "get" : "---" - ,(display_attr->flags & VA_DISPLAY_ATTRIB_SETTABLE) ? "set" : "---" - , display_attr->min_value - , display_attr->max_value - , display_attr->value); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + { + CLog::Log(LOGDEBUG, "VAAPI - attrib %d (%s/%s) min %d max %d value 0x%x\n" + , display_attr->type + ,(display_attr->flags & VA_DISPLAY_ATTRIB_GETTABLE) ? "get" : "---" + ,(display_attr->flags & VA_DISPLAY_ATTRIB_SETTABLE) ? "set" : "---" + , display_attr->min_value + , display_attr->max_value + , display_attr->value); + } } int max_profiles = vaMaxNumProfiles(m_display); @@ -190,7 +195,10 @@ void CVAAPIContext::QueryCaps() return; for(int i = 0; i < m_profileCount; i++) - CLog::Log(LOGDEBUG, "VAAPI - profile %d", m_profiles[i]); + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "VAAPI - profile %d", m_profiles[i]); + } } VAConfigAttrib CVAAPIContext::GetAttrib(VAProfile profile) @@ -482,7 +490,8 @@ bool CDecoder::Open(AVCodecContext* avctx, const enum PixelFormat fmt, unsigned if (CDVDVideoCodec::IsCodecDisabled(g_vaapi_available, settings_count, avctx->codec_id)) return false; - CLog::Log(LOGDEBUG,"VAAPI - open decoder"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG,"VAAPI - open decoder"); if (!CVAAPIContext::EnsureContext(&m_vaapiConfig.context, this)) return false; @@ -616,7 +625,8 @@ long CDecoder::Release() if (m_vaapiConfigured == true) { CSingleLock lock(m_DecoderSection); - CLog::Log(LOGDEBUG,"VAAPI::Release pre-cleanup"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG,"VAAPI::Release pre-cleanup"); Message *reply; if (m_vaapiOutput.m_controlPort.SendOutMessageSync(COutputControlProtocol::PRECLEANUP, @@ -834,7 +844,8 @@ int CDecoder::Check(AVCodecContext* avctx) if (state == VAAPI_LOST) { - CLog::Log(LOGDEBUG,"VAAPI::Check waiting for display reset event"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG,"VAAPI::Check waiting for display reset event"); if (!m_DisplayEvent.WaitMSec(4000)) { CLog::Log(LOGERROR, "VAAPI::Check - device didn't reset in reasonable time"); @@ -1071,7 +1082,8 @@ void CDecoder::FiniVAAPIOutput() m_vaapiConfig.contextId = VA_INVALID_ID; // detroy surfaces - CLog::Log(LOGDEBUG, "VAAPI::FiniVAAPIOutput destroying %d video surfaces", m_videoSurfaces.Size()); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "VAAPI::FiniVAAPIOutput destroying %d video surfaces", m_videoSurfaces.Size()); VASurfaceID surf; while((surf = m_videoSurfaces.RemoveNext()) != VA_INVALID_SURFACE) { @@ -1827,7 +1839,8 @@ void COutput::InitCycle() } else { - CLog::Log(LOGDEBUG,"VAAPI - deinterlace method not supported, falling back to BOB"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG,"VAAPI - deinterlace method not supported, falling back to BOB"); method = VS_INTERLACEMETHOD_RENDER_BOB; } @@ -2073,7 +2086,8 @@ bool COutput::ProcessSyncPicture() } else { - CLog::Log(LOGDEBUG, "COutput::%s - return of invalid render pic", __FUNCTION__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "COutput::%s - return of invalid render pic", __FUNCTION__); } } return busy; @@ -2177,8 +2191,8 @@ bool COutput::EnsureBufferPool() } m_bufferPool.procPicId = 0; - - CLog::Log(LOGDEBUG, "VAAPI::COutput::InitBufferPool - Surfaces created"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "VAAPI::COutput::InitBufferPool - Surfaces created"); return true; } @@ -2342,8 +2356,8 @@ bool COutput::CreateGlxContext() CLog::Log(LOGERROR, "VAAPI::COutput::CreateGlxContext - Could not make Pixmap current"); return false; } - - CLog::Log(LOGDEBUG, "VAAPI::COutput::CreateGlxContext - created context"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "VAAPI::COutput::CreateGlxContext - created context"); return true; } @@ -3047,7 +3061,8 @@ bool CFFmpegPostproc::Init(EINTERLACEMETHOD method) else if (method == VS_INTERLACEMETHOD_RENDER_BOB || method == VS_INTERLACEMETHOD_NONE) { - CLog::Log(LOGDEBUG, "CFFmpegPostproc::Init - skip deinterlacing"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "CFFmpegPostproc::Init - skip deinterlacing"); avfilter_inout_free(&outputs); avfilter_inout_free(&inputs); } From 5ccbe76792aa2ff0792cdc86f47ce2b893292c48 Mon Sep 17 00:00:00 2001 From: fritsch Date: Tue, 11 Nov 2014 21:37:16 +0100 Subject: [PATCH 2/5] VDPAU: Component Logging --- .../cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp index 5760fc5647683..1871eb8c8004c 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp @@ -667,7 +667,8 @@ void CDecoder::SetWidthHeight(int width, int height) m_vdpauConfig.outWidth = width; m_vdpauConfig.outHeight = height; } - CLog::Log(LOGDEBUG, "CVDPAU::SetWidthHeight Setting OutWidth: %i OutHeight: %i", m_vdpauConfig.outWidth, m_vdpauConfig.outHeight); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "CVDPAU::SetWidthHeight Setting OutWidth: %i OutHeight: %i", m_vdpauConfig.outWidth, m_vdpauConfig.outHeight); } void CDecoder::OnLostDevice() @@ -806,8 +807,9 @@ void CDecoder::FiniVDPAUOutput() if (CheckStatus(vdp_st, __LINE__)) return; m_vdpauConfig.vdpDecoder = VDP_INVALID_HANDLE; - - CLog::Log(LOGDEBUG, "CVDPAU::FiniVDPAUOutput destroying %d video surfaces", m_videoSurfaces.Size()); + + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "CVDPAU::FiniVDPAUOutput destroying %d video surfaces", m_videoSurfaces.Size()); VdpVideoSurface surf; while((surf = m_videoSurfaces.RemoveNext()) != VDP_INVALID_HANDLE) @@ -1047,7 +1049,10 @@ int CDecoder::Render(struct AVCodecContext *s, struct AVFrame *src, uint64_t diff = CurrentHostCounter() - startTime; if (diff*1000/CurrentHostFrequency() > 30) - CLog::Log(LOGDEBUG, "CVDPAU::DrawSlice - VdpDecoderRender long decoding: %d ms, dec: %d, proc: %d, rend: %d", (int)((diff*1000)/CurrentHostFrequency()), decoded, processed, rend); + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "CVDPAU::DrawSlice - VdpDecoderRender long decoding: %d ms, dec: %d, proc: %d, rend: %d", (int)((diff*1000)/CurrentHostFrequency()), decoded, processed, rend); + } return 0; } @@ -1161,7 +1166,10 @@ int CDecoder::Decode(AVCodecContext *avctx, AVFrame *pFrame) m_bufferStats.SetParams(diff, m_codecControl); } if (diff*1000/CurrentHostFrequency() > 50) - CLog::Log(LOGDEBUG,"CVDPAU::Decode long wait: %d", (int)((diff*1000)/CurrentHostFrequency())); + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG,"CVDPAU::Decode long wait: %d", (int)((diff*1000)/CurrentHostFrequency())); + } if (!retval) { @@ -2996,7 +3004,9 @@ void COutput::Flush() it2 = m_bufferPool.glVideoSurfaceMap.find(pic->sourceIdx); if (it2 == m_bufferPool.glVideoSurfaceMap.end()) { - CLog::Log(LOGDEBUG, "COutput::Flush - gl surface not found"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "COutput::Flush - gl surface not found"); + continue; } m_config.videoSurfaces->MarkRender(it2->second.sourceVuv); @@ -3157,7 +3167,8 @@ bool COutput::ProcessSyncPicture() } else { - CLog::Log(LOGDEBUG, "COutput::%s - return of invalid render pic", __FUNCTION__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "COutput::%s - return of invalid render pic", __FUNCTION__); } } return busy; @@ -3171,7 +3182,9 @@ void COutput::ProcessReturnPicture(CVdpauRenderPicture *pic) it = m_bufferPool.glVideoSurfaceMap.find(pic->sourceIdx); if (it == m_bufferPool.glVideoSurfaceMap.end()) { - CLog::Log(LOGDEBUG, "COutput::ProcessReturnPicture - gl surface not found"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "COutput::ProcessReturnPicture - gl surface not found"); + return; } #ifdef GL_NV_vdpau_interop @@ -3186,7 +3199,9 @@ void COutput::ProcessReturnPicture(CVdpauRenderPicture *pic) it = m_bufferPool.glOutputSurfaceMap.find(pic->sourceIdx); if (it == m_bufferPool.glOutputSurfaceMap.end()) { - CLog::Log(LOGDEBUG, "COutput::ProcessReturnPicture - gl surface not found"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "COutput::ProcessReturnPicture - gl surface not found"); + return; } #ifdef GL_NV_vdpau_interop @@ -3326,8 +3341,8 @@ void COutput::PreCleanup() CheckStatus(vdp_st, __LINE__); m_bufferPool.outputSurfaces[i] = VDP_INVALID_HANDLE; - - CLog::Log(LOGDEBUG, "VDPAU::PreCleanup - released output surface"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "VDPAU::PreCleanup - released output surface"); } } From 7859022843ada34f84b4c6b6d7a1f1f44c452030 Mon Sep 17 00:00:00 2001 From: fritsch Date: Tue, 11 Nov 2014 21:49:45 +0100 Subject: [PATCH 3/5] IMX: Use Component Logging --- .../DVDCodecs/Video/DVDVideoCodecIMX.cpp | 64 ++++++++++++------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp index adbb27ebd185a..e8ccc67717ccd 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp @@ -29,6 +29,7 @@ #include "threads/SingleLock.h" #include "utils/log.h" #include "DVDClock.h" +#include "settings/AdvancedSettings.h" #include "threads/Atomics.h" #define FRAME_ALIGN 16 @@ -171,7 +172,8 @@ bool CDVDVideoCodecIMX::VpuOpen(void) } else { - CLog::Log(LOGDEBUG, "VPU Lib version : major.minor.rel=%d.%d.%d.\n", vpuVersion.nLibMajor, vpuVersion.nLibMinor, vpuVersion.nLibRelease); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "VPU Lib version : major.minor.rel=%d.%d.%d.\n", vpuVersion.nLibMajor, vpuVersion.nLibMinor, vpuVersion.nLibRelease); } ret = VPU_DecQueryMem(&memInfo); @@ -363,19 +365,23 @@ bool CDVDVideoCodecIMX::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) } m_hints = hints; - CLog::Log(LOGDEBUG, "Let's decode with iMX VPU\n"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "Let's decode with iMX VPU\n"); #ifdef MEDIAINFO - CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: fpsrate %d / fpsscale %d\n", m_hints.fpsrate, m_hints.fpsscale); - CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: CodecID %d \n", m_hints.codec); - CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: StreamType %d \n", m_hints.type); - CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Level %d \n", m_hints.level); - CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Profile %d \n", m_hints.profile); - CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: PTS_invalid %d \n", m_hints.ptsinvalid); - CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Tag %d \n", m_hints.codec_tag); - CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %dx%d \n", m_hints.width, m_hints.height); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + { + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: fpsrate %d / fpsscale %d\n", m_hints.fpsrate, m_hints.fpsscale); + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: CodecID %d \n", m_hints.codec); + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: StreamType %d \n", m_hints.type); + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Level %d \n", m_hints.level); + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Profile %d \n", m_hints.profile); + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: PTS_invalid %d \n", m_hints.ptsinvalid); + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Tag %d \n", m_hints.codec_tag); + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %dx%d \n", m_hints.width, m_hints.height); + } { uint8_t *pb = (uint8_t*)&m_hints.codec_tag; - if (isalnum(pb[0]) && isalnum(pb[1]) && isalnum(pb[2]) && isalnum(pb[3])) + if ((isalnum(pb[0]) && isalnum(pb[1]) && isalnum(pb[2]) && isalnum(pb[3])) && g_advancedSettings.CanLogComponent(LOGVIDEO)) CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Tag fourcc %c%c%c%c\n", pb[0], pb[1], pb[2], pb[3]); } if (m_hints.extrasize) @@ -384,10 +390,15 @@ bool CDVDVideoCodecIMX::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) for (unsigned int i=0; i < m_hints.extrasize; i++) sprintf(buf+i*2, "%02x", ((uint8_t*)m_hints.extradata)[i]); - CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: extradata %d %s\n", m_hints.extrasize, buf); + + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: extradata %d %s\n", m_hints.extrasize, buf); + } + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + { + CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %d / %d \n", m_hints.width, m_hints.height); + CLog::Log(LOGDEBUG, "Decode: aspect %f - forced aspect %d\n", m_hints.aspect, m_hints.forced_aspect); } - CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %d / %d \n", m_hints.width, m_hints.height); - CLog::Log(LOGDEBUG, "Decode: aspect %f - forced aspect %d\n", m_hints.aspect, m_hints.forced_aspect); #endif m_convert_bitstream = false; @@ -647,11 +658,14 @@ int CDVDVideoCodecIMX::Decode(BYTE *pData, int iSize, double dts, double pts) ret = VPU_DecGetInitialInfo(m_vpuHandle, &m_initInfo); if (ret == VPU_DEC_RET_SUCCESS) { - CLog::Log(LOGDEBUG, "%s - VPU Init Stream Info : %dx%d (interlaced : %d - Minframe : %d)"\ - " - Align : %d bytes - crop : %d %d %d %d - Q16Ratio : %x\n", __FUNCTION__, - m_initInfo.nPicWidth, m_initInfo.nPicHeight, m_initInfo.nInterlace, m_initInfo.nMinFrameBufferCount, - m_initInfo.nAddressAlignment, m_initInfo.PicCropRect.nLeft, m_initInfo.PicCropRect.nTop, - m_initInfo.PicCropRect.nRight, m_initInfo.PicCropRect.nBottom, m_initInfo.nQ16ShiftWidthDivHeightRatio); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + { + CLog::Log(LOGDEBUG, "%s - VPU Init Stream Info : %dx%d (interlaced : %d - Minframe : %d)"\ + " - Align : %d bytes - crop : %d %d %d %d - Q16Ratio : %x\n", __FUNCTION__, + m_initInfo.nPicWidth, m_initInfo.nPicHeight, m_initInfo.nInterlace, m_initInfo.nMinFrameBufferCount, + m_initInfo.nAddressAlignment, m_initInfo.PicCropRect.nLeft, m_initInfo.PicCropRect.nTop, + m_initInfo.PicCropRect.nRight, m_initInfo.PicCropRect.nBottom, m_initInfo.nQ16ShiftWidthDivHeightRatio); + } if (VpuAllocFrameBuffers()) { ret = VPU_DecRegisterFrameBuffer(m_vpuHandle, m_vpuFrameBuffers, m_vpuFrameBufferNum); @@ -744,11 +758,13 @@ int CDVDVideoCodecIMX::Decode(BYTE *pData, int iSize, double dts, double pts) if (decRet & VPU_DEC_OUTPUT_REPEAT) { - CLog::Log(LOGDEBUG, "%s - Frame repeat.\n", __FUNCTION__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s - Frame repeat.\n", __FUNCTION__); } if (decRet & VPU_DEC_OUTPUT_DROPPED) { - CLog::Log(LOGDEBUG, "%s - Frame dropped.\n", __FUNCTION__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s - Frame dropped.\n", __FUNCTION__); } if (decRet & VPU_DEC_NO_ENOUGH_BUF) { @@ -756,7 +772,8 @@ int CDVDVideoCodecIMX::Decode(BYTE *pData, int iSize, double dts, double pts) } if (decRet & VPU_DEC_SKIP) { - CLog::Log(LOGDEBUG, "%s - Frame skipped.\n", __FUNCTION__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s - Frame skipped.\n", __FUNCTION__); } if (decRet & VPU_DEC_FLUSH) { @@ -823,7 +840,8 @@ void CDVDVideoCodecIMX::Reset() { int ret; - CLog::Log(LOGDEBUG, "%s - called\n", __FUNCTION__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s - called\n", __FUNCTION__); // Release last buffer if(m_lastBuffer) From 52ffc3f187a6288c71dc460257969fad94c1ab6b Mon Sep 17 00:00:00 2001 From: Memphiz Date: Wed, 12 Nov 2014 13:36:21 +0100 Subject: [PATCH 4/5] [vtb/vda] - use component debug logging --- .../DVDCodecs/Video/DVDVideoCodecVDA.cpp | 4 +++- .../Video/DVDVideoCodecVideoToolBox.cpp | 24 ++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp index 6db3ed4f41a61..14d9e913cafa0 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp @@ -39,6 +39,7 @@ extern "C" { #include "utils/StringUtils.h" #include "utils/TimeUtils.h" #include "settings/Settings.h" +#include "settings/AdvancedSettings.h" #include #include @@ -609,7 +610,8 @@ void CDVDVideoCodecVDA::VDADecoderCallback( } if (kVDADecodeInfo_FrameDropped & infoFlags) { - CLog::Log(LOGDEBUG, "%s - frame dropped", __FUNCTION__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s - frame dropped", __FUNCTION__); return; } diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp index 60f70f906d0d8..67ae61b5e4f2d 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp @@ -28,6 +28,7 @@ #include "DVDCodecUtils.h" #include "DVDVideoCodecVideoToolBox.h" #include "settings/Settings.h" +#include "settings/AdvancedSettings.h" #include "utils/log.h" #include "utils/TimeUtils.h" #include "osx/DarwinUtils.h" @@ -196,7 +197,8 @@ vtdec_session_dump_property(CFStringRef prop_name, CFDictionaryRef prop_attrs, V char *attrs_str; attrs_str = vtutil_object_to_string(prop_attrs); - CLog::Log(LOGDEBUG, "%s = %s\n", name_str, attrs_str); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s = %s\n", name_str, attrs_str); free(attrs_str); } @@ -206,7 +208,8 @@ vtdec_session_dump_property(CFStringRef prop_name, CFDictionaryRef prop_attrs, V char *value_str; value_str = vtutil_object_to_string(prop_value); - CLog::Log(LOGDEBUG, "%s = %s\n", name_str, value_str); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s = %s\n", name_str, value_str); free(value_str); if (prop_value != NULL) @@ -214,7 +217,8 @@ vtdec_session_dump_property(CFStringRef prop_name, CFDictionaryRef prop_attrs, V } else { - CLog::Log(LOGDEBUG, "%s = \n", name_str, (int)status); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s = \n", name_str, (int)status); } free(name_str); @@ -235,7 +239,8 @@ void vtdec_session_dump_properties(VTDecompressionSessionRef session) return; error: - CLog::Log(LOGDEBUG, "failed to dump properties\n"); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "failed to dump properties\n"); } #endif //----------------------------------------------------------------------------------- @@ -342,7 +347,8 @@ CreateFormatDescriptionFromCodecData(VTFormatId format_id, int width, int height if (CDarwinUtils::GetIOSVersion() < 4.3) { - CLog::Log(LOGDEBUG, "%s - GetIOSVersion says < 4.3", __FUNCTION__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s - GetIOSVersion says < 4.3", __FUNCTION__); status = FigVideoHack.FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom1( NULL, format_id, @@ -355,7 +361,8 @@ CreateFormatDescriptionFromCodecData(VTFormatId format_id, int width, int height } else { - CLog::Log(LOGDEBUG, "%s - GetIOSVersion says >= 4.3", __FUNCTION__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s - GetIOSVersion says >= 4.3", __FUNCTION__); status = FigVideoHack.FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom2( NULL, format_id, @@ -1459,7 +1466,7 @@ bool CDVDVideoCodecVideoToolBox::GetPicture(DVDVideoPicture* pDvdVideoPicture) DisplayQueuePop(); static double old_pts; - if (pDvdVideoPicture->pts < old_pts) + if (g_advancedSettings.CanLogComponent(LOGVIDEO) && pDvdVideoPicture->pts < old_pts) CLog::Log(LOGDEBUG, "%s - VTBDecoderDecode dts(%f), pts(%f), old_pts(%f)", __FUNCTION__, pDvdVideoPicture->dts, pDvdVideoPicture->pts, old_pts); old_pts = pDvdVideoPicture->pts; @@ -1624,7 +1631,8 @@ CDVDVideoCodecVideoToolBox::VTDecoderCallback( } if (kVTDecodeInfo_FrameDropped & infoFlags) { - CLog::Log(LOGDEBUG, "%s - frame dropped", __FUNCTION__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s - frame dropped", __FUNCTION__); return; } From 3f2af95a02519ae63e2c4c6c0e0fbca442e26779 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 12 Nov 2014 16:52:15 +0000 Subject: [PATCH 5/5] MMAL: Use Component Logging v2 --- .../dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 170 ++++++++---------- 1 file changed, 76 insertions(+), 94 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp index 664376cd7cc66..098910ec8d709 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp @@ -41,21 +41,17 @@ #include "cores/VideoRenderers/RenderFlags.h" #include "settings/DisplaySettings.h" #include "cores/VideoRenderers/RenderManager.h" +#include "settings/AdvancedSettings.h" #include "linux/RBP.h" -#ifdef _DEBUG -#define MMAL_DEBUG_VERBOSE -#endif - #define CLASSNAME "CMMALVideoBuffer" CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) : m_omv(omv), m_refs(0) { -#if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); mmal_buffer = NULL; width = 0; height = 0; @@ -67,18 +63,16 @@ CMMALVideoBuffer::CMMALVideoBuffer(CMMALVideo *omv) CMMALVideoBuffer::~CMMALVideoBuffer() { -#if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); } CMMALVideoBuffer* CMMALVideoBuffer::Acquire() { long count = AtomicIncrement(&m_refs); - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); (void)count; return this; } @@ -86,9 +80,8 @@ CMMALVideoBuffer* CMMALVideoBuffer::Acquire() long CMMALVideoBuffer::Release() { long count = AtomicDecrement(&m_refs); -#if defined(MMAL_DEBUG_VERBOSE) -CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_buffer, count); if (count == 0) { m_omv->ReleaseBuffer(this); @@ -101,9 +94,8 @@ CLog::Log(LOGDEBUG, "%s::%s %p (%p) ref:%ld", CLASSNAME, __func__, this, mmal_bu CMMALVideo::CMMALVideo() { - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); pthread_mutex_init(&m_output_mutex, NULL); m_drop_state = false; @@ -140,9 +132,8 @@ CMMALVideo::CMMALVideo() CMMALVideo::~CMMALVideo() { - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, this); assert(m_finished); Reset(); @@ -203,7 +194,8 @@ void CMMALVideo::PortSettingsChanged(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu m_aspect_ratio = (float)(m_es_format->es->video.par.num * m_es_format->es->video.crop.width) / (m_es_format->es->video.par.den * m_es_format->es->video.crop.height); m_decoded_width = m_es_format->es->video.crop.width; m_decoded_height = m_es_format->es->video.crop.height; - CLog::Log(LOGDEBUG, "%s::%s format changed: %dx%d %.2f frame:%d", CLASSNAME, __func__, m_decoded_width, m_decoded_height, m_aspect_ratio, m_changed_count); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s format changed: %dx%d %.2f frame:%d", CLASSNAME, __func__, m_decoded_width, m_decoded_height, m_aspect_ratio, m_changed_count); } else CLog::Log(LOGERROR, "%s::%s format changed: Unexpected %dx%d", CLASSNAME, __func__, m_es_format->es->video.crop.width, m_es_format->es->video.crop.height); @@ -220,7 +212,8 @@ void CMMALVideo::dec_control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *bu } else if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED) { - CLog::Log(LOGDEBUG, "%s::%s format changed", CLASSNAME, __func__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s format changed", CLASSNAME, __func__); PortSettingsChanged(port, buffer); } else @@ -238,19 +231,18 @@ static void dec_control_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T * static void dec_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { -#if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p, len %d cmd:%x", CLASSNAME, __func__, port, buffer, buffer->length, buffer->cmd); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p, len %d cmd:%x", CLASSNAME, __func__, port, buffer, buffer->length, buffer->cmd); mmal_buffer_header_release(buffer); } void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { -#if defined(MMAL_DEBUG_VERBOSE) if (!(buffer->cmd == 0 && buffer->length > 0)) - CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p, len %d cmd:%x", CLASSNAME, __func__, port, buffer, buffer->length, buffer->cmd); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s port:%p buffer %p, len %d cmd:%x", CLASSNAME, __func__, port, buffer, buffer->length, buffer->cmd); + bool kept = false; if (buffer->cmd == 0) @@ -273,16 +265,16 @@ void CMMALVideo::dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf if (m_drop_state) { - CLog::Log(LOGDEBUG, "%s::%s - dropping %p (drop:%d)", CLASSNAME, __func__, buffer, m_drop_state); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - dropping %p (drop:%d)", CLASSNAME, __func__, buffer, m_drop_state); } else { CMMALVideoBuffer *omvb = new CMMALVideoBuffer(this); m_output_busy++; -#if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x frame:%d", - CLASSNAME, __func__, buffer, omvb, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags, omvb->m_changed_count); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - %p (%p) buffer_size(%u) dts:%.3f pts:%.3f flags:%x:%x frame:%d", + CLASSNAME, __func__, buffer, omvb, buffer->length, dts*1e-6, buffer->pts*1e-6, buffer->flags, buffer->type->video.flags, omvb->m_changed_count); omvb->mmal_buffer = buffer; buffer->user_data = (void *)omvb; omvb->m_changed_count = m_changed_count; @@ -314,7 +306,8 @@ static void dec_output_port_cb_static(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *b bool CMMALVideo::change_dec_output_format() { MMAL_STATUS_T status; - CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T interlace_type = {{ MMAL_PARAMETER_VIDEO_INTERLACE_TYPE, sizeof( interlace_type )}}; status = mmal_port_parameter_get( m_dec_output, &interlace_type.hdr ); @@ -323,7 +316,8 @@ bool CMMALVideo::change_dec_output_format() { if (m_interlace_mode != interlace_type.eMode) { - CLog::Log(LOGDEBUG, "%s::%s Interlace mode %d->%d", CLASSNAME, __func__, m_interlace_mode, interlace_type.eMode); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s Interlace mode %d->%d", CLASSNAME, __func__, m_interlace_mode, interlace_type.eMode); m_interlace_mode = interlace_type.eMode; } } @@ -345,7 +339,8 @@ bool CMMALVideo::CreateDeinterlace(EINTERLACEMETHOD interlace_method) { MMAL_STATUS_T status; - CLog::Log(LOGDEBUG, "%s::%s method:%d", CLASSNAME, __func__, interlace_method); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s method:%d", CLASSNAME, __func__, interlace_method); assert(!m_deint); assert(m_dec_output == m_dec->output[0]); @@ -428,7 +423,8 @@ bool CMMALVideo::DestroyDeinterlace() { MMAL_STATUS_T status; - CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); assert(m_deint); assert(m_dec_output == m_deint->output[0]); @@ -496,9 +492,8 @@ bool CMMALVideo::SendCodecConfigData() buffer->length = std::min(m_hints.extrasize, buffer->alloc_size); memcpy(buffer->data, m_hints.extradata, buffer->length); buffer->flags |= MMAL_BUFFER_HEADER_FLAG_FRAME_END | MMAL_BUFFER_HEADER_FLAG_CONFIG; -#if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d flags:%x", CLASSNAME, __func__, buffer, buffer->length, buffer->flags); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d flags:%x", CLASSNAME, __func__, buffer, buffer->length, buffer->flags); status = mmal_port_send_buffer(m_dec_input, buffer); if (status != MMAL_SUCCESS) { @@ -510,9 +505,8 @@ bool CMMALVideo::SendCodecConfigData() bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, MMALVideoPtr myself) { - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s usemmal:%d software:%d %dx%d", CLASSNAME, __func__, CSettings::Get().GetBool("videoplayer.usemmal"), hints.software, hints.width, hints.height); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s usemmal:%d software:%d %dx%d", CLASSNAME, __func__, CSettings::Get().GetBool("videoplayer.usemmal"), hints.software, hints.width, hints.height); // we always qualify even if DVDFactoryCodec does this too. if (!CSettings::Get().GetBool("videoplayer.usemmal") || hints.software) @@ -716,9 +710,8 @@ void CMMALVideo::Dispose() done = true; m_finished = true; pthread_mutex_unlock(&m_output_mutex); - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s dts_queue(%d) ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, m_dts_queue.size(), m_output_ready.size(), m_output_busy, done); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s dts_queue(%d) ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, m_dts_queue.size(), m_output_ready.size(), m_output_busy, done); if (done) { assert(m_dts_queue.empty()); @@ -728,10 +721,9 @@ void CMMALVideo::Dispose() void CMMALVideo::SetDropState(bool bDrop) { -#if defined(MMAL_DEBUG_VERBOSE) if (m_drop_state != bDrop) - CLog::Log(LOGDEBUG, "%s::%s - m_drop_state(%d)", CLASSNAME, __func__, bDrop); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - m_drop_state(%d)", CLASSNAME, __func__, bDrop); m_drop_state = bDrop; if (m_drop_state) { @@ -756,10 +748,9 @@ void CMMALVideo::SetDropState(bool bDrop) int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) { - #if defined(MMAL_DEBUG_VERBOSE) - //CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d dts:%.3f pts:%.3f dts_queue(%d) ready_queue(%d) busy_queue(%d)", - // CLASSNAME, __func__, pData, iSize, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, m_dts_queue.size(), m_output_ready.size(), m_output_busy); - #endif + //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + // CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d dts:%.3f pts:%.3f dts_queue(%d) ready_queue(%d) busy_queue(%d)", + // CLASSNAME, __func__, pData, iSize, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, m_dts_queue.size(), m_output_ready.size(), m_output_busy); unsigned int demuxer_bytes = 0; uint8_t *demuxer_content = NULL; @@ -845,10 +836,9 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) if (demuxer_bytes == 0) buffer->flags |= MMAL_BUFFER_HEADER_FLAG_FRAME_END; - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d/%-6d dts:%.3f pts:%.3f flags:%x dts_queue(%d) ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d)", - CLASSNAME, __func__, buffer, buffer->length, demuxer_bytes, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, buffer->flags, m_dts_queue.size(), m_output_ready.size(), m_output_busy, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - %-8p %-6d/%-6d dts:%.3f pts:%.3f flags:%x dts_queue(%d) ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d)", + CLASSNAME, __func__, buffer, buffer->length, demuxer_bytes, dts == DVD_NOPTS_VALUE ? 0.0 : dts*1e-6, pts == DVD_NOPTS_VALUE ? 0.0 : pts*1e-6, buffer->flags, m_dts_queue.size(), m_output_ready.size(), m_output_busy, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); assert((int)buffer->length > 0); status = mmal_port_send_buffer(m_dec_input, buffer); if (status != MMAL_SUCCESS) @@ -875,7 +865,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) } if (m_changed_count_dec != m_changed_count) { - CLog::Log(LOGDEBUG, "%s::%s format changed frame:%d(%d)", CLASSNAME, __func__, m_changed_count_dec, m_changed_count); + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s format changed frame:%d(%d)", CLASSNAME, __func__, m_changed_count_dec, m_changed_count); m_changed_count_dec = m_changed_count; if (!change_dec_output_format()) { @@ -915,21 +906,20 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) int ret = 0; if (!m_output_ready.empty()) { - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s - got output picture:%d", CLASSNAME, __func__, m_output_ready.size()); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - got space for output: demux_queue(%d) space(%d)", CLASSNAME, __func__, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); ret |= VC_PICTURE; } if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length) { - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s - got space for output: demux_queue(%d) space(%d)", CLASSNAME, __func__, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - got output picture:%d", CLASSNAME, __func__, m_output_ready.size()); ret |= VC_BUFFER; } if (!ret) { - CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: dts_queue(%d) ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d)", + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: dts_queue(%d) ready_queue(%d) busy_queue(%d) demux_queue(%d) space(%d)", CLASSNAME, __func__, m_dts_queue.size(), m_output_ready.size(), m_output_busy, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size); Sleep(10); // otherwise we busy spin } @@ -938,9 +928,8 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) void CMMALVideo::Reset(void) { - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__); if (m_dec_input) mmal_port_disable(m_dec_input); @@ -979,26 +968,23 @@ void CMMALVideo::Reset(void) void CMMALVideo::ReturnBuffer(CMMALVideoBuffer *buffer) { -#if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s %p (%d)", CLASSNAME, __func__, buffer, m_output_busy); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p (%d)", CLASSNAME, __func__, buffer, m_output_busy); mmal_buffer_header_release(buffer->mmal_buffer); } void CMMALVideo::Recycle(MMAL_BUFFER_HEADER_T *buffer) { -#if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, buffer); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p", CLASSNAME, __func__, buffer); MMAL_STATUS_T status; mmal_buffer_header_reset(buffer); buffer->cmd = 0; - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s Send buffer %p from pool to decoder output port %p dts_queue(%d) ready_queue(%d) busy_queue(%d)", CLASSNAME, __func__, buffer, m_dec_output, - m_dts_queue.size(), m_output_ready.size(), m_output_busy); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s Send buffer %p from pool to decoder output port %p dts_queue(%d) ready_queue(%d) busy_queue(%d)", CLASSNAME, __func__, buffer, m_dec_output, + m_dts_queue.size(), m_output_ready.size(), m_output_busy); status = mmal_port_send_buffer(m_dec_output, buffer); if (status != MMAL_SUCCESS) { @@ -1022,9 +1008,8 @@ void CMMALVideo::ReleaseBuffer(CMMALVideoBuffer *buffer) pthread_mutex_unlock(&m_output_mutex); if (done) m_myself.reset(); - #if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s %p (%p) dts_queue(%d) ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, buffer, buffer->mmal_buffer, m_dts_queue.size(), m_output_ready.size(), m_output_busy, done); - #endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s %p (%p) dts_queue(%d) ready_queue(%d) busy_queue(%d) done:%d", CLASSNAME, __func__, buffer, buffer->mmal_buffer, m_dts_queue.size(), m_output_ready.size(), m_output_busy, done); delete buffer; } @@ -1067,11 +1052,10 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) pDvdVideoPicture->MMALBuffer->Acquire(); pDvdVideoPicture->iFlags = DVP_FLAG_ALLOCATED; -#if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGINFO, "%s::%s dts:%.3f pts:%.3f flags:%x:%x MMALBuffer:%p mmal_buffer:%p", CLASSNAME, __func__, - pDvdVideoPicture->dts == DVD_NOPTS_VALUE ? 0.0 : pDvdVideoPicture->dts*1e-6, pDvdVideoPicture->pts == DVD_NOPTS_VALUE ? 0.0 : pDvdVideoPicture->pts*1e-6, - pDvdVideoPicture->iFlags, buffer->mmal_buffer->flags, pDvdVideoPicture->MMALBuffer, pDvdVideoPicture->MMALBuffer->mmal_buffer); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGINFO, "%s::%s dts:%.3f pts:%.3f flags:%x:%x MMALBuffer:%p mmal_buffer:%p", CLASSNAME, __func__, + pDvdVideoPicture->dts == DVD_NOPTS_VALUE ? 0.0 : pDvdVideoPicture->dts*1e-6, pDvdVideoPicture->pts == DVD_NOPTS_VALUE ? 0.0 : pDvdVideoPicture->pts*1e-6, + pDvdVideoPicture->iFlags, buffer->mmal_buffer->flags, pDvdVideoPicture->MMALBuffer, pDvdVideoPicture->MMALBuffer->mmal_buffer); assert(!(buffer->mmal_buffer->flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY)); } else @@ -1092,9 +1076,8 @@ bool CMMALVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture) { if (pDvdVideoPicture->format == RENDER_FMT_MMAL) { -#if defined(MMAL_DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, "%s::%s - %p (%p)", CLASSNAME, __func__, pDvdVideoPicture->MMALBuffer, pDvdVideoPicture->MMALBuffer->mmal_buffer); -#endif + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - %p (%p)", CLASSNAME, __func__, pDvdVideoPicture->MMALBuffer, pDvdVideoPicture->MMALBuffer->mmal_buffer); pDvdVideoPicture->MMALBuffer->Release(); } memset(pDvdVideoPicture, 0, sizeof *pDvdVideoPicture); @@ -1106,8 +1089,7 @@ bool CMMALVideo::GetCodecStats(double &pts, int &droppedPics) pts = m_decoderPts; droppedPics = m_droppedPics; m_droppedPics = 0; -#if defined(MMAL_DEBUG_VERBOSE) - //CLog::Log(LOGDEBUG, "%s::%s - pts:%.0f droppedPics:%d", CLASSNAME, __func__, pts, droppedPics); -#endif + //if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + // CLog::Log(LOGDEBUG, "%s::%s - pts:%.0f droppedPics:%d", CLASSNAME, __func__, pts, droppedPics); return true; }