From ea71d4d257d892b4644d9f8518fa9cf3520555d6 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Fri, 3 Sep 2021 20:45:24 +0100 Subject: [PATCH] Log conversion --- inputcec.cc | 28 ++--- inputlinux.cc | 22 ++-- inputlirc.cc | 36 +++--- inputlirc.h | 4 +- inputwin.cc | 6 +- main.cc | 6 +- messagequeue.cc | 8 +- videoomx.cc | 293 ++++++++++++++++++++++++------------------------ videoomx.h | 3 +- wol.cc | 16 +-- wol.h | 4 +- 11 files changed, 222 insertions(+), 204 deletions(-) diff --git a/inputcec.cc b/inputcec.cc index ca67a91..8a8f15e 100644 --- a/inputcec.cc +++ b/inputcec.cc @@ -29,6 +29,8 @@ using namespace CEC; #include "woptionpane.h" #include "inputcec.h" +static const char* TAG = "InputCEC"; + //#define W_G_HCW(type,code) ((static_cast(type) << 32) | code) @@ -46,7 +48,7 @@ bool InputCEC::init() // bcm_host_init(); //may be move to custom hardware init? // now init cec - Log::getInstance()->log("InputCEC", Log::NOTICE, "Init LibCEC"); + LogNT::getInstance()->info(TAG, "Init LibCEC"); instance = this; cec_config.Clear(); @@ -70,7 +72,7 @@ bool InputCEC::init() cec_adap = LibCecInitialise(&cec_config); if (!cec_adap) { - Log::getInstance()->log("InputCEC", Log::ERR, "Init LibCEC failed"); + LogNT::getInstance()->error(TAG, "Init LibCEC failed"); return false; } @@ -80,25 +82,25 @@ bool InputCEC::init() int adap_num = cec_adap->DetectAdapters(cec_adapter_descriptors, 10); if (adap_num < 0) { - Log::getInstance()->log("InputCEC", Log::ERR, "CEC:Failed to find adapter"); + LogNT::getInstance()->error(TAG, "CEC:Failed to find adapter"); return false; } if (adap_num == 0) { - Log::getInstance()->log("InputCEC", Log::NOTICE, "CEC: No adapter found"); + LogNT::getInstance()->info(TAG, "CEC: No adapter found"); return false; } if (!cec_adap->Open(cec_adapter_descriptors[0].strComName)) { - Log::getInstance()->log("InputCEC", Log::ERR, "CEC:Failed to open adapter"); + LogNT::getInstance()->error(TAG, "CEC:Failed to open adapter"); return false; } if (!cec_adap->SetActiveSource(cec_config.deviceTypes[0])) { - Log::getInstance()->log("InputCEC", Log::ERR, "CEC:Failed set active source"); + LogNT::getInstance()->error(TAG, "CEC:Failed set active source"); return false; } @@ -109,13 +111,13 @@ void InputCEC::shutdown() { if (cec_adap) { - Log::getInstance()->log("InputCEC", Log::NOTICE, "Shutdown libcec begin"); + LogNT::getInstance()->info(TAG, "Shutdown libcec begin"); cec_adap->SetInactiveView(); cec_adap->Close(); vc_cec_register_callback(NULL, NULL); //deactivate callback! UnloadLibCec(cec_adap); cec_adap = NULL; - Log::getInstance()->log("InputCEC", Log::NOTICE, "Shutdown libcec end"); + LogNT::getInstance()->info(TAG, "Shutdown libcec end"); } instance = NULL; @@ -214,7 +216,7 @@ bool InputCEC::handleOptionChanges(Option* option) == 0) { cechandlesvolume=true; } - Log::getInstance()->log("InputCEC", Log::DEBUG, "Set volume handling to to %s %d",option->options[option->userSetChoice],cechandlesvolume); + LogNT::getInstance()->debug(TAG, "Set volume handling to to {} {}",option->options[option->userSetChoice],cechandlesvolume); return true; } break; @@ -226,7 +228,7 @@ bool InputCEC::handleOptionChanges(Option* option) void InputCEC::cecLogMessage(void* /* param */, const cec_log_message* message) { - Log::getInstance()->log("InputCEC", Log::DEBUG, "CECLOG: %lld %d %s", message->time, message->level, message->message); + LogNT::getInstance()->debug(TAG, "CECLOG: {} {} {}", message->time, message->level, message->message); } void InputCEC::cecKeyPress(void* /* param */, const cec_keypress* key) @@ -237,7 +239,7 @@ void InputCEC::cecKeyPress(void* /* param */, const cec_keypress* key) void InputCEC::cecCommand(void* /* param */, const cec_command* command) { - Log::getInstance()->log("InputCEC", Log::DEBUG, "CECCommand: %d", command->opcode); + LogNT::getInstance()->debug(TAG, "CECCommand: {}", command->opcode); switch (command->opcode) { case CEC_OPCODE_STANDBY: @@ -279,12 +281,12 @@ void InputCEC::cecCommand(void* /* param */, const cec_command* command) void InputCEC::cecConfigurationChanged(void* /* param */, const libcec_configuration*) { - Log::getInstance()->log("InputCEC", Log::DEBUG, "CECConfig:"/*,config->string()*/); + LogNT::getInstance()->debug(TAG, "CECConfig:"/*,config->string()*/); } void InputCEC::cecSourceActivated(void* /* param */, const cec_logical_address address, const uint8_t activated) { - Log::getInstance()->log("InputCEC", Log::DEBUG, "CECSourceActivated: %d %d", address, activated); + LogNT::getInstance()->debug(TAG, "CECSourceActivated: {} {}", address, activated); if (activated == 1) { instance->incomingPowerkey(POWERON); diff --git a/inputlinux.cc b/inputlinux.cc index 4c07644..676a4d7 100644 --- a/inputlinux.cc +++ b/inputlinux.cc @@ -35,6 +35,8 @@ #include "inputlinux.h" +static const char* TAG = "InputLinux"; + #define test_bit(input,b) ((1 << ((b) % 8))&(input)[b / 8] ) bool InputLinux::init() @@ -53,26 +55,26 @@ bool InputLinux::init() struct stat test_buf; if (stat(buffer, &test_buf) == 0) { - Log::getInstance()->log("InputLinux", Log::NOTICE, "Probe /dev/input/event%d", eventid); + LogNT::getInstance()->info(TAG, "Probe /dev/input/event{}", eventid); // file exists unsigned long ev_type = 0; int new_fd = open(buffer, O_RDONLY); if (new_fd < 0) { - Log::getInstance()->log("InputLinux", Log::NOTICE, "Can not open /dev/input/event%d", eventid); + LogNT::getInstance()->info(TAG, "Can not open /dev/input/event{}", eventid); continue; } if (ioctl(new_fd, EVIOCGBIT(0, EV_MAX), &ev_type) < 0) { - Log::getInstance()->log("InputLinux", Log::NOTICE, "Ioctl failed /dev/input/event%d %d", eventid, errno); + LogNT::getInstance()->info(TAG, "Ioctl failed /dev/input/event{} {}", eventid, errno); close(new_fd); } //Now test if it generates keyboard presses if (test_bit(reinterpret_cast(&ev_type), EV_KEY)) { - Log::getInstance()->log("InputLinux", Log::NOTICE, "Add /dev/input/event%d to List", eventid); + LogNT::getInstance()->info(TAG, "Add /dev/input/event{} to List", eventid); devices.push_back(new_fd); // Grab the device - make it exclusive to vomp. Fixes rubbish input going to console in background @@ -129,7 +131,7 @@ UCHAR InputLinux::TranslateHWCFixed(int code) void InputLinux::InitHWCListwithDefaults() { - Log::getInstance()->log("InputLinux", Log::INFO, "InitHWCListwithDefaults"); + LogNT::getInstance()->info(TAG, "InitHWCListwithDefaults"); // Processing VK_Messages translist[KEY_9] = NINE; @@ -513,7 +515,7 @@ void InputLinux::EnterLearningMode(UCHAR vompKey) bool InputLinux::start() { - Log::getInstance()->log("Input", Log::INFO, "start called"); + LogNT::getInstance()->info(TAG, "start called"); threadStartProtect.lock(); // Make sure listenThread is fully initted before start returns listenThread = std::thread( [this] @@ -547,11 +549,11 @@ void InputLinux::listenLoop() if (pipe2(pfds, O_NONBLOCK) == -1) { - Log::getInstance()->log("InputLinux", Log::ERR, "pipe2() fail"); + LogNT::getInstance()->error(TAG, "pipe2() fail"); return; } - Log::getInstance()->log("InputLinux", Log::INFO, "Listen loop"); + LogNT::getInstance()->info(TAG, "Listen loop"); while(1) { @@ -575,14 +577,14 @@ void InputLinux::listenLoop() // -1 = error if (select(maxfd + 1, &readfds, NULL, NULL, NULL) < 1) { - Log::getInstance()->log("InputLinux", Log::ERR, "Select fail"); + LogNT::getInstance()->error(TAG, "Select fail"); break; } if (FD_ISSET(pfds[0], &readfds)) { // assume quit signal - Log::getInstance()->log("InputLinux", Log::NOTICE, "pfds quit"); + LogNT::getInstance()->info(TAG, "pfds quit"); break; // FUTURE: read the byte and do different things? Read listenLoopStop and maybe other bools? diff --git a/inputlirc.cc b/inputlirc.cc index 6c208bb..af72f66 100644 --- a/inputlirc.cc +++ b/inputlirc.cc @@ -22,55 +22,57 @@ #include #include "config.h" -#include "oldlog.h" +#include "log.h" #include "inputman.h" #include "inputlirc.h" +static const char* TAG = "InputLIRC"; + const char* InputLIRC::myModName = "InputLIRC"; bool InputLIRC::init() { if (initted) return false; initted = true; - log = Log::getInstance(); - log->log(myModName, Log::DEBUG, "Starting InputLIRC"); + log = LogNT::getInstance(); + log->debug(TAG, "Starting InputLIRC"); if (!tcp.init()) { - log->log(myModName, Log::DEBUG, "TCP init error"); + log->debug(TAG, "TCP init error"); initted = false; return false; } bool arraySuccess = Config::getInstance()->foreachInArray("input_lirc", "remotes", [&] (const std::string& remoteName) { - log->log(myModName, Log::DEBUG, "Remote name: %s", remoteName.c_str()); + log->debug(TAG, "Remote name: {}", remoteName); bool objSuccess = Config::getInstance()->foreachPairInObject("input_lirc", remoteName, [&] (const std::string& lircName, const std::string& vompName) { UCHAR keyNumber = InputMan::getVompKeyNumber(vompName.c_str()); - log->log(myModName, Log::DEBUG, " Lirc: %s, vomp: %s, vomp-number %i", lircName.c_str(), vompName.c_str(), keyNumber); + log->debug(TAG, " Lirc: {}, vomp: {}, vomp-number {}", lircName, vompName, keyNumber); remotes[remoteName][lircName] = keyNumber; }); if (!objSuccess) { - log->log(myModName, Log::ERR, "Error reading config for remote %s", remoteName.c_str()); + log->error(TAG, "Error reading config for remote {}", remoteName); } }); if (!arraySuccess) { - log->log(myModName, Log::DEBUG, "Error reading remotes list"); + log->debug(TAG, "Error reading remotes list"); } else { - log->log(myModName, Log::DEBUG, "Remotes array read OK"); + log->debug(TAG, "Remotes array read OK"); } @@ -82,7 +84,7 @@ bool InputLIRC::init() ButtonsType& b = i->second; for(ButtonsType:: iterator j = b.begin(); j != b.end(); j++) { - log->log(myModName, Log::DEBUG, "%s - %s - %i", i->first.c_str(), j->first.c_str(), j->second); + log->debug(TAG, "{} - {} - {}", i->first.c_str(), j->first.c_str(), j->second); } } @@ -105,7 +107,7 @@ bool InputLIRC::start(const std::string& ip, USHORT port) bool tr = tcp.connect(ip, port); // NCONFIG if (!tr) { - log->log(myModName, Log::DEBUG, "InputLIRC TCP connect failed"); + log->debug(TAG, "InputLIRC TCP connect failed"); return false; } @@ -118,7 +120,7 @@ bool InputLIRC::start(const std::string& ip, USHORT port) }); threadStartProtect.unlock(); - log->log(myModName, Log::DEBUG, "InputLIRC command client started"); + log->debug(TAG, "InputLIRC command client started"); return true; } @@ -153,21 +155,21 @@ void InputLIRC::listenLoop() { if (!tcp.status()) { - log->log(myModName, Log::CRIT, "TCP status fail"); + log->crit(TAG, "TCP status fail"); return; } // return to stop this thread continue; } - log->log(myModName, Log::DEBUG, "got data: %s", ss.str().c_str()); + log->debug(TAG, "got data: {}", ss.str()); std::string remoteName, remoteButton; int repeatCount; if (parse(ss.str(), remoteName, remoteButton, repeatCount)) - log->log(myModName, Log::DEBUG, "Remote: '%s', Button: '%s', Count: '%i'", remoteName.c_str(), remoteButton.c_str(), repeatCount); + log->debug(TAG, "Remote: '{}', Button: '{}', Count: '{}'", remoteName, remoteButton, repeatCount); else - log->log(myModName, Log::ERR, "Parse error"); + log->error(TAG, "Parse error"); UCHAR button; try @@ -176,7 +178,7 @@ void InputLIRC::listenLoop() } catch (std::exception& e) { - log->log(myModName, Log::ERR, "Remote button not found"); + log->error(TAG, "Remote button not found"); continue; } diff --git a/inputlirc.h b/inputlirc.h index 6f38b1b..39be337 100644 --- a/inputlirc.h +++ b/inputlirc.h @@ -29,7 +29,7 @@ #include "tcp.h" #include "input.h" -class Log; +class LogNT; class InputLIRC : public Input { @@ -45,7 +45,7 @@ class InputLIRC : public Input std::string getHardwareKeyName(HWC_TYPE hardwareKey); private: - Log* log{}; + LogNT* log{}; static const char* myModName; const char* modName() { return myModName; } diff --git a/inputwin.cc b/inputwin.cc index 5c6ace2..ea8fb78 100644 --- a/inputwin.cc +++ b/inputwin.cc @@ -19,7 +19,7 @@ #include "vompreswin.h" #include "i18n.h" -#include "oldlog.h" +#include "log.h" #include "inputwin.h" #define W_G_HCW(type,code) ( (((ULLONG)(type))<<32) | code) @@ -29,6 +29,8 @@ #define W_HCW_RI 3 /* remote control */ #define W_HCW_CH 4 /* char */ +static const char* TAG = "InputWin"; + const char* InputWin::myModName = "InputWin"; InputWin::InputWin() @@ -50,7 +52,7 @@ bool InputWin::init() void InputWin::shutdown() { if (!initted) return; - Log::getInstance()->log("InputWin", Log::DEBUG, "Shutdown called"); + LogNT::getInstance()->debug(TAG, "Shutdown called"); CloseHandle(event); initted = false; } diff --git a/main.cc b/main.cc index b4cffd5..84f82cd 100644 --- a/main.cc +++ b/main.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2020 Chris Tallon + Copyright 2004-2021 Chris Tallon This file is part of VOMP. @@ -146,7 +146,9 @@ int main(int argc, char** argv) shutdown(1); } - if (!loggerNT->init("stdout", debugEnabled ? 1 : 0)) // NCONFIG x2 + std::string logFileName("stdout"); + config->getString("log", "filename", logFileName); + if (!loggerNT->init(logFileName, debugEnabled ? 1 : 0)) // NCONFIG x2 { printf("Could not initialise log object. Aborting.\n"); shutdown(1); diff --git a/messagequeue.cc b/messagequeue.cc index 7c2673b..6bad8b4 100644 --- a/messagequeue.cc +++ b/messagequeue.cc @@ -20,7 +20,9 @@ #include "messagequeue.h" #include "message.h" -#include "oldlog.h" +#include "log.h" + +static const char* TAG = "MessageQueue"; MessageQueue* MessageQueue::instance{}; @@ -32,10 +34,10 @@ MessageQueue* MessageQueue::getInstance() { return instance; } void MessageQueue::postMessage(Message* m) { - Log::getInstance()->log("MessageQueue", Log::DEBUG, "PostMessage"); + LogNT::getInstance()->debug(TAG, "PostMessage"); std::lock_guard lg(messageQueueMutex); // Get the lock messages.push_back(m); - Log::getInstance()->log("MessageQueue", Log::DEBUG, "Pushed message. Notify..."); + LogNT::getInstance()->debug(TAG, "Pushed message. Notify..."); messageQueueCond.notify_one(); } // mutex unlocks diff --git a/videoomx.cc b/videoomx.cc index 7299c42..417aa1a 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -22,7 +22,7 @@ #include -#include "oldlog.h" +#include "log.h" #include "audioomx.h" #include "demuxer.h" #include "vdr.h" @@ -36,7 +36,10 @@ //A lot of parts of this file are heavily inspired by xbmc omx implementations +static const char* TAG = "VideoOMX"; + VideoOMX::VideoOMX() { + logger = LogNT::getInstance(); omx_running = false; @@ -91,19 +94,19 @@ int VideoOMX::init(UCHAR tformat) int ret=vc_gencmd_send("codec_enabled MPG2"); if (ret!=0) { - Log::getInstance()->log("Video", Log::DEBUG, "vc_gencmd_send failed %x",ret); + logger->debug(TAG, "vc_gencmd_send failed {:#x}",ret); } else { char buffer[1024]; ret=vc_gencmd_read_response(buffer,sizeof(buffer)); if (ret!=0) { - Log::getInstance()->log("Video", Log::DEBUG, "vc_gencmd_read_response failed %x",ret); + logger->debug(TAG, "vc_gencmd_read_response failed {:#x}",ret); } else { if (STRCASECMP(buffer,"MPG2=enabled")==0) { mpeg2_supported=true; } else if (STRCASECMP(buffer,"MPG2=disabled")==0) { mpeg2_supported=false; } else { - Log::getInstance()->log("Video", Log::DEBUG, "Undefined mpg codec answer %s",buffer); + logger->debug(TAG, "Undefined mpg codec answer {}",buffer); } } } @@ -122,7 +125,7 @@ int VideoOMX::init(UCHAR tformat) OMX_ERRORTYPE error; error = OMX_Init(); if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX failed %x", + logger->debug(TAG, "Init OMX failed {:#x}", error); return 0; } @@ -271,7 +274,7 @@ int VideoOMX::shutdown() bool VideoOMX::loadOptionsFromServer(VDR* vdr) { - Log::getInstance()->log("Video", Log::DEBUG, "VideoOMX config load"); + logger->debug(TAG, "VideoOMX config load"); char *name=vdr->configLoad("VideoOMX","SDDeinterlacing"); if (name != NULL) { @@ -286,7 +289,7 @@ bool VideoOMX::loadOptionsFromServer(VDR* vdr) }*/ else if (STRCASECMP(name, "Fast") == 0) { deinterlace = 4; } - Log::getInstance()->log("Video", Log::DEBUG, "Set deinterlacing to %s %d",name,deinterlace); + logger->debug(TAG, "Set deinterlacing to {} {}",name,deinterlace); delete[] name; } @@ -315,7 +318,7 @@ bool VideoOMX::handleOptionChanges(Option* option) == 0) { deinterlace = 4; } - Log::getInstance()->log("Video", Log::DEBUG, "Set deinterlacing to %s %d",option->options[option->userSetChoice],deinterlace); + logger->debug(TAG, "Set deinterlacing to {} {}",option->options[option->userSetChoice],deinterlace); return true; } break; @@ -575,7 +578,7 @@ int VideoOMX::setAspectRatio(UCHAR taspectRatio, int tparx,int tpary) parx=tparx; pary=tpary; - Log::getInstance()->log("Video", Log::DEBUG, "Setting aspect to %i: PAR %d %d", aspectRatio,parx,pary); + logger->debug(TAG, "Setting aspect to {}: PAR {} {}", aspectRatio,parx,pary); updateMode(); // if (ioctl(fdVideo, AV_SET_VID_RATIO, aspectRatio) != 0) return 0; @@ -839,7 +842,7 @@ int VideoOMX::play() { if (!initted) return 0; iframemode = false; - Log::getInstance()->log("Video", Log::DEBUG, "enter play"); + logger->debug(TAG, "enter play"); interlaceSwitch4Demux(); @@ -878,7 +881,7 @@ int VideoOMX::initClock() error=OMX_GetHandle(&omx_clock,L_VPE_OMX_CLOCK,NULL,&callbacks); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX clock failed %x", error); + logger->debug(TAG, "Init OMX clock failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -891,7 +894,7 @@ int VideoOMX::initClock() p_param.nVersion.nVersion=OMX_VERSION; error=OMX_GetParameter(omx_clock,OMX_IndexParamOtherInit,&p_param); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "Init clock OMX_GetParameter failed %x", error); + logger->debug(TAG, "Init clock OMX_GetParameter failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -900,7 +903,7 @@ int VideoOMX::initClock() for (unsigned int i=0;ilog("Video", Log::DEBUG, "Disable Ports OMX clock failed %d",i); + logger->debug(TAG, "Disable Ports OMX clock failed {}",i); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -911,7 +914,7 @@ int VideoOMX::initClock() } - Log::getInstance()->log("Video", Log::DEBUG, "init omx clock %x %x",this,omx_clock); + logger->debug(TAG, "init omx clock {:#x} {:#x}", (void*)this, omx_clock); clock_references++; clock_mutex.unlock(); return 1; @@ -938,7 +941,7 @@ int VideoOMX::getClockAudioandInit(OMX_HANDLETYPE *p_omx_clock,OMX_U32 *p_omx_cl //refclock.eClock=OMX_TIME_RefClockVideo; error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeActiveRefClock,&refclock); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Clock OMX_IndexConfigTimeActiveRefClock failed %x", error); + logger->debug(TAG, "Clock OMX_IndexConfigTimeActiveRefClock failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -950,7 +953,7 @@ int VideoOMX::getClockAudioandInit(OMX_HANDLETYPE *p_omx_clock,OMX_U32 *p_omx_cl p_param.nVersion.nVersion=OMX_VERSION; error=OMX_GetParameter(omx_clock,OMX_IndexParamOtherInit,&p_param); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init clock OMX_GetParameter failed %x", error); + logger->debug(TAG, "Init clock OMX_GetParameter failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -967,7 +970,7 @@ int VideoOMX::getClockAudioandInit(OMX_HANDLETYPE *p_omx_clock,OMX_U32 *p_omx_cl else clock_conf.nWaitMask=OMX_CLOCKPORT0|OMX_CLOCKPORT1; error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeClockState,&clock_conf); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "AuI Clock IndexConfigTimeClockState failed %x", error); + logger->debug(TAG, "AuI Clock IndexConfigTimeClockState failed {:#x}", error); } @@ -997,7 +1000,7 @@ int VideoOMX::getClockVideoandInit() refclock.eClock=OMX_TIME_RefClockVideo; error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeActiveRefClock,&refclock); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "Clock OMX_IndexConfigTimeActiveRefClock failed %x", error); + logger->debug(TAG, "Clock OMX_IndexConfigTimeActiveRefClock failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1010,7 +1013,7 @@ int VideoOMX::getClockVideoandInit() p_param.nVersion.nVersion=OMX_VERSION; error=OMX_GetParameter(omx_clock,OMX_IndexParamOtherInit,&p_param); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init clock OMX_GetParameter failed %x", error); + logger->debug(TAG, "Init clock OMX_GetParameter failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1026,7 +1029,7 @@ int VideoOMX::getClockVideoandInit() clock_conf.nOffset=intToOMXTicks(0); error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeClockState,&clock_conf); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "VuI Clock IndexConfigTimeClockState failed %x", error); + logger->debug(TAG, "VuI Clock IndexConfigTimeClockState failed {:#x}", error); } @@ -1040,7 +1043,7 @@ int VideoOMX::getClockVideoandInit() else clock_conf.nWaitMask=OMX_CLOCKPORT0|OMX_CLOCKPORT1; error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeClockState,&clock_conf); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "VuI Clock IndexConfigTimeClockState failed %x", error); + logger->debug(TAG, "VuI Clock IndexConfigTimeClockState failed {:#x}", error); } omx_clock_output_port=p_param.nStartPortNumber; @@ -1062,7 +1065,7 @@ void VideoOMX::clockUnpause() scale_type.xScale=1<<16; error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeScale,&scale_type); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "ClockUnpause OMX_IndexConfigTimeScale failed %x", error); + logger->debug(TAG, "ClockUnpause OMX_IndexConfigTimeScale failed {:#x}", error); } Log::getInstance()->log("Video", Log::NOTICE, "set playback speed ClockUnpause"); clockpaused=false; @@ -1084,7 +1087,7 @@ void VideoOMX::clockPause() scale_type.xScale=0; error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeScale,&scale_type); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "ClockPause OMX_IndexConfigTimeScale failed %x", error); + logger->debug(TAG, "ClockPause OMX_IndexConfigTimeScale failed {:#x}", error); } Log::getInstance()->log("Video", Log::NOTICE, "set playback speed ClockPause"); clockpaused=true; @@ -1123,7 +1126,7 @@ int VideoOMX::AllocateCodecsOMX() if (!idleClock()) { - Log::getInstance()->log("Video", Log::DEBUG, "idleClock failed"); + logger->debug(TAG, "idleClock failed"); return 0; } /* TODO end */ @@ -1136,21 +1139,21 @@ int VideoOMX::AllocateCodecsOMX() } if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video decoder failed %x", error); + logger->debug(TAG, "Init OMX video decoder failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; } - Log::getInstance()->log("Video", Log::DEBUG, "Nmark3 "); + logger->debug(TAG, "Nmark3 "); OMX_PORT_PARAM_TYPE p_param; memset(&p_param,0,sizeof(p_param)); p_param.nSize=sizeof(p_param); p_param.nVersion.nVersion=OMX_VERSION; error=OMX_GetParameter(omx_vid_dec,OMX_IndexParamVideoInit,&p_param); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX h264 decoder OMX_GetParameter failed %x", error); + logger->debug(TAG, "Init OMX h264 decoder OMX_GetParameter failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1159,13 +1162,13 @@ int VideoOMX::AllocateCodecsOMX() omx_codec_output_port=p_param.nStartPortNumber+1; if (!DisablePort(omx_vid_dec,omx_codec_input_port) || !DisablePort(omx_vid_dec,omx_codec_output_port)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Ports OMX video decoder failed"); + logger->debug(TAG, "Disable Ports OMX video decoder failed"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; } - Log::getInstance()->log("Video", Log::DEBUG, "Nmark4 "); + logger->debug(TAG, "Nmark4 "); OMX_PARAM_BRCMVIDEODECODEERRORCONCEALMENTTYPE conceal; memset(&conceal,0,sizeof(conceal)); @@ -1175,7 +1178,7 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_SetParameter(omx_vid_dec,OMX_IndexParamBrcmVideoDecodeErrorConcealment,&conceal); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "OMX_IndexParamBrcmVideoDecodeErrorConcealment failed %x", error); + logger->debug(TAG, "OMX_IndexParamBrcmVideoDecodeErrorConcealment failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1219,7 +1222,7 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_GetHandle(&omx_vid_sched,L_VPE_OMX_VIDEO_SCHED,NULL,&callbacks); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video scheduler failed %x", error); + logger->debug(TAG, "Init OMX video scheduler failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1229,7 +1232,7 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_GetParameter(omx_vid_sched,OMX_IndexParamVideoInit,&p_param); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video scheduler OMX_GetParameter failed %x", error); + logger->debug(TAG, "Init OMX video scheduler OMX_GetParameter failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1240,18 +1243,18 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_GetParameter(omx_vid_sched,OMX_IndexParamOtherInit,&p_param); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video scheduler OMX_GetParameter failed %x", error); + logger->debug(TAG, "Init OMX video scheduler OMX_GetParameter failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; } omx_shed_clock_port=p_param.nStartPortNumber; - Log::getInstance()->log("Video", Log::DEBUG, "scheduler ports %d %d %d ",omx_shed_input_port,omx_shed_output_port,omx_shed_clock_port); + logger->debug(TAG, "scheduler ports {} {} {}",omx_shed_input_port,omx_shed_output_port,omx_shed_clock_port); if (!DisablePort(omx_vid_sched,omx_shed_input_port,true) || !DisablePort(omx_vid_sched,omx_shed_output_port,true) || !DisablePort(omx_vid_sched,omx_shed_clock_port,true)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Ports OMX video shed failed"); + logger->debug(TAG, "Disable Ports OMX video shed failed"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1260,7 +1263,7 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_GetHandle(&omx_vid_rend,L_VPE_OMX_VIDEO_REND,NULL,&callbacks); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video rend failed %x", error); + logger->debug(TAG, "Init OMX video rend failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1268,7 +1271,7 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_GetParameter(omx_vid_rend,OMX_IndexParamVideoInit,&p_param); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX video rend OMX_GetParameter failed %x", error); + logger->debug(TAG, "Init OMX video rend OMX_GetParameter failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1279,7 +1282,7 @@ int VideoOMX::AllocateCodecsOMX() if (!DisablePort(omx_vid_rend,omx_rend_input_port,true) /*|| !DisablePort(omx_vid_rend,omx_rend_output_port)*/ ) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Ports OMX video rend failed"); + logger->debug(TAG, "Disable Ports OMX video rend failed"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1291,7 +1294,7 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_SetupTunnel(omx_clock,omx_clock_output_port,omx_vid_sched,omx_shed_clock_port); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel clock to sched failed %x %d %d", error,omx_clock_output_port,omx_shed_clock_port); + logger->debug(TAG, "OMX_Setup tunnel clock to sched failed {:#x} {} {}", error,omx_clock_output_port,omx_shed_clock_port); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1299,7 +1302,7 @@ int VideoOMX::AllocateCodecsOMX() if (!EnablePort(omx_clock,omx_clock_output_port,false) || !EnablePort(omx_vid_sched,omx_shed_clock_port,false) ) { - Log::getInstance()->log("Video", Log::DEBUG, "Enable Ports OMX clock shed failed"); + logger->debug(TAG, "Enable Ports OMX clock shed failed"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1308,7 +1311,7 @@ int VideoOMX::AllocateCodecsOMX() if (!ChangeComponentState(omx_vid_sched,OMX_StateIdle)) { - Log::getInstance()->log("Video", Log::DEBUG, "vid_sched idle ChangeComponentState"); + logger->debug(TAG, "vid_sched idle ChangeComponentState"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1337,7 +1340,7 @@ int VideoOMX::AllocateCodecsOMX() /* error=OMX_SendCommand(omx_vid_dec,OMX_CommandStateSet,OMX_StateIdle,0); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "vid_dec Send Command to OMX State Idle %x", error); + logger->debug(TAG, "vid_dec Send Command to OMX State Idle {:#x}", error); return 0; }*/ @@ -1356,10 +1359,10 @@ int VideoOMX::AllocateCodecsOMX() ft_type.xFramerate=0*(1<<16);//25*(1<<16);//demux->getFrameRate()*(1<<16); - Log::getInstance()->log("Video", Log::DEBUG, "Framerate: %d",demux->getFrameRate()); + logger->debug(TAG, "Framerate: {}",demux->getFrameRate()); error=OMX_SetParameter(omx_vid_dec,OMX_IndexParamVideoPortFormat,&ft_type); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexParamVideoPortFormat failed %x", error); + logger->debug(TAG, "Init OMX_IndexParamVideoPortFormat failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1367,7 +1370,7 @@ int VideoOMX::AllocateCodecsOMX() if (!ChangeComponentState(omx_vid_dec,OMX_StateIdle)) { - Log::getInstance()->log("Video", Log::DEBUG, "vid_dec ChangeComponentState"); + logger->debug(TAG, "vid_dec ChangeComponentState"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1381,7 +1384,7 @@ int VideoOMX::AllocateCodecsOMX() stall_conf.nDelay=1500*1000; error=OMX_SetConfig(omx_vid_dec,OMX_IndexConfigBufferStall,&stall_conf); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigBufferStall failed %x", error); + logger->debug(TAG, "Init OMX_IndexConfigBufferStall failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1397,7 +1400,7 @@ int VideoOMX::AllocateCodecsOMX() req_callback.bEnable=OMX_TRUE; error=OMX_SetConfig(omx_vid_dec,OMX_IndexConfigRequestCallback,&req_callback); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigRequestCallback failed %x", error); + logger->debug(TAG, "Init OMX_IndexConfigRequestCallback failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1414,7 +1417,7 @@ int VideoOMX::AllocateCodecsOMX() if (!dodeint) { error=OMX_SetupTunnel(omx_vid_dec,omx_codec_output_port,omx_vid_sched,omx_shed_input_port); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel dec to sched failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel dec to sched failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1424,7 +1427,7 @@ int VideoOMX::AllocateCodecsOMX() if (!EnablePort(omx_vid_dec,omx_codec_output_port,false) || !EnablePort(omx_vid_sched,omx_shed_input_port,false) ) { - Log::getInstance()->log("Video", Log::DEBUG, "Enable Ports OMX codec shed failed"); + logger->debug(TAG, "Enable Ports OMX codec shed failed"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1440,7 +1443,7 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_SetupTunnel(omx_vid_dec,omx_codec_output_port,omx_vid_deint,omx_deint_input_port); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel dec to deint failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel dec to deint failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1450,7 +1453,7 @@ int VideoOMX::AllocateCodecsOMX() if (!EnablePort(omx_vid_dec,omx_codec_output_port,false) || !EnablePort(omx_vid_deint,omx_deint_input_port,false) ) { - Log::getInstance()->log("Video", Log::DEBUG, "Enable Ports OMX codec deint failed"); + logger->debug(TAG, "Enable Ports OMX codec deint failed"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1463,7 +1466,7 @@ int VideoOMX::AllocateCodecsOMX() } if (!ChangeComponentState(omx_vid_deint,OMX_StateIdle)) { - Log::getInstance()->log("Video", Log::DEBUG, "vid_deint ChangeComponentState"); + logger->debug(TAG, "vid_deint ChangeComponentState"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1501,7 +1504,7 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_SetConfig(omx_vid_deint,OMX_IndexConfigCommonImageFilterParameters,&imagefilter); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigCommonImageFilterParameters failed %x", error); + logger->debug(TAG, "Init OMX_IndexConfigCommonImageFilterParameters failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1510,7 +1513,7 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_SetupTunnel(omx_vid_deint,omx_deint_output_port,omx_vid_sched,omx_shed_input_port); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel deint to sched failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel deint to sched failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1518,7 +1521,7 @@ int VideoOMX::AllocateCodecsOMX() if (!EnablePort(omx_vid_deint,omx_deint_output_port,false) || !EnablePort(omx_vid_sched,omx_shed_input_port,false) ) { - Log::getInstance()->log("Video", Log::DEBUG, "Enable Ports OMX deint shed failed"); + logger->debug(TAG, "Enable Ports OMX deint shed failed"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1533,7 +1536,7 @@ int VideoOMX::AllocateCodecsOMX() } if (!ChangeComponentState(omx_vid_dec,OMX_StateExecuting)) { - Log::getInstance()->log("Video", Log::DEBUG, "omx_vid_dec ChangeComponentState Execute"); + logger->debug(TAG, "omx_vid_dec ChangeComponentState Execute"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1541,7 +1544,7 @@ int VideoOMX::AllocateCodecsOMX() error=OMX_SetupTunnel(omx_vid_sched,omx_shed_output_port,omx_vid_rend,omx_rend_input_port); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel sched to rend failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel sched to rend failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1549,7 +1552,7 @@ int VideoOMX::AllocateCodecsOMX() if (!EnablePort(omx_vid_sched,omx_shed_output_port,false) || !EnablePort(omx_vid_rend,omx_rend_input_port,false) ) { - Log::getInstance()->log("Video", Log::DEBUG, "Enable Ports OMX shed rend failed"); + logger->debug(TAG, "Enable Ports OMX shed rend failed"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1563,7 +1566,7 @@ int VideoOMX::AllocateCodecsOMX() } if (!ChangeComponentState(omx_vid_rend,OMX_StateIdle)) { - Log::getInstance()->log("Video", Log::DEBUG, "vid_rend ChangeComponentState"); + logger->debug(TAG, "vid_rend ChangeComponentState"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1571,7 +1574,7 @@ int VideoOMX::AllocateCodecsOMX() if (dodeint) { if (!ChangeComponentState(omx_vid_deint,OMX_StateExecuting)) { - Log::getInstance()->log("Video", Log::DEBUG, "vid_vid_deint ChangeComponentState"); + logger->debug(TAG, "vid_vid_deint ChangeComponentState"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1581,14 +1584,14 @@ int VideoOMX::AllocateCodecsOMX() } if (!ChangeComponentState(omx_vid_sched,OMX_StateExecuting)) { - Log::getInstance()->log("Video", Log::DEBUG, "omx_vid_sched ChangeComponentState Execute"); + logger->debug(TAG, "omx_vid_sched ChangeComponentState Execute"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; } if (!ChangeComponentState(omx_vid_rend,OMX_StateExecuting)) { - Log::getInstance()->log("Video", Log::DEBUG, "omx_vid_rend ChangeComponentState Execute"); + logger->debug(TAG, "omx_vid_rend ChangeComponentState Execute"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1606,7 +1609,7 @@ int VideoOMX::AllocateCodecsOMX() dispconf.layer=1; error=OMX_SetConfig(omx_vid_rend,OMX_IndexConfigDisplayRegion,&dispconf); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigDisplayRegion failed %x", error); + logger->debug(TAG, "Init OMX_IndexConfigDisplayRegion failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1616,7 +1619,7 @@ int VideoOMX::AllocateCodecsOMX() dispconf.fullscreen=OMX_FALSE; error=OMX_SetParameter(omx_vid_rend,OMX_IndexConfigDisplayRegion,&dispconf); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigDisplayRegion failed %x", error); + logger->debug(TAG, "Init OMX_IndexConfigDisplayRegion failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1629,7 +1632,7 @@ int VideoOMX::AllocateCodecsOMX() dispconf.dest_rect.height=480; error=OMX_SetParameter(omx_vid_rend,OMX_IndexConfigDisplayRegion,&dispconf); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX_IndexConfigDisplayRegion failed %x", error); + logger->debug(TAG, "Init OMX_IndexConfigDisplayRegion failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1662,7 +1665,7 @@ int VideoOMX::idleClock() if (temp_state!=OMX_StateIdle) { if (!ChangeComponentState(omx_clock,OMX_StateIdle)) { - Log::getInstance()->log("Video", Log::DEBUG, "omx_clock ChangeComponentState Idle failed"); + logger->debug(TAG, "omx_clock ChangeComponentState Idle failed"); clock_mutex.unlock(); return 0; } @@ -1680,7 +1683,7 @@ int VideoOMX::setClockExecutingandRunning() if (temp_state!=OMX_StateExecuting) { if (!ChangeComponentState(omx_clock,OMX_StateExecuting)) { - Log::getInstance()->log("Video", Log::DEBUG, "omx_clock ChangeComponentState Execute failed"); + logger->debug(TAG, "omx_clock ChangeComponentState Execute failed"); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1694,7 +1697,7 @@ int VideoOMX::setClockExecutingandRunning() clock_conf.eState=OMX_TIME_ClockStateRunning; error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeClockState,&clock_conf); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "Clock IndexConfigTimeClockState failed %x", error); + logger->debug(TAG, "Clock IndexConfigTimeClockState failed {:#x}", error); clock_mutex.unlock(); DeAllocateCodecsOMX(); return 0; @@ -1710,7 +1713,7 @@ int VideoOMX::ChangeComponentState(OMX_HANDLETYPE handle,OMX_STATETYPE type,bool OMX_ERRORTYPE error; error=OMX_SendCommand(handle,OMX_CommandStateSet,type,0); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "handle %x Send Command to OMX State %x %x",handle,type, error); + logger->debug(TAG, "handle {:#x} Send Command to OMX State {:#x} {:#x}",handle,type, error); return 0; } @@ -1745,7 +1748,7 @@ int VideoOMX::EnablePort(OMX_HANDLETYPE handle,OMX_U32 port,bool wait) //needs t if (!skip) { error=OMX_SendCommand(handle,OMX_CommandPortEnable,port,0); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "handle %x Send Command to enable port %x %x",handle,port, error); + logger->debug(TAG, "handle {:#x} Send Command to enable port {:#x} {:#x}",handle,port, error); return 0; } @@ -1781,7 +1784,7 @@ int VideoOMX::DisablePort(OMX_HANDLETYPE handle,OMX_U32 port,bool wait) //needs if (!skip) { error=OMX_SendCommand(handle,OMX_CommandPortDisable,port,0); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "handle %x Send Command to disable port %x %x",handle,port, error); + logger->debug(TAG, "handle {:#x} Send Command to disable port {:#x} {:#x}",handle,port, error); return 0; } @@ -1808,13 +1811,13 @@ int VideoOMX::WaitForEvent(OMX_HANDLETYPE handle,OMX_U32 event, int wait) //need if (current.event_type==OMX_EventError) { omx_events.erase(itty); omx_event_mutex.unlock(); - Log::getInstance()->log("Video", Log::DEBUG, "WaitForEvent Finished on Error"); + logger->debug(TAG, "WaitForEvent Finished on Error"); return 0; } else if (current.event_type==event) { omx_events.erase(itty); omx_event_mutex.unlock(); - Log::getInstance()->log("Video", Log::DEBUG, "WaitForEvent Finished Completed"); + logger->debug(TAG, "WaitForEvent Finished Completed"); return 1; } } @@ -1823,7 +1826,7 @@ int VideoOMX::WaitForEvent(OMX_HANDLETYPE handle,OMX_U32 event, int wait) //need } omx_event_mutex.unlock(); - //Log::getInstance()->log("Video", Log::DEBUG, "WaitForEvent"); + //logger->debug(TAG, "WaitForEvent"); std::unique_lock ul(omx_event_ready_signal_mutex); omx_event_ready_signal.wait_for(ul, std::chrono::milliseconds(10)); ul.unlock(); @@ -1831,7 +1834,7 @@ int VideoOMX::WaitForEvent(OMX_HANDLETYPE handle,OMX_U32 event, int wait) //need i++; } - Log::getInstance()->log("Video", Log::DEBUG, "WaitForEvent waited too long %x %x",handle,event); + logger->debug(TAG, "WaitForEvent waited too long {:#x} {:#x}",handle,event); return 0; } @@ -1864,7 +1867,7 @@ int VideoOMX::clearEventsForComponent(OMX_HANDLETYPE handle) void VideoOMX::checkForStalledBuffers() { - //Log::getInstance()->log("Video", Log::DEBUG, "Check stalled"); + //logger->debug(TAG, "Check stalled"); clock_mutex.lock(); omx_event_mutex.lock(); std::list::iterator itty=omx_events.begin(); @@ -1882,17 +1885,17 @@ void VideoOMX::checkForStalledBuffers() error=OMX_GetConfig(omx_vid_dec,OMX_IndexConfigBufferStall,&stall_conf); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Get OMX_IndexConfigBufferStall failed %x", error); + logger->debug(TAG, "Get OMX_IndexConfigBufferStall failed {:#x}", error); clock_mutex.unlock(); omx_event_mutex.unlock(); return ; } if (stall_conf.bStalled==OMX_TRUE) { omx_vid_stalled=true; - Log::getInstance()->log("Video", Log::DEBUG, "Video decoder stalled! %d", stall_conf.nDelay); + logger->debug(TAG, "Video decoder stalled! {}", stall_conf.nDelay); } else { omx_vid_stalled=false; - Log::getInstance()->log("Video", Log::DEBUG, "Video decoder unstalled! %d",stall_conf.nDelay); + logger->debug(TAG, "Video decoder unstalled! {}",stall_conf.nDelay); } omx_events.erase(itty); break; @@ -1919,13 +1922,13 @@ int VideoOMX::CommandFinished(OMX_HANDLETYPE handle,OMX_U32 command,OMX_U32 data if (current.event_type==OMX_EventError) { omx_events.erase(itty); omx_event_mutex.unlock(); - Log::getInstance()->log("Video", Log::DEBUG, "Command Finished on Error %x",current.data1); + logger->debug(TAG, "Command Finished on Error {:#x}",current.data1); return 0; } else if (current.event_type==OMX_EventCmdComplete && current.data1==command && current.data2==data2) { omx_events.erase(itty); omx_event_mutex.unlock(); - //Log::getInstance()->log("Video", Log::DEBUG, "Command Finished Completed"); + //logger->debug(TAG, "Command Finished Completed"); return 1; } } @@ -1941,7 +1944,7 @@ int VideoOMX::CommandFinished(OMX_HANDLETYPE handle,OMX_U32 command,OMX_U32 data i++; } - Log::getInstance()->log("Video", Log::DEBUG, "CommandFinished waited too long %x %x %x",handle,command, data2); + logger->debug(TAG, "CommandFinished waited too long {:#x} {:#x} {:#x}",handle,command, data2); return 0; } @@ -1960,9 +1963,9 @@ int VideoOMX::PrepareInputBufsOMX() //needs to be called with locked mutex error=OMX_GetParameter(omx_vid_dec,OMX_IndexParamPortDefinition, &port_def_type); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Get OMX OMX_IndexParamPortDefinition failed %x", error); + logger->debug(TAG, "Get OMX OMX_IndexParamPortDefinition failed {:#x}", error); } -/* Log::getInstance()->log("Video", Log::DEBUG, "Port para %d %d %d %d %d %d %d", port_def_type.nBufferCountActual, +/* logger->debug(TAG, "Port para %d %d %d %d %d %d %d", 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);*/ @@ -1972,13 +1975,13 @@ int VideoOMX::PrepareInputBufsOMX() //needs to be called with locked mutex error=OMX_SetParameter(omx_vid_dec,OMX_IndexParamPortDefinition, &port_def_type); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Set OMX OMX_IndexParamPortDefinition failed %x", error); + logger->debug(TAG, "Set OMX OMX_IndexParamPortDefinition failed {:#x}", error); } error=OMX_SendCommand(omx_vid_dec,OMX_CommandPortEnable,omx_codec_input_port,0); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Prepare Input bufs Send Command to enable port %x", error); + logger->debug(TAG, "Prepare Input bufs Send Command to enable port {:#x}", error); return 0; } @@ -1989,13 +1992,13 @@ int VideoOMX::PrepareInputBufsOMX() //needs to be called with locked mutex OMX_BUFFERHEADERTYPE *buf_head=NULL; /* error=OMX_Usebuffer(omx_vid_dec,&buf_head,omx_codec_input_port,NULL,port_def_type.nbufferSize,new_buffer_data); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Use OMX_Usebuffer failed %x", error); + logger->debug(TAG, "Use OMX_Usebuffer failed {:#x}", error); input_bufs_omx_mutex.unlock(); return 0; }*/ error=OMX_AllocateBuffer(omx_vid_dec,&buf_head,omx_codec_input_port,NULL,port_def_type.nBufferSize); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Use OMX_AllocateBuffer failed %x", error); + logger->debug(TAG, "Use OMX_AllocateBuffer failed {:#x}", error); input_bufs_omx_mutex.unlock(); return 0; } @@ -2009,11 +2012,11 @@ int VideoOMX::PrepareInputBufsOMX() //needs to be called with locked mutex input_bufs_omx_mutex.unlock(); - Log::getInstance()->log("Video", Log::DEBUG, "PrepareInputBufsOMX mark3"); + logger->debug(TAG, "PrepareInputBufsOMX mark3"); if (!CommandFinished(omx_vid_dec,OMX_CommandPortEnable,omx_codec_input_port)) { return 0; } - Log::getInstance()->log("Video", Log::DEBUG, "PrepareInputBufsOMX mark4"); + logger->debug(TAG, "PrepareInputBufsOMX mark4"); return 1; } @@ -2029,7 +2032,7 @@ int VideoOMX::DestroyInputBufsOMX() //need s to be called with locked mutex // input_bufs_omx_all[i]->pBuffer=NULL; error=OMX_FreeBuffer(omx_vid_dec,omx_codec_input_port,input_bufs_omx_all[i]); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "Use OMX_FreeBuffer failed %x", error); + logger->debug(TAG, "Use OMX_FreeBuffer failed {:#x}", error); input_bufs_omx_mutex.unlock(); return 0; } @@ -2178,13 +2181,13 @@ int VideoOMX::DeAllocateCodecsOMX() { OMX_ERRORTYPE error; omx_running=false; - Log::getInstance()->log("Video", Log::DEBUG, "enter deallocatecodecsomx"); + logger->debug(TAG, "enter deallocatecodecsomx"); if (cur_input_buf_omx) { cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_EOS; error=ProtOMXEmptyThisBuffer(omx_vid_dec,cur_input_buf_omx); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "OMX_EmptyThisBuffer failed %x", error); + logger->debug(TAG, "OMX_EmptyThisBuffer failed {:#x}", error); } cur_input_buf_omx=NULL;//write out old data @@ -2194,7 +2197,7 @@ int VideoOMX::DeAllocateCodecsOMX() if (omx_vid_dec) { // first stop the omx elements if (!ChangeComponentState(omx_vid_dec,OMX_StateIdle)) { - Log::getInstance()->log("Video", Log::DEBUG, "vid_dec ChangeComponentState"); + logger->debug(TAG, "vid_dec ChangeComponentState"); } clock_mutex.unlock(); @@ -2212,12 +2215,12 @@ int VideoOMX::DeAllocateCodecsOMX() if (!ChangeComponentState(omx_vid_sched,OMX_StateIdle)) { - Log::getInstance()->log("Video", Log::DEBUG, "vid_shed ChangeComponentState"); + logger->debug(TAG, "vid_shed ChangeComponentState"); } if (!ChangeComponentState(omx_vid_rend,OMX_StateIdle)) { - Log::getInstance()->log("Video", Log::DEBUG, "vid_rend ChangeComponentState"); + logger->debug(TAG, "vid_rend ChangeComponentState"); } @@ -2233,19 +2236,19 @@ int VideoOMX::DeAllocateCodecsOMX() error=OMX_SendCommand(omx_clock,OMX_CommandFlush, omx_clock_output_port, NULL); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Flush clock out failed %x", error); + logger->debug(TAG, "OMX_Flush clock out failed {:#x}", error); } error=OMX_SendCommand(omx_vid_sched,OMX_CommandFlush, omx_shed_clock_port, NULL); if (error!=OMX_ErrorNone){ - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Flush shed clock failed %x", error); + logger->debug(TAG, "OMX_Flush shed clock failed {:#x}", error); } if (!CommandFinished(omx_clock,OMX_CommandFlush,omx_clock_output_port) || !CommandFinished(omx_vid_sched,OMX_CommandFlush,omx_shed_clock_port)) { - Log::getInstance()->log("Video", Log::DEBUG, "flush cmd clock shed failed"); + logger->debug(TAG, "flush cmd clock shed failed"); } @@ -2266,49 +2269,49 @@ int VideoOMX::DeAllocateCodecsOMX() //todo flushing if (!DisablePort(omx_vid_sched,omx_shed_output_port,true)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Tunnel Port failed 2 "); + logger->debug(TAG, "Disable Tunnel Port failed 2"); } if (!DisablePort(omx_vid_rend,omx_rend_input_port,true)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Tunnel Port failed 1"); + logger->debug(TAG, "Disable Tunnel Port failed 1"); } if (!DisablePort(omx_vid_dec,omx_codec_output_port,true)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Tunnel Port failed 6"); + logger->debug(TAG, "Disable Tunnel Port failed 6"); } if (!DisablePort(omx_vid_dec,omx_codec_input_port,true)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Tunnel Port failed 7"); + logger->debug(TAG, "Disable Tunnel Port failed 7"); } if (dodeint) { if (!DisablePort(omx_vid_deint,omx_deint_output_port,true)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Tunnel Port failed 6a"); + logger->debug(TAG, "Disable Tunnel Port failed 6a"); } if (!DisablePort(omx_vid_deint,omx_deint_input_port,true)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Tunnel Port failed 7a"); + logger->debug(TAG, "Disable Tunnel Port failed 7a"); } } if (!DisablePort(omx_vid_sched,omx_shed_input_port,true)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Tunnel Port failed 3"); + logger->debug(TAG, "Disable Tunnel Port failed 3"); } if (!DisablePort(omx_vid_sched,omx_shed_clock_port,true)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Tunnel Port failed 4"); + logger->debug(TAG, "Disable Tunnel Port failed 4"); } if (!DisablePort(omx_clock,omx_clock_output_port,true)) { - Log::getInstance()->log("Video", Log::DEBUG, "Disable Tunnel Port failed 5"); + logger->debug(TAG, "Disable Tunnel Port failed 5"); } @@ -2316,52 +2319,52 @@ int VideoOMX::DeAllocateCodecsOMX() error=OMX_SetupTunnel(omx_vid_dec,omx_codec_output_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } if (dodeint) { error=OMX_SetupTunnel(omx_vid_deint,omx_deint_input_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } error=OMX_SetupTunnel(omx_vid_deint,omx_deint_output_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } } error=OMX_SetupTunnel(omx_vid_sched,omx_shed_input_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } error=OMX_SetupTunnel(omx_vid_sched,omx_shed_output_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } error=OMX_SetupTunnel(omx_vid_rend,omx_rend_input_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + logger->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("Video", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } error=OMX_SetupTunnel(omx_vid_sched,omx_shed_clock_port,NULL,0); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "OMX_Setup tunnel teardown failed %x", error); + logger->debug(TAG, "OMX_Setup tunnel teardown failed {:#x}", error); } @@ -2376,10 +2379,10 @@ int VideoOMX::DeAllocateCodecsOMX() clock_mutex.unlock(); destroyClock(); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "FreeHandle failed %d", error); + logger->debug(TAG, "FreeHandle failed {}", error); } } else clock_mutex.unlock(); - Log::getInstance()->log("Video", Log::DEBUG, "leave deallocate codecs OMX"); + logger->debug(TAG, "leave deallocate codecs OMX"); return 1; } @@ -2392,10 +2395,10 @@ void VideoOMX::destroyClock() clock_references--; if (clock_references==0) { OMX_ERRORTYPE error; - Log::getInstance()->log("Video", Log::DEBUG, "destroy omx clock"); + logger->debug(TAG, "destroy omx clock"); error=OMX_FreeHandle(omx_clock); if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "FreeHandle failed %d", error); + logger->debug(TAG, "FreeHandle failed {}", error); } } @@ -2432,7 +2435,7 @@ int VideoOMX::reset() int VideoOMX::pause() { if (!initted) return 0; - Log::getInstance()->log("Video", Log::DEBUG, "enter pause"); + logger->debug(TAG, "enter pause"); // clockPause(); // ignore it audio handles this return 1; @@ -2441,7 +2444,7 @@ int VideoOMX::pause() int VideoOMX::unPause() // FIXME get rid - same as play!! Not here! { if (!initted) return 0; - Log::getInstance()->log("Video", Log::DEBUG, "enter unpause"); + logger->debug(TAG, "enter unpause"); //clockUnpause(); //ignore it audio handles this @@ -2883,7 +2886,7 @@ bool VideoOMX::DrainTargetBufferFull() checkForStalledBuffers(); // check if the decoder has a problem if (full && omx_vid_stalled && !omx_first_frame) { omx_vid_stalled=false; - Log::getInstance()->log("Video", Log::DEBUG, "Decoder is stalled, do a reset!"); + logger->debug(TAG, "Decoder is stalled, do a reset!"); int oldcancelstate; int oldcanceltype; @@ -2952,8 +2955,8 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet, if (isClockPaused()) return 0; //Block if we pause -// Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 1"); - //Log::getInstance()->log("Video", Log::DEBUG, "DeliverMediaPacketOMX time %lld",packet.presentation_time); +// logger->debug(TAG, "DMP mark 1"); + //logger->debug(TAG, "DeliverMediaPacketOMX time {}", packet.presentation_time); /*First Check, if we have an video sample*/ @@ -2971,7 +2974,7 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet, cur_input_buf_omx=NULL; } } - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 2"); + //logger->debug(TAG, "DMP mark 2"); /*Inspect PES-Header */ // OMX_STATETYPE temp_state; @@ -2979,7 +2982,7 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet, if (*samplepos==0) {//stripheader headerstrip=buffer[packet.pos_buffer+8]+9/*is this right*/; - // if (h264) Log::getInstance()->log("Video", Log::DEBUG, "PES info %x %x %x %x", + // if (h264) logger->debug(TAG, "PES info {:#x} {:#x} {:#x} {:#x}", // buffer[packet.pos_buffer+0],buffer[packet.pos_buffer+1],buffer[packet.pos_buffer+2],buffer[packet.pos_buffer+3]); *samplepos+=headerstrip; if (headerstrip>=packet.length) { @@ -2988,39 +2991,39 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet, } if ( packet.synched ) { if (!firstsynched) { - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 2a"); + //logger->debug(TAG, "DMP mark 2a"); // check if this is an I frame, the decoder does not like non I frames at startup! if (!detectIFrame(buffer,packet.length)) { *samplepos=packet.length;//if we have not processed at least one - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 3"); + //logger->debug(TAG, "DMP mark 3"); return packet.length;//synched packet ignore it! } } if (cur_input_buf_omx) { - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 4a"); + //logger->debug(TAG, "DMP mark 4a"); cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_ENDOFFRAME; PutBufferToPres(cur_input_buf_omx); cur_input_buf_omx=NULL;//write out old data - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 4b"); + //logger->debug(TAG, "DMP mark 4b"); } firstsynched=true; } else { if (!firstsynched) {// *samplepos=packet.length;//if we have not processed at least one - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 5"); + //logger->debug(TAG, "DMP mark 5"); return packet.length;//synched packet ignore it! } } } - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 6"); + //logger->debug(TAG, "DMP mark 6"); if (!cur_input_buf_omx) { input_bufs_omx_mutex.lock(); if (input_bufs_omx_free.size()==0) { input_bufs_omx_mutex.unlock(); - //Log::getInstance()->log("Video", Log::DEBUG, "Deliver MediaPacket no free sample"); - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 7"); + //logger->debug(TAG, "Deliver MediaPacket no free sample"); + //logger->debug(TAG, "DMP mark 7"); return 0; // we do not have a free media sample } @@ -3037,19 +3040,19 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet, if (cur_input_buf_omx->nFilledLen==0) {//will only be changed on first packet if (packet.synched) { - // Log::getInstance()->log("Video", Log::DEBUG, "packet synched marker"); + // logger->debug(TAG, "packet synched marker"); //lastreftimePTS=packet.pts; if (omx_first_frame) { // TODO time cur_input_buf_omx->nFlags=OMX_BUFFERFLAG_STARTTIME; - Log::getInstance()->log("Video", Log::DEBUG, "Starttime"); + logger->debug(TAG, "Starttime"); omx_first_frame=false; } else { cur_input_buf_omx->nFlags=0; //cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_TIME_UNKNOWN; } lastreftimeOMX=packet.presentation_time; - // Log::getInstance()->log("Video", Log::DEBUG, "Time code %lld pts %lld", lastreftimeOMX,packet.pts); + // logger->debug(TAG, "Time code {} pts {}", lastreftimeOMX,packet.pts); lastreftimePTS=packet.pts; cur_input_buf_omx->nTimeStamp=intToOMXTicks(lastreftimeOMX/10LL); // the clock component is faulty; } @@ -3057,7 +3060,7 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet, { cur_input_buf_omx->nFlags=OMX_BUFFERFLAG_TIME_UNKNOWN; cur_input_buf_omx->nTimeStamp=intToOMXTicks(0); - //Log::getInstance()->log("Video", Log::DEBUG, "packet unsynched marker"); + //logger->debug(TAG, "packet unsynched marker"); } if (packet.disconti) cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_DISCONTINUITY; @@ -3065,17 +3068,17 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet, } unsigned int haveToCopy=packet.length-*samplepos; - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 8"); + //logger->debug(TAG, "DMP mark 8"); while (haveToCopy> (cur_input_buf_omx->nAllocLen-cur_input_buf_omx->nFilledLen)) { - //Log::getInstance()->log("Video", Log::DEBUG, "Big buffer %d %d %d",packet.length,cur_input_buf_omx->nAllocLen,cur_input_buf_omx->nFilledLen); + //logger->debug(TAG, "Big buffer {} {} {}",packet.length,cur_input_buf_omx->nAllocLen,cur_input_buf_omx->nFilledLen); unsigned int cancopy=cur_input_buf_omx->nAllocLen-cur_input_buf_omx->nFilledLen; memcpy(cur_input_buf_omx->pBuffer+cur_input_buf_omx->nFilledLen,buffer+packet.pos_buffer+*samplepos,cancopy); haveToCopy-=cancopy; cur_input_buf_omx->nFilledLen+=cancopy; *samplepos+=cancopy; // push old buffer out - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 9"); + //logger->debug(TAG, "DMP mark 9"); PutBufferToPres(cur_input_buf_omx); cur_input_buf_omx=NULL; @@ -3083,7 +3086,7 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet, input_bufs_omx_mutex.lock(); if (input_bufs_omx_free.size()==0) { input_bufs_omx_mutex.unlock(); - // Log::getInstance()->log("Video", Log::DEBUG, "Deliver MediaPacket no free sample2"); + // logger->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(); @@ -3093,14 +3096,14 @@ UINT VideoOMX::DeliverMediaPacket(MediaPacket packet, cur_input_buf_omx->nTimeStamp=intToOMXTicks(0); input_bufs_omx_free.pop_front(); input_bufs_omx_mutex.unlock(); - //Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 10"); + //logger->debug(TAG, "DMP mark 10"); } memcpy(cur_input_buf_omx->pBuffer+cur_input_buf_omx->nFilledLen, buffer+packet.pos_buffer+*samplepos,haveToCopy); cur_input_buf_omx->nFilledLen+=haveToCopy; -// Log::getInstance()->log("Video", Log::DEBUG, "DMP mark 11"); +// logger->debug(TAG, "DMP mark 11"); *samplepos+=haveToCopy; diff --git a/videoomx.h b/videoomx.h index c78e5e6..409ffc5 100644 --- a/videoomx.h +++ b/videoomx.h @@ -55,7 +55,7 @@ struct VPE_OMX_EVENT { - +class LogNT; class AudioVPE; class VideoOMX : public Video @@ -143,6 +143,7 @@ class VideoOMX : public Video } private: + LogNT* logger; int EnterIframePlayback(); bool iframemode; bool InIframemode() {return iframemode;}; diff --git a/wol.cc b/wol.cc index 158d491..ca4e6d8 100644 --- a/wol.cc +++ b/wol.cc @@ -44,10 +44,12 @@ #include #endif #include "wol.h" -#include "oldlog.h" +#include "log.h" #define _PATH_PROCNET_ARP "/proc/net/arp" +static const char* TAG = "WOL"; + Wol* Wol::instance = NULL; Wol::Wol() @@ -56,7 +58,7 @@ Wol::Wol() instance = this; bEtherKnown = false; wolEnabled = true; - logger = Log::getInstance(); + logger = LogNT::getInstance(); #ifdef WIN32 // goo; #endif @@ -102,7 +104,7 @@ int Wol::find_ether(const char *name) /* if the user specified address differs, skip it */ if (name[0] && !strcmp(ip, name)) { - logger->log("Wol", Log::NOTICE, "Found etheraddr %s", ether_addr); + logger->info(TAG, "Found etheraddr {}", ether_addr); fclose(fp); return 1; } @@ -127,7 +129,7 @@ int Wol::find_ether(const char *name) if (table==NULL) return -1; if (GetIpNetTable(table,&size,TRUE)!=NOERROR) { - logger->log("Wol", Log::NOTICE, "Error getting IPtable"); + logger->info(TAG, "Error getting IPtable"); delete [] table; return -1; } @@ -139,7 +141,7 @@ int Wol::find_ether(const char *name) ethp+=sprintf(ethp,"%X:",table->table[x].bPhysAddr[i]); } delete [] table; - logger->log("Wol", Log::NOTICE, "Found etheraddr %s", ether_addr); + logger->info(TAG, "Found etheraddr {}", ether_addr); return 1; } @@ -285,7 +287,7 @@ int Wol::doWakeUp() return (-1); } - logger->log("Wol", Log::NOTICE, "Send wakeonlan to server"); + logger->info(TAG, "Send wakeonlan to server"); CLOSESOCKET(packet); return (0); @@ -296,7 +298,7 @@ void Wol::setWakeUpIP(const char* ip_addr) if(find_ether(ip_addr)) { bEtherKnown = true; - logger->log("Wol", Log::NOTICE, "Server IP set"); + logger->info(TAG, "Server IP set"); } } diff --git a/wol.h b/wol.h index 10fab1f..8ca3db3 100644 --- a/wol.h +++ b/wol.h @@ -29,7 +29,7 @@ #include #include -class Log; +class LogNT; class Wol { @@ -48,7 +48,7 @@ class Wol char ether_addr[100]; bool bEtherKnown; bool wolEnabled; - Log* logger; + LogNT* logger; }; #endif -- 2.39.2