From 687b1b79891a2153416cfdb36997a60ab45f03c5 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 4 Sep 2021 00:04:59 +0100 Subject: [PATCH] Log conversion --- afeed.cc | 10 +- audio.cc | 4 +- audioomx.cc | 376 +++++++++++++++++++++++---------------------- boxx.cc | 10 +- channel.cc | 17 +- config.cc | 2 +- dvbsubtitles.cc | 62 ++++---- event.cc | 10 +- imageomx.cc | 192 +++++++++++------------ osdopenvg.cc | 161 +++++++++---------- osdopenvg.h | 1 - osdvector.cc | 41 ++--- playervideolive.cc | 62 ++++---- playervideolive.h | 4 +- playervideorec.cc | 68 ++++---- playervideorec.h | 4 +- recinfo.cc | 46 +++--- recording.cc | 26 ++-- recording.h | 4 +- vepgsummary.cc | 4 +- vfeed.cc | 8 +- videoomx.cc | 238 ++++++++++++++-------------- vradiorec.cc | 22 +-- vvideolivetv.cc | 42 ++--- 24 files changed, 723 insertions(+), 691 deletions(-) diff --git a/afeed.cc b/afeed.cc index c0efb2a..6493c76 100644 --- a/afeed.cc +++ b/afeed.cc @@ -17,7 +17,7 @@ along with VOMP. If not, see . */ -#include "oldlog.h" +#include "log.h" #include "demuxer.h" #include "callback.h" #include "util.h" @@ -56,12 +56,12 @@ void AFeed::start() void AFeed::stop() { - Log::getInstance()->log("AFeed", Log::DEBUG, "Stop1"); + LogNT::getInstance()->debug("AFeed", "Stop1"); if (!feedThread.joinable()) return; stopThread = true; feedThread.join(); stopThread = false; - Log::getInstance()->log("AFeed", Log::DEBUG, "Stop2"); + LogNT::getInstance()->debug("AFeed", "Stop2"); } void AFeed::threadMethod() @@ -80,7 +80,7 @@ void AFeed::threadMethod() if (newdata) cb.call(this); if (alen) { - //Log::getInstance()->log("Afeed", Log::DEBUG, "written"); + //LogNT::getInstance()->debug("AFeed", "written"); cb.call(this); } else @@ -92,7 +92,7 @@ void AFeed::threadMethod() else { Demuxer::getInstance()->flushAudio(); - //Log::getInstance()->log("AFeed", Log::DEBUG, "No data delay"); + //LogNT::getInstance()->debug("AFeed", "No data delay"); //MILLISLEEP(100); MILLISLEEP(5); //Performance Issue } diff --git a/audio.cc b/audio.cc index 4ff9bd0..e0808c6 100644 --- a/audio.cc +++ b/audio.cc @@ -20,7 +20,7 @@ #include "audio.h" -#include "oldlog.h" +#include "log.h" Audio* Audio::instance = NULL; @@ -106,7 +106,7 @@ int Audio::systemMuteOff() int Audio::doMuting() { - Log::getInstance()->log("Audio", Log::DEBUG, "doMuting: user=%i sys=%i", userMute, systemMute); + LogNT::getInstance()->debug("Audio", "doMuting: user=%i sys=%i", userMute, systemMute); if (userMute || systemMute) { diff --git a/audioomx.cc b/audioomx.cc index 10a6318..1c5cb3d 100644 --- a/audioomx.cc +++ b/audioomx.cc @@ -20,7 +20,7 @@ #include #include "videoomx.h" -#include "oldlog.h" +#include "log.h" #include "vdr.h" #include "woptionpane.h" #include "osdopenvg.h" @@ -33,6 +33,8 @@ extern "C" { #include "audioomx.h" +static const char* TAG = "AudioOMX"; + AudioOMX::AudioOMX() { initted = 0; @@ -107,21 +109,21 @@ int AudioOMX::init(UCHAR tstreamType) { ac3codec_libav = avcodec_find_decoder(AV_CODEC_ID_AC3); if (ac3codec_libav == NULL) { - Log::getInstance()->log("Audio", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "Find libav ac3 decoder failed"); return 0; } mp23codec_libav = avcodec_find_decoder(AV_CODEC_ID_MP3); if (mp23codec_libav == NULL) { - Log::getInstance()->log("Audio", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "Find libav mpeg audio decoder failed"); return 0; } aaclatmcodec_libav = avcodec_find_decoder(AV_CODEC_ID_AAC_LATM); if (aaclatmcodec_libav == NULL) { - Log::getInstance()->log("Audio", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "Find libav aac latm decoder failed"); return 0; } @@ -132,28 +134,28 @@ int AudioOMX::init(UCHAR tstreamType) { if (ret==0) { //canpass_mp2=true; // not implemented - Log::getInstance()->log("Audio", Log::NOTICE, + LogNT::getInstance()->info(TAG, "TV hdmi supports mpeg1 layer 1 and 2"); } ret=vc_tv_hdmi_audio_supported( EDID_AudioFormat_eMP3,2,EDID_AudioSampleRate_e48KHz,0); if (ret==0) { //canpass_mp3=true; // not implemented - Log::getInstance()->log("Audio", Log::NOTICE, + LogNT::getInstance()->info(TAG, "TV hdmi supports mpeg1 layer 3"); } ret=vc_tv_hdmi_audio_supported( EDID_AudioFormat_eAC3,6,EDID_AudioSampleRate_e48KHz,0); if (ret==0) { canpass_ac3=true; - Log::getInstance()->log("Audio", Log::NOTICE, + LogNT::getInstance()->info(TAG, "TV hdmi supports AC3"); } ret=vc_tv_hdmi_audio_supported( EDID_AudioFormat_eAAC,6,EDID_AudioSampleRate_e48KHz,0); if (ret==0) { canpass_aac=true; //not implemented - Log::getInstance()->log("Audio", Log::NOTICE, + LogNT::getInstance()->info(TAG, "TV hdmi supports AAC"); } @@ -172,7 +174,7 @@ int AudioOMX::shutdown() if (!initted) return 0; initted = 0; - Log::getInstance()->log("Audio", Log::DEBUG, "audio shutdown called"); + LogNT::getInstance()->debug(TAG, "audio shutdown called"); DeAllocateCodecsOMX(); free(decompress_buffer); @@ -185,7 +187,7 @@ int AudioOMX::shutdown() bool AudioOMX::loadOptionsFromServer(VDR* vdr) { - Log::getInstance()->log("Audio", Log::DEBUG, "AudioOMX config load"); + LogNT::getInstance()->debug(TAG, "AudioOMX config load"); char *name=vdr->configLoad("AudioOMX","AC3DecodingMode"); if (name != NULL) { @@ -502,7 +504,7 @@ bool AudioOMX::addOptionsToPanes(int panenumber,Options *options,WOptionPane* pa OMX_ERRORTYPE AudioOMX::EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE /* hcomp */, OMX_IN OMX_PTR /* appdata */, OMX_IN OMX_BUFFERHEADERTYPE* buffer) { - //Log::getInstance()->log("Audio", Log::NOTICE, "EmptyBufferDone"); + //LogNT::getInstance()->info(TAG, "EmptyBufferDone"); AudioOMX* audio = static_cast(getInstance()); audio->ReturnEmptyOMXBuffer(buffer); return OMX_ErrorNone; @@ -511,9 +513,9 @@ OMX_ERRORTYPE AudioOMX::EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE /* hcomp */, O void AudioOMX::ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* buffer) { input_bufs_omx_mutex.lock(); - //Log::getInstance()->log("Audio", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size()); + //LogNT::getInstance()->info(TAG, "ReturnEmptyOMXBuffer {}",input_bufs_omx_free.size()); input_bufs_omx_free.push_back(buffer); - //Log::getInstance()->log("Audio", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size()); + //LogNT::getInstance()->info(TAG, "ReturnEmptyOMXBuffer {}",input_bufs_omx_free.size()); input_bufs_omx_mutex.unlock(); VideoOMX* video = static_cast(Video::getInstance()); video->signalOmx(); @@ -521,7 +523,7 @@ void AudioOMX::ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* buffer) OMX_ERRORTYPE AudioOMX::FillBufferDone_OMX(OMX_IN OMX_HANDLETYPE /* hcomp */, OMX_IN OMX_PTR /* appdata */, OMX_IN OMX_BUFFERHEADERTYPE* /* buffer */) { - Log::getInstance()->log("Audio", Log::NOTICE, "FillBufferDone"); + LogNT::getInstance()->info(TAG, "FillBufferDone"); VideoOMX* video = static_cast(Video::getInstance()); video->signalOmx(); return OMX_ErrorNone; @@ -563,7 +565,7 @@ int AudioOMX::play() { if (!initted) return 0; lastAType=MPTYPE_MPEG_AUDIO; - Log::getInstance()->log("Audio", Log::DEBUG, "enter play"); + LogNT::getInstance()->debug(TAG, "enter play"); static_cast(Video::getInstance())->interlaceSwitch4Demux(); // switch resolution if necessary @@ -588,10 +590,10 @@ int AudioOMX::ChangeAudioDestination() //clock aka omx mutex needs to be locked auddest.nVersion.nVersion=OMX_VERSION; strcpy((char *)auddest.sName, destinations[dest]); - Log::getInstance()->log("Audio", Log::DEBUG, "setting destination to: %s",auddest.sName); + LogNT::getInstance()->debug(TAG, "setting destination to: {}",auddest.sName); error=OMX_SetConfig(omx_aud_rend,OMX_IndexConfigBrcmAudioDestination,&auddest); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "Init OMX_IndexConfigBrcmAudioDestination failed %x %x %s", error,omx_aud_rend,auddest.sName); + LogNT::getInstance()->debug(TAG, "Init OMX_IndexConfigBrcmAudioDestination failed {:#x} {:#x} {}", error,omx_aud_rend,auddest.sName); DeAllocateCodecsOMX(); return 0; } @@ -604,7 +606,7 @@ int AudioOMX::ChangeAudioPortConfig(bool disport) //clock aka omx mutex needs to { OMX_ERRORTYPE error; //Ok first fidle a working configuration - Log::getInstance()->log("Audio", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "ChangeAudioPortConfig"); OMX_AUDIO_CODINGTYPE encoding; @@ -628,8 +630,8 @@ int AudioOMX::ChangeAudioPortConfig(bool disport) //clock aka omx mutex needs to if (prefered_aac == 2 && false) { //not supported yet } else { - Log::getInstance()->log("Audio", Log::DEBUG, - "ChangeAudioPortConfig debug %d %d",prefered_aac,canpass_aac); + LogNT::getInstance()->debug(TAG, + "ChangeAudioPortConfig debug {} {}",prefered_aac,canpass_aac); if (prefered_aac == 1 && canpass_aac) { passthrough = true; encoding=OMX_AUDIO_CodingAAC; @@ -645,8 +647,8 @@ int AudioOMX::ChangeAudioPortConfig(bool disport) //clock aka omx mutex needs to if (prefered_ac3 == 2 && false) { //not supported yet } else { - Log::getInstance()->log("Audio", Log::DEBUG, - "ChangeAudioPortConfig debug %d %d",prefered_ac3,canpass_ac3); + LogNT::getInstance()->debug(TAG, + "ChangeAudioPortConfig debug {} {}",prefered_ac3,canpass_ac3); if (prefered_ac3 == 1 && canpass_ac3) { passthrough = true; encoding=OMX_AUDIO_CodingDDP; @@ -692,8 +694,8 @@ int AudioOMX::ChangeAudioPortConfig(bool disport) //clock aka omx mutex needs to error = OMX_SetParameter(omx_aud_dec, OMX_IndexParamBrcmDecoderPassThrough, &booly); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Init OMX_IndexParamBrcmDecoderPassThrough failed %x", error); + LogNT::getInstance()->debug(TAG, + "Init OMX_IndexParamBrcmDecoderPassThrough failed {:#x}", error); DeAllocateCodecsOMX(); return 0; }*/ @@ -714,22 +716,22 @@ int AudioOMX::ChangeAudioPortConfig(bool disport) //clock aka omx mutex needs to error = OMX_GetParameter(omx_aud_rend, OMX_IndexParamAudioPortFormat, &format); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Get OMX_IndexParamAudioPortFormat failed %x %d", error, + LogNT::getInstance()->debug(TAG, + "Get OMX_IndexParamAudioPortFormat failed {:#x} {}", error, omx_rend_input_port); return 0; } if (disport) - Log::getInstance()->log("Audio", Log::DEBUG, - "Get OMX_IndexParamAudioPortFormat returned %d",format.eEncoding ); + LogNT::getInstance()->debug(TAG, + "Get OMX_IndexParamAudioPortFormat returned {}",format.eEncoding ); format.eEncoding = encoding; error = OMX_SetParameter(omx_aud_rend, OMX_IndexParamAudioPortFormat, &format); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Set OMX_IndexParamAudioPortFormat failed %x %d %d", error, + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexParamAudioPortFormat failed {:#x} {} {}", error, omx_rend_input_port,format.eEncoding ); //return 0; } @@ -755,8 +757,8 @@ int AudioOMX::ChangeAudioPortConfig(bool disport) //clock aka omx mutex needs to error = OMX_SetParameter(omx_aud_rend, OMX_IndexParamAudioPcm, &audio_pcm); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Init OMX_IndexParamAudioPcm failed %x %d", error, + LogNT::getInstance()->debug(TAG, + "Init OMX_IndexParamAudioPcm failed {:#x} {}", error, omx_rend_input_port); return 0; } @@ -782,8 +784,8 @@ int AudioOMX::ChangeAudioPortConfig(bool disport) //clock aka omx mutex needs to error = OMX_SetParameter(omx_aud_rend, OMX_IndexParamAudioDdp, &audio_ddp); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Init OMX_IndexParamAudioDdp failed %x %d", error, + LogNT::getInstance()->debug(TAG, + "Init OMX_IndexParamAudioDdp failed {:#x} {}", error, omx_rend_input_port); return 0; } @@ -812,7 +814,7 @@ int AudioOMX::InitDecoderLibAV() libav_mutex.lock(); ac3codec_context_libav = avcodec_alloc_context3(ac3codec_libav); if (!ac3codec_context_libav) { - Log::getInstance()->log("Audio", Log::DEBUG, "Alloc avcodec for ac3 decoding context failed!"); + LogNT::getInstance()->debug(TAG, "Alloc avcodec for ac3 decoding context failed!"); return 0; } @@ -830,14 +832,14 @@ int AudioOMX::InitDecoderLibAV() int avc_ret = avcodec_open2(ac3codec_context_libav, ac3codec_libav, NULL); if (avc_ret < 0) { - Log::getInstance()->log("Audio", Log::DEBUG, "Opening libav codec failed \n"); + LogNT::getInstance()->debug(TAG, "Opening libav codec failed"); libav_mutex.unlock(); return 0; } aaclatmcodec_context_libav = avcodec_alloc_context3(aaclatmcodec_libav); if (!aaclatmcodec_context_libav) { - Log::getInstance()->log("Audio", Log::DEBUG, "Alloc avcodec for aac decoding context failed!"); + LogNT::getInstance()->debug(TAG, "Alloc avcodec for aac decoding context failed!"); return 0; } @@ -855,7 +857,7 @@ int AudioOMX::InitDecoderLibAV() avc_ret = avcodec_open2(aaclatmcodec_context_libav, aaclatmcodec_libav, NULL); if (avc_ret < 0) { - Log::getInstance()->log("Audio", Log::DEBUG, "Opening libav codec failed \n"); + LogNT::getInstance()->debug(TAG, "Opening libav codec failed"); libav_mutex.unlock(); return 0; } @@ -863,7 +865,7 @@ int AudioOMX::InitDecoderLibAV() mp23codec_context_libav = avcodec_alloc_context3(mp23codec_libav); if (!ac3codec_context_libav) { - Log::getInstance()->log("Audio", Log::DEBUG, "Alloc avcodec for mp23 decoding context failed!"); + LogNT::getInstance()->debug(TAG, "Alloc avcodec for mp23 decoding context failed!"); libav_mutex.unlock(); return 0; } @@ -882,14 +884,14 @@ int AudioOMX::InitDecoderLibAV() avc_ret = avcodec_open2(mp23codec_context_libav, mp23codec_libav, NULL); if (avc_ret < 0) { - Log::getInstance()->log("Audio", Log::DEBUG, "Opening libav codec failed \n"); + LogNT::getInstance()->debug(TAG, "Opening libav codec failed"); libav_mutex.unlock(); return 0; } resam_con_libav = swr_alloc(); if (resam_con_libav == NULL) { - Log::getInstance()->log("Audio", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "Alloc resample context failed"); return 0; } @@ -952,7 +954,7 @@ int AudioOMX::AllocateCodecsOMX() OMX_ERRORTYPE error; static OMX_CALLBACKTYPE callbacks= {&VideoOMX::EventHandler_OMX,&EmptyBufferDone_OMX,&FillBufferDone_OMX}; - Log::getInstance()->log("Audio", Log::NOTICE, "Allocate Codecs OMX"); + LogNT::getInstance()->info(TAG, "Allocate Codecs OMX"); //Clock, move later to audio VideoOMX* video = static_cast(Video::getInstance()); @@ -977,8 +979,8 @@ int AudioOMX::AllocateCodecsOMX() error = OMX_GetHandle(&omx_aud_rend, L_VPE_OMX_AUDIO_REND, NULL, &callbacks); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Init OMX audio rend failed %x", error); + LogNT::getInstance()->debug(TAG, + "Init OMX audio rend failed {:#x}", error); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -992,8 +994,8 @@ int AudioOMX::AllocateCodecsOMX() error = OMX_GetParameter(omx_aud_rend, OMX_IndexParamAudioInit, &p_param); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Init OMX audio rend OMX_GetParameter failed %x", error); + LogNT::getInstance()->debug(TAG, + "Init OMX audio rend OMX_GetParameter failed {:#x}", error); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1006,8 +1008,8 @@ int AudioOMX::AllocateCodecsOMX() error = OMX_GetParameter(omx_aud_rend, OMX_IndexParamOtherInit, &p_param); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Init OMX aud rend OMX_GetParameter failed %x", error); + LogNT::getInstance()->debug(TAG, + "Init OMX aud rend OMX_GetParameter failed {:#x}", error); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1021,7 +1023,7 @@ int AudioOMX::AllocateCodecsOMX() /* error=OMX_GetHandle(&omx_aud_dec,VPE_OMX_AUDIO_DECODER,NULL,&callbacks); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "Init OMX audio decoder failed %x", error); + LogNT::getInstance()->debug(TAG, "Init OMX audio decoder failed {:#x}", error); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1029,7 +1031,7 @@ int AudioOMX::AllocateCodecsOMX() error=OMX_GetParameter(omx_aud_dec,OMX_IndexParamAudioInit,&p_param); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "Init OMX audio decoder OMX_GetParameter failed %x", error); + LogNT::getInstance()->debug(TAG, "Init OMX audio decoder OMX_GetParameter failed {:#x}", error); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1038,7 +1040,7 @@ int AudioOMX::AllocateCodecsOMX() omx_codec_output_port=p_param.nStartPortNumber+1; if (!video->DisablePort(omx_aud_dec,omx_codec_input_port) || !video->DisablePort(omx_aud_dec,omx_codec_output_port)) { - Log::getInstance()->log("Audio", Log::DEBUG, "Disable Ports OMX audio decoder failed"); + LogNT::getInstance()->debug(TAG, "Disable Ports OMX audio decoder failed"); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1048,15 +1050,15 @@ int AudioOMX::AllocateCodecsOMX() if (!video->DisablePort(omx_aud_rend,omx_rend_input_port,true) ) { - Log::getInstance()->log("Audio", Log::DEBUG, "Disable Ports OMX audio rend failed %d",omx_rend_input_port); + LogNT::getInstance()->debug(TAG, "Disable Ports OMX audio rend failed {}",omx_rend_input_port); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; } if ( !video->DisablePort(omx_aud_rend, omx_rend_clock_port, true)) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Disable Ports OMX rend clock port failed %d",omx_rend_clock_port); + LogNT::getInstance()->debug(TAG, + "Disable Ports OMX rend clock port failed {}",omx_rend_clock_port); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1070,7 +1072,7 @@ int AudioOMX::AllocateCodecsOMX() error=OMX_SetupTunnel(omx_clock,omx_clock_output_port,omx_aud_rend,omx_rend_clock_port); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Setup tunnel clock to rend failed %x %d %d", error,omx_clock_output_port,omx_rend_clock_port); + LogNT::getInstance()->debug(TAG, "OMX_Setup tunnel clock to rend failed {:#x} {} {}", error,omx_clock_output_port,omx_rend_clock_port); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1078,14 +1080,14 @@ int AudioOMX::AllocateCodecsOMX() if (!video->EnablePort(omx_clock,omx_clock_output_port,false) || !video->EnablePort(omx_aud_rend,omx_rend_clock_port,false) ) { - Log::getInstance()->log("Audio", Log::DEBUG, "Enable Ports OMX clock rend failed"); + LogNT::getInstance()->debug(TAG, "Enable Ports OMX clock rend failed"); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; } if (!video->ChangeComponentState(omx_aud_rend,OMX_StateIdle)) { - Log::getInstance()->log("Audio", Log::DEBUG, "aud_rend idle ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "aud_rend idle ChangeComponentState"); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1109,14 +1111,14 @@ int AudioOMX::AllocateCodecsOMX() if (!ChangeAudioPortConfig(false)){ - Log::getInstance()->log("Audio", Log::NOTICE, "Change AudioPortConfig failed"); + LogNT::getInstance()->info(TAG, "Change AudioPortConfig failed"); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; } /* if (!video->ChangeComponentState(omx_aud_dec,OMX_StateIdle)) { - Log::getInstance()->log("Audio", Log::DEBUG, "aud_dec ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "aud_dec ChangeComponentState"); DeAllocateCodecsOMX(); return 0; }*/ @@ -1133,7 +1135,7 @@ int AudioOMX::AllocateCodecsOMX() /* error=OMX_SetupTunnel(omx_aud_dec,omx_codec_output_port,omx_aud_rend,omx_rend_input_port); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Setup tunnel dec to render failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Setup tunnel dec to render failed {:#x}", error); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1143,7 +1145,7 @@ int AudioOMX::AllocateCodecsOMX() /* if (!video->EnablePort(omx_aud_dec,omx_codec_output_port,false) || !video->EnablePort(omx_aud_rend,omx_rend_input_port,false) ) { - Log::getInstance()->log("Audio", Log::DEBUG, "Enable Ports OMX codec rend failed"); + LogNT::getInstance()->debug(TAG, "Enable Ports OMX codec rend failed"); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1157,7 +1159,7 @@ int AudioOMX::AllocateCodecsOMX() }*/ if (!video->ChangeComponentState(omx_aud_rend,OMX_StateExecuting)) { - Log::getInstance()->log("Audio", Log::DEBUG, "omx_aud_rend ChangeComponentState Execute"); + LogNT::getInstance()->debug(TAG, "omx_aud_rend ChangeComponentState Execute"); video->UnlockClock(); DeAllocateCodecsOMX(); return 0; @@ -1173,7 +1175,7 @@ int AudioOMX::AllocateCodecsOMX() if (!video->setClockExecutingandRunning()) return 0; - Log::getInstance()->log("Audio", Log::NOTICE, "Allocate Codecs OMX finished"); + LogNT::getInstance()->info(TAG, "Allocate Codecs OMX finished"); return 1; } @@ -1192,7 +1194,7 @@ int AudioOMX::PrepareInputBufsOMX(bool setportdef) //needs to be called with loc error=OMX_GetParameter(omx_aud_rend/*dec*/,OMX_IndexParamPortDefinition, &port_def_type); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "Get OMX OMX_IndexParamPortDefinition failed %x", error); + LogNT::getInstance()->debug(TAG, "Get OMX OMX_IndexParamPortDefinition failed {:#x}", error); } @@ -1203,14 +1205,14 @@ int AudioOMX::PrepareInputBufsOMX(bool setportdef) //needs to be called with loc error=OMX_SetParameter(omx_aud_rend/*dec*/,OMX_IndexParamPortDefinition, &port_def_type); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "Set OMX OMX_IndexParamPortDefinition failed %x", error); + LogNT::getInstance()->debug(TAG, "Set OMX OMX_IndexParamPortDefinition failed {:#x}", error); } } error=OMX_SendCommand(omx_aud_rend/*dec*/,OMX_CommandPortEnable,omx_rend_input_port/*codec*/,0); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "Prepare Input bufs Send Command to enable port %x", error); + LogNT::getInstance()->debug(TAG, "Prepare Input bufs Send Command to enable port {:#x}", error); return 0; } @@ -1219,7 +1221,7 @@ int AudioOMX::PrepareInputBufsOMX(bool setportdef) //needs to be called with loc OMX_BUFFERHEADERTYPE *buf_head=NULL; error=OMX_AllocateBuffer(omx_aud_rend/*dec*/,&buf_head,omx_rend_input_port/*codec*/,NULL,port_def_type.nBufferSize); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "Use OMX_AllocateBuffer failed %x", error); + LogNT::getInstance()->debug(TAG, "Use OMX_AllocateBuffer failed {:#x}", error); input_bufs_omx_mutex.unlock(); return 0; } @@ -1248,7 +1250,7 @@ int AudioOMX::DestroyInputBufsOMX() //call with clock mutex locked for (UINT i=0; i< input_bufs_omx_all.size();i++) { error=OMX_FreeBuffer(omx_aud_rend/*dec*/,omx_rend_input_port/*codec*/,input_bufs_omx_all[i]); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "Use OMX_FreeBuffer failed %x", error); + LogNT::getInstance()->debug(TAG, "Use OMX_FreeBuffer failed {:#x}", error); input_bufs_omx_mutex.unlock(); return 0; } @@ -1286,7 +1288,7 @@ int AudioOMX::DestroyInputBufsOMXwhilePlaying() //call with clock mutex locked } } - Log::getInstance()->log("Audio", Log::DEBUG, "DestroyInputBufsOMXwhilePlaying %d %d", input_bufs_omx_all.size(),input_bufs_omx_free.size()); + LogNT::getInstance()->debug(TAG, "DestroyInputBufsOMXwhilePlaying {} {}", input_bufs_omx_all.size(),input_bufs_omx_free.size()); input_bufs_omx_mutex.unlock(); return 1; } @@ -1297,37 +1299,37 @@ int AudioOMX::DeAllocateCodecsOMX() OMX_ERRORTYPE error; omx_running=false; VideoOMX* video = static_cast(Video::getInstance()); - Log::getInstance()->log("Audio", Log::DEBUG, "enter deallocatecodecsomx"); + LogNT::getInstance()->debug(TAG, "enter deallocatecodecsomx"); - Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 1"); + LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 1"); if (cur_input_buf_omx) { cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_EOS; error=video->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/,cur_input_buf_omx); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_EmptyThisBuffer 6 failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_EmptyThisBuffer 6 failed {:#x}", error); } cur_input_buf_omx=NULL;//write out old data } - Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 2"); + LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 2"); video->LockClock(); if (omx_aud_rend/*dec*/) { // first stop the omx elements /* if (!video->ChangeComponentState(omx_aud_dec,OMX_StateIdle)) { - Log::getInstance()->log("Audio", Log::DEBUG, "aud_dec ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "aud_dec ChangeComponentState"); }*/ - Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 3"); + LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 3"); video->UnlockClock(); - Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 4"); + LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 4"); video->idleClock(); - Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 5"); + LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 5"); video->LockClock(); if (!video->ChangeComponentState(omx_aud_rend,OMX_StateIdle)) { - Log::getInstance()->log("Audio", Log::DEBUG, "aud_rend ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "aud_rend ChangeComponentState"); } // TODO proper deinit sequence @@ -1335,73 +1337,73 @@ int AudioOMX::DeAllocateCodecsOMX() error=OMX_SendCommand(omx_aud_rend,OMX_CommandFlush, omx_rend_input_port, NULL); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Flush rend in failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Flush rend in failed {:#x}", error); } /* error=OMX_SendCommand(omx_aud_dec,OMX_CommandFlush, omx_codec_input_port, NULL); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Flush codec out failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Flush codec out failed {:#x}", error); }*/ /* if (!video->CommandFinished(omx_aud_dec,OMX_CommandFlush,omx_codec_input_port)) { - Log::getInstance()->log("Audio", Log::DEBUG, "flush cmd codec input failed"); + LogNT::getInstance()->debug(TAG, "flush cmd codec input failed"); }*/ error=OMX_SendCommand(omx_clock,OMX_CommandFlush, omx_clock_output_port, NULL); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Flush clock out failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Flush clock out failed {:#x}", error); } error=OMX_SendCommand(omx_aud_rend,OMX_CommandFlush, omx_rend_clock_port, NULL); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Flush rend clock failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Flush rend clock failed {:#x}", error); } - Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 6"); + LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 6"); if (!video->CommandFinished(omx_clock,OMX_CommandFlush,omx_clock_output_port) || !video->CommandFinished(omx_aud_rend,OMX_CommandFlush,omx_rend_clock_port)) { - Log::getInstance()->log("Audio", Log::DEBUG, "flush cmd clock shed failed"); + LogNT::getInstance()->debug(TAG, "flush cmd clock shed failed"); } DestroyInputBufsOMX(); //We have to make sure that no buffers are in use - Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 6a"); + LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 6a"); DeinitDecoderLibAV(); - Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 7"); + LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 7"); //todo flushing if (!video->DisablePort(omx_aud_rend,omx_rend_input_port,true)) { - Log::getInstance()->log("Audio", Log::DEBUG, "Disable Tunnel Port failed 1"); + LogNT::getInstance()->debug(TAG, "Disable Tunnel Port failed 1"); } /* if (!video->DisablePort(omx_aud_dec,omx_codec_output_port,true)) { - Log::getInstance()->log("Audio", Log::DEBUG, "Disable Tunnel Port failed 6"); + LogNT::getInstance()->debug(TAG, "Disable Tunnel Port failed 6"); } if (!video->DisablePort(omx_aud_dec,omx_codec_input_port,true)) { - Log::getInstance()->log("Audio", Log::DEBUG, "Disable Tunnel Port failed 7"); + LogNT::getInstance()->debug(TAG, "Disable Tunnel Port failed 7"); }*/ if (!video->DisablePort(omx_aud_rend,omx_rend_clock_port,true)) { - Log::getInstance()->log("Audio", Log::DEBUG, "Disable Tunnel Port failed 4"); + LogNT::getInstance()->debug(TAG, "Disable Tunnel Port failed 4"); } if (!video->DisablePort(omx_clock,omx_clock_output_port,true)) { - Log::getInstance()->log("Audio", Log::DEBUG, "Disable Tunnel Port failed 5"); + LogNT::getInstance()->debug(TAG, "Disable Tunnel Port failed 5"); } /* error=OMX_SetupTunnel(omx_aud_dec,omx_codec_output_port,NULL,NULL); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); }*/ @@ -1409,22 +1411,22 @@ int AudioOMX::DeAllocateCodecsOMX() error=OMX_SetupTunnel(omx_aud_rend,omx_rend_input_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } error=OMX_SetupTunnel(omx_clock,omx_clock_output_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } error=OMX_SetupTunnel(omx_aud_rend,omx_rend_clock_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } - Log::getInstance()->log("Audio", Log::DEBUG, "deallocatecodecsomx mark 8"); + LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 8"); //error=OMX_FreeHandle(omx_aud_dec); @@ -1433,14 +1435,14 @@ int AudioOMX::DeAllocateCodecsOMX() video->destroyClock(); omx_aud_rend/*dec*/=NULL; if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, "FreeHandle failed %d", error); + LogNT::getInstance()->debug(TAG, "FreeHandle failed {}", error); } } else { video->UnlockClock(); DeinitDecoderLibAV(); } - Log::getInstance()->log("Audio", Log::DEBUG, "leave deallocate codecs OMX"); + LogNT::getInstance()->debug(TAG, "leave deallocate codecs OMX"); return 1; } @@ -1451,7 +1453,7 @@ int AudioOMX::stop() { if (!initted) return 0; - Log::getInstance()->log("Audio", Log::DEBUG, "Audio stop called"); + LogNT::getInstance()->debug(TAG, "Audio stop called"); DeAllocateCodecsOMX(); //if (ioctl(fdAudio, AV_SET_AUD_RESET, 0x11) != 0) return 0; return 1; @@ -1460,7 +1462,7 @@ int AudioOMX::stop() int AudioOMX::mute() { if (!initted) return 0; - Log::getInstance()->log("Audio", Log::DEBUG, "MUTE MUTE MUTE"); + LogNT::getInstance()->debug(TAG, "MUTE MUTE MUTE"); VideoOMX* vw = static_cast(Video::getInstance()); vw->LockClock(); if (omx_running) { @@ -1474,8 +1476,8 @@ int AudioOMX::mute() { OMX_ERRORTYPE error= OMX_SetParameter(omx_aud_rend, OMX_IndexConfigAudioMute, &amute); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Set OMX_IndexConfigAudioMute failed %x %d", error, + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexConfigAudioMute failed {:#x} {}", error, omx_rend_input_port); vw->UnlockClock(); return 0; @@ -1492,7 +1494,7 @@ int AudioOMX::unMute() { if (!initted) return 0; - Log::getInstance()->log("Audio", Log::DEBUG, "MUTE OFF OFF OFF"); + LogNT::getInstance()->debug(TAG, "MUTE OFF OFF OFF"); VideoOMX* vw = static_cast(Video::getInstance()); vw->LockClock(); if (omx_running) { @@ -1506,8 +1508,8 @@ int AudioOMX::unMute() OMX_ERRORTYPE error = OMX_SetParameter(omx_aud_rend, OMX_IndexConfigAudioMute, &amute); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Set OMX_IndexConfigAudioMute failed %x %d", error, + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexConfigAudioMute failed {:#x} {}", error, omx_rend_input_port); vw->UnlockClock(); return 0; @@ -1540,11 +1542,11 @@ int AudioOMX::reset() { if (!initted) return 0; //test(); - Log::getInstance()->log("Audio", Log::DEBUG, "reset called"); + LogNT::getInstance()->debug(TAG, "reset called"); DeAllocateCodecsOMX(); // if (ioctl(fdAudio, AV_SET_AUD_RESET, 0x11) != 0) return 0; -// Log::getInstance()->log("Audio", Log::DEBUG, "reset back"); +// LogNT::getInstance()->debug(TAG, "reset back"); // if (ioctl(fdAudio, AV_SET_AUD_PLAY, 0) != 0) return 0; doMuting(); @@ -1577,8 +1579,8 @@ int AudioOMX::setVolume(int tvolume) OMX_ERRORTYPE error = OMX_SetParameter(omx_aud_rend, OMX_IndexConfigAudioVolume, &avol); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Set OMX_IndexConfigAudioVolume failed %x %d", error, + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexConfigAudioVolume failed {:#x} {}", error, omx_rend_input_port); vw->UnlockClock(); return 0; @@ -1674,8 +1676,8 @@ unsigned int AudioOMX::AdvanceMpAudioSync(const UCHAR *data,unsigned int size,un else mp3sameheadercount=0; mp3sameheader=sameheadertest; - //Log::getInstance()->log("Audio", Log::DEBUG, "FRAME: %d %d %d %d %d %d %d",lsf,layer,bitrate_index,sample_rate,padding,temp_frame_size, frame_size); - //Log::getInstance()->log("Audio", Log::DEBUG, "FRAME DIAG: %x %x %x %d",data[atest],data[atest+1],data[atest+2],mp3sameheadercount); + //LogNT::getInstance()->debug(TAG, "FRAME: {} {} {} {} {} {} {}",lsf,layer,bitrate_index,sample_rate,padding,temp_frame_size, frame_size); + //LogNT::getInstance()->debug(TAG, "FRAME DIAG: {:#x} {:#x} {:#x} {}",data[atest],data[atest+1],data[atest+2],mp3sameheadercount); if (mp3sameheadercount>4) { *framesize=frame_size; @@ -1702,7 +1704,7 @@ unsigned int AudioOMX::AdvanceAc3AudioSync(const UCHAR *data,unsigned int size,u unsigned char code=data[atest+4]; unsigned char fscod=(code& 0xC0)>>6; unsigned char frmsize=(code &0x3f); - if (fscod!=0) Log::getInstance()->log("Audio", Log::DEBUG, "warning we only support 48 KHz sampling rate"); + if (fscod!=0) LogNT::getInstance()->debug(TAG, "warning we only support 48 KHz sampling rate"); *framesize=frm_size_tab[frmsize]*2; return atest; // probably FrameSync } @@ -1759,12 +1761,12 @@ long long AudioOMX::correctAudioLatency(long long pts,int addsamples,int srate) &audio_lat); video->UnlockClock(); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Init OMX_IndexConfigAudioRenderingLatencyfailed %x %d", error, + LogNT::getInstance()->debug(TAG, + "Init OMX_IndexConfigAudioRenderingLatencyfailed {:#x} {}", error, omx_rend_input_port); return pts; // no correction in case of error } - /*Log::getInstance()->log("Audio", Log::DEBUG, "Current audio latency %d", + /*LogNT::getInstance()->debug(TAG, "Current audio latency {}", audio_lat.nU32);*/ long long workpts=0; @@ -1804,20 +1806,20 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, if (!omx_running) return 0; // if we are not runnig do not do this if (vw->isClockPaused()) return 0; //Block if we pause - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 1"); + //LogNT::getInstance()->debug(TAG, "DMP mark 1"); - //Log::getInstance()->log("Audio", Log::DEBUG, "DeliverMediaPacketOMX time %lld",mpacket.presentation_time); + //LogNT::getInstance()->debug(TAG, "DeliverMediaPacketOMX time {}",mpacket.presentation_time); /* if (mpacket.synched && mpacket.presentation_time <= 0) { *samplepos = mpacket.length; firstsynched = false; lsync=true; - Log::getInstance()->log("Audio", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "DeliverMediaPacketOMX Frameskip"); return mpacket.length; }*/ - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 2"); + //LogNT::getInstance()->debug(TAG, "DMP mark 2"); UINT headerstrip = 0; if (mpacket.disconti) { @@ -1827,19 +1829,19 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "OMX_EmptyThisBuffer 1 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_EmptyThisBuffer 1 failed {:#x}", error); } cur_input_buf_omx = NULL; } lsync=true; } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 3"); + //LogNT::getInstance()->debug(TAG, "DMP mark 3"); if (mpacket.type != lastAType) {//Format Change //Push data out ! firstsynched = false; achange=true; mp3sameheader=0; - Log::getInstance()->log("Audio", Log::DEBUG,"Notice audio type change %d %d", mpacket.type,lastAType); + LogNT::getInstance()->debug(TAG,"Notice audio type change {} {}", mpacket.type,lastAType); lastAType = mpacket.type; decompress_buffer_filled=0; @@ -1847,8 +1849,8 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "OMX_EmptyThisBuffer 2 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_EmptyThisBuffer 2 failed {:#x}", error); } cur_input_buf_omx = NULL; } @@ -1859,7 +1861,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldcanceltype); vw->LockClock(); if (!ChangeAudioPortConfig(true)) { - Log::getInstance()->log("Audio", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "Changing audio port config failed", error); } vw->UnlockClock(); @@ -1868,7 +1870,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, lsync=true; } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 4"); + //LogNT::getInstance()->debug(TAG, "DMP mark 4"); /*Inspect PES-Header */ if (*samplepos == 0 && mpacket.type != MPTYPE_MPEG_AUDIO_LAYER3) {//stripheader @@ -1882,8 +1884,8 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "OMX_EmptyThisBuffer 3 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_EmptyThisBuffer 3 failed {:#x}", error); } //vw->AdjustAudioPTS(correctAudioLatency(lastreftimeOMX,cur_input_buf_omx->nFilledLen/(2*2),48000)); @@ -1895,7 +1897,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, if (!firstsynched) {// *samplepos = mpacket.length;//if we have not processed at least one decompress_buffer_filled=0; - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 5"); + //LogNT::getInstance()->debug(TAG, "DMP mark 5"); return mpacket.length;//synched packet ignore it! } } @@ -1904,8 +1906,8 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, input_bufs_omx_mutex.lock(); if (input_bufs_omx_free.size()==0) { input_bufs_omx_mutex.unlock(); - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 6"); - //Log::getInstance()->log("Audio", Log::DEBUG, "Deliver MediaPacket no free sample"); + //LogNT::getInstance()->debug(TAG, "DMP mark 6"); + //LogNT::getInstance()->debug(TAG, "Deliver MediaPacket no free sample"); return 0; // we do not have a free media sample } @@ -1916,29 +1918,29 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, input_bufs_omx_free.pop_front(); input_bufs_omx_mutex.unlock(); } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 7"); + //LogNT::getInstance()->debug(TAG, "DMP mark 7"); if (cur_input_buf_omx->nFilledLen == 0) {//will only be changed on first packet if (mpacket.synched) { - //Log::getInstance()->log("Audio", Log::DEBUG, + //LogNT::getInstance()->debug(TAG, // "packet synched marker"); //lastreftimePTS=mpacket.pts; if (omx_first_frame) { // TODO time cur_input_buf_omx->nFlags = OMX_BUFFERFLAG_STARTTIME; - Log::getInstance()->log("Audio", Log::DEBUG, "Starttime"); + LogNT::getInstance()->debug(TAG, "Starttime"); omx_first_frame = false; } else { cur_input_buf_omx->nFlags = 0; //cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_TIME_UNKNOWN; } lastreftimeOMX = mpacket.presentation_time; - //Log::getInstance()->log("Audio", Log::DEBUG, - // "Time code %lld pts %lld dts %lld", lastreftimeOMX, mpacket.pts,mpacket.dts); + //LogNT::getInstance()->debug(TAG, + // "Time code {} pts {} dts {}", lastreftimeOMX, mpacket.pts,mpacket.dts); lastreftimePTS = mpacket.pts; cur_input_buf_omx->nTimeStamp = VideoOMX::intToOMXTicks(lastreftimeOMX/10LL); // the clock component is faulty; } else { - // Log::getInstance()->log("Audio", Log::DEBUG, + // LogNT::getInstance()->debug(TAG, // "packet NOT synched marker"); cur_input_buf_omx->nFlags = OMX_BUFFERFLAG_TIME_UNKNOWN; cur_input_buf_omx->nTimeStamp = VideoOMX::intToOMXTicks(0); @@ -1951,14 +1953,14 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, } } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 8"); + //LogNT::getInstance()->debug(TAG, "DMP mark 8"); if (*samplepos>mpacket.length) *samplepos=0; //propably the thread got interrupted and sample is not valid any more! unsigned int haveToCopy=mpacket.length-*samplepos; if (passthrough) { while (haveToCopy>0) { - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 9"); + //LogNT::getInstance()->debug(TAG, "DMP mark 9"); if (lsync) { unsigned int gotframesize=0; int adv=0; @@ -1988,7 +1990,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, *samplepos+=adv; } else { *samplepos=mpacket.length; //no ac3 sync byte - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 10"); + //LogNT::getInstance()->debug(TAG, "DMP mark 10"); return mpacket.length; } } @@ -1998,12 +2000,12 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, haveToCopy-=cancopy; cur_input_buf_omx->nFilledLen+=cancopy; *samplepos+=cancopy; - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 11"); + //LogNT::getInstance()->debug(TAG, "DMP mark 11"); error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "OMX_EmptyThisBuffer 5 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_EmptyThisBuffer 5 failed {:#x}", error); } cur_input_buf_omx=NULL; if (haveToCopy>0) { @@ -2011,7 +2013,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, input_bufs_omx_mutex.lock(); if (input_bufs_omx_free.size()==0) { input_bufs_omx_mutex.unlock(); - // Log::getInstance()->log("Audio", Log::DEBUG, "Deliver MediaPacket no free sample2"); + // LogNT::getInstance()->debug(TAG, "Deliver MediaPacket no free sample2"); return *samplepos; // we do not have a free media sample } cur_input_buf_omx=input_bufs_omx_free.front(); @@ -2022,10 +2024,10 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, input_bufs_omx_free.pop_front(); input_bufs_omx_mutex.unlock(); } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 12"); + //LogNT::getInstance()->debug(TAG, "DMP mark 12"); } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 13"); + //LogNT::getInstance()->debug(TAG, "DMP mark 13"); } else { int len; @@ -2057,17 +2059,17 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, min(haveToCopy,decompress_buffer_size-decompress_buffer_filled)); incoming_paket_libav.size = decompress_buffer_filled +min(haveToCopy,decompress_buffer_size-decompress_buffer_filled); - //Log::getInstance()->log("Audio", Log::DEBUG,"Use saved audio buffer %d %d %d",mpacket.type,decompress_buffer_filled,mpacket.synched); + //LogNT::getInstance()->debug(TAG,"Use saved audio buffer {} {} {}",mpacket.type,decompress_buffer_filled,mpacket.synched); } else { incoming_paket_libav.data =(uint8_t*) buffer+mpacket.pos_buffer+*samplepos; incoming_paket_libav.size = haveToCopy; } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 18"); + //LogNT::getInstance()->debug(TAG, "DMP mark 18"); while (haveToCopy> 0 && errcount<3) { - //Log::getInstance()->log("Audio", Log::DEBUG,"libav in %d %d",framesize,current_context->frame_size); - //Log::getInstance()->log("Audio", Log::DEBUG, "libav in %d %d", + //LogNT::getInstance()->debug(TAG,"libav in {} {}",framesize,current_context->frame_size); + //LogNT::getInstance()->debug(TAG, "libav in {} {}", // framesize, current_context->frame_size); bool donotdecompress=false; @@ -2100,9 +2102,9 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, *samplepos += adv; /*if (current_context->frame_size>0) framesize=min(current_context->frame_size,haveToCopy); else*/ framesize=haveToCopy; - //Log::getInstance()->log("Audio", Log::DEBUG,"Advance by %d %d from %d",adv,mpacket.type,*samplepos ); + //LogNT::getInstance()->debug(TAG,"Advance by {} {} from {}",adv,mpacket.type,*samplepos ); if (haveToCopy <= 0) { - // Log::getInstance()->log("Audio", Log::DEBUG,"No sync code in packet remove %d",mpacket.type); + // LogNT::getInstance()->debug(TAG,"No sync code in packet remove {}",mpacket.type); *samplepos=mpacket.length; return mpacket.length; } @@ -2114,9 +2116,9 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, donotdecompress=true; errcount=100; // exit loop } - // else Log::getInstance()->log("Audio", Log::DEBUG,"Loop run" ); + // else LogNT::getInstance()->debug(TAG,"Loop run"); } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 19"); + //LogNT::getInstance()->debug(TAG, "DMP mark 19"); if (!donotdecompress) { int oldcancelstate; int oldcanceltype; @@ -2130,7 +2132,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, return *samplepos; } libav_mutex.unlock(); - // Log::getInstance()->log("Audio", Log::DEBUG,"libav out"); + // LogNT::getInstance()->debug(TAG,"libav out"); int save_size=incoming_paket_libav.size; if ((int)gotframesize <= incoming_paket_libav.size) { @@ -2138,13 +2140,13 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, len = avcodec_decode_audio4(current_context, decode_frame_libav, &gotta, &incoming_paket_libav); } else { - //Log::getInstance()->log("Audio", Log::DEBUG, "FRAME:E %d %d",gotframesize,incoming_paket_libav.size); + //LogNT::getInstance()->debug(TAG, "FRAME:E {} {}",gotframesize,incoming_paket_libav.size); gotta=0; len=0; } - //Log::getInstance()->log("Audio", Log::DEBUG, "FRAME:T %d",len); + //LogNT::getInstance()->debug(TAG, "FRAME:T {}",len); incoming_paket_libav.size=save_size; - //Log::getInstance()->log("Audio", Log::DEBUG, "libav out1"); + //LogNT::getInstance()->debug(TAG, "libav out1"); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); pthread_testcancel(); @@ -2153,8 +2155,8 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, gotta=0; len=0; } - //Log::getInstance()->log("Audio", Log::DEBUG, "libav out2"); - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 20"); + //LogNT::getInstance()->debug(TAG, "libav out2"); + //LogNT::getInstance()->debug(TAG, "DMP mark 20"); if (!omx_running) { libav_mutex.unlock(); return *samplepos; @@ -2162,7 +2164,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, if (decompress_buffer_filled) { // reset to normal decoding if (len>0) { - //Log::getInstance()->log("Audio", Log::DEBUG,"saved audio: %d",len); + //LogNT::getInstance()->debug(TAG,"saved audio: {}",len); haveToCopy -= min(len-decompress_buffer_filled,0); *samplepos += min(len-decompress_buffer_filled,0); //if (current_context->frame_size>0) framesize=min(current_context->frame_size,haveToCopy); @@ -2187,11 +2189,11 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, framesize=haveToCopy; } } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 21"); + //LogNT::getInstance()->debug(TAG, "DMP mark 21"); incoming_paket_libav.size =framesize; if (gotta) { - //Log::getInstance()->log("Audio", Log::DEBUG, + //LogNT::getInstance()->debug(TAG, // "Got a frame"); int dsize = av_samples_get_buffer_size(NULL, @@ -2204,13 +2206,13 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, if ((cur_input_buf_omx->nFilledLen + dsize) > cur_input_buf_omx->nAllocLen ) { // I doubt that this will ever happen - // Log::getInstance()->log("Audio", Log::DEBUG, - // "P 2 Time code %lld pts %lld", lastreftimeOMX, mpacket.pts); + // LogNT::getInstance()->debug(TAG, + // "P 2 Time code {} pts {}", lastreftimeOMX, mpacket.pts); error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "OMX_EmptyThisBuffer 4 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_EmptyThisBuffer 4 failed {:#x}", error); } cur_input_buf_omx = NULL; @@ -2221,12 +2223,12 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, input_bufs_omx_mutex.lock(); if (input_bufs_omx_free.size() == 0) { input_bufs_omx_mutex.unlock(); - // Log::getInstance()->log("Audio", Log::DEBUG, + // LogNT::getInstance()->debug(TAG, // "Deliver MediaPacket no free sample"); MILLISLEEP(5); - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark22"); + //LogNT::getInstance()->debug(TAG, "DMP mark22"); if (!omx_running) return *samplepos; - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 23"); + //LogNT::getInstance()->debug(TAG, "DMP mark 23"); continue; } cur_input_buf_omx = input_bufs_omx_free.front(); @@ -2243,18 +2245,18 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, } - //Log::getInstance()->log("Audio", Log::DEBUG,"memcpy in %d %d %d" ,dsize,current_context->sample_rate,cur_input_buf_omx->nFilledLen); + //LogNT::getInstance()->debug(TAG,"memcpy in {} {} {}" ,dsize,current_context->sample_rate,cur_input_buf_omx->nFilledLen); av_opt_set_int(resam_con_libav, "in_sample_rate",decode_frame_libav->sample_rate,0); av_opt_set_int(resam_con_libav, "in_sample_fmt",decode_frame_libav->format,0); av_opt_set_int(resam_con_libav, "in_channel_layout",decode_frame_libav->channel_layout, 0); - //Log::getInstance()->log("Audio", Log::ERR,"AV resampledata %d %d %d %d",current_context->channels,current_context->sample_rate,current_context->sample_fmt,current_context->channel_layout); - //Log::getInstance()->log("Audio", Log::ERR,"AV resampledata2 %d %d %d",decode_frame_libav->sample_rate,decode_frame_libav->format,decode_frame_libav->channel_layout); + //LogNT::getInstance()->error(TAG, "AV resampledata {} {} {} {}",current_context->channels,current_context->sample_rate,current_context->sample_fmt,current_context->channel_layout); + //LogNT::getInstance()->error(TAG, "AV resampledata2 {} {} {}",decode_frame_libav->sample_rate,decode_frame_libav->format,decode_frame_libav->channel_layout); int ret = swr_init(resam_con_libav); if (ret<0) { - Log::getInstance()->log("Audio", Log::ERR,"Opening AV resample failed %d",ret); + LogNT::getInstance()->error(TAG, "Opening AV resample failed {}",ret); } else { uint8_t *output=cur_input_buf_omx->pBuffer + cur_input_buf_omx->nFilledLen; /* @@ -2282,30 +2284,30 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, ) new call: */ - //Log::getInstance()->log("AudioOMX", Log::DEBUG, "Calling swr_convert"); + //LogNT::getInstance()->debug(TAG, "Calling swr_convert"); swr_convert(resam_con_libav, &output, decode_frame_libav->nb_samples, (const uint8_t**)decode_frame_libav->extended_data, decode_frame_libav->nb_samples); swr_close(resam_con_libav); } - //Log::getInstance()->log("Audio", Log::DEBUG,"memcpy out"); + //LogNT::getInstance()->debug(TAG,"memcpy out"); cur_input_buf_omx->nFilledLen += dsize; } else { - //Log::getInstance()->log("Audio", Log::DEBUG,"Incomplete mpeg frames in pes packet %d %d",incoming_paket_libav.size,mpacket.length); + //LogNT::getInstance()->debug(TAG,"Incomplete mpeg frames in pes packet {} {}",incoming_paket_libav.size,mpacket.length); /* uint8_t a1=incoming_paket_libav.data[0]; uint8_t a2=incoming_paket_libav.data[1]; uint8_t a3=incoming_paket_libav.data[2]; uint8_t a4=incoming_paket_libav.data[3];*/ - // Log::getInstance()->log("Audio", Log::DEBUG,"Header %x %x %x %x",a1,a2, + // LogNT::getInstance()->debug(TAG,"Header {:#x} {:#x} {:#x} {:#x}",a1,a2, // a3,a4); } } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 24"); + //LogNT::getInstance()->debug(TAG, "DMP mark 24"); decompress_buffer_filled=0; if (haveToCopy ) { - //Log::getInstance()->log("Audio", Log::DEBUG,"We can not decompress %d save for later %d %x %x",haveToCopy,mpacket.type,incoming_paket_libav.data,mpacket.pos_buffer); + //LogNT::getInstance()->debug(TAG,"We can not decompress {} save for later {} {:#x} {:#x}",haveToCopy,mpacket.type,incoming_paket_libav.data,mpacket.pos_buffer); memcpy(decompress_buffer,incoming_paket_libav.data,min(haveToCopy,decompress_buffer_size)); decompress_buffer_filled=min(haveToCopy,decompress_buffer_size); @@ -2313,12 +2315,12 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, } if (cur_input_buf_omx->nFilledLen) { - //Log::getInstance()->log("Audio", Log::DEBUG, - // "P 3 Time code %lld pts %lld", lastreftimeOMX, mpacket.pts); + //LogNT::getInstance()->debug(TAG, + // "P 3 Time code {} pts {}", lastreftimeOMX, mpacket.pts); error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "OMX_EmptyThisBuffer 5 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_EmptyThisBuffer 5 failed {:#x}", error); } //if (mpacket.synched) vw->AdjustAudioPTS(correctAudioLatency(lastreftimeOMX,cur_input_buf_omx->nFilledLen/(2*2),48000)); cur_input_buf_omx = NULL; @@ -2326,7 +2328,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, } - //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 25"); + //LogNT::getInstance()->debug(TAG, "DMP mark 25"); *samplepos=mpacket.length; return mpacket.length; diff --git a/boxx.cc b/boxx.cc index 0e2ae1c..79cafc8 100644 --- a/boxx.cc +++ b/boxx.cc @@ -20,7 +20,7 @@ #include #include "defines.h" -#include "oldlog.h" +#include "log.h" #include "message.h" #include "osd.h" #include "surface.h" @@ -28,6 +28,8 @@ #include "boxx.h" +static const char* TAG = "Boxx"; + char Boxx::numBoxxes = 0; Boxx::Boxx() @@ -35,14 +37,14 @@ Boxx::Boxx() vdisplay.mode = None; numBoxxes++; - Log::getInstance()->log("Boxx", Log::DEBUG, "Construct, now %u", numBoxxes); + LogNT::getInstance()->debug(TAG, "Construct, now {}", numBoxxes); } Boxx::~Boxx() { if (surface) delete surface; numBoxxes--; - Log::getInstance()->log("Boxx", Log::DEBUG, "Destruct, now %u", numBoxxes); + LogNT::getInstance()->debug(TAG, "Destruct, now {}", numBoxxes); } void Boxx::draw() @@ -92,7 +94,7 @@ void Boxx::remove(Boxx* oldChild) return; } } - Log::getInstance()->log("Boxx", Log::ERR, "Remove child box called, child %p not found", oldChild); + LogNT::getInstance()->error(TAG, "Remove child box called, child {} not found", (void*)oldChild); } void Boxx::removeVisibleChilds(Region & r) diff --git a/channel.cc b/channel.cc index e6830e6..148f4e9 100644 --- a/channel.cc +++ b/channel.cc @@ -20,9 +20,11 @@ #include "channel.h" #include "vdr.h" -#include "oldlog.h" +#include "log.h" #include "control.h" +static const char* TAG = "Channel"; + Channel::Channel() { } @@ -54,19 +56,22 @@ void Channel::loadPids() Control::getInstance()->connectionLost(); return; } - - Log::getInstance()->log("Channel", Log::DEBUG, "C.%lu loaded, VPid=%lu, numApids=%lu, numDpids=%lu, numSpids=%lu TPid=%lu", + + LogNT* logger = LogNT::getInstance(); + + + logger->debug(TAG, "C.{} loaded, VPid={}, numApids={}, numDpids={}, numSpids={} TPid={}", number, vpid, numAPids, numDPids, numSPids, tpid); for (ULONG i = 0; i < numAPids; i++) { - Log::getInstance()->log("Channel", Log::DEBUG, "APid %lu %s %d", apids[i].pid, apids[i].desc,apids[i].type); + logger->debug(TAG, "APid {} {} {}", apids[i].pid, apids[i].desc,apids[i].type); } for (ULONG i = 0; i < numDPids; i++) { - Log::getInstance()->log("Channel", Log::DEBUG, "DPid %lu %s %d", dpids[i].pid, dpids[i].desc,dpids[i].type); + logger->debug(TAG, "DPid {} {} {}", dpids[i].pid, dpids[i].desc,dpids[i].type); } for (ULONG i = 0; i < numSPids; i++) { - Log::getInstance()->log("Channel", Log::DEBUG, "SPid %lu %s %d %d %d", spids[i].pid, spids[i].desc,spids[i].type,spids[i].data1,spids[i].data2); + logger->debug(TAG, "SPid {} {} {} {} {}", spids[i].pid, spids[i].desc,spids[i].type,spids[i].data1,spids[i].data2); } } diff --git a/config.cc b/config.cc index e58c2cd..c420432 100644 --- a/config.cc +++ b/config.cc @@ -58,7 +58,7 @@ bool Config::loadFile() Json::CharReaderBuilder builder; builder["collectComments"] = false; - builder["allowTrailingCommas"] = true; + builder["allowTrailingCommas"] = true; // FIXME std::string errs; bool ok = Json::parseFromStream(builder, configFile, &jconfig, &errs); diff --git a/dvbsubtitles.cc b/dvbsubtitles.cc index 22efab0..03b52bf 100644 --- a/dvbsubtitles.cc +++ b/dvbsubtitles.cc @@ -37,10 +37,12 @@ #include "demuxer.h" #include "osdreceiver.h" #include "video.h" -#include "oldlog.h" +#include "log.h" #include "dvbsubtitles.h" +static const char* TAG = "DVBSubtitles"; + DVBSubtitleCLUT::DVBSubtitleCLUT() : version(0xFF), palette2(2), @@ -516,14 +518,14 @@ void DVBSubtitles::put(const PESPacket& packet) { worklist.push_back(packet); signalRecalcWLTO = true; - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Received packet: PTS: %llu, size: %u, type: %u", packet.getPTS(), packet.getSize(), packet.getPacketType()); + LogNT::getInstance()->debug(TAG, "Received packet: PTS: {}, size: {}, type: {}", packet.getPTS(), packet.getSize(), packet.getPacketType()); dvbsCond.notify_one(); } else { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "PUT DROPPING INVALID PACKET: PTS: %llu, size: %u, type: %u", packet.getPTS(), packet.getSize(), packet.getPacketType()); + LogNT::getInstance()->debug(TAG, "PUT DROPPING INVALID PACKET: PTS: {}, size: {}, type: {}", packet.getPTS(), packet.getSize(), packet.getPacketType()); } } input_mutex.unlock(); @@ -751,7 +753,7 @@ void DVBSubtitles::finishPage(const DVBSubtitlePage& page) DVBSubtitlePage::RegionMap::const_iterator region_iter; region_iter = page.regions.find(i->first); if (region_iter == page.regions.end()) continue; - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Clear region %d", i->first); + LogNT::getInstance()->debug(TAG, "Clear region {}", i->first); if (!osdMenuShowing) osd->clearOSDArea(i->second.x, i->second.y, region_iter->second.getWidth(), region_iter->second.getHeight(),dds); } @@ -762,7 +764,7 @@ void DVBSubtitles::finishPage(const DVBSubtitlePage& page) DVBSubtitlePage::RegionMap::const_iterator region_iter; region_iter = page.regions.find(i->first); if (region_iter == page.regions.end()) continue; - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Display region %d", i->first); + LogNT::getInstance()->debug(TAG, "Display region {}", i->first); if (!osdMenuShowing) osd->drawOSDBitmap(i->second.x, i->second.y, region_iter->second,dds); } @@ -771,12 +773,12 @@ void DVBSubtitles::finishPage(const DVBSubtitlePage& page) subtitleTimeoutPoint = std::chrono::system_clock::now() + std::chrono::seconds(page.timeout); subtitleTimeoutPointActive = true; - Log::getInstance()->log("DVBSubs", Log::DEBUG, "SubtitleTimeout %d", page.timeout); + LogNT::getInstance()->debug(TAG, "SubtitleTimeout {}", page.timeout); } void DVBSubtitles::start() { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "subs start"); + LogNT::getInstance()->debug(TAG, "subs start"); #ifdef DVBSDEBUG @@ -799,12 +801,12 @@ void DVBSubtitles::start() void DVBSubtitles::stop() { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "subs stop"); + LogNT::getInstance()->debug(TAG, "subs stop"); input_mutex.lock(); if (!running) { - Log::getInstance()->log("DVBSubs", Log::ERR, "STOP called, already dead!"); + LogNT::getInstance()->error(TAG, "STOP called, already dead!"); input_mutex.unlock(); return; } @@ -828,7 +830,7 @@ void DVBSubtitles::stop() void DVBSubtitles::show() { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "subs show"); + LogNT::getInstance()->debug(TAG, "subs show"); output_mutex.lock(); showing = true; @@ -837,7 +839,7 @@ void DVBSubtitles::show() void DVBSubtitles::hide() { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "subs hide"); + LogNT::getInstance()->debug(TAG, "subs hide"); showing = false; clearDisplayedPages(); @@ -869,12 +871,12 @@ void DVBSubtitles::clearDisplayedPages() void DVBSubtitles::pause() { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "subs pause"); + LogNT::getInstance()->debug(TAG, "subs pause"); input_mutex.lock(); if (!running) { - Log::getInstance()->log("DVBSubs", Log::ERR, "pause called, already dead!"); + LogNT::getInstance()->error(TAG, "pause called, already dead!"); input_mutex.unlock(); return; } @@ -886,12 +888,12 @@ void DVBSubtitles::pause() void DVBSubtitles::unPause() { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "subs unpause"); + LogNT::getInstance()->debug(TAG, "subs unpause"); input_mutex.lock(); if (!running) { - Log::getInstance()->log("DVBSubs", Log::ERR, "pause called, already dead!"); + LogNT::getInstance()->error(TAG, "pause called, already dead!"); input_mutex.unlock(); return; } @@ -937,7 +939,7 @@ void DVBSubtitles::threadMethod() if (signalStop) { - Log::getInstance()->log("DVBSubs", Log::INFO, "Thread exiting"); + LogNT::getInstance()->info(TAG, "Thread exiting"); signalStop = false; return; } @@ -958,12 +960,12 @@ void DVBSubtitles::threadMethod() { // Video is not started yet. DVBSub packet has come in. Don't set worklistTimeoutPoint, // just store the packet and allow next signal to start things off - Log::getInstance()->log("DVBSubs", Log::DEBUG, "signalRecalcWLTO but Video PTS == 0"); + LogNT::getInstance()->debug(TAG, "signalRecalcWLTO but Video PTS == 0"); } else if (worklist.size()) // It is possible to be called to recalc when there are no packets { worklistTimeoutPointActive = true; - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Calc: Num packets available: %i", worklist.size()); + LogNT::getInstance()->debug(TAG, "Calc: Num packets available: {}", worklist.size()); ULLONG pktPTS = worklist.front().getPTS(); ULLONG diff = PTSDifference(pktPTS, nowPTS); @@ -971,7 +973,7 @@ void DVBSubtitles::threadMethod() if (diff < 60 * 1000) { worklistTimeoutPoint = std::chrono::system_clock::now() + std::chrono::milliseconds(diff); - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Calc'd new worklistTimeoutPoint"); + LogNT::getInstance()->debug(TAG, "Calc'd new worklistTimeoutPoint"); } else { @@ -981,13 +983,13 @@ void DVBSubtitles::threadMethod() // FIXME check if this still works worklistTimeoutPoint = std::chrono::system_clock::now(); - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Problem packet"); + LogNT::getInstance()->debug(TAG, "Problem packet"); } } } else if (waitExpireST) // do real work - subtitletimeout { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Subtitle timeout occurred"); + LogNT::getInstance()->debug(TAG, "Subtitle timeout occurred"); waitExpireST = false; subtitleTimeoutPointActive = false; output_mutex.lock(); @@ -996,7 +998,7 @@ void DVBSubtitles::threadMethod() } else if (waitExpireWL) // do real work - worklist - could be multiple packets to do { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Something to do"); + LogNT::getInstance()->debug(TAG, "Something to do"); waitExpireWL = false; worklistTimeoutPointActive = false; @@ -1069,25 +1071,25 @@ void DVBSubtitles::threadMethod() if (!subtitleTimeoutPointActive && !worklistTimeoutPointActive) { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "No WL or STT. Infinite wait"); + LogNT::getInstance()->debug(TAG, "No WL or STT. Infinite wait"); dvbsCond.wait(ul); // Wait until signalled } else if (subtitleTimeoutPointActive) { if (worklistTimeoutPointActive && (worklistTimeoutPoint < subtitleTimeoutPoint)) { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "WaitFor: WL"); + LogNT::getInstance()->debug(TAG, "WaitFor: WL"); if (dvbsCond.wait_until(ul, worklistTimeoutPoint) == std::cv_status::timeout) waitExpireWL = true; } else { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "WaitFor: ST"); + LogNT::getInstance()->debug(TAG, "WaitFor: ST"); if (dvbsCond.wait_until(ul, subtitleTimeoutPoint) == std::cv_status::timeout) waitExpireST = true; } } else { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "WaitFor: WL"); + LogNT::getInstance()->debug(TAG, "WaitFor: WL"); if (dvbsCond.wait_until(ul, worklistTimeoutPoint) == std::cv_status::timeout) waitExpireWL = true; } } @@ -1120,12 +1122,12 @@ void DVBSubtitles::threadMethod() { // Get milliseconds until the timeout wakeup = std::chrono::duration_cast(subtitleTimeoutPoint - std::chrono::system_clock::now()).count(); - Log::getInstance()->log("DVBSubs", Log::DEBUG, "A1: %lu", wakeup); + LogNT::getInstance()->debug(TAG, "A1: {}", wakeup); // now - begin wakeup = -(SubtitleTimeout.Elapsed()); - Log::getInstance()->log("DVBSubs", Log::DEBUG, "A2: %lu", wakeup); + LogNT::getInstance()->debug(TAG, "A2: {}", wakeup); if (wakeup > 0 && sleeptime.tv_nsec == 0 && sleeptime.tv_sec == 0) // We are not done, we still have a Subtitle Timeout! @@ -1146,12 +1148,12 @@ void DVBSubtitles::threadMethod() { // We have done the current work and no more has arrived. Sleep. if (sleeptime.tv_sec == 0 && sleeptime.tv_nsec == 0) { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Sleeping until nudged."); + LogNT::getInstance()->debug(TAG, "Sleeping until nudged."); threadWaitForSignal(); } else { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Sleeping for %d and %d", sleeptime.tv_sec, sleeptime.tv_nsec); + LogNT::getInstance()->debug(TAG, "Sleeping for {} and {}", sleeptime.tv_sec, sleeptime.tv_nsec); struct timespec targetTime; getClockRealTime(&targetTime); diff --git a/event.cc b/event.cc index c33c9f4..c22a3a4 100644 --- a/event.cc +++ b/event.cc @@ -19,12 +19,14 @@ */ #include "event.h" -#include "oldlog.h" +#include "log.h" #include "control.h" #include "movieinfo.h" #include "seriesinfo.h" #include "vdr.h" +static const char* TAG = "Event"; + MovieInfo* Event::movieInfo = NULL; SeriesInfo* Event::seriesInfo = NULL; @@ -40,7 +42,7 @@ void Event::loadinfos(UINT channelid) if (movieID == 0 && seriesID == 0) { vdr->getScraperEventType(channelid, id, movieID, seriesID, episodeID, epgImage); - Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper EventType %d %d, %d %d %d %d", + LogNT::getInstance()->debug(TAG, "Got Scraper EventType {} {}, {} {} {} {}", id, channelid, movieID, seriesID, episodeID); } @@ -49,12 +51,12 @@ void Event::loadinfos(UINT channelid) if (movieID != 0) { movieInfo = vdr->getScraperMovieInfo(movieID); - Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper MovieInfo"); + LogNT::getInstance()->debug(TAG, "Got Scraper MovieInfo"); } else if (seriesID != 0) { seriesInfo = vdr->getScraperSeriesInfo(seriesID, episodeID); - Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper SeriesInfo"); + LogNT::getInstance()->debug(TAG, "Got Scraper SeriesInfo"); } if (!vdr->isConnected()) Control::getInstance()->connectionLost(); diff --git a/imageomx.cc b/imageomx.cc index a0e1193..18ee566 100644 --- a/imageomx.cc +++ b/imageomx.cc @@ -27,6 +27,8 @@ #include "imageomx.h" +static const char* TAG = "ImageOMX"; + ImageOMX::ImageOMX(OsdVector::PictureReader * treader):OsdVector::PictureDecoder(treader) { initted = 0; @@ -55,7 +57,7 @@ void ImageOMX::init() void ImageOMX::shutdown() { - Log::getInstance()->log("ImageOMX", Log::DEBUG, "shutdown"); + LogNT::getInstance()->debug(TAG, "shutdown"); //DeAllocateCodecsOMX(); } @@ -65,7 +67,7 @@ void ImageOMX::shutdown() OMX_ERRORTYPE ImageOMX::EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE /*hcomp*/,OMX_IN OMX_PTR /*appdata*/,OMX_IN OMX_BUFFERHEADERTYPE* buffer){ - //Log::getInstance()->log("Image", Log::NOTICE, "EmptyBufferDone"); + //LogNT::getInstance()->info(TAG, "EmptyBufferDone"); ImageOMX* image = static_cast(buffer->pAppPrivate); image->ReturnEmptyOMXBuffer(buffer); return OMX_ErrorNone; @@ -79,9 +81,9 @@ void ImageOMX::ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* buffer){ buffer->pBuffer = NULL; }*/ buffer->nAllocLen= 0; - //Log::getInstance()->log("Image", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size()); + //LogNT::getInstance()->info(TAG, "ReturnEmptyOMXBuffer {}",input_bufs_omx_free.size()); input_bufs_omx_free.push_back(buffer); - //Log::getInstance()->log("Image", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size()); + //LogNT::getInstance()->info(TAG, "ReturnEmptyOMXBuffer {}",input_bufs_omx_free.size()); input_bufs_omx_mutex.unlock(); VideoOMX* video = static_cast(Video::getInstance()); @@ -89,7 +91,7 @@ void ImageOMX::ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* buffer){ } OMX_ERRORTYPE ImageOMX::FillBufferDone_OMX(OMX_IN OMX_HANDLETYPE /*hcomp*/, OMX_IN OMX_PTR /*appdata*/,OMX_IN OMX_BUFFERHEADERTYPE* buffer) { - Log::getInstance()->log("ImageOmx", Log::NOTICE, "FillBufferDone"); + LogNT::getInstance()->info(TAG, "FillBufferDone"); ImageOMX* image = static_cast(buffer->pAppPrivate); image->ReturnFillOMXBuffer(buffer); return OMX_ErrorNone; @@ -131,7 +133,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length) OMX_ERRORTYPE error; static OMX_CALLBACKTYPE callbacks= {&VideoOMX::EventHandler_OMX,&EmptyBufferDone_OMX,&FillBufferDone_OMX}; - //Log::getInstance()->log("Image", Log::NOTICE, "Allocate Codecs OMX"); + //LogNT::getInstance()->info(TAG, "Allocate Codecs OMX"); //Clock, move later to Image VideoOMX* video = static_cast(Video::getInstance()); @@ -146,7 +148,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length) error = OMX_GetHandle(&omx_imag_decode, L_VPE_OMX_IMAGE_DECODER, NULL, &callbacks); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "Init OMX Image decoder failed %x", error); video->UnlockClock(); return 0; @@ -156,7 +158,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length) error = OMX_GetParameter(omx_imag_decode, OMX_IndexParamImageInit, &p_param); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "Init OMX Image rend OMX_GetParameter failed %x", error); video->UnlockClock(); return 0; @@ -188,20 +190,20 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length) error=OMX_SetParameter(omx_imag_decode,OMX_IndexParamImagePortFormat,&ft_type); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Init OMX_IndexParamVImagePortFormat failed %x", error); + LogNT::getInstance()->debug(TAG, "Init OMX_IndexParamVImagePortFormat failed %x", error); video->UnlockClock(); return 0; } if (!video->DisablePort(omx_imag_decode,omx_image_input_port) || !video->DisablePort(omx_imag_decode,omx_image_output_port)) { - Log::getInstance()->log("Image", Log::DEBUG, "Disable Ports OMX Image decoder failed"); + LogNT::getInstance()->debug(TAG, "Disable Ports OMX Image decoder failed"); video->UnlockClock(); return 0; } if (!video->ChangeComponentState(omx_imag_decode,OMX_StateIdle)) { - Log::getInstance()->log("Image", Log::DEBUG, "image decode idle ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "image decode idle ChangeComponentState"); video->UnlockClock(); return 0; } @@ -210,7 +212,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length) if (!PrepareInputBufsOMX(true, buffer, length)) { video->UnlockClock(); - Log::getInstance()->log("Image", Log::DEBUG, "prepare input bufs failed"); + LogNT::getInstance()->debug(TAG, "prepare input bufs failed"); return 0; } @@ -221,7 +223,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length) if (!video->ChangeComponentState(omx_imag_decode,OMX_StateExecuting)) { - Log::getInstance()->log("Image", Log::DEBUG, "omx_image_decode ChangeComponentState Execute"); + LogNT::getInstance()->debug(TAG, "omx_image_decode ChangeComponentState Execute"); video->UnlockClock(); return 0; } @@ -231,7 +233,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length) if (!video->EnablePort(omx_imag_decode,omx_image_input_port,false) ) { - Log::getInstance()->log("Image", Log::DEBUG, "Enable Ports OMXdecoder inputfailed"); + LogNT::getInstance()->debug(TAG, "Enable Ports OMXdecoder inputfailed"); video->UnlockClock(); return 0; } @@ -244,7 +246,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length) - //Log::getInstance()->log("Image", Log::NOTICE, "Allocate Codecs OMX finished"); + //LogNT::getInstance()->debug(TAG, "Allocate Codecs OMX finished"); return 1; } @@ -257,7 +259,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length) unsigned char* ImageOMX::decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, bool freemem) { if (pictInfValid) return buffer; // does support only one image at a Time; -// Log::getInstance()->log("Image", Log::DEBUG, +// LogNT::getInstance()->debug(TAG, // "decodePicture 1"); EGLPictureCreator * pictcreat =dynamic_cast(Osd::getInstance()); curformat=Unsupported; @@ -265,7 +267,7 @@ unsigned char* ImageOMX::decodePicture(LoadIndex index, unsigned char * buffer, if (buffer[0]== 0x89 && buffer[1] ==0x50 && buffer[2] ==0x4e) curformat=PNG; if (curformat == Unsupported) return buffer; // Jpeg magic numbers -// Log::getInstance()->log("Image", Log::DEBUG, +// LogNT::getInstance()->debug(TAG, // "decodePicture 2"); VideoOMX* video = static_cast(Video::getInstance()); @@ -304,8 +306,8 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un int count =0; while (input_bufs_omx_free.size()==0) { input_bufs_omx_mutex.unlock(); - //Log::getInstance()->log("Image", Log::DEBUG, "DMP mark 6"); - //Log::getInstance()->log("Image", Log::DEBUG, "Deliver MediaPacket no free sample"); + //LogNT::getInstance()->debug(TAG, "DMP mark 6"); + //LogNT::getInstance()->debug(TAG, "Deliver MediaPacket no free sample"); //return 0; // we do not have a free media sample count++; @@ -333,7 +335,7 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un video->LockClock(); -// Log::getInstance()->log("Image", Log::DEBUG, +// LogNT::getInstance()->debug(TAG, // "decodePicture 3"); video->WaitForEvent(omx_imag_decode,OMX_EventPortSettingsChanged); @@ -345,17 +347,17 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un port_def_type.nSize=sizeof(port_def_type); port_def_type.nVersion.nVersion=OMX_VERSION; port_def_type.nPortIndex=omx_image_output_port; -// Log::getInstance()->log("Image", Log::DEBUG, +// LogNT::getInstance()->debug(TAG, // "decodePicture 3a"); error=OMX_GetParameter(omx_imag_decode,OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, - "OMX_IndexParamPortDefinition fix failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_IndexParamPortDefinition fix failed {:#x}", error); video->UnlockClock(); return false; } -// Log::getInstance()->log("Image", Log::DEBUG, +// LogNT::getInstance()->debug(TAG, // "decodePicture 4"); @@ -367,12 +369,12 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un /* video->DisablePort(omx_imag_decode,omx_image_output_port,false); - Log::getInstance()->log("Image", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "decodePicture 5"); if ( !video->CommandFinished(omx_imag_decode,OMX_CommandPortDisable,omx_image_output_port)) { video->UnlockClock(); - Log::getInstance()->log("Image", Log::DEBUG, "commandfinishes end iop"); + LogNT::getInstance()->debug(TAG, "commandfinishes end iop"); return false; }*/ @@ -402,8 +404,8 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un error = OMX_SetParameter(omx_imag_decode, OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, - "Set OMX_IndexParamPortDefinition1 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexParamPortDefinition1 failed {:#x}", error); video->UnlockClock(); return false; } @@ -414,7 +416,7 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un error=OMX_GetHandle(&omx_egl_render,L_VPE_OMX_EGL_REND,NULL,&callbacks); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Init OMX EGL renderer failed %x", error); + LogNT::getInstance()->debug(TAG, "Init OMX EGL renderer failed {:#x}", error); video->UnlockClock(); return false; } @@ -426,7 +428,7 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un error=OMX_GetParameter(omx_egl_render,OMX_IndexParamVideoInit,&p_param); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Init OMX EGL renderer OMX_GetParameter failed %x", error); + LogNT::getInstance()->debug(TAG, "Init OMX EGL renderer OMX_GetParameter failed {:#x}", error); video->UnlockClock(); return false; } @@ -437,14 +439,14 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un if (!video->DisablePort(omx_egl_render,omx_egl_input_port) || !video->DisablePort(omx_egl_render,omx_egl_output_port)) { - Log::getInstance()->log("Image", Log::DEBUG, "Disable Ports OMX Image decoder failed"); + LogNT::getInstance()->debug(TAG, "Disable Ports OMX Image decoder failed"); video->UnlockClock(); return false; } if (!video->ChangeComponentState(omx_egl_render,OMX_StateIdle)) { - Log::getInstance()->log("Image", Log::DEBUG, "egl render idle ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "egl render idle ChangeComponentState"); video->UnlockClock(); return false; } @@ -455,7 +457,7 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un /* if ( !video->CommandFinished(omx_egl_render,OMX_CommandPortDisable,omx_egl_input_port)) { video->UnlockClock(); - Log::getInstance()->log("Image", Log::DEBUG, "commandfinishes end eip"); + LogNT::getInstance()->debug(TAG, "commandfinishes end eip"); return false; }*/ @@ -466,8 +468,8 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un error = OMX_SetParameter(omx_egl_render, OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, - "Set OMX_IndexParamPortDefinition3 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexParamPortDefinition3 failed {:#x}", error); video->UnlockClock(); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); @@ -485,8 +487,8 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un error=OMX_GetParameter(omx_egl_render,OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, - "OMX_IndexParamPortDefinition fix failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_IndexParamPortDefinition fix failed {:#x}", error); video->UnlockClock(); return false; } @@ -496,20 +498,20 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un port_def_type.nBufferCountActual = 1; EGLDisplay egl_display; if (!pictcreat->getEGLPicture(pictInf, &egl_display)) { - Log::getInstance()->log("Image", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "getEGLPict failed"); video->UnlockClock(); return false; } - Log::getInstance()->log("Image", Log::DEBUG, - "getEGLPict %x",pictInf.reference); + LogNT::getInstance()->debug(TAG, + "getEGLPict {:#x}",pictInf.reference); port_def_type.format.video.pNativeWindow = egl_display; error = OMX_SetParameter(omx_egl_render, OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, - "Set OMX_IndexParamPortDefinition3 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexParamPortDefinition3 failed {:#x}", error); video->UnlockClock(); return false; } @@ -525,35 +527,35 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un error=OMX_SetupTunnel(omx_imag_decode,omx_image_output_port,omx_egl_render,omx_egl_input_port); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "OMX_Setup tunnel decode to egl rend failed %x "); + LogNT::getInstance()->debug(TAG, "OMX_Setup tunnel decode to egl rend failed"); video->UnlockClock(); return 0; } if (!video->EnablePort(omx_imag_decode,omx_image_output_port,false) || !video->EnablePort(omx_egl_render,omx_egl_input_port,false) ) { - Log::getInstance()->log("Image", Log::DEBUG, "Enable Ports OMXdecoder rend failed"); + LogNT::getInstance()->debug(TAG, "Enable Ports OMXdecoder rend failed"); video->UnlockClock(); return 0; } if ( !video->CommandFinished(omx_imag_decode,OMX_CommandPortEnable,omx_image_output_port)) { video->UnlockClock(); - Log::getInstance()->log("Image", Log::DEBUG, "commandfinishes end iop"); + LogNT::getInstance()->debug(TAG, "commandfinishes end iop"); return 0; } if ( !video->CommandFinished(omx_egl_render,OMX_CommandPortEnable,omx_egl_input_port)) { video->UnlockClock(); - Log::getInstance()->log("Image", Log::DEBUG, "commandfinishes end eip"); + LogNT::getInstance()->debug(TAG, "commandfinishes end eip"); return 0; } -// Log::getInstance()->log("Image", Log::DEBUG, +// LogNT::getInstance()->debug(TAG, // "decodePicture 7"); video->WaitForEvent(omx_egl_render,OMX_EventPortSettingsChanged); - Log::getInstance()->log("Image", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "decodePicture 8"); @@ -564,20 +566,20 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un error=OMX_SendCommand(omx_egl_render/*dec*/,OMX_CommandPortEnable,omx_egl_output_port/*codec*/,0); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Prepare omx_egl_output_port Send Command to enable port %x", error); + LogNT::getInstance()->debug(TAG, "Prepare omx_egl_output_port Send Command to enable port {:#x}", error); return 0; } error=OMX_UseEGLImage(omx_egl_render/*dec*/,&buf_head_egl,omx_egl_output_port/*codec*/, this, pictInf.reference); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Use OMX_UseEGLImage failed %x", error); + LogNT::getInstance()->debug(TAG, "Use OMX_UseEGLImage failed {:#x}", error); video->UnlockClock(); return false; } buf_head_egl->pAppPrivate=this; -// Log::getInstance()->log("Image", Log::DEBUG, +// LogNT::getInstance()->debug(TAG, // "decodePicture 8 a"); video->EnablePort(omx_imag_decode,omx_image_output_port,false); @@ -590,28 +592,28 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un - Log::getInstance()->log("Image", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "decodePicture 8 end"); if (!video->ChangeComponentState(omx_egl_render,OMX_StateExecuting)) { - Log::getInstance()->log("Image", Log::DEBUG, "omx_egl_rendd ChangeComponentState Execute"); + LogNT::getInstance()->debug(TAG, "omx_egl_rendd ChangeComponentState Execute"); video->UnlockClock(); return false; } -// Log::getInstance()->log("Image", Log::DEBUG, +// LogNT::getInstance()->debug(TAG, // "decodePicture 9"); //video->EnablePort(omx_egl_render,omx_egl_output_port,false); -// Log::getInstance()->log("Image", Log::DEBUG, +// LogNT::getInstance()->debug(TAG, // "decodePicture 10"); omx_egl_filled = false; error = OMX_FillThisBuffer(omx_egl_render, buf_head_egl); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "OMX_FillThisBuffer failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_FillThisBuffer failed {:#x}", error); video->UnlockClock(); return false; } @@ -621,7 +623,7 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un count++; if (count>500) { - Log::getInstance()->log("Image", Log::DEBUG, "No one filled my buffer"); + LogNT::getInstance()->debug(TAG, "No one filled my buffer"); return false; } MILLISLEEP(1); @@ -630,7 +632,7 @@ bool ImageOMX::intDecodePicture(LoadIndex index, unsigned char* /* buffer */, un } omx_egl_filled = false; -// Log::getInstance()->log("Image", Log::DEBUG, +// LogNT::getInstance()->debug(TAG, // "decodePicture left"); @@ -665,7 +667,7 @@ int ImageOMX::PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsig error=OMX_GetParameter(omx_imag_decode/*dec*/,OMX_IndexParamPortDefinition, &port_def_type); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Get OMX OMX_IndexParamPortDefinition failed %x", error); + LogNT::getInstance()->debug(TAG, "Get OMX OMX_IndexParamPortDefinition failed {:#x}", error); } @@ -676,14 +678,14 @@ int ImageOMX::PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsig error=OMX_SetParameter(omx_imag_decode/*dec*/,OMX_IndexParamPortDefinition, &port_def_type); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Set OMX OMX_IndexParamPortDefinition failed %x", error); + LogNT::getInstance()->debug(TAG, "Set OMX OMX_IndexParamPortDefinition failed {:#x}", error); } } error=OMX_SendCommand(omx_imag_decode/*dec*/,OMX_CommandPortEnable,omx_image_input_port/*codec*/,0); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Prepare Input bufs Send Command to enable port %x", error); + LogNT::getInstance()->debug(TAG, "Prepare Input bufs Send Command to enable port {:#x}", error); return 0; } @@ -692,7 +694,7 @@ int ImageOMX::PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsig OMX_BUFFERHEADERTYPE *buf_head=NULL; error=OMX_UseBuffer(omx_imag_decode/*dec*/,&buf_head,omx_image_input_port/*codec*/,this,port_def_type.nBufferSize, buffer); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Use OMX_UseBuffer failed %x", error); + LogNT::getInstance()->debug(TAG, "Use OMX_UseBuffer failed {:#x}", error); input_bufs_omx_mutex.unlock(); return 0; } @@ -717,12 +719,12 @@ int ImageOMX::DestroyInputBufsOMX() //call with clock mutex locked input_bufs_omx_mutex.lock(); for (UINT i=0; i< input_bufs_omx_all.size();i++) { - Log::getInstance()->log("Image", Log::DEBUG, "OMX_FreeBuffer mark"); + LogNT::getInstance()->debug(TAG, "OMX_FreeBuffer mark"); //if (input_bufs_omx_all[i]->pBuffer) free(input_bufs_omx_all[i]->pBuffer); input_bufs_omx_all[i]->pBuffer=NULL; error=OMX_FreeBuffer(omx_imag_decode/*dec*/,omx_image_input_port/*codec*/,input_bufs_omx_all[i]); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Use OMX_FreeBuffer failed %x", error); + LogNT::getInstance()->debug(TAG, "Use OMX_FreeBuffer failed {:#x}", error); input_bufs_omx_mutex.unlock(); return 0; } @@ -759,7 +761,7 @@ int ImageOMX::DestroyInputBufsOMXwhilePlaying() //call with clock mutex locked } } - Log::getInstance()->log("Image", Log::DEBUG, "DestroyInputBufsOMXwhilePlaying %d %d", input_bufs_omx_all.size(),input_bufs_omx_free.size()); + LogNT::getInstance()->debug(TAG, "DestroyInputBufsOMXwhilePlaying {} {}", input_bufs_omx_all.size(),input_bufs_omx_free.size()); input_bufs_omx_mutex.unlock(); return 1; } @@ -770,34 +772,34 @@ int ImageOMX::DeAllocateCodecsOMX() OMX_ERRORTYPE error; omx_running=false; VideoOMX* video = static_cast(Video::getInstance()); -// Log::getInstance()->log("Image", Log::DEBUG, "enter deallocatecodecsomx"); +// LogNT::getInstance()->debug(TAG, "enter deallocatecodecsomx"); -// Log::getInstance()->log("Image", Log::DEBUG, "deallocatecodecsomx mark 1"); +// LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 1"); -// Log::getInstance()->log("Image", Log::DEBUG, "deallocatecodecsomx mark 2"); +// LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 2"); video->LockClock(); if (omx_imag_decode/*dec*/) { if (!video->ChangeComponentState(omx_imag_decode,OMX_StateIdle)) { - Log::getInstance()->log("Image", Log::DEBUG, "omx_imag_decode ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "omx_imag_decode ChangeComponentState"); } if (omx_egl_render) { if (!video->ChangeComponentState(omx_egl_render,OMX_StateIdle)) { - Log::getInstance()->log("Image", Log::DEBUG, "omx_egl_render ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "omx_egl_render ChangeComponentState"); } /*if (!video->ChangeComponentState(omx_egl_render,OMX_StateLoaded,false)) { - Log::getInstance()->log("Image", Log::DEBUG, "omx_egl_render ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "omx_egl_render ChangeComponentState"); }*/ } /* if (!video->ChangeComponentState(omx_imag_decode,OMX_StateLoaded,false)) { - Log::getInstance()->log("Image", Log::DEBUG, "omx_imag_decode ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "omx_imag_decode ChangeComponentState"); }*/ @@ -807,33 +809,33 @@ int ImageOMX::DeAllocateCodecsOMX() -// Log::getInstance()->log("Image", Log::DEBUG, "deallocatecodecsomx mark 3"); +// LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 3"); error=OMX_SendCommand(omx_imag_decode,OMX_CommandFlush, omx_image_output_port, NULL); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, "OMX_Flush rend in failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Flush rend in failed {:#x}", error); } if (omx_egl_render) { if (!video->ChangeComponentState(omx_egl_render,OMX_StateIdle)) { - Log::getInstance()->log("Image", Log::DEBUG, "omx_egl_render ChangeComponentState"); + LogNT::getInstance()->debug(TAG, "omx_egl_render ChangeComponentState"); } -// Log::getInstance()->log("Image", Log::DEBUG, "deallocatecodecsomx mark 4"); +// LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 4"); error=OMX_SendCommand(omx_egl_render,OMX_CommandFlush, omx_egl_input_port, NULL); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, "OMX_Flush rend in failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Flush rend in failed {:#x}", error); } -// Log::getInstance()->log("Image", Log::DEBUG, "deallocatecodecsomx mark 5"); +// LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 5"); error=OMX_SendCommand(omx_egl_render,OMX_CommandFlush, omx_egl_output_port, NULL); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, "OMX_Flush rend in failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Flush rend in failed {:#x}", error); } @@ -841,78 +843,78 @@ int ImageOMX::DeAllocateCodecsOMX() if (!video->CommandFinished(omx_egl_render,OMX_CommandFlush,omx_egl_input_port) || !video->CommandFinished(omx_egl_render,OMX_CommandFlush,omx_egl_output_port)) { - Log::getInstance()->log("Image", Log::DEBUG, "flush cmd clock shed failed"); + LogNT::getInstance()->debug(TAG, "flush cmd clock shed failed"); } -// Log::getInstance()->log("Image", Log::DEBUG, "deallocatecodecsomx mark 6 a"); +// LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 6 a"); } error=OMX_SendCommand(omx_imag_decode,OMX_CommandFlush, omx_image_input_port, NULL); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, "OMX_Flush rend in failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Flush rend in failed {:#x}", error); } if (buf_head_egl) { error=OMX_FreeBuffer(omx_egl_render/*dec*/, omx_egl_output_port/*codec*/,buf_head_egl); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Image", Log::DEBUG, "Use OMX_FreeBuffer 2 failed %x", error); + LogNT::getInstance()->debug(TAG, "Use OMX_FreeBuffer 2 failed {:#x}", error); } } buf_head_egl=NULL; -// Log::getInstance()->log("Image", Log::DEBUG, "deallocatecodecsomx mark 6 b"); +// LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 6 b"); if (!video->CommandFinished(omx_imag_decode,OMX_CommandFlush,omx_image_input_port) || !video->CommandFinished(omx_imag_decode,OMX_CommandFlush,omx_image_output_port) ) { - Log::getInstance()->log("Image", Log::DEBUG, "flush cmd clock shed failed"); + LogNT::getInstance()->debug(TAG, "flush cmd clock shed failed"); } -// Log::getInstance()->log("Image", Log::DEBUG, "deallocatecodecsomx mark 6 c"); +// LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 6 c"); DestroyInputBufsOMX(); //We have to make sure that no buffers are in use -// Log::getInstance()->log("Image", Log::DEBUG, "deallocatecodecsomx mark 7"); +// LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 7"); //todo flushing if (!video->DisablePort(omx_imag_decode,omx_image_output_port,true)) { - Log::getInstance()->log("Image", Log::DEBUG, "Disable Tunnel Port failed 1"); + LogNT::getInstance()->debug(TAG, "Disable Tunnel Port failed 1"); } if (omx_egl_render) { if (!video->DisablePort(omx_egl_render,omx_egl_input_port,true)) { - Log::getInstance()->log("Image", Log::DEBUG, "Disable Tunnel Port failed 4"); + LogNT::getInstance()->debug(TAG, "Disable Tunnel Port failed 4"); } error=OMX_SetupTunnel(omx_imag_decode,omx_image_output_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } error=OMX_SetupTunnel(omx_egl_render,omx_egl_input_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + LogNT::getInstance()->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } } -// Log::getInstance()->log("Image", Log::DEBUG, "deallocatecodecsomx mark 8"); +// LogNT::getInstance()->debug(TAG, "deallocatecodecsomx mark 8"); //error=OMX_FreeHandle(omx_aud_dec); error=OMX_FreeHandle(omx_imag_decode); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, "FreeHandle failed %d", error); + LogNT::getInstance()->debug(TAG, "FreeHandle failed {}", error); } if (omx_egl_render) { error=OMX_FreeHandle(omx_egl_render); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Image", Log::DEBUG, "FreeHandle failed %d", error); + LogNT::getInstance()->debug(TAG, "FreeHandle failed {}", error); } } video->UnlockClock(); @@ -926,7 +928,7 @@ int ImageOMX::DeAllocateCodecsOMX() video->UnlockClock(); } -// Log::getInstance()->log("Image", Log::DEBUG, "leave deallocate codecs OMX"); +// LogNT::getInstance()->debug(TAG, "leave deallocate codecs OMX"); return 1; } diff --git a/osdopenvg.cc b/osdopenvg.cc index 7779fd0..6fa2778 100644 --- a/osdopenvg.cc +++ b/osdopenvg.cc @@ -23,6 +23,7 @@ #include #include +#include "oldlog.h" #include "videoomx.h" #include "surface.h" #include "message.h" @@ -31,6 +32,8 @@ #include "osdopenvg.h" +static const char* TAG = "OsdOpenVG"; + #define EXTERNALPICTURE(name, fname, fileextension) extern uint8_t name ## _data[] asm("_binary_other_"#fname"_"#fileextension"_start"); \ extern uint8_t name ## _data_end[] asm("_binary_other_"#fname"_"#fileextension"_end"); @@ -88,31 +91,31 @@ int OsdOpenVG::init() egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (egl_display == EGL_NO_DISPLAY) { - Log::getInstance()->log("OSD", Log::WARN, "Could not get egl display! %x", eglGetError()); + LogNT::getInstance()->crit(TAG, "Could not get egl display! {:#x}", eglGetError()); vgmutex.unlock(); return 0; } if (eglInitialize(egl_display, NULL, NULL) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::WARN, "Initialising display failed! %x", eglGetError()); + LogNT::getInstance()->crit(TAG, "Initialising display failed! {:#x}", eglGetError()); vgmutex.unlock(); return 0; } const char* query_str = eglQueryString(egl_display, EGL_CLIENT_APIS); - if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); - else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x", eglGetError()); + if (query_str) LogNT::getInstance()->debug(TAG, query_str); + else LogNT::getInstance()->warn(TAG, "Could not query display {:#x}", eglGetError()); query_str = eglQueryString(egl_display, EGL_EXTENSIONS); - if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); - else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x", eglGetError()); + if (query_str) LogNT::getInstance()->info(TAG, query_str); + else LogNT::getInstance()->warn(TAG, "Could not query display {:#x}", eglGetError()); if (eglBindAPI(EGL_OPENVG_API) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::WARN, "Binding openvg api failed! %x", eglGetError()); + LogNT::getInstance()->warn(TAG, "Binding openvg api failed! {:#x}", eglGetError()); vgmutex.unlock(); return 0; } @@ -129,7 +132,7 @@ int OsdOpenVG::init() if (eglChooseConfig(egl_display, attributs, &egl_ourconfig, 1, &number) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::WARN, "Choosing egl config failed! %x", eglGetError()); + LogNT::getInstance()->warn(TAG, "Choosing egl config failed! {:#x}", eglGetError()); vgmutex.unlock(); return 0; } @@ -138,7 +141,7 @@ int OsdOpenVG::init() if (egl_context == EGL_NO_CONTEXT) { - Log::getInstance()->log("OSD", Log::WARN, "Creating egl context failed! %x", eglGetError()); + LogNT::getInstance()->warn(TAG, "Creating egl context failed! {:#x}", eglGetError()); vgmutex.unlock(); return 0; } @@ -148,12 +151,12 @@ int OsdOpenVG::init() if (graphics_get_display_size(0, reinterpret_cast(&display_width), reinterpret_cast(&display_height)) < 0) { - Log::getInstance()->log("OSD", Log::WARN, "Getting display size failed! (BCM API) "); + LogNT::getInstance()->warn(TAG, "Getting display size failed! (BCM API)"); vgmutex.unlock(); return 0; } - Log::getInstance()->log("OSD", Log::NOTICE, "Displaysize is %d x %d ", display_width, display_height); + LogNT::getInstance()->info(TAG, "Displaysize is {} x {}", display_width, display_height); VC_RECT_T dst_rect = {0, 0, display_width, display_height}; VC_RECT_T src_rect = {0, 0, BACKBUFFER_WIDTH << 16, BACKBUFFER_HEIGHT << 16}; VC_RECT_T src_rect_bg = {0, 0, 16 << 16, 16 << 16}; @@ -186,16 +189,16 @@ int OsdOpenVG::init() egl_surface = eglCreateWindowSurface(egl_display, egl_ourconfig, &nativewindow, NULL); if (egl_surface == EGL_NO_SURFACE) { - Log::getInstance()->log("OSD", Log::WARN, "Creating egl window surface failed!"); + LogNT::getInstance()->warn(TAG, "Creating egl window surface failed!"); vgmutex.unlock(); return 0; } - Log::getInstance()->log("OSD", Log::DEBUG, "Making egl current in1%d", syscall(SYS_gettid)); + LogNT::getInstance()->debug(TAG, "Making egl current in SYS_gettid: {}", syscall(SYS_gettid)); if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::WARN, "Making egl Current failed"); + LogNT::getInstance()->warn(TAG, "Making egl Current failed"); vgmutex.unlock(); return 0; } @@ -204,23 +207,23 @@ int OsdOpenVG::init() query_str = reinterpret_cast(vgGetString(VG_VERSION)); - if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); - else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x", vgGetError()); + if (query_str) LogNT::getInstance()->info(TAG, query_str); + else LogNT::getInstance()->warn(TAG, "Could not query display {:#x}", vgGetError()); query_str = reinterpret_cast(vgGetString(VG_VENDOR)); - if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); - else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x", vgGetError()); + if (query_str) LogNT::getInstance()->info(TAG, query_str); + else LogNT::getInstance()->warn(TAG, "Could not query display {:#x}", vgGetError()); query_str = reinterpret_cast(vgGetString(VG_RENDERER)); - if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); - else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x", vgGetError()); + if (query_str) LogNT::getInstance()->info(TAG, query_str); + else LogNT::getInstance()->warn(TAG, "Could not query display {:#x}", vgGetError()); query_str = reinterpret_cast(vgGetString(VG_EXTENSIONS)); - if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); - else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x", vgGetError()); + if (query_str) LogNT::getInstance()->info(TAG, query_str); + else LogNT::getInstance()->warn(TAG, "Could not query display {:#x}", vgGetError()); aspect_correction = ((float)BACKBUFFER_HEIGHT) / 576.f / (((float)BACKBUFFER_WIDTH) / 720.f); initPaths(); @@ -288,7 +291,7 @@ int OsdOpenVG::init() eglSwapInterval(egl_display, 1); - Log::getInstance()->log("OSD", Log::DEBUG, "Making egl current out 1%d", syscall(SYS_gettid)); + LogNT::getInstance()->debug(TAG, "Making egl current out SYS_gettid {}", syscall(SYS_gettid)); eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); //Now we will create the Screen initted = true; // must set this here or create surface won't work @@ -322,7 +325,7 @@ int OsdOpenVG::init() void OsdOpenVG::renderThreadStop() { - Log::getInstance()->log("OSDOpenVG", Log::WARN, "renderThreadStop"); + LogNT::getInstance()->warn(TAG, "renderThreadStop"); renderThreadMutex.lock(); renderThreadReq = 2; // req-stop @@ -350,24 +353,24 @@ int OsdOpenVG::shutdown() if (!initted) return 0; initted = false; - Log::getInstance()->log("OSD", Log::DEBUG, "shutdown mark1"); + LogNT::getInstance()->debug(TAG, "shutdown mark1"); renderThreadStop(); - Log::getInstance()->log("OSD", Log::DEBUG, "shutdown mark1a"); + LogNT::getInstance()->debug(TAG, "shutdown mark1a"); //(((VideoOMX*)Video::getInstance())->shutdownUsingOSDObjects()); if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::WARN, "Making egl Current failed in shutdown %x", eglGetError()); + LogNT::getInstance()->warn(TAG, "Making egl Current failed in shutdown {:#x}", eglGetError()); } if (eglBindAPI(EGL_OPENVG_API) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::WARN, "Binding openvg api thread failed! %x", eglGetError()); + LogNT::getInstance()->warn(TAG, "Binding openvg api thread failed! {:#x}", eglGetError()); } - Log::getInstance()->log("OSD", Log::DEBUG, "shutdown mark2"); + LogNT::getInstance()->debug(TAG, "shutdown mark2"); processOpenVGCommands(); - Log::getInstance()->log("OSD", Log::DEBUG, "shutdown mark3"); + LogNT::getInstance()->debug(TAG, "shutdown mark3"); taskmutex.lock(); vgmutex.lock(); @@ -382,22 +385,22 @@ int OsdOpenVG::shutdown() vgSetfv(VG_CLEAR_COLOR, 4, colclear); vgClear(0, 0, BACKBUFFER_WIDTH, BACKBUFFER_HEIGHT); eglSwapBuffers(egl_display, egl_surface); - Log::getInstance()->log("OSD", Log::DEBUG, "Making egl current out final"); + LogNT::getInstance()->debug(TAG, "Making egl current out final"); eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (eglDestroySurface(egl_display, egl_surface) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::ERR, "eglDestroySurface failed %x", eglGetError()); + LogNT::getInstance()->error(TAG, "eglDestroySurface failed {:#x}", eglGetError()); } if (eglDestroyContext(egl_display, egl_context) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::ERR, "eglDestroyContext failed %x", eglGetError()); + LogNT::getInstance()->error(TAG, "eglDestroyContext failed {:#x}", eglGetError()); } if (eglTerminate(egl_display) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::ERR, "eglTerminate failed %x", eglGetError()); + LogNT::getInstance()->error(TAG, "eglTerminate failed {:#x}", eglGetError()); } DISPMANX_UPDATE_HANDLE_T bcm_update; @@ -415,7 +418,7 @@ int OsdOpenVG::shutdown() // OSDOVG-ROD-EXPERIMENT - temp hack to allow OsdVector to signal the thread in OsdOpenVG void OsdOpenVG::doRender() { - Log::getInstance()->log("OSD", Log::DEBUG, "Nudge render thread"); + LogNT::getInstance()->debug(TAG, "Nudge render thread"); // signal renderLoop to go-around (from putOpenVGCommand) renderThreadMutex.lock(); @@ -450,17 +453,17 @@ void OsdOpenVG::doRender() void OsdOpenVG::renderLoop() { // We have to claim the egl context for this thread - Log::getInstance()->log("OSD", Log::NOTICE, "Entering drawing thread"); + LogNT::getInstance()->info(TAG, "Entering drawing thread"); if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::WARN, "Making egl Current failed in thread %x", eglGetError()); + LogNT::getInstance()->warn(TAG, "Making egl Current failed in thread {:#x}", eglGetError()); return; } if (eglBindAPI(EGL_OPENVG_API) == EGL_FALSE) { - Log::getInstance()->log("OSD", Log::WARN, "Binding openvg api thread failed! %x", eglGetError()); + LogNT::getInstance()->warn(TAG, "Binding openvg api thread failed! {:#x}", eglGetError()); return; } @@ -479,7 +482,7 @@ void OsdOpenVG::renderLoop() #if DEV dumpStyles(); #endif - Log::getInstance()->log("OSDOpenVG", Log::CRAZY, "EXPERIMENT - render"); + LogNT::getInstance()->trace(TAG, "EXPERIMENT - render"); InternalRendering(); lastrendertime = getTimeMS(); @@ -497,7 +500,7 @@ void OsdOpenVG::renderLoop() if (renderThreadReq == 2) { if (eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_FALSE) - Log::getInstance()->log("OSD", Log::WARN, "Making egl Current out thread failed"); + LogNT::getInstance()->warn(TAG, "Making egl Current out thread failed"); ul.unlock(); return; } @@ -511,7 +514,7 @@ void OsdOpenVG::renderLoop() if (renderThreadReq == 2) { if (eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_FALSE) - Log::getInstance()->log("OSD", Log::WARN, "Making egl Current out thread failed"); + LogNT::getInstance()->warn(TAG, "Making egl Current out thread failed"); ul.unlock(); return; } @@ -847,7 +850,7 @@ int OsdOpenVG::loadFont(bool newfont) if (error) { - Log::getInstance()->log("OSD", Log::WARN, "Could not load freetype %x", error); + LogNT::getInstance()->warn(TAG, "Could not load freetype {:#x}", error); return 0; } } @@ -882,20 +885,20 @@ int OsdOpenVG::loadFont(bool newfont) } else { - Log::getInstance()->log("OSD", Log::CRIT, "Could not locate a font! Abort!"); + LogNT::getInstance()->crit(TAG, "Could not locate a font! Abort!"); return 0; } FcPatternDestroy(pattern); - Log::getInstance()->log("OSD", Log::NOTICE, "Load Font %s: %s", cur_fontname, filename); + LogNT::getInstance()->info(TAG, "Load Font {}: {}", cur_fontname, filename); // second load the font FT_Face new_ft_face; error = FT_New_Face(ft_library, reinterpret_cast(filename), 0, &new_ft_face); if (error) { - Log::getInstance()->log("OSD", Log::WARN, "Could not load font face %x %s", error, filename); + LogNT::getInstance()->warn(TAG, "Could not load font face {:#x} {}", error, filename); return 0; } @@ -904,7 +907,7 @@ int OsdOpenVG::loadFont(bool newfont) if (error) { FT_Done_Face(new_ft_face); - Log::getInstance()->log("OSD", Log::WARN, "Could not set face size %x", error); + LogNT::getInstance()->warn(TAG, "Could not set face size {:#x}", error); return 0; } @@ -926,7 +929,7 @@ int OsdOpenVG::loadFont(bool newfont) segments.reserve(256); coord.reserve(1024); - //Log::getInstance()->log("OSD", Log::DEBUG, "Create Glyph test %d %x %x %d",cur_char,font_data_end,font_data,glyph); + //LogNT::getInstance()->debug(TAG, "Create Glyph test {} {} {} {}",cur_char,font_data_end,font_data,glyph); while (glyph != 0) { error = FT_Load_Glyph(ft_face, glyph, FT_LOAD_DEFAULT); @@ -934,7 +937,7 @@ int OsdOpenVG::loadFont(bool newfont) if (error) { cur_char = FT_Get_Next_Char(ft_face, cur_char, &glyph); - Log::getInstance()->log("OSD", Log::WARN, "Could not load glyph %x %c", error); + LogNT::getInstance()->warn(TAG, "Could not load glyph {:#x} {}", error); continue; } @@ -967,13 +970,13 @@ int OsdOpenVG::loadFont(bool newfont) char last_tag = 0; short first_point = point; - //Log::getInstance()->log("OSD", Log::DEBUG, "runs %d",*cont); + //LogNT::getInstance()->debug(TAG, "runs {}", *cont); for (; point < next_cont; point++) { char tag = tags[point]; FT_Vector fpoint = pt[point]; - // Log::getInstance()->log("OSD", Log::DEBUG, "tag %d point %d %d: %d %d",tag,fpoint.x,fpoint.y,point,n_point); + // LogNT::getInstance()->debug(TAG, "tag %d point {} {}: {} {}",tag,fpoint.x,fpoint.y,point,n_point); if (first) { segments.push_back(VG_MOVE_TO); @@ -1014,7 +1017,7 @@ int OsdOpenVG::loadFont(bool newfont) last_tag = tag; coord.push_back(((float)fpoint.x)*aspect_correction / 256.); coord.push_back(font_size - ((float)fpoint.y) / 256.); - //Log::getInstance()->log("OSD", Log::DEBUG, "Create APD Glyph coord %d %d %g %g",fpoint.x,fpoint.y,coord[coord.size()-2],coord[coord.size()-1]); + //LogNT::getInstance()->debug(TAG, "Create APD Glyph coord {} {} {} {}",fpoint.x,fpoint.y,coord[coord.size()-2],coord[coord.size()-1]); } if (!(last_tag & 0x1)) @@ -1041,20 +1044,20 @@ int OsdOpenVG::loadFont(bool newfont) switch (segments[m]) { case VG_MOVE_TO: - Log::getInstance()->log("OSD", Log::DEBUG, "Move To %g %g",coord[n],coord[n+1]);n+=2; break; + LogNT::getInstance()->debug(TAG, "Move To {} {}",coord[n],coord[n+1]);n+=2; break; case VG_LINE_TO: - Log::getInstance()->log("OSD", Log::DEBUG, "Line To %g %g",coord[n],coord[n+1]);n+=2; break; + LogNT::getInstance()->debug(TAG, "Line To {} {}",coord[n],coord[n+1]);n+=2; break; case VG_CUBIC_TO: - Log::getInstance()->log("OSD", Log::DEBUG, "Cubic To %g %g %g %g %g %g",coord[n],coord[n+1],coord[n+2],coord[n+3],coord[n+4],coord[n+5]);n+=6; break; + LogNT::getInstance()->debug(TAG, "Cubic To {} {} {} {} {} {}",coord[n],coord[n+1],coord[n+2],coord[n+3],coord[n+4],coord[n+5]);n+=6; break; case VG_QUAD_TO: - Log::getInstance()->log("OSD", Log::DEBUG, "Quad To %g %g %g %g",coord[n],coord[n+1],coord[n+2],coord[n+3]);n+=4; break; + LogNT::getInstance()->debug(TAG, "Quad To {} {} {} {}",coord[n],coord[n+1],coord[n+2],coord[n+3]);n+=4; break; case VG_CLOSE_PATH: - Log::getInstance()->log("OSD", Log::DEBUG, "Close Path"); break; + LogNT::getInstance()->debug(TAG, "Close Path"); break; } }*/ //vguRect(path,0.f,0.f,1.f,1.f); - //Log::getInstance()->log("OSD", Log::DEBUG, "Create APD Glyph %d %x",segments.size(),vgGetError()); + //LogNT::getInstance()->debug(TAG, "Create APD Glyph {} {:#x}",segments.size(),vgGetError()); } VGfloat ori[] = {0.f, 0.f}; @@ -1063,7 +1066,7 @@ int OsdOpenVG::loadFont(bool newfont) vgSetGlyphToPath(vgfont, glyph, path, VG_FALSE, ori, esp); - //Log::getInstance()->log("OSD", Log::DEBUG, "Create Glyph %d %d %x",path,glyph,vgGetError()); + //LogNT::getInstance()->debug(TAG, "Create Glyph {} {} {:#x}",path,glyph,vgGetError()); if (path != VG_INVALID_HANDLE) { vgDestroyPath(path); @@ -1101,7 +1104,7 @@ void OsdOpenVG::drawSetTrans(SurfaceInfo& sc) clip_shift_y = sc.y; //vgTranslate(0.f+sc.x,576.f-sc.y); - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Translate %g %g",sc.x,sc.y); + //LogNT::getInstance()->debug(TAG, "Draw Translate {} {}",sc.x,sc.y); } void OsdOpenVG::executeDrawCommand(SVGCommand& command) @@ -1116,7 +1119,7 @@ void OsdOpenVG::executeDrawCommand(SVGCommand& command) vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE); // VGuint rgba; // rgba = vgGetColor((VGPaint) command.handle); - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Path %d %x %g %g %g %g",command.handle,command.target.path_index,command.x,command.y,command.w,command.h); + //LogNT::getInstance()->debug(TAG, "Draw Path {} {:#x} {} {} {} {}",command.handle,command.target.path_index,command.x,command.y,command.w,command.h); //vgSeti(VG_FILL_RULE,); vgGetMatrix(save_matrix); @@ -1211,7 +1214,7 @@ void OsdOpenVG::executeDrawCommand(SVGCommand& command) vgScale(scalex, scaley); vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER); vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_NORMAL); - //Log::getInstance()->log("OSD", Log::DEBUG, "TVMedia Draw Image Scale %g %g %g %g %g %g",command.w,imagewidth,command.h,imageheight,scalex,scaley); + //LogNT::getInstance()->debug(TAG, "TVMedia Draw Image Scale {} {} {} {} {} {}",command.w,imagewidth,command.h,imageheight,scalex,scaley); } //vgLoadIdentity(); @@ -1220,7 +1223,7 @@ void OsdOpenVG::executeDrawCommand(SVGCommand& command) vgDrawImage(static_cast(command.target.image)); - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Image %d %x %g %g %g %g %x",command.handle,command.target.image,command.x,command.y,command.w,command.h, + //LogNT::getInstance()->debug(TAG, "Draw Image {} {:#x} {} {} {} {} {:#x}",command.handle,command.target.image,command.x,command.y,command.w,command.h, // vgGetError()); if (command.handle) { @@ -1252,7 +1255,7 @@ void OsdOpenVG::executeDrawCommand(SVGCommand& command) vgDrawGlyph(vgfont, glyph_index, VG_FILL_PATH, VG_FALSE); //vgDrawPath(std_paths[Rectangle],VG_FILL_PATH); - /* Log::getInstance()->log("OSD", Log::DEBUG, "Draw Glyph %d %c %d %g %g %x",command.handle,command.target.textchar,glyph_index,command.x,command.y, + /* LogNT::getInstance()->debug(TAG, "Draw Glyph {} {} {} {} {} {:#x}",command.handle,command.target.textchar,glyph_index,command.x,command.y, vgGetError());*/ vgSeti(VG_MATRIX_MODE, VG_MATRIX_GLYPH_USER_TO_SURFACE); vgLoadMatrix(save_matrix); @@ -1303,7 +1306,7 @@ void OsdOpenVG::executeDrawCommand(SVGCommand& command) glyph_index = loadTTchar(tchar); vgDrawGlyph(vgttfont, glyph_index, VG_FILL_PATH, VG_FALSE); - /* Log::getInstance()->log("OSD", Log::DEBUG, "Draw TTchar %x %x %x %x",glyph_index,ttforegcolour,Surface::enumTeletextColorToCoulour(ttforegcolour).rgba(), + /* LogNT::getInstance()->debug(TAG, "Draw TTchar {:#x} {:#x} {:#x} {:#x}",glyph_index,ttforegcolour,Surface::enumTeletextColorToCoulour(ttforegcolour).rgba(), vgGetColor(vgttpaint));*/ vgLoadMatrix(save_matrix); @@ -1347,13 +1350,13 @@ unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command) } case OVGdestroyImageRef: //imcount--; { - //Log::getInstance()->log("OSD", Log::DEBUG, "TVMedia Draw Image Destroy %x %d",command.param1,imcount); + //LogNT::getInstance()->debug(TAG, "TVMedia Draw Image Destroy {:#x} {}",command.param1,imcount); vgDestroyImage(static_cast(command.param1)); return 0; } case OVGdestroyPaint: { - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Paint Destroy %d ",command.param1); + //LogNT::getInstance()->debug(TAG, "Draw Paint Destroy {}",command.param1); vgDestroyPaint(static_cast(command.param1)); return 0; } @@ -1362,7 +1365,7 @@ unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command) VGImage input = vgCreateImage(VG_A_8, command.param1, command.param2, VG_IMAGE_QUALITY_NONANTIALIASED | VG_IMAGE_QUALITY_FASTER | VG_IMAGE_QUALITY_BETTER); - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw create palette %d %d %x %d",command.param1,command.param2,vgGetError(),input); + //LogNT::getInstance()->debug(TAG, "Draw create palette {} {} {:#x} {}",command.param1,command.param2,vgGetError(),input); vgImageSubData(input, command.data, command.param1, VG_A_8, 0, 0, command.param1, command.param2); // upload palettized image data VGImage handle = vgCreateImage(VG_sRGBA_8888, command.param1, command.param2, @@ -1387,7 +1390,7 @@ unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command) { VGImage handle = vgCreateImage(VG_A_1, command.param1, command.param2, VG_IMAGE_QUALITY_FASTER); - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw create mono %d %d %x %d",command.param1,command.param2,vgGetError(),handle); + //LogNT::getInstance()->debug(TAG, "Draw create mono {} {} {:#x} {}",command.param1,command.param2,vgGetError(),handle); unsigned int buffer_len = (command.param1 * command.param2) >> 3; unsigned char* buffer = static_cast(malloc(buffer_len)); unsigned char* r_buffer1 = buffer; @@ -1403,7 +1406,7 @@ unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command) vgImageSubData(handle, buffer, command.param1 >> 3, VG_A_1, 0, 0, command.param1, command.param2); free(buffer); - // Log::getInstance()->log("OSD", Log::DEBUG, "Draw create mono2 %d %d %x %d",command.param1,command.param2,vgGetError(),handle); + // LogNT::getInstance()->debug(TAG, "Draw create mono2 {} {} {:#x} {}",command.param1,command.param2,vgGetError(),handle); return handle; } /*case OVGcreateImageFile: { @@ -1415,26 +1418,26 @@ unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command) handle=vgCreateImage(VG_sXBGR_8888,imagefile->columns(),imagefile->rows(), VG_IMAGE_QUALITY_BETTER); - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw create image details %d %d %x mark1",imagefile->columns(),imagefile->rows(),(unsigned int*)imageblob.data()); + //LogNT::getInstance()->debug(TAG, "Draw create image details {} {} {:#x} mark1",imagefile->columns(),imagefile->rows(),(unsigned int*)imageblob.data()); vgImageSubData(handle,imageblob.data(),imagefile->columns()*4, VG_sXBGR_8888,0,0,imagefile->columns(),imagefile->rows()); - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw create image details %d %d %x mark2",imagefile->columns(),imagefile->rows(),(unsigned int*)imageblob.data()); + //LogNT::getInstance()->debug(TAG, "Draw create image details {} {} {:#x} mark2",imagefile->columns(),imagefile->rows(),(unsigned int*)imageblob.data()); delete imagefile; }catch( Exception &error_ ) { - Log::getInstance()->log("OSD", Log::DEBUG, "Libmagick hT: %s",error_.what()); + LogNT::getInstance()->debug(TAG, "Libmagick hT: {}",error_.what()); return 0; } - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw create file %d %d %x %d",command.param1,command.param2,vgGetError(),handle); + //LogNT::getInstance()->debug(TAG, "Draw create file {} {} {:#x} {}",command.param1,command.param2,vgGetError(),handle); return handle; } */ case OVGcreateImageMemory: //imcount++; { const PictureInfo* info = static_cast(command.data); VGImage handle; - //Log::getInstance()->log("OSD", Log::DEBUG, "TVMedia OVGcreateImageMemory %d",imcount); + //LogNT::getInstance()->debug(TAG, "TVMedia OVGcreateImageMemory {}",imcount); handle = vgCreateImage(VG_sABGR_8888, info->width, info->height, VG_IMAGE_QUALITY_BETTER); vgImageSubData(handle, info->image, info->width * 4, VG_sABGR_8888, 0, 0, info->width, info->height); @@ -1472,13 +1475,13 @@ unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command) VGImage handle; handle = vgCreateImage(VG_sABGR_8888, info->width, info->height, VG_IMAGE_QUALITY_BETTER); - // Log::getInstance()->log("OSD", Log::DEBUG, "TVMedia OVGcreateEGLImage %d %d %x %d",info->width,info->height, handle,imcount); + // LogNT::getInstance()->debug(TAG, "TVMedia OVGcreateEGLImage {} {} {:#x} {}",info->width,info->height, handle,imcount); info->handle = handle; info->reference = eglCreateImageKHR(egl_display, egl_context, EGL_VG_PARENT_IMAGE_KHR, reinterpret_cast(handle), NULL); if (info->reference) return true; - Log::getInstance()->log("OSD", Log::DEBUG, "TVMedia OVGcreateEGLImage %d %d %x Fail!", info->width, info->height, handle); + LogNT::getInstance()->debug(TAG, "TVMedia OVGcreateEGLImage {} {} {:#x} Fail!", info->width, info->height, handle); if (handle) vgDestroyImage(handle); return false; } @@ -1525,14 +1528,14 @@ unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command) vgSetColor(handle, command.param1); //VGuint rgba; //rgba = vgGetColor((VGPaint)handle); - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Paint %d %x %x",handle,command.param1,rgba); + //LogNT::getInstance()->debug(TAG, "Draw Paint {} {:#x} {:#x}",handle,command.param1,rgba); break; } case DrawStyle::GradientLinear: { vgSetParameteri(handle, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT); VGfloat params[] = {style->x1, style->y1, style->x2, style->y2, style->r}; - //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Gradient %d %g %g %g %g",handle,params[0],params[1],params[2],params[3]); + //LogNT::getInstance()->debug(TAG, "Draw Gradient {} {} {} {} {}",handle,params[0],params[1],params[2],params[3]); vgSetParameterfv(handle, VG_PAINT_LINEAR_GRADIENT, 4, params); break; } @@ -1608,7 +1611,7 @@ bool OsdOpenVG::getStaticImageData(unsigned int static_id, UCHAR** userdata, ULO void OsdOpenVG::createPicture(struct PictureInfo& pict_inf) { struct OpenVGCommand comm; - Log::getInstance()->log("OsdOpenVG", Log::DEBUG, "TVMedia Create Picture %d", pict_inf.type); + LogNT::getInstance()->debug(TAG, "TVMedia Create Picture {}", pict_inf.type); if (pict_inf.type == PictureInfo::RGBAMemBlock) { diff --git a/osdopenvg.h b/osdopenvg.h index 7b3a0f2..00d1ecf 100644 --- a/osdopenvg.h +++ b/osdopenvg.h @@ -33,7 +33,6 @@ #include "defines.h" #include "osdvector.h" -#include "oldlog.h" #include "videoomx.h" #include "staticartwork.h" #ifdef PICTURE_DECODER_OMX diff --git a/osdvector.cc b/osdvector.cc index cf938fe..cd86d35 100644 --- a/osdvector.cc +++ b/osdvector.cc @@ -17,6 +17,7 @@ along with VOMP. If not, see . */ +#include "log.h" #include "surfacevector.h" #include "vdr.h" #include "vdrresponsepacket.h" @@ -33,6 +34,8 @@ using namespace Magick; +static const char* TAG = "OsdVector"; + class MagickDecoder: public OsdVector::PictureDecoder { public: @@ -59,7 +62,7 @@ unsigned char* MagickDecoder::decodePicture(LoadIndex index, unsigned char* buff try { - Log::getInstance()->log("MagickDecoder", Log::DEBUG, "decodePicture"); + LogNT::getInstance()->debug("MagickDecoder", "decodePicture"); if (freemem) myblob.updateNoCopy(buffer, length, Blob::MallocAllocator); else myblob.update(buffer, length); @@ -71,9 +74,9 @@ unsigned char* MagickDecoder::decodePicture(LoadIndex index, unsigned char* buff } catch ( Exception& error_ ) { - Log::getInstance()->log("MagickDecoder", Log::DEBUG, "Libmagick: %s", error_.what()); + LogNT::getInstance()->debug("MagickDecoder", "Libmagick: {}", error_.what()); delete imageblob; - Log::getInstance()->log("MagickDecoder", Log::DEBUG, "Libmagick: error mark2"); + LogNT::getInstance()->debug("MagickDecoder", "Libmagick: error mark2"); unsigned char* newbuffer = (unsigned char*) malloc(length); memcpy(newbuffer, myblob.data(), length); return newbuffer; @@ -134,7 +137,7 @@ bool OsdVector::screenShot(const char* fileName) if (!screenShotInternal(mem, width, height, true)) { - Log::getInstance()->log("OsdVector", Log::DEBUG, "Screenshot failed!"); + LogNT::getInstance()->debug(TAG, "Screenshot failed!"); free(mem); return false; } @@ -145,7 +148,7 @@ bool OsdVector::screenShot(const char* fileName) } catch ( Exception& error_ ) { - Log::getInstance()->log("MagickEncoder", Log::DEBUG, "Libmagick: %s", error_.what()); + LogNT::getInstance()->debug("MagickEncoder", "Libmagick: {}", error_.what()); return false; } @@ -280,7 +283,7 @@ void OsdVector::updateOrAddSurface(const SurfaceVector* surf, float x, float y, SurfacesIterator si; #if DEV - Log::getInstance()->log("OsdVector", Log::CRAZY, "updateOrAddSurface, surfaces.length %i", surfaces.size()); + LogNT::getInstance()->trace(TAG, "updateOrAddSurface, surfaces.length {}", surfaces.size()); dumpStyles(); #endif @@ -332,19 +335,19 @@ void OsdVector::updateOrAddSurface(const SurfaceVector* surf, float x, float y, cleanupOrphanedRefs(); #if DEV - Log::getInstance()->log("OsdVector", Log::CRAZY, "After UOAS:"); + LogNT::getInstance()->trace(TAG, "After UOAS:"); dumpStyles(); #endif // OSDOVG-ROD-EXPERIMENT - Log::getInstance()->log("OsdVector", Log::CRAZY, "EXPERIMENT - call doRender"); + LogNT::getInstance()->trace(TAG, "EXPERIMENT - call doRender"); doRender(); } void OsdVector::removeSurface(const SurfaceVector* surf) { std::lock_guard lg(surfaces_mutex); // FIXME - Can block here on shutdown if a timer is fired just as the wrong time - Log::getInstance()->log("OSDVector-347", Log::CRAZY, "EXPERIMENT - removeSurface"); + LogNT::getInstance()->trace("OsdVector-348", "EXPERIMENT - removeSurface"); for (auto i = surfaces.begin(); i != surfaces.end(); i++) { if (i->surface == surf) @@ -449,7 +452,7 @@ void OsdVector::removeLoadIndexRef(const LoadIndex ref) } tvmedias_loaded.erase(ref); - // Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia removeLoadIndexRef %d %llx",tvmedias_load.size(),ref); + // LogNT::getInstance()->debug(TAG, "TVMedia removeLoadIndexRef {} {:#x}",tvmedias_load.size(),ref); tvmedias_load.erase(tvmedias_load_inv[ref]); tvmedias_load_inv.erase(ref); @@ -683,13 +686,13 @@ void OsdVector::dumpStyles() for(i = drawstyleHandles.begin(); i != drawstyleHandles.end(); i++) { const DrawStyle* test = &(i->first); - Log::getInstance()->log("OsdVector", Log::DEBUG, "DumpStyles: %p %i", test , i->second); + LogNT::getInstance()->debug(TAG, "DumpStyles: {} {}", (void*)test , i->second); } std::map::iterator i2; for (i2 = drawstyleHandlesRefCounts.begin(); i2 != drawstyleHandlesRefCounts.end(); i2++) { - Log::getInstance()->log("OsdVector", Log::DEBUG, "DumpStylesRef: %i %i", i2->first, i2->second); + LogNT::getInstance()->debug(TAG, "DumpStylesRef: {} {}", i2->first, i2->second); } } #endif @@ -781,7 +784,7 @@ void OsdVector::informPicture(LoadIndex index, ImageIndex imageIndex) //Beware for thread safety ImageIndex image_index = 0; - Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Picture for request id %llx arrived %x", index, imageIndex); + LogNT::getInstance()->debug(TAG, "TVMedia Picture for request id {:#x} arrived {:#x}", index, imageIndex); surfaces_mutex.lock(); TVMediaInfo tvmedia = tvmedias_load_inv[index]; @@ -922,7 +925,7 @@ void OsdVector::PictureReader::removeDecoder(PictureDecoder* decoder) itty++; } - Log::getInstance()->log("OsdVector", Log::DEBUG, "removeDecoder"); + LogNT::getInstance()->debug(TAG, "removeDecoder"); decoder->shutdown(); delete decoder; decoders_lock.unlock(); @@ -931,13 +934,13 @@ void OsdVector::PictureReader::removeDecoder(PictureDecoder* decoder) void OsdVector::PictureReader::threadMethod() { OsdVector* osdvector = dynamic_cast(Osd::getInstance()); - Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Start Picture Reader"); + LogNT::getInstance()->debug(TAG, "TVMedia Start Picture Reader"); while (true) { if (!threadIsActive()) { - Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia End Picture Reader"); + LogNT::getInstance()->debug(TAG, "TVMedia End Picture Reader"); threadCheckExit(); } @@ -969,7 +972,7 @@ void OsdVector::PictureReader::threadMethod() decoders_lock.unlock(); } - //Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Sleep Picture Reader"); + //LogNT::getInstance()->debug(TAG, "TVMedia Sleep Picture Reader"); struct timespec target_time; getClockRealTime(&target_time); @@ -985,7 +988,7 @@ void OsdVector::PictureReader::threadMethod() threadLock(); threadWaitForSignalTimed(&target_time); threadUnlock(); - //Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Sleep end Picture Reader"); + //LogNT::getInstance()->debug(TAG, "TVMedia Sleep end Picture Reader"); } } @@ -1052,7 +1055,7 @@ bool OsdVector::PictureReader::processReceivedPictures() return true; } - // Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Pictures arrived VDR %x %d %d", + // LogNT::getInstance()->debug(TAG, "TVMedia Pictures arrived VDR {:#x} {} {}", // vresp->getStreamID(),vresp->getUserDataLength(),vresp->getFlag()); bool decode = false; bool freed = false; diff --git a/playervideolive.cc b/playervideolive.cc index 099c6b2..0ca0025 100644 --- a/playervideolive.cc +++ b/playervideolive.cc @@ -24,7 +24,7 @@ #include #include "defines.h" -#include "oldlog.h" +#include "log.h" #include "audio.h" #include "video.h" #include "demuxerts.h" @@ -39,6 +39,8 @@ #include "playervideolive.h" +static const char* TAG = "PlayerVideoLive"; + // ----------------------------------- Called from outside, one offs or info funcs PlayerVideoLive::PlayerVideoLive(MessageQueue* tmessageQueue, void* tmessageReceiver, OSDReceiver* tosdReceiver, ChannelList* tchanList) @@ -47,7 +49,7 @@ PlayerVideoLive::PlayerVideoLive(MessageQueue* tmessageQueue, void* tmessageRece { audio = Audio::getInstance(); video = Video::getInstance(); - logger = Log::getInstance(); + logger = LogNT::getInstance(); vdr = VDR::getInstance(); video->turnVideoOn(); @@ -86,7 +88,7 @@ int PlayerVideoLive::init() if (!demuxer->init(this, audio, video, teletext, demux_video_size, demux_audio_size, 65536 * text_fak, 25./*unimportant*/, subtitles)) { - logger->log("PlayerVideoLive", Log::ERR, "Demuxer failed to init"); + logger->error(TAG, "Demuxer failed to init"); shutdown(); return 0; } @@ -102,10 +104,10 @@ int PlayerVideoLive::init() int PlayerVideoLive::shutdown() { if (!initted) return 0; - logger->log("PlayerVideoLive", Log::DEBUG, "Shutdown"); + logger->debug(TAG, "Shutdown"); if (state != S_STOP) { - logger->log("PlayerVideoLive", Log::DEBUG, "state is not stop, calling"); + logger->debug(TAG, "state is not stop, calling"); stop(); } @@ -209,7 +211,7 @@ void PlayerVideoLive::go(ULONG index) void PlayerVideoLive::setChannel(ULONG index) { - logger->log("PlayerVideoLive", Log::DEBUG, "setChannel"); + logger->debug(TAG, "setChannel"); struct PLInstruction i; i.instruction = I_SETCHANNEL; i.channelIndex = index; @@ -219,7 +221,7 @@ void PlayerVideoLive::setChannel(ULONG index) void PlayerVideoLive::stop() { - logger->log("PlayerVideoLive", Log::DEBUG, "stop"); + logger->debug(TAG, "stop"); playerThreadMutex.lock(); @@ -231,7 +233,7 @@ void PlayerVideoLive::stop() playerThreadMutex.unlock(); playerThread.join(); - logger->log("PlayerVideoLive", Log::DEBUG, "stop succesfull"); + logger->debug(TAG, "stop succesfull"); } // ----------------------------------- Callback @@ -240,7 +242,7 @@ void PlayerVideoLive::call(void* caller) { if (caller == demuxer) { - logger->log("PlayerVideoLive", Log::DEBUG, "Callback from demuxer"); + logger->debug(TAG, "Callback from demuxer"); int parx,pary; UCHAR dxCurrentAspect = demuxer->getAspectRatio(&parx, &pary); @@ -248,12 +250,12 @@ void PlayerVideoLive::call(void* caller) { if (video->getTVsize() == Video::ASPECT16X9) { - logger->log("PlayerVideoLive", Log::DEBUG, "Demuxer said video is 4:3 aspect, switching TV"); + logger->debug(TAG, "Demuxer said video is 4:3 aspect, switching TV"); video->setAspectRatio(Video::ASPECT4X3, parx, pary); } else { - logger->log("PlayerVideoLive", Log::DEBUG, "TV is 4:3, ignoring aspect switching"); + logger->debug(TAG, "TV is 4:3, ignoring aspect switching"); } Message* m = new Message(); @@ -267,12 +269,12 @@ void PlayerVideoLive::call(void* caller) { if (video->getTVsize() == Video::ASPECT16X9) { - logger->log("PlayerVideoLive", Log::DEBUG, "Demuxer said video is 16:9 aspect, switching TV"); + logger->debug(TAG, "Demuxer said video is 16:9 aspect, switching TV"); video->setAspectRatio(Video::ASPECT16X9, parx, pary); } else { - logger->log("PlayerVideoLive", Log::DEBUG, "TV is 4:3, ignoring aspect switching"); + logger->debug(TAG, "TV is 4:3, ignoring aspect switching"); } Message* m = new Message(); @@ -284,7 +286,7 @@ void PlayerVideoLive::call(void* caller) } else { - logger->log("PlayerVideoLive", Log::DEBUG, "Demuxer said video is something else... switch anyway"); + logger->debug(TAG, "Demuxer said video is something else... switch anyway"); video->setAspectRatio(dxCurrentAspect, parx, pary); } } @@ -292,7 +294,7 @@ void PlayerVideoLive::call(void* caller) { if (state == S_VIDEOSTARTUP) { - logger->log("PlayerVideoLive", Log::DEBUG, "afeed video startup"); + logger->debug(TAG, "afeed video startup"); videoStartup = true; playerThreadCond.notify_one(); } @@ -334,7 +336,7 @@ void PlayerVideoLive::streamReceive(ULONG flag, void* data, ULONG len) { // Too many chunks in streamChunks, drop this chunk free(data); - logger->log("PlayerVideoLive", Log::WARN, "Dropped chunk"); + logger->debug(TAG, "Dropped chunk"); } } @@ -342,7 +344,7 @@ void PlayerVideoLive::clearStreamChunks() { while(streamChunks.size()) { - logger->log("PlayerVideoLive", Log::DEBUG, "Dropping chunk from old stream"); + logger->debug(TAG, "Dropping chunk from old stream"); struct StreamChunk s = streamChunks.front(); streamChunks.pop(); free(s.data); @@ -372,7 +374,7 @@ void PlayerVideoLive::chunkToDemuxer() void PlayerVideoLive::switchState(UCHAR newState) { - logger->log("PlayerVideoLive", Log::DEBUG, "Switch from state %u to state %u", state, newState); + logger->debug(TAG, "Switch from state {} to state {}", state, newState); switch(state) { @@ -423,7 +425,7 @@ void PlayerVideoLive::switchState(UCHAR newState) } default: { - logger->log("PlayerVideoLive", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState); + logger->crit(TAG, "Thread called state {} to state {} which is not supported", state, newState); abort(); break; } @@ -498,7 +500,7 @@ void PlayerVideoLive::switchState(UCHAR newState) } default: { - logger->log("PlayerVideoLive", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState); + logger->crit(TAG, "Thread called state {} to state {} which is not supported", state, newState); abort(); break; } @@ -572,7 +574,7 @@ void PlayerVideoLive::switchState(UCHAR newState) } default: { - logger->log("PlayerVideoLive", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState); + logger->crit(TAG, "Thread called state {} to state {} which is not supported", state, newState); abort(); break; } @@ -642,7 +644,7 @@ void PlayerVideoLive::switchState(UCHAR newState) } default: { - logger->log("PlayerVideoLive", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState); + logger->crit(TAG, "Thread called state {} to state {} which is not supported", state, newState); abort(); break; } @@ -699,7 +701,7 @@ void PlayerVideoLive::threadMethod() //logger->log("PlayerVideoLive", Log::DEBUG, "VS: %d pA %d",videoStartup,pendingAudioPlay); if (videoStartup && !pendingAudioPlay) // we are in S_VIDEOSTARTUP, afeed has signalled that it has written some data { - logger->log("PlayerVideoLive", Log::DEBUG, "Enter prebuffering"); + logger->debug(TAG, "Enter prebuffering"); switchState(S_PREBUFFERING); videoStartup = false; preBufferCount = 0; @@ -715,7 +717,7 @@ void PlayerVideoLive::threadMethod() if (i.instruction == I_SETCHANNEL) { - logger->log("PlayerVideoLive", Log::DEBUG, "start new stream"); + logger->debug(TAG, "start new stream"); bool subsRestore = subtitles->isShowing(); @@ -775,20 +777,20 @@ void PlayerVideoLive::threadMethod() { demuxer->setAID(chan->dpids[selected].pid, 1, chan->dpids[selected].type, true); audio->setStreamType(Audio::MPEG2_PES); - logger->log("PlayerVideoLive", Log::DEBUG, "Demuxer pids: %u %u (ac3) %u", + logger->debug(TAG, "Demuxer pids: {} {} (ac3) {}", chan->vpid, chan->dpids[selected].pid, chan->dpids[selected].type); } else { demuxer->setAID(chan->apids[selected].pid, 0, chan->apids[selected].type, true); audio->setStreamType(Audio::MPEG2_PES); - logger->log("PlayerVideoLive", Log::DEBUG, "Demuxer pids: %u %u %u", chan->vpid, chan->apids[selected].pid, + logger->debug(TAG, "Demuxer pids: {} {} {}", chan->vpid, chan->apids[selected].pid, chan->apids[selected].type); } } else { - logger->log("PlayerVideoLive", Log::WARN, "Demuxer video pid only: %u", chan->vpid); + logger->warn(TAG, "Demuxer video pid only: {}", chan->vpid); } selected = -1; @@ -846,7 +848,7 @@ void PlayerVideoLive::threadMethod() } else if (i.instruction == I_STOP) { - logger->log("PlayerVideoLive", Log::DEBUG, "Stopping by instruction"); + logger->debug(TAG, "Stopping by instruction"); switchState(S_STOP); checkError(); return; @@ -864,7 +866,7 @@ void PlayerVideoLive::threadMethod() // logger->log("PlayerVideoLive", Log::DEBUG, "chunk mark3"); ++preBufferCount; ULONG percentDone = (preBufferCount * 100) / preBufferAmount; - logger->log("PlayerVideoLive", Log::DEBUG, "Prebuffering %lu%%", percentDone); + logger->debug(TAG, "Prebuffering {}%", percentDone); Message* m = new Message(); m->from = this; @@ -891,5 +893,5 @@ void PlayerVideoLive::threadMethod() //logger->log("PlayerVideoLive", Log::DEBUG, "wait for signal2 %d",streamChunks.size()); } - logger->log("PlayerVideoLive", Log::DEBUG, "End of thread"); + logger->debug(TAG, "End of thread"); } diff --git a/playervideolive.h b/playervideolive.h index 4581098..5b91f48 100644 --- a/playervideolive.h +++ b/playervideolive.h @@ -40,7 +40,7 @@ class MessageQueue; class Audio; class Video; -class Log; +class LogNT; class DemuxerTS; class OSDReceiver; class DVBSubtitles; @@ -95,7 +95,7 @@ class PlayerVideoLive : public PlayerLive, public Callback, public StreamReceive void* messageReceiver; OSDReceiver* osdReceiver; ChannelList* chanList; - Log* logger; + LogNT* logger; Audio* audio; Video* video; DemuxerTS* demuxer; diff --git a/playervideorec.cc b/playervideorec.cc index e9324ac..43793d8 100644 --- a/playervideorec.cc +++ b/playervideorec.cc @@ -17,7 +17,7 @@ along with VOMP. If not, see . */ -#include "oldlog.h" +#include "log.h" #include "audio.h" #include "video.h" #include "demuxervdr.h" @@ -33,6 +33,8 @@ #include "playervideorec.h" +static const char* TAG = "PlayerVideoRec"; + #define USER_RESPONSE_TIME 500 // Milliseconds // ----------------------------------- Called from outside, one offs or info funcs @@ -43,7 +45,7 @@ PlayerVideoRec::PlayerVideoRec(MessageQueue* tmessageQueue, void* tmessageReceiv { audio = Audio::getInstance(); video = Video::getInstance(); - logger = Log::getInstance(); + logger = LogNT::getInstance(); vdr = VDR::getInstance(); video->turnVideoOn(); @@ -83,7 +85,7 @@ int PlayerVideoRec::init(bool p_isPesRecording, double framespersecond) if (!demuxer->init(this, audio, video,teletext, demux_video_size,demux_audio_size,65536, framespersecond, subtitles)) { - logger->log("Player", Log::ERR, "Demuxer failed to init"); + logger->error(TAG, "Demuxer failed to init"); shutdown(); return 0; } @@ -152,20 +154,20 @@ void PlayerVideoRec::setStartFrame(ULONG startFrame) // Now step back a GOP. This ensures we go to the greatest I-Frame equal to or less than the requested frame vdr->getNextIFrame(nextiframeNumber, 0, &filePos, &iframeNumber, &iframeLength); - logger->log("Player", Log::DEBUG, "setStartFrame %lu %lu %lu", startFrame, nextiframeNumber,iframeNumber); + logger->debug(TAG, "setStartFrame {} {} {}", startFrame, nextiframeNumber,iframeNumber); currentFrameNumber = iframeNumber; } void PlayerVideoRec::setLengthBytes(ULLONG length) { lengthBytes = length; - logger->log("Player", Log::DEBUG, "Player has received length bytes of %llu", lengthBytes); + logger->debug(TAG, "Player has received length bytes of {}", lengthBytes); } void PlayerVideoRec::setLengthFrames(ULONG length) { lengthFrames = length; - logger->log("Player", Log::DEBUG, "Player has received length frames of %lu", lengthFrames); + logger->debug(TAG, "Player has received length frames of {}", lengthFrames); } ULONG PlayerVideoRec::getLengthFrames() @@ -330,7 +332,7 @@ void PlayerVideoRec::stop() if (!initted) return; if (state == S_STOP) return; stateMutex.lock(); - logger->log("Player", Log::DEBUG, "Stop called lock"); + logger->debug(TAG, "Stop called lock"); switchState(S_STOP); stateMutex.unlock(); } @@ -407,7 +409,7 @@ void PlayerVideoRec::fastBackward() void PlayerVideoRec::jumpToPercent(double percent) { stateMutex.lock(); - logger->log("Player", Log::DEBUG, "JUMP TO %f%%", percent); + logger->debug(TAG, "JUMP TO {}%", percent); ULONG newFrame = static_cast(percent * lengthFrames / 100); switchState(S_JUMP, newFrame); // stateMutex.unlock(); - let thread unlock this @@ -416,7 +418,7 @@ void PlayerVideoRec::jumpToPercent(double percent) void PlayerVideoRec::jumpToMark(int mark) { stateMutex.lock(); - logger->log("Player", Log::DEBUG, "JUMP TO MARK %i%%", mark); + logger->debug(TAG, "JUMP TO MARK {}%", mark); switchState(S_JUMP, mark); // stateMutex.unlock(); - let thread unlock this } @@ -424,7 +426,7 @@ void PlayerVideoRec::jumpToMark(int mark) void PlayerVideoRec::jumpToFrameP(int newFrame) { stateMutex.lock(); - logger->log("Player", Log::DEBUG, "JUMP TO FRAME AND PAUSE %i", newFrame); + logger->debug(TAG, "JUMP TO FRAME AND PAUSE {}", newFrame); switchState(S_JUMP_PI, newFrame); stateMutex.unlock(); } @@ -432,7 +434,7 @@ void PlayerVideoRec::jumpToFrameP(int newFrame) void PlayerVideoRec::skipForward(int seconds) { stateMutex.lock(); - logger->log("Player", Log::DEBUG, "SKIP FORWARD %i SECONDS", seconds); + logger->debug(TAG, "SKIP FORWARD {} SECONDS", seconds); ULONG newFrame = getCurrentFrameNum(); if (newFrame == 0) { stateMutex.unlock(); return; } // Current pos from demuxer is not valid newFrame += static_cast(static_cast(seconds) * fps); @@ -444,7 +446,7 @@ void PlayerVideoRec::skipForward(int seconds) void PlayerVideoRec::skipBackward(int seconds) { stateMutex.lock(); - logger->log("Player", Log::DEBUG, "SKIP BACKWARD %i SECONDS", seconds); + logger->debug(TAG, "SKIP BACKWARD {} SECONDS", seconds); long newFrame = getCurrentFrameNum(); if (newFrame == 0) { stateMutex.unlock(); return; } // Current pos from demuxer is not valid newFrame -= static_cast(static_cast(seconds) * fps); @@ -459,7 +461,7 @@ void PlayerVideoRec::switchState(UCHAR toState, ULONG jumpFrame) { if (!initted) return; - logger->log("Player", Log::DEBUG, "Switch state from %u to %u", state, toState); + logger->debug(TAG, "Switch state from {} to {}", state, toState); switch(state) // current state selector { @@ -852,7 +854,7 @@ void PlayerVideoRec::switchState(UCHAR toState, ULONG jumpFrame) videoStartup = true; state = S_PLAY; threadStart(); - logger->log("Player", Log::DEBUG, "Immediate play"); + logger->debug(TAG, "Immediate play"); afeed.start(); vfeed.start(); tfeed.start(); @@ -964,7 +966,7 @@ void PlayerVideoRec::restartAtFramePI(ULONG newFrame) void PlayerVideoRec::doConnectionLost() { - logger->log("Player", Log::DEBUG, "Connection lost, sending message"); + logger->debug(TAG, "Connection lost, sending message"); Message* m = new Message(); m->to = messageReceiver; m->from = this; @@ -979,11 +981,11 @@ void PlayerVideoRec::call(void* caller) { if (caller == demuxer) { - logger->log("Player", Log::DEBUG, "Callback from demuxer"); + logger->debug(TAG, "Callback from demuxer"); if (video->getTVsize() == Video::ASPECT4X3) { - logger->log("Player", Log::DEBUG, "TV is 4:3, ignoring aspect switching"); + logger->debug(TAG, "TV is 4:3, ignoring aspect switching"); return; } @@ -991,7 +993,7 @@ void PlayerVideoRec::call(void* caller) UCHAR dxCurrentAspect = demuxer->getAspectRatio(&parx,&pary); if (dxCurrentAspect == Demuxer::ASPECT_4_3) { - logger->log("Player", Log::DEBUG, "Demuxer said video is 4:3 aspect, switching TV"); + logger->debug(TAG, "Demuxer said video is 4:3 aspect, switching TV"); video->setAspectRatio(Video::ASPECT4X3,parx,pary); Message* m = new Message(); @@ -1003,7 +1005,7 @@ void PlayerVideoRec::call(void* caller) } else if (dxCurrentAspect == Demuxer::ASPECT_16_9) { - logger->log("Player", Log::DEBUG, "Demuxer said video is 16:9 aspect, switching TV"); + logger->debug(TAG, "Demuxer said video is 16:9 aspect, switching TV"); video->setAspectRatio(Video::ASPECT16X9,parx,pary); Message* m = new Message(); @@ -1015,7 +1017,7 @@ void PlayerVideoRec::call(void* caller) } else { - logger->log("Player", Log::DEBUG, "Demuxer said video is something else... setting it anyway"); + logger->debug(TAG, "Demuxer said video is something else... setting it anyway"); video->setAspectRatio(static_cast(dxCurrentAspect), parx, pary); } @@ -1059,9 +1061,9 @@ void PlayerVideoRec::threadMethod() m->from = this; m->message = Message::PLAYER_EVENT; m->parameter = STOP_PLAYBACK; - logger->log("Player", Log::DEBUG, "Posting message to %p...", messageQueue); + logger->debug(TAG, "Posting message to {}...", (void*)messageQueue); messageQueue->postMessage(m); - logger->log("Player", Log::DEBUG, "Message posted..."); + logger->debug(TAG, "Message posted..."); return; } // if execution gets to here, threadFeedScan hit the start, go to play mode @@ -1093,7 +1095,7 @@ void PlayerVideoRec::threadFeedPlay() feedPosition = vdr->positionFromFrameNumber(currentFrameNumber); if (!vdr->isConnected()) { doConnectionLost(); return; } - logger->log("Player", Log::DEBUG, "startFeedPlay: wantedframe %i goto %llu", currentFrameNumber, feedPosition); + logger->debug(TAG, "startFeedPlay: wantedframe {} goto {}", currentFrameNumber, feedPosition); Buffer threadBuffer; @@ -1112,7 +1114,7 @@ void PlayerVideoRec::threadFeedPlay() { lengthBytes = vdr->rescanRecording(&lengthFrames); if (!vdr->isConnected()) { doConnectionLost(); return; } - logger->log("Player", Log::DEBUG, "Rescanned and reset length: %llu", lengthBytes); + logger->debug(TAG, "Rescanned and reset length: {}", lengthBytes); lastRescan = time(NULL); } @@ -1151,7 +1153,7 @@ void PlayerVideoRec::threadFeedPlay() { int a_stream = demuxer->scan(threadBuffer.ucharp(), thisRead); demuxer->setAudioStream(a_stream); - logger->log("Player", Log::DEBUG, "Startup Audio stream chosen %x", a_stream); + logger->debug(TAG, "Startup Audio stream chosen {:#x}", a_stream); startup = false; } @@ -1180,7 +1182,7 @@ void PlayerVideoRec::threadFeedPlay() } // end of recording - logger->log("Player", Log::DEBUG, "Recording playback ends"); + logger->debug(TAG, "Recording playback ends"); if (videoStartup) // oh woe. there never was a stream, I was conned! { @@ -1196,7 +1198,7 @@ void PlayerVideoRec::threadFeedPlay() m->from = this; m->message = Message::PLAYER_EVENT; m->parameter = PlayerVideoRec::STOP_PLAYBACK; - logger->log("Player", Log::DEBUG, "Posting message to %p...", messageQueue); + logger->debug(TAG, "Posting message to {}...", (void*)messageQueue); messageQueue->postMessage(m); } @@ -1245,7 +1247,7 @@ bool PlayerVideoRec::threadPTSFeedScan() frameTimeOffset = static_cast((abs(static_cast(iframeNumber - currentfeedFrameNumber)) * 1000) / (fps * ifactor)); - logger->log("Player", Log::DEBUG, "XXX Got frame"); + logger->debug(TAG, "XXX Got frame"); threadBuffer.set(vdr->getBlock(filePos, iframeLength, &amountReceived)); @@ -1357,7 +1359,7 @@ bool PlayerVideoRec::threadFeedScan() #else while (clock2 != 0 && clock0 + total_msec > clock2 + frameTimeOffset); #endif - logger->log("Player", Log::DEBUG, "XXX Got frame"); + logger->debug(TAG, "XXX Got frame"); threadBuffer.set(vdr->getBlock(filePos, iframeLength, &amountReceived)); @@ -1381,7 +1383,7 @@ bool PlayerVideoRec::threadFeedScan() if (sleepTime < 0) sleepTime = 0; if (threadReqQuit) return false; MILLISLEEP(sleepTime); - logger->log("Player", Log::DEBUG, "XXX Slept for %d", sleepTime); + logger->debug(TAG, "XXX Slept for {}", sleepTime); videoLength = demuxer->stripAudio(threadBuffer.ucharp(), amountReceived); video->displayIFrame(threadBuffer.ucharp(), videoLength); @@ -1401,7 +1403,7 @@ bool PlayerVideoRec::threadFeedScan() total_msec = clock2 - clock0 - sleepTime; disp_msec = clock2 - clock1 - sleepTime; #endif - logger->log("Player", Log::DEBUG, "XXX disp_msec = %4d total_msec = %4d", disp_msec, total_msec); + logger->debug(TAG, "XXX disp_msec = {} total_msec = {}", disp_msec, total_msec); } } @@ -1410,11 +1412,11 @@ bool PlayerVideoRec::threadFeedScan() #ifdef DEV void PlayerVideoRec::test1() { - logger->log("Player", Log::DEBUG, "PLAYER TEST 1"); + logger->debug(TAG, "PLAYER TEST 1"); } void PlayerVideoRec::test2() { - logger->log("Player", Log::DEBUG, "PLAYER TEST 2"); + logger->debug(TAG, "PLAYER TEST 2"); } #endif diff --git a/playervideorec.h b/playervideorec.h index f91269d..5687ab5 100644 --- a/playervideorec.h +++ b/playervideorec.h @@ -43,7 +43,7 @@ class MessageQueue; class Audio; class Video; class VDR; -class Log; +class LogNT; class Demuxer; class OSDReceiver; class DVBSubtitles; @@ -138,7 +138,7 @@ class PlayerVideoRec : public Callback OSDReceiver* osdReceiver; MessageQueue* messageQueue; void* messageReceiver; - Log* logger; + LogNT* logger; Audio* audio; Video* video; Demuxer* demuxer; diff --git a/recinfo.cc b/recinfo.cc index f1d8e53..bfcdd9b 100644 --- a/recinfo.cc +++ b/recinfo.cc @@ -21,11 +21,13 @@ #include -#include "oldlog.h" +#include "log.h" #include "i18n.h" #include "recinfo.h" +static const char* TAG = "RecInfo"; + RecInfo::RecInfo() { timerStart = 0; @@ -52,14 +54,14 @@ RecInfo::RecInfo() RecInfo::~RecInfo() { - Log::getInstance()->log("RecInfo", Log::CRAZY, "Deleting recinfo: %lu, %s", numComponents, summary); + LogNT::getInstance()->info(TAG, "Deleting recinfo: %lu, %s", numComponents, summary); if (summary) delete[] summary; for (ULONG i = 0; i < numComponents; i++) { - Log::getInstance()->log("RecInfo", Log::CRAZY, "i: %lu, languages[i]=%p:%s", i, languages[i], languages[i]); - Log::getInstance()->log("RecInfo", Log::CRAZY, "i: %lu, descripti[i]=%p:%s", i, descriptions[i], descriptions[i]); + LogNT::getInstance()->info(TAG, "i: %lu, languages[i]=%p:%s", i, languages[i], languages[i]); + LogNT::getInstance()->info(TAG, "i: %lu, descripti[i]=%p:%s", i, descriptions[i], descriptions[i]); if (languages[i]) delete[] (languages[i]); if (descriptions[i]) delete[] (descriptions[i]); } @@ -119,28 +121,28 @@ void RecInfo::addComponent(ULONG componentNum, UCHAR tstream, UCHAR ttype, char* void RecInfo::print() { - Log* logger = Log::getInstance(); + LogNT* logger = LogNT::getInstance(); - logger->log("RecInfo", Log::DEBUG, "timerStart %lu", timerStart); - logger->log("RecInfo", Log::DEBUG, "timerEnd %lu", timerEnd); - logger->log("RecInfo", Log::DEBUG, "resumePoint %lu", resumePoint); - logger->log("RecInfo", Log::DEBUG, "Summary: %s", summary); - logger->log("RecInfo", Log::DEBUG, "numComponents: %lu", numComponents); + logger->info(TAG, "timerStart {}", timerStart); + logger->info(TAG, "timerEnd {}", timerEnd); + logger->info(TAG, "resumePoint {}", resumePoint); + logger->info(TAG, "Summary: {}", summary); + logger->info(TAG, "numComponents: {}", numComponents); for (ULONG i = 0; i < numComponents; i++) { - logger->log("RecInfo", Log::DEBUG, "streams[%lu]: %u", i, streams[i]); - logger->log("RecInfo", Log::DEBUG, "types[%lu]: %u", i, types[i]); - logger->log("RecInfo", Log::DEBUG, "languages[%lu]: %s", i, languages[i]); - logger->log("RecInfo", Log::DEBUG, "descriptions[%lu]: %s", i, descriptions[i]); + logger->info(TAG, "streams[{}]: {}", i, streams[i]); + logger->info(TAG, "types[{}]: {}", i, types[i]); + logger->info(TAG, "languages[{}]: {}", i, languages[i]); + logger->info(TAG, "descriptions[{}]: {}", i, descriptions[i]); } - logger->log("RecInfo", Log::DEBUG, "Title: %s", title); - logger->log("RecInfo", Log::DEBUG, "Channel: %s", channelName); - logger->log("RecInfo", Log::DEBUG, "Duration: %lu", duration); - logger->log("RecInfo", Log::DEBUG, "Filesize: %lu", fileSize); - logger->log("RecInfo", Log::DEBUG, "Priority: %lu", priority); - logger->log("RecInfo", Log::DEBUG, "Lifetime: %lu", lifetime); + logger->info(TAG, "Title: {}", title); + logger->info(TAG, "Channel: {}", channelName); + logger->info(TAG, "Duration: {}", duration); + logger->info(TAG, "Filesize: {}", fileSize); + logger->info(TAG, "Priority: {}", priority); + logger->info(TAG, "Lifetime: {}", lifetime); } bool RecInfo::hasNoVideo() @@ -162,7 +164,7 @@ char* RecInfo::buildSummaryWithDetails(bool forceRefresh) { if (forceRefresh && summaryWithDetails) delete[] summaryWithDetails; - Log* logger = Log::getInstance(); + LogNT* logger = LogNT::getInstance(); int swdLength = strlen(summary) + strlen(tr("Channel: ")) + strlen(channelName) + @@ -197,7 +199,7 @@ char* RecInfo::buildSummaryWithDetails(bool forceRefresh) tr("Size: "), fileSize ); - logger->log("RecInfo", Log::DEBUG, "Build summary with details C: %i, A: %i", swdLength, strlen(summaryWithDetails)); + logger->info(TAG, "Build summary with details C: {}, A: {}", swdLength, strlen(summaryWithDetails)); } return summaryWithDetails; } diff --git a/recording.cc b/recording.cc index 298a334..3142ef7 100644 --- a/recording.cc +++ b/recording.cc @@ -20,7 +20,7 @@ #include "recinfo.h" #include "mark.h" -#include "oldlog.h" +#include "log.h" #include "demuxer.h" #include "demuxerts.h" #include "control.h" @@ -29,6 +29,8 @@ #include "recording.h" +static const char* TAG = "Recording"; + Recording* Recording::recInfoFor = NULL; RecInfo* Recording::recInfo = NULL; MovieInfo* Recording::movieInfo = NULL; @@ -36,7 +38,7 @@ SeriesInfo* Recording::seriesInfo = NULL; Recording::Recording() { - logger = Log::getInstance(); + logger = LogNT::getInstance(); vdr = VDR::getInstance(); } @@ -53,7 +55,7 @@ Recording::~Recording() delete (*markList)[i]; } markList->clear(); - Log::getInstance()->log("Recording", Log::DEBUG, "Recording destructor, marks list deleted"); + logger->debug(TAG, "Recording destructor, marks list deleted"); } if (markList) delete markList; @@ -107,7 +109,7 @@ void Recording::loadRecInfo() if (recInfo) delete recInfo; recInfoFor = this; recInfo = vdr->getRecInfo(fileName); - Log::getInstance()->log("Recording", Log::DEBUG, "Recording has loaded recInfo %p", recInfo); + logger->debug(TAG, "Recording has loaded recInfo {}", (void*)recInfo); if (!vdr->isConnected()) Control::getInstance()->connectionLost(); @@ -119,7 +121,7 @@ void Recording::loadRecInfo() movieID = 0; seriesID =0; vdr->getScraperEventType(fileName, movieID, seriesID, episodeID); - Log::getInstance()->log("Recording", Log::DEBUG, "Got Scraper EventType %d %d %d", + logger->debug(TAG, "Got Scraper EventType {} {} {}", movieID, seriesID, episodeID); if (!vdr->isConnected()) Control::getInstance()->connectionLost(); @@ -127,12 +129,12 @@ void Recording::loadRecInfo() if (movieID != 0) { movieInfo = vdr->getScraperMovieInfo(movieID); - Log::getInstance()->log("Recording", Log::DEBUG, "Got Scraper MovieInfo "); + logger->debug(TAG, "Got Scraper MovieInfo"); } else if (seriesID != 0) { seriesInfo = vdr->getScraperSeriesInfo(seriesID, episodeID); - Log::getInstance()->log("Recording", Log::DEBUG, "Got Scraper SeriesInfo "); + logger->debug(TAG, "Got Scraper SeriesInfo"); } @@ -188,7 +190,7 @@ bool Recording::isRadio(bool &h264) vdr->stopStreaming(); if (!VDR::getInstance()->isConnected()) Control::getInstance()->connectionLost(); - Log::getInstance()->log("Recording", Log::DEBUG, "Recording has messed about and worked out radio = %u", !hasVideo); + logger->debug(TAG, "Recording has messed about and worked out radio = {}", !hasVideo); if (!hasVideo) return true; @@ -205,11 +207,11 @@ int Recording::getPrevMark(int currentFrame) for(i = markList->rbegin(); i != markList->rend(); i++) { loopMark = *i; - logger->log("Recording", Log::NOTICE, "findprev:comparing Frame %i with current Frame %i",loopMark->pos,currentFrame); + logger->info(TAG, "findprev:comparing Frame {} with current Frame {}",loopMark->pos,currentFrame); if (loopMark->pos < currentFrame) { - logger->log("Recording", Log::NOTICE, "findprev:setting pos %i to jumpframe_target",loopMark->pos); + logger->info(TAG, "findprev:setting pos {} to jumpframe_target",loopMark->pos); return loopMark->pos; } } @@ -228,11 +230,11 @@ int Recording::getNextMark(int currentFrame) for(i = markList->begin(); i != markList->end(); i++) { loopMark = *i; - logger->log("Recording", Log::NOTICE, "findnext:comparing Frame %i with current Frame %i",loopMark->pos,currentFrame); + logger->info(TAG, "findnext:comparing Frame {} with current Frame {}",loopMark->pos,currentFrame); if (loopMark->pos > currentFrame) { - logger->log("Recording", Log::NOTICE, "findnext:setting pos %i to jumpframe_target",loopMark->pos); + logger->info(TAG, "findnext:setting pos {} to jumpframe_target",loopMark->pos); return loopMark->pos; } } diff --git a/recording.h b/recording.h index 020ec74..3f7aec5 100644 --- a/recording.h +++ b/recording.h @@ -26,7 +26,7 @@ #include "defines.h" #include "vdr.h" -class Log; +class LogNT; class Recording { @@ -68,7 +68,7 @@ class Recording static SeriesInfo* seriesInfo; private: - Log* logger; + LogNT* logger; VDR* vdr; bool isNew{}; diff --git a/vepgsummary.cc b/vepgsummary.cc index 1b235d2..8cd8c2f 100644 --- a/vepgsummary.cc +++ b/vepgsummary.cc @@ -32,7 +32,7 @@ #include "event.h" #include "channel.h" #include "message.h" -#include "oldlog.h" +#include "log.h" #include "wmovieview.h" #include "wseriesview.h" #include "wpictureview.h" @@ -172,7 +172,7 @@ int VEpgSummary::handleCommand(int command) if (command==Input::RED) { if (!channel) return 2; - Log::getInstance()->log("VEpgSummary", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", event->id, event->time, event->duration, event->title); + LogNT::getInstance()->debug("VEpgSummary", "ID {} TIME {} DURATION {} TITLE {}", event->id, event->time, event->duration, event->title); VEpgSetTimer* vs = new VEpgSetTimer(event, channel); vs->draw(); BoxStack *boxstack=BoxStack::getInstance(); diff --git a/vfeed.cc b/vfeed.cc index 9225142..12139ea 100644 --- a/vfeed.cc +++ b/vfeed.cc @@ -17,7 +17,7 @@ along with VOMP. If not, see . */ -#include "oldlog.h" +#include "log.h" #include "demuxer.h" #include "callback.h" #include "util.h" @@ -43,19 +43,19 @@ void VFeed::start() void VFeed::stop() { - Log::getInstance()->log("VFeed", Log::DEBUG, "Stop1"); + LogNT::getInstance()->debug("VFeed", "Stop1"); if (!feedThread.joinable()) return; stopThread = true; feedThread.join(); stopThread = false; - Log::getInstance()->log("VFeed", Log::DEBUG, "Stop2"); + LogNT::getInstance()->debug("VFeed", "Stop2"); } void VFeed::threadMethod() { bool vlen; - Log::getInstance()->log("VFeed", Log::DEBUG, "Started"); + LogNT::getInstance()->debug("VFeed", "Started"); while(1) { diff --git a/videoomx.cc b/videoomx.cc index 417aa1a..9986b28 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -148,7 +148,7 @@ OMX_ERRORTYPE VideoOMX::EventHandler_OMX(OMX_IN OMX_HANDLETYPE handle,OMX_IN OMX OMX_IN OMX_EVENTTYPE event_type,OMX_IN OMX_U32 data1, OMX_IN OMX_U32 data2,OMX_IN OMX_PTR event_data) { - //Log::getInstance()->log("Video", Log::NOTICE, "eventHandler %x %x %x %x %x",handle,event_type,data1,data2,event_data); + //LogNT::getInstance()->info(TAG, "eventHandler {:#x} {:#x} {:#x} {:#x} {:#x}",handle,event_type,data1,data2,event_data); struct VPE_OMX_EVENT new_event; new_event.handle=handle; @@ -209,11 +209,11 @@ void VideoOMX::AddOmxEvent(VPE_OMX_EVENT new_event) OMX_ERRORTYPE VideoOMX::EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp,OMX_IN OMX_PTR appdata,OMX_IN OMX_BUFFERHEADERTYPE* buffer){ -// Log::getInstance()->log("Video", Log::NOTICE, "EmptyBufferDone"); +// LogNT::getInstance()->info(TAG, "EmptyBufferDone"); VideoOMX* video = static_cast(Video::getInstance()); /* long long temp =buffer->nTimeStamp.nLowPart | ((long long) buffer->nTimeStamp.nHighPart << 32); - Log::getInstance()->log("Video", Log::NOTICE, "EBD Video %lld %x",temp,buffer->nFlags);*/ + LogNT::getInstance()->info(TAG, "EBD Video %lld {:#x}",temp,buffer->nFlags);*/ video->ReturnEmptyOMXBuffer(buffer); return OMX_ErrorNone; @@ -221,16 +221,16 @@ OMX_ERRORTYPE VideoOMX::EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp,OMX_IN O void VideoOMX::ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* buffer){ input_bufs_omx_mutex.lock(); - //Log::getInstance()->log("Video", Log::NOTICE, "ReturnEmptyOMXBuffer %d %d",input_bufs_omx_free.size(),input_bufs_omx_all.size()); + //LogNT::getInstance()->info(TAG, "ReturnEmptyOMXBuffer {} {}",input_bufs_omx_free.size(),input_bufs_omx_all.size()); input_bufs_omx_free.push_back(buffer); - //Log::getInstance()->log("Video", Log::NOTICE, "ReturnEmptyOMXBuffer %d",input_bufs_omx_free.size()); + //LogNT::getInstance()->info(TAG, "ReturnEmptyOMXBuffer {}",input_bufs_omx_free.size()); input_bufs_omx_mutex.unlock(); signalOmx(); } OMX_ERRORTYPE VideoOMX::FillBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp, OMX_IN OMX_PTR appdata,OMX_IN OMX_BUFFERHEADERTYPE* buffer) { - //Log::getInstance()->log("Video", Log::NOTICE, "FillBufferDone"); + //LogNT::getInstance()->info(TAG, "FillBufferDone"); return OMX_ErrorNone; } @@ -240,7 +240,7 @@ int VideoOMX::shutdown() { if (!initted) return 0; initted = 0; - Log::getInstance()->log("Video", Log::NOTICE, "Shutdown video module"); + LogNT::getInstance()->info(TAG, "Shutdown video module"); DeAllocateCodecsOMX(); OMX_Deinit(); @@ -250,21 +250,21 @@ int VideoOMX::shutdown() struct fb_var_screeninfo screeninfo; fd_fbset=open("/dev/fb0",O_RDONLY); if (fd_fbset<0) { - Log::getInstance()->log("Video", Log::CRIT, "Could not open frame buffer device %d", fd_fbset); + LogNT::getInstance()->crit(TAG, "Could not open frame buffer device {}", fd_fbset); return 0; } if (ioctl(fd_fbset, FBIOGET_VSCREENINFO, &screeninfo)){ close(fd_fbset); - Log::getInstance()->log("Video", Log::CRIT, "Could not FBIOGET_VSCREENINFO frame buffer device"); + LogNT::getInstance()->crit(TAG, "Could not FBIOGET_VSCREENINFO frame buffer device"); return 0; } screeninfo.bits_per_pixel=8; if (ioctl(fd_fbset, FBIOPUT_VSCREENINFO, &screeninfo)){ - Log::getInstance()->log("Video", Log::CRIT, "Could not FBIOPUT_VSCREENINFO frame buffer device"); + LogNT::getInstance()->crit(TAG, "Could not FBIOPUT_VSCREENINFO frame buffer device"); } screeninfo.bits_per_pixel=16; if (ioctl(fd_fbset, FBIOPUT_VSCREENINFO, &screeninfo)){ - Log::getInstance()->log("Video", Log::CRIT, "Could not FBIOPUT_VSCREENINFO frame buffer device"); + LogNT::getInstance()->crit(TAG, "Could not FBIOPUT_VSCREENINFO frame buffer device"); } close(fd_fbset); return 1; @@ -390,7 +390,7 @@ UCHAR VideoOMX::getTVsize() { void VideoOMX::executePendingModeChanges() { if (pendingmodechange) { - Log::getInstance()->log("Video", Log::NOTICE, "Execute pending mode change"); + LogNT::getInstance()->info(TAG, "Execute pending mode change"); Osd::getInstance()->shutdown(); selectVideoMode(0); Osd::getInstance()->restore(); @@ -433,16 +433,16 @@ void VideoOMX::selectVideoMode(int interlaced) if ((tvstate.state & VC_HDMI_UNPLUGGED)) { hdmi = false; - Log::getInstance()->log("Video", Log::NOTICE, "HDMI unplugged"); + LogNT::getInstance()->info(TAG, "HDMI unplugged"); } else { hdmi = true; - Log::getInstance()->log("Video", Log::NOTICE, "HDMI plugged"); + LogNT::getInstance()->info(TAG, "HDMI plugged"); if (connection==COMPOSITERGB) { hdmi=false; - Log::getInstance()->log("Video", Log::NOTICE, "SDTV set"); + LogNT::getInstance()->info(TAG, "SDTV set"); } else { hdmi=true; - Log::getInstance()->log("Video", Log::NOTICE, "HDMI set"); + LogNT::getInstance()->info(TAG, "HDMI set"); } } @@ -463,7 +463,7 @@ void VideoOMX::selectVideoMode(int interlaced) all_my_modes=vc_tv_hdmi_get_supported_modes(HDMI_RES_GROUP_DMT, all_supp_modes,200, &pref_group,&pref_mode); - Log::getInstance()->log("Video", Log::NOTICE, "No CEA fall back to DMT modes "); + LogNT::getInstance()->info(TAG, "No CEA fall back to DMT modes "); } @@ -479,7 +479,7 @@ void VideoOMX::selectVideoMode(int interlaced) for (int i=0;ilog("Video", Log::NOTICE, "Found native mode %dx%d %d Hz i: %d", + LogNT::getInstance()->info(TAG, "Found native mode {}x{} {} Hz i: {}", mymode->width,mymode->height,mymode->frame_rate,mymode->scan_mode); native_width=mymode->width; native_height=mymode->height; @@ -495,11 +495,11 @@ void VideoOMX::selectVideoMode(int interlaced) if(curmode->scan_mode==interlaced) { //got_optimum=true; mymode=curmode; - Log::getInstance()->log("Video", Log::NOTICE, "Found optimum mode %dx%d %d Hz i: %d", + LogNT::getInstance()->info(TAG, "Found optimum mode {}x{} {} Hz i: {}", mymode->width,mymode->height,mymode->frame_rate,mymode->scan_mode); } else { mymode_second_best=curmode; - Log::getInstance()->log("Video", Log::NOTICE, "Found close to optimum mode %dx%d %d Hz i: %d", + LogNT::getInstance()->info(TAG, "Found close to optimum mode {}x{} {} Hz i: {}", mymode_second_best->width,mymode_second_best->height, mymode_second_best->frame_rate,mymode_second_best->scan_mode); } @@ -509,13 +509,13 @@ void VideoOMX::selectVideoMode(int interlaced) // InputMan::getInstance()->shutdown(); FIXME FIXME FIXME - disabling this temp, why does this have to run? vc_tv_power_off(); if (mymode) { - Log::getInstance()->log("Video", Log::NOTICE, "Switch to optimum mode"); + LogNT::getInstance()->info(TAG, "Switch to optimum mode"); vc_tv_hdmi_power_on_explicit(HDMI_MODE_HDMI,group,mymode->code); } else if (mymode_second_best) { - Log::getInstance()->log("Video", Log::NOTICE, "Switch to close to optimum mode"); + LogNT::getInstance()->info(TAG, "Switch to close to optimum mode"); vc_tv_hdmi_power_on_explicit(HDMI_MODE_HDMI,group,mymode_second_best->code); } else { - Log::getInstance()->log("Video", Log::NOTICE, "Switch to prefered mode"); + LogNT::getInstance()->info(TAG, "Switch to prefered mode"); vc_tv_hdmi_power_on_best(1920, 1080, target_fps, interlaced ? HDMI_INTERLACED : HDMI_NONINTERLACED, static_cast(HDMI_MODE_MATCH_FRAMERATE|HDMI_MODE_MATCH_RESOLUTION|HDMI_MODE_MATCH_SCANMODE)); } @@ -523,7 +523,7 @@ void VideoOMX::selectVideoMode(int interlaced) outputinterlaced=interlaced; } else { /* analog tv case */ - Log::getInstance()->log("Video", Log::NOTICE, "Analog tv case"); + LogNT::getInstance()->info(TAG, "Analog tv case"); // InputMan::getInstance()->shutdown(); FIXME FIXME FIXME - disabling this temp, why does this have to run? vc_tv_power_off(); SDTV_MODE_T setmode=SDTV_MODE_PAL; SDTV_OPTIONS_T options; @@ -531,13 +531,13 @@ void VideoOMX::selectVideoMode(int interlaced) switch (tvsize) { default: case ASPECT16X9: - Log::getInstance()->log("Video", Log::NOTICE, "SDTV aspect 16:9"); + LogNT::getInstance()->info(TAG, "SDTV aspect 16:9"); options.aspect=SDTV_ASPECT_16_9; break; case ASPECT4X3: - Log::getInstance()->log("Video", Log::NOTICE, "SDTV aspect 4:3"); + LogNT::getInstance()->info(TAG, "SDTV aspect 4:3"); options.aspect=SDTV_ASPECT_4_3; break; case ASPECT14X9: - Log::getInstance()->log("Video", Log::NOTICE, "SDTV aspect 14:9"); + LogNT::getInstance()->info(TAG, "SDTV aspect 14:9"); options.aspect=SDTV_ASPECT_14_9; break; }; @@ -651,8 +651,8 @@ void VideoOMX::updateMode() error = OMX_SetParameter(omx_vid_rend, OMX_IndexConfigDisplayRegion, &dispconf); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Set OMX_IndexConfigDisplayRegion1 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexConfigDisplayRegion1 failed {:#x}", error); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); clock_mutex.unlock(); @@ -666,8 +666,8 @@ void VideoOMX::updateMode() error = OMX_SetParameter(omx_vid_rend, OMX_IndexConfigDisplayRegion, &dispconf); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Set OMX_IndexConfigDisplayRegion5 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexConfigDisplayRegion5 failed {:#x}", error); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); clock_mutex.unlock(); @@ -686,8 +686,8 @@ void VideoOMX::updateMode() error = OMX_SetParameter(omx_vid_rend, OMX_IndexConfigDisplayRegion, &dispconf); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Set OMX_IndexConfigDisplayRegion2 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexConfigDisplayRegion2 failed {:#x}", error); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); clock_mutex.unlock(); @@ -704,8 +704,8 @@ void VideoOMX::updateMode() error = OMX_SetParameter(omx_vid_rend, OMX_IndexConfigDisplayRegion, &dispconf); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Set OMX_IndexConfigDisplayRegion3 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexConfigDisplayRegion3 failed {:#x}", error); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); clock_mutex.unlock(); @@ -717,7 +717,7 @@ void VideoOMX::updateMode() display_width = display_height = 0; if (graphics_get_display_size(0, &display_width, &display_height) < 0) { - Log::getInstance()->log("OSD", Log::WARN, + LogNT::getInstance()->warn(TAG, "Getting display size failed! (BCM API) "); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); @@ -732,15 +732,15 @@ void VideoOMX::updateMode() * ((float) display_height)); dispconf.dest_rect.width = (int) (width * ((float) display_width)); dispconf.dest_rect.height = (int) (height * ((float) display_height)); - Log::getInstance()->log("Video", Log::DEBUG, - "Set dest_rect as %d %d %d %d", dispconf.dest_rect.x_offset,dispconf.dest_rect.y_offset, + LogNT::getInstance()->debug(TAG, + "Set dest_rect as {} {} {} {}", dispconf.dest_rect.x_offset,dispconf.dest_rect.y_offset, dispconf.dest_rect.width , dispconf.dest_rect.height); error = OMX_SetParameter(omx_vid_rend, OMX_IndexConfigDisplayRegion, &dispconf); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Set OMX_IndexConfigDisplayRegion failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexConfigDisplayRegion failed {:#x}", error); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); clock_mutex.unlock(); @@ -757,7 +757,7 @@ void VideoOMX::updateMode() int VideoOMX::signalOff() { //TODO reinit osd - Log::getInstance()->log("Video", Log::NOTICE, "signalOff"); + LogNT::getInstance()->info(TAG, "signalOff"); Osd::getInstance()->stopUpdate(); // turn off drawing thread InputMan::getInstance()->shutdown(); vc_tv_power_off(); @@ -770,7 +770,7 @@ int VideoOMX::signalOn() { if (!signalon) { Osd::getInstance()->shutdown(); - Log::getInstance()->log("Video", Log::NOTICE, "signalOn"); + LogNT::getInstance()->info(TAG, "signalOn"); selectVideoMode(0); Osd::getInstance()->restore(); Osd::getInstance()->init(); @@ -820,7 +820,7 @@ void VideoOMX::interlaceSwitch4Demux() { if (demux->getHorizontalSize()>720 && demux->getInterlaced()) { set_interlaced=1; } - Log::getInstance()->log("Video", Log::NOTICE, "switch interlacing %d %d %d",demux->getInterlaced(),outputinterlaced,set_interlaced); + LogNT::getInstance()->info(TAG, "switch interlacing {} {} {}",demux->getInterlaced(),outputinterlaced,set_interlaced); if (outputinterlaced!=set_interlaced) { selectVideoMode(set_interlaced); Osd::getInstance()->shutdown(); @@ -852,11 +852,11 @@ int VideoOMX::play() { } else { if (h264) { omx_h264 = false; - Log::getInstance()->log("Video", Log::NOTICE, + LogNT::getInstance()->info(TAG, "Allocate Codecs OMX failed assume h264 unsupported"); } else { omx_mpeg2 = false; - Log::getInstance()->log("Video", Log::NOTICE, + LogNT::getInstance()->info(TAG, "Allocate Codecs OMX failed assume mpeg2 unsupported"); } } @@ -1055,7 +1055,7 @@ int VideoOMX::getClockVideoandInit() void VideoOMX::clockUnpause() { OMX_ERRORTYPE error; - Log::getInstance()->log("Video", Log::NOTICE, "enter Clockunpause"); + LogNT::getInstance()->info(TAG, "enter Clockunpause"); clock_mutex.lock(); if (clock_references>0 && clockpaused) { OMX_TIME_CONFIG_SCALETYPE scale_type; @@ -1067,7 +1067,7 @@ void VideoOMX::clockUnpause() if (error!=OMX_ErrorNone) { logger->debug(TAG, "ClockUnpause OMX_IndexConfigTimeScale failed {:#x}", error); } - Log::getInstance()->log("Video", Log::NOTICE, "set playback speed ClockUnpause"); + LogNT::getInstance()->info(TAG, "set playback speed ClockUnpause"); clockpaused=false; } clock_mutex.unlock(); @@ -1077,7 +1077,7 @@ void VideoOMX::clockUnpause() void VideoOMX::clockPause() { OMX_ERRORTYPE error; - Log::getInstance()->log("Video", Log::NOTICE, "enter ClockPause"); + LogNT::getInstance()->info(TAG, "enter ClockPause"); clock_mutex.lock(); if (clock_references>0 && !clockpaused) { OMX_TIME_CONFIG_SCALETYPE scale_type; @@ -1089,7 +1089,7 @@ void VideoOMX::clockPause() if (error!=OMX_ErrorNone) { logger->debug(TAG, "ClockPause OMX_IndexConfigTimeScale failed {:#x}", error); } - Log::getInstance()->log("Video", Log::NOTICE, "set playback speed ClockPause"); + LogNT::getInstance()->info(TAG, "set playback speed ClockPause"); clockpaused=true; } clock_mutex.unlock(); @@ -1107,15 +1107,15 @@ int VideoOMX::AllocateCodecsOMX() dodeint=false; first_frame=true; - Log::getInstance()->log("Video", Log::NOTICE, "Allocate Codecs OMX"); + LogNT::getInstance()->info(TAG, "Allocate Codecs OMX"); //Clock, move later to audio including events - Log::getInstance()->log("Video", Log::NOTICE, "Deinter VideoType %d x %d i: %d", demux->getHorizontalSize(),demux->getVerticalSize(),demux->getInterlaced()); + LogNT::getInstance()->info(TAG, "Deinter VideoType {} x {} i: {}", demux->getHorizontalSize(),demux->getVerticalSize(),demux->getInterlaced()); if (deinterlace!=0 && /*(demux->getHorizontalSize()<=720 ) &&*/ demux->getInterlaced()) { dodeint=true; - Log::getInstance()->log("Video", Log::NOTICE, "Deinterlacing activated %d",deinterlace); + LogNT::getInstance()->info(TAG, "Deinterlacing activated {}",deinterlace); } @@ -1188,8 +1188,8 @@ int VideoOMX::AllocateCodecsOMX() error = OMX_GetHandle(&omx_vid_deint, L_VPE_OMX_VIDEO_DEINTERLACE, NULL, &callbacks); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Init OMX video deinterlacer failed %x", error); + LogNT::getInstance()->debug(TAG, + "Init OMX video deinterlacer failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1198,8 +1198,8 @@ int VideoOMX::AllocateCodecsOMX() error = OMX_GetParameter(omx_vid_deint, OMX_IndexParamImageInit, &p_param); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Init OMX video deinterlacer OMX_GetParameter failed %x", + LogNT::getInstance()->debug(TAG, + "Init OMX video deinterlacer OMX_GetParameter failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); @@ -1210,7 +1210,7 @@ int VideoOMX::AllocateCodecsOMX() if (!DisablePort(omx_vid_deint, omx_deint_input_port, true) || !DisablePort(omx_vid_deint, omx_deint_output_port, true)) { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "Disable Ports OMX video deint failed"); clock_mutex.unlock(); DeAllocateCodecsOMX(); @@ -1965,7 +1965,7 @@ int VideoOMX::PrepareInputBufsOMX() //needs to be called with locked mutex if (error!=OMX_ErrorNone){ logger->debug(TAG, "Get OMX OMX_IndexParamPortDefinition failed {:#x}", error); } -/* logger->debug(TAG, "Port para %d %d %d %d %d %d %d", port_def_type.nBufferCountActual, +/* logger->debug(TAG, "Port para {} {} {} {} {} {} {}", port_def_type.nBufferCountActual, port_def_type.nBufferCountMin,port_def_type.nBufferSize,port_def_type.bEnabled,port_def_type.bPopulated, port_def_type.bBuffersContiguous,port_def_type.nBufferAlignment);*/ @@ -2056,56 +2056,56 @@ int VideoOMX::FlushRenderingPipe() error = OMX_SendCommand(omx_vid_dec, OMX_CommandFlush, omx_codec_output_port, NULL); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_Flush codec out 1 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_Flush codec out 1 failed {:#x}", error); } error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush, omx_shed_input_port, NULL); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_Flush shed in 2 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_Flush shed in 2 failed {:#x}", error); } if (!CommandFinished(omx_vid_dec, OMX_CommandFlush, omx_codec_output_port)) { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "flush cmd codec 3 failed"); } if (!CommandFinished(omx_vid_sched, OMX_CommandFlush, omx_shed_input_port)) { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "flush cmd shed 4 failed"); } } else { error = OMX_SendCommand(omx_vid_dec, OMX_CommandFlush, omx_codec_output_port, NULL); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_Flush codec out 5 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_Flush codec out 5 failed {:#x}", error); } error = OMX_SendCommand(omx_vid_deint, OMX_CommandFlush, omx_deint_input_port, NULL); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_Flush deint in 6 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_Flush deint in 6 failed {:#x}", error); } if (!CommandFinished(omx_vid_dec, OMX_CommandFlush, omx_codec_output_port)) { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "flush cmd codec 7 failed"); } if (!CommandFinished(omx_vid_deint, OMX_CommandFlush, omx_deint_input_port)) { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "flush cmd deint 8 failed"); } @@ -2113,28 +2113,28 @@ int VideoOMX::FlushRenderingPipe() error = OMX_SendCommand(omx_vid_deint, OMX_CommandFlush, omx_deint_output_port, NULL); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_Flush deint out 9 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_Flush deint out 9 failed {:#x}", error); } error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush, omx_shed_input_port, NULL); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_Flush shed in 10 failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_Flush shed in 10 failed {:#x}", error); } if (!CommandFinished(omx_vid_deint, OMX_CommandFlush, omx_deint_output_port)) { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "flush cmd deint 11 failed"); } if (!CommandFinished(omx_vid_sched, OMX_CommandFlush, omx_shed_input_port)) { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "flush cmd shed 12 failed"); } @@ -2146,16 +2146,16 @@ int VideoOMX::FlushRenderingPipe() error = OMX_SendCommand(omx_vid_rend, OMX_CommandFlush, omx_rend_input_port, NULL); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_Flush rend in failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_Flush rend in failed {:#x}", error); } error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush, omx_shed_output_port, NULL); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_Flush shed out failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_Flush shed out failed {:#x}", error); } @@ -2163,13 +2163,13 @@ int VideoOMX::FlushRenderingPipe() if (!CommandFinished(omx_vid_rend, OMX_CommandFlush, omx_rend_input_port)) { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "flush cmd shed rend failed"); } if (!CommandFinished(omx_vid_sched, OMX_CommandFlush, omx_shed_output_port)) { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "flush cmd shed rend failed"); } @@ -2207,7 +2207,7 @@ int VideoOMX::DeAllocateCodecsOMX() if (dodeint) { if (!ChangeComponentState(omx_vid_deint, OMX_StateIdle)) { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "vid_deint ChangeComponentState"); } @@ -2257,8 +2257,8 @@ int VideoOMX::DeAllocateCodecsOMX() error = OMX_SendCommand(omx_vid_dec, OMX_CommandFlush, omx_codec_input_port, NULL); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_Flush codec out failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_Flush codec out failed {:#x}", error); } @@ -2503,7 +2503,7 @@ ULLONG VideoOMX::getCurrentTimestamp() { error= OMX_GetConfig(omx_clock, OMX_IndexConfigTimeClockState, &clock_conf); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG,"getCurrentTimestamp IndexConfigTimeClockState failed %x",error); + LogNT::getInstance()->debug(TAG,"getCurrentTimestamp IndexConfigTimeClockState failed {:#x}",error); } if (clock_conf.eState == OMX_TIME_ClockStateRunning) { @@ -2516,7 +2516,7 @@ ULLONG VideoOMX::getCurrentTimestamp() { error = OMX_GetConfig(omx_clock, OMX_IndexConfigTimeCurrentMediaTime, &cur_time_stamp); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video",Log::DEBUG,"getCurrentTimestamp OMX_IndexConfigTimeCurrentMediaTime failed %x",error); + LogNT::getInstance()->debug(TAG, "getCurrentTimestamp OMX_IndexConfigTimeCurrentMediaTime failed {:#x}",error); } else { long long temp = cur_time_stamp.nTimestamp.nLowPart | ((long long) cur_time_stamp.nTimestamp.nHighPart << 32); @@ -2535,7 +2535,7 @@ ULLONG VideoOMX::getCurrentTimestamp() { result += (long long) (ncur_clock_time / 10000LL * 90LL); if (result < 0) result = (1LL << 33) - result; - //Log::getInstance()->log("Video", Log::DEBUG,"getCurrentTimestamp %lld %lld %lld %lld %lld %lld",ncur_clock_time,cur_clock_time,lastreftimeOMX,lastreftimePTS,result,startoffset); + //LogNT::getInstance()->debug(TAG,"getCurrentTimestamp {} {} {} {} {} {}",ncur_clock_time,cur_clock_time,lastreftimeOMX,lastreftimePTS,result,startoffset); return result; @@ -2660,20 +2660,20 @@ void VideoOMX::FirstFrameFix() error=OMX_GetParameter(omx_vid_dec,OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_IndexParamPortDefinition fix failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_IndexParamPortDefinition fix failed {:#x}", error); clock_mutex.unlock(); return; } - Log::getInstance()->log("Video", Log::DEBUG, - "Deinit first frame fix %d %d %d %d %d %d %d %d",port_def_type.format.video.nFrameWidth , demux->getHorizontalSize(), + LogNT::getInstance()->debug(TAG, + "Deinit first frame fix {} {} {} {} {} {} {} {}",port_def_type.format.video.nFrameWidth , demux->getHorizontalSize(), port_def_type.format.video.nFrameHeight , demux->getVerticalSize(),port_def_type.format.video.nStride, port_def_type.format.video.nSliceHeight, port_def_type.format.video.xFramerate, port_def_type.format.video.bFlagErrorConcealment ); - Log::getInstance()->log("Video", Log::DEBUG, - "Deinit first frame fix2 %d %d", + LogNT::getInstance()->debug(TAG, + "Deinit first frame fix2 {} {}", port_def_type.format.video.eCompressionFormat , port_def_type.format.video.eColorFormat ); first_frame=false; @@ -2686,8 +2686,8 @@ void VideoOMX::FirstFrameFix() il.nPortIndex=omx_codec_output_port; error=OMX_GetConfig(omx_vid_dec,OMX_IndexConfigCommonInterlace, &il); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_IndexConfigCommonInterlace fix failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_IndexConfigCommonInterlace fix failed {:#x}", error); } @@ -2704,8 +2704,8 @@ void VideoOMX::FirstFrameFix() error = OMX_SetParameter(omx_vid_deint, OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Set OMX_IndexParamPortDefinition1 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexParamPortDefinition1 failed {:#x}", error); clock_mutex.unlock(); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); @@ -2718,8 +2718,8 @@ void VideoOMX::FirstFrameFix() error = OMX_SetParameter(omx_vid_deint, OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Set OMX_IndexParamPortDefinition1 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexParamPortDefinition1 failed {:#x}", error); clock_mutex.unlock(); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); @@ -2727,7 +2727,7 @@ void VideoOMX::FirstFrameFix() } // WaitForEvent(omx_vid_dec,OMX_EventPortSettingsChanged); - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "Marker"); EnablePort(omx_vid_deint,omx_deint_input_port,true); WaitForEvent(omx_vid_deint,OMX_EventPortSettingsChanged); @@ -2735,20 +2735,20 @@ void VideoOMX::FirstFrameFix() error = OMX_GetParameter(omx_vid_deint, OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Get OMX_IndexParamPortDefinition2 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Get OMX_IndexParamPortDefinition2 failed {:#x}", error); clock_mutex.unlock(); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); return; } - Log::getInstance()->log("Video", Log::DEBUG, - "Deinit first frame fix3 %d %d %d %d %d %d %d ",port_def_type.format.image.nFrameWidth , demux->getHorizontalSize(), + LogNT::getInstance()->debug(TAG, + "Deinit first frame fix3 {} {} {} {} {} {} {} ",port_def_type.format.image.nFrameWidth , demux->getHorizontalSize(), port_def_type.format.image.nFrameHeight , demux->getVerticalSize(),port_def_type.format.image.nStride, port_def_type.format.image.nSliceHeight, /*port_def_type.format.image.xFramerate,*/ port_def_type.format.image.bFlagErrorConcealment ); - Log::getInstance()->log("Video", Log::DEBUG, - "Deinit first frame fix4 %d %d", + LogNT::getInstance()->debug(TAG, + "Deinit first frame fix4 {} {}", port_def_type.format.image.eCompressionFormat , port_def_type.format.image.eColorFormat ); DisablePort(omx_vid_deint,omx_deint_output_port,true); @@ -2758,8 +2758,8 @@ void VideoOMX::FirstFrameFix() error = OMX_SetParameter(omx_vid_sched, OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Set OMX_IndexParamPortDefinition3 failed %x", error); + LogNT::getInstance()->debug(TAG, + "Set OMX_IndexParamPortDefinition3 failed {:#x}", error); clock_mutex.unlock(); pthread_setcancelstate(oldcancelstate, NULL); pthread_setcanceltype(oldcanceltype, NULL); @@ -2788,8 +2788,8 @@ void VideoOMX::PutBufferToPres(OMX_BUFFERHEADERTYPE* buffer) OMX_ERRORTYPE error = ProtOMXEmptyThisBuffer(omx_vid_dec, buffer); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "OMX_EmptyThisBuffer failed %x", error); + LogNT::getInstance()->debug(TAG, + "OMX_EmptyThisBuffer failed {:#x}", error); } if (first_frame) FirstFrameFix(); @@ -2819,15 +2819,15 @@ OMX_ERRORTYPE VideoOMX::ProtOMXEmptyThisBuffer(OMX_HANDLETYPE handle, OMX_BUFFER ×tamp); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Audio", Log::DEBUG, - "Init OMX_IndexConfigAudioRenderingLatencyfailed %x %d", error, + LogNT::getInstance()->debug(TAG, + "Init OMX_IndexConfigAudioRenderingLatencyfailed {:#x} {}", error, omx_rend_input_port); } long long temp2 =timestamp.nTimestamp.nLowPart | ((long long) timestamp.nTimestamp.nHighPart << 32); - Log::getInstance()->log("Video", Log::NOTICE, "OMXETB %x %lld %lld %x",handle,temp,temp2,buffer->nFlags);*/ + LogNT::getInstance()->info(TAG, "OMXETB {:#x} {} {} {:#x}",handle,temp,temp2,buffer->nFlags);*/ OMX_ERRORTYPE ret_val; ret_val=OMX_EmptyThisBuffer(handle,buffer); clock_mutex.unlock(); @@ -3125,7 +3125,7 @@ bool VideoOMX::displayIFrame(const UCHAR* buffer, UINT length) { input_bufs_omx_mutex.lock(); if (input_bufs_omx_free.size() == 0) { input_bufs_omx_mutex.unlock(); - // Log::getInstance()->log("Video", Log::DEBUG, + // LogNT::getInstance()->debug(TAG, // "Deliver MediaPacket no free sample"); return false; // we do not have a free media sample @@ -3182,7 +3182,7 @@ bool VideoOMX::displayIFrame(const UCHAR* buffer, UINT length) { input_bufs_omx_mutex.lock(); if (input_bufs_omx_free.size() == 0) { input_bufs_omx_mutex.unlock(); - // Log::getInstance()->log("Video", Log::DEBUG, + // LogNT::getInstance()->debug(TAG, // "Ifrane no free sample"); MILLISLEEP(5); if (!omx_running) return false; @@ -3238,18 +3238,18 @@ bool VideoOMX::displayIFrame(const UCHAR* buffer, UINT length) { int VideoOMX::EnterIframePlayback() { - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "EnterIframePlayback"); if (cur_input_buf_omx) { PutBufferToPres(cur_input_buf_omx); cur_input_buf_omx = NULL; } - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "EnterIframePlayback 2"); dynamic_cast(Audio::getInstance())->DeAllocateCodecsOMX(); DeAllocateCodecsOMX(); AllocateCodecsOMX(); - Log::getInstance()->log("Video", Log::DEBUG, + LogNT::getInstance()->debug(TAG, "leave IframePlayback"); iframemode=true; diff --git a/vradiorec.cc b/vradiorec.cc index f8dd383..9b24980 100644 --- a/vradiorec.cc +++ b/vradiorec.cc @@ -30,11 +30,13 @@ #include "input.h" #include "vinfo.h" #include "i18n.h" -#include "oldlog.h" +#include "log.h" #include "messagequeue.h" #include "vradiorec.h" +static const char* TAG = "VRadioRec"; + VRadioRec::VRadioRec(Recording* rec) { boxstack = BoxStack::getInstance(); @@ -70,7 +72,7 @@ VRadioRec::VRadioRec(Recording* rec) delete[] cendMargin; } - Log::getInstance()->log("VRadioRec", Log::DEBUG, "SM: %u EM: %u", startMargin, endMargin); + LogNT::getInstance()->debug(TAG, "SM: {} EM: {}", startMargin, endMargin); setSize(video->getScreenWidth(), video->getScreenHeight()); createBuffer(); @@ -123,7 +125,7 @@ void VRadioRec::go(bool resume) else startFrameNum = 0; - Log::getInstance()->log("VRadioRec", Log::DEBUG, "Starting stream: %s", myRec->getFileName()); + LogNT::getInstance()->debug(TAG, "Starting stream: {}", myRec->getFileName()); ULONG lengthFrames = 0; bool isPesRecording; ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording); @@ -308,7 +310,7 @@ void VRadioRec::processMessage(Message* m) { if (m->from != player) return; - Log::getInstance()->log("VRadioRec", Log::DEBUG, "Message received"); + LogNT::getInstance()->debug(TAG, "Message received"); switch(m->parameter) { @@ -336,7 +338,7 @@ void VRadioRec::processMessage(Message* m) void VRadioRec::stopPlay() { - Log::getInstance()->log("VRadioRec", Log::DEBUG, "Pre stopPlay"); + LogNT::getInstance()->debug(TAG, "Pre stopPlay"); removeBar(); player->stop(); @@ -346,7 +348,7 @@ void VRadioRec::stopPlay() playing = false; if (!vdr->isConnected()) { Control::getInstance()->connectionLost(); return; } - Log::getInstance()->log("VRadioRec", Log::DEBUG, "Post stopPlay"); + LogNT::getInstance()->debug(TAG, "Post stopPlay"); } void VRadioRec::doBar(int action) @@ -427,7 +429,7 @@ void VRadioRec::timercall(int clientReference) void VRadioRec::drawBarClocks() { Log* logger = Log::getInstance(); - logger->log("VRadioRec", Log::DEBUG, "Draw bar clocks"); + LogNT::getInstance()->debug(TAG, "Draw bar clocks"); // Draw RTC // Blank the area first @@ -464,7 +466,7 @@ void VRadioRec::drawBarClocks() dlengthSeconds %= 60; SNPRINTF(buffer, 99, "%01lu:%02lu:%02lu / %01lu:%02lu:%02lu", currentHours, currentMinutes, dcurrentSeconds, lengthHours, lengthMinutes, dlengthSeconds); - logger->log("VRadioRec", Log::DEBUG, buffer); + LogNT::getInstance()->debug(TAG, buffer); } else { @@ -498,13 +500,13 @@ void VRadioRec::drawBarClocks() } */ - logger->log("VRadioRec", Log::DEBUG, "blips"); + LogNT::getInstance()->debug(TAG, "blips"); // Now calc position for start margin blips int posPix; posPix = 302 * startMargin / lengthSeconds; - logger->log("VRadioRec", Log::DEBUG, "posPix %i", posPix); + LogNT::getInstance()->debug(TAG, "posPix {}", posPix); rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT); rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT); diff --git a/vvideolivetv.cc b/vvideolivetv.cc index e2f2669..97d20c8 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -39,7 +39,7 @@ #include "event.h" #include "vepg.h" #include "bitmap.h" -#include "oldlog.h" +#include "log.h" #include "vteletextview.h" #include "vepgsummary.h" #include "vepglistadvanced.h" @@ -49,6 +49,8 @@ #include "vvideolivetv.h" +static const char* TAG = "VVideoLiveTV"; + VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, VChannelList* tvchannelList) { @@ -816,7 +818,7 @@ void VVideoLiveTV::clearScreen() void VVideoLiveTV::showUnavailable() { - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Show unavailable called"); + LogNT::getInstance()->debug(TAG, "Show unavailable called"); textUnavailable.setVisible(true); textUnavailable.draw(); @@ -849,7 +851,7 @@ void VVideoLiveTV::timercall(int ref) { if (keying) { - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 key start."); + LogNT::getInstance()->debug(TAG, "Timer Call 1 key start."); UINT newChannel = 0; for(int i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * static_cast(pow(10.f, i)); @@ -859,45 +861,45 @@ void VVideoLiveTV::timercall(int ref) m->parameter = newChannel; m->tag = 1; // signal to call displayOSD(); MessageQueue::getInstance()->postMessage(m); - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 key end."); + LogNT::getInstance()->debug(TAG, "Timer Call 1 key end."); } else { - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 not key start."); + LogNT::getInstance()->debug(TAG, "Timer Call 1 not key start."); // We have received a timer, we are not keying. If still prebuffering, don't remove the bar if (preBuffering < 100) { - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Still prebuffering, not removing osd..."); + LogNT::getInstance()->debug(TAG, "Still prebuffering, not removing osd..."); Timers::getInstance()->setTimerD(this, 1, 2); // reset timer for another 2s return; } bool osdpbvisible=osdposterbanner.getVisible(); - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 notkey 1."); + LogNT::getInstance()->debug(TAG, "Timer Call 1 notkey 1."); osd.setVisible(false); osdposterbanner.setVisible(false); okTriggeredOSD = false; - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 notkey 2."); + LogNT::getInstance()->debug(TAG, "Timer Call 1 notkey 2."); draw(); - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 notkey 4."); + LogNT::getInstance()->debug(TAG, "Timer Call 1 notkey 4."); if (osdpbvisible) boxstack->update(this); else boxstack->update(this, osd.getRegion()); - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 notkey 3."); + LogNT::getInstance()->debug(TAG, "Timer Call 1 notkey 3."); PlayerVideoLive* playerlivetv = dynamic_cast(player); if (playerlivetv) playerlivetv->tellSubtitlesOSDVisible(false); - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 notkey end."); + LogNT::getInstance()->debug(TAG, "Timer Call 1 notkey end."); } } else if (ref == 2) { - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 2 start."); + LogNT::getInstance()->debug(TAG, "Timer Call 2 start."); setClock(); if (osd.getVisible()) { clock.draw(); boxstack->update(this, osd.getRegion()); } - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 2 end."); + LogNT::getInstance()->debug(TAG, "Timer Call 2 end."); } } @@ -955,9 +957,9 @@ bool VVideoLiveTV::channelChange(UCHAR changeType, UINT newData) preBuffering = 0; - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Set player to channel %u", currentChannelIndex); + LogNT::getInstance()->debug(TAG, "Set player to channel {}", currentChannelIndex); player->setChannel(currentChannelIndex); - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Done Set player to channel %u", currentChannelIndex); + LogNT::getInstance()->debug(TAG, "Done Set player to channel {}", currentChannelIndex); // Blank out the symbols OsdVector *osdv=dynamic_cast(Osd::getInstance()); @@ -1059,7 +1061,7 @@ void VVideoLiveTV::processMessage(Message* m) } else if (m->message == Message::AUDIO_CHANGE_CHANNEL) { - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change audio channel to %x", m->parameter); + LogNT::getInstance()->debug(TAG, "Received change audio channel to {:#x}", m->parameter); player->setAudioChannel((m->parameter & 0xFFFF), (m->parameter & 0xFF0000) >> 16, (m->parameter & 0xFF000000) >> 24); } else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL) @@ -1068,7 +1070,7 @@ void VVideoLiveTV::processMessage(Message* m) PlayerVideoLive* playervl = static_cast(player); - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change subtitle channel to %x", m->parameter); + LogNT::getInstance()->debug(TAG, "Received change subtitle channel to {:#x}", m->parameter); int type = (m->parameter & 0xFF0000) >> 16; switch (type) { @@ -1118,7 +1120,7 @@ void VVideoLiveTV::processMessage(Message* m) { case PlayerVideoLive::CONNECTION_LOST: // connection lost detected { - Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received connection lost from player"); + LogNT::getInstance()->debug(TAG, "Received connection lost from player"); Control::getInstance()->connectionLost(); break; } @@ -1172,7 +1174,7 @@ void VVideoLiveTV::processMessage(Message* m) case PlayerVideoLive::PREBUFFERING: { preBuffering = m->tag; - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Prebuffering - %u", preBuffering); + LogNT::getInstance()->debug(TAG, "Prebuffering - {}", preBuffering); bufferBar.setPercent(preBuffering); if (osd.getVisible()) @@ -1229,7 +1231,7 @@ void VVideoLiveTV::doAudioChannelSymbol() Demuxer* demux=Demuxer::getInstance(); if (demux) { int vertical_size=demux->getVerticalSize(); - Log::getInstance()->log("VVideoRec", Log::DEBUG, "TVMedia vertical size %d", vertical_size); + LogNT::getInstance()->debug(TAG, "TVMedia vertical size {}", vertical_size); reslogo.setVisible(true); switch (vertical_size) { case 576: -- 2.39.5