Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinuxHWDecoders: Adjust to new component logging #5695

Merged
merged 5 commits into from Nov 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
64 changes: 41 additions & 23 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -744,19 +758,22 @@ 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)
{
CLog::Log(LOGERROR, "%s - No frame buffer available.\n", __FUNCTION__);
}
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)
{
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp
Expand Up @@ -39,6 +39,7 @@ extern "C" {
#include "utils/StringUtils.h"
#include "utils/TimeUtils.h"
#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"

#include <CoreFoundation/CoreFoundation.h>
#include <VideoDecodeAcceleration/VDADecoder.h>
Expand Down Expand Up @@ -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;
}

Expand Down
24 changes: 16 additions & 8 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}

Expand All @@ -206,15 +208,17 @@ 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)
CFRelease(prop_value);
}
else
{
CLog::Log(LOGDEBUG, "%s = <failed to query: %d>\n", name_str, (int)status);
if (g_advancedSettings.CanLogComponent(LOGVIDEO))
CLog::Log(LOGDEBUG, "%s = <failed to query: %d>\n", name_str, (int)status);
}

free(name_str);
Expand All @@ -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
//-----------------------------------------------------------------------------------
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down