From 8d67df0703fdc64695fece8a5575519b95f6fb2f Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Mon, 15 Nov 2021 16:40:08 +0000 Subject: [PATCH] Disable copious logging from new ImageOMX code --- imageomx2.cc | 104 +++++++++++++++++++++--------------------- omx/omx.cc | 51 +++++++++++---------- omx/omxeglrender.cc | 41 ++++++++++------- omx/omximagedecode.cc | 44 ++++++++++-------- osdvector.cc | 6 +-- 5 files changed, 132 insertions(+), 114 deletions(-) diff --git a/imageomx2.cc b/imageomx2.cc index c9daf90..7eaffdb 100644 --- a/imageomx2.cc +++ b/imageomx2.cc @@ -102,7 +102,7 @@ unsigned char* ImageOMX2::decodePicture(LoadIndex index, unsigned char* buffer, decode(reinterpret_cast(buffer), length, &rawData, &rawDataSize, &rawDataWidth, &rawDataHeight, &rawDataStride); - log->debug(TAG, "decoded {}, size = {}, w = {}, h = {}, s = {}", static_cast(rawData), rawDataSize, rawDataWidth, rawDataHeight, rawDataStride); +// log->debug(TAG, "decoded {}, size = {}, w = {}, h = {}, s = {}", static_cast(rawData), rawDataSize, rawDataWidth, rawDataHeight, rawDataStride); currentDecode.width = rawDataWidth; currentDecode.height = rawDataHeight; @@ -171,33 +171,33 @@ void ImageOMX2::decode(char* inputData, int inputDataSize, char** outRawData, in { // Talk to image_decode - log->debug(TAG, "image_decode: disable input"); +// log->debug(TAG, "image_decode: disable input"); omx_imagedecode->disableInput(); - log->debug(TAG, "image_decode: disable output"); +// log->debug(TAG, "image_decode: disable output"); omx_imagedecode->disableOutput(); - log->debug(TAG, "image_decode: change state to idle"); +// log->debug(TAG, "image_decode: change state to idle"); omx_imagedecode->changeState(OMX_StateIdle); - log->debug(TAG, "image_decode: set format"); +// log->debug(TAG, "image_decode: set format"); omx_imagedecode->setFormat(); - log->debug(TAG, "image_decode: prepare input buffers"); +// log->debug(TAG, "image_decode: prepare input buffers"); omx_imagedecode->prepareInputBuffers(inputDataSize); - log->debug(TAG, "image_decode: enable input"); +// log->debug(TAG, "image_decode: enable input"); omx_imagedecode->enableInput(false); // Don't wait for this, it depends on OMX_UseBuffer being called next - log->debug(TAG, "image_decode: allocate input buffers"); +// log->debug(TAG, "image_decode: allocate input buffers"); omx_imagedecode->allocateInputBuffers(inputData); - log->debug(TAG, "image_decode: change state to executing"); +// log->debug(TAG, "image_decode: change state to executing"); omx_imagedecode->changeState(OMX_StateExecuting); - log->debug(TAG, "image_decode: sendtoinput"); +// log->debug(TAG, "image_decode: sendtoinput"); omx_imagedecode->sendToInput(); - log->debug(TAG, "image_decode: wait for port settings change"); +// log->debug(TAG, "image_decode: wait for port settings change"); omx_imagedecode->waitForOutputPortSettingsChange(); - log->debug(TAG, "image_decode: fix slice height"); +// log->debug(TAG, "image_decode: fix slice height"); omx_imagedecode->setSliceHeight(16); // FIXME allow full height if imageHeight % 16 = 0 ?? - log->debug(TAG, "image_decode: enable output"); +// log->debug(TAG, "image_decode: enable output"); omx_imagedecode->enableOutput(false); // Don't wait for this, I hope it depends on OMX_UseBuffer being called next - log->debug(TAG, "image_decode: allocate output buffer"); +// log->debug(TAG, "image_decode: allocate output buffer"); omx_imagedecode->allocateOutputBuffer(); int xwidth{}; @@ -206,7 +206,7 @@ void ImageOMX2::decode(char* inputData, int inputDataSize, char** outRawData, in int xsliceHeight{}; omx_imagedecode->getImageInfo(&xwidth, &xheight, &xstride, &xsliceHeight); - log->debug(TAG, "ImageInfo: {} {} {} {}", xwidth, xheight, xstride, xsliceHeight); +// log->debug(TAG, "ImageInfo: {} {} {} {}", xwidth, xheight, xstride, xsliceHeight); int linesGot = 0; int linesToGet; @@ -214,9 +214,9 @@ void ImageOMX2::decode(char* inputData, int inputDataSize, char** outRawData, in { char* data; int nFlags; - log->debug(TAG, "image_decode: receiveFromOutput"); +// log->debug(TAG, "image_decode: receiveFromOutput"); omx_imagedecode->receiveFromOutput(&data, &nFlags); - log->debug(TAG, "image_decode: receiveFromOutput {:#x}", nFlags); +// log->debug(TAG, "image_decode: receiveFromOutput {:#x}", nFlags); linesToGet = xheight - linesGot; @@ -234,24 +234,24 @@ void ImageOMX2::decode(char* inputData, int inputDataSize, char** outRawData, in } } - log->debug(TAG, "image_decode: change state to idle"); +// log->debug(TAG, "image_decode: change state to idle"); omx_imagedecode->changeState(OMX_StateIdle); - log->debug(TAG, "image_decode: disable input"); +// log->debug(TAG, "image_decode: disable input"); omx_imagedecode->disableInput(false); - log->debug(TAG, "image_decode: disable output"); +// log->debug(TAG, "image_decode: disable output"); omx_imagedecode->disableOutput(false); - log->debug(TAG, "image_decode: deallocate input buffers"); +// log->debug(TAG, "image_decode: deallocate input buffers"); omx_imagedecode->deallocateInputBuffers(); - log->debug(TAG, "image_decode: deallocate output buffer"); +// log->debug(TAG, "image_decode: deallocate output buffer"); omx_imagedecode->deallocateOutputBuffer(); - log->debug(TAG, "image_decode: change state to loaded"); +// log->debug(TAG, "image_decode: change state to loaded"); omx_imagedecode->changeState(OMX_StateLoaded); int totalSize{}; for (int chunkSize : sizes) totalSize += chunkSize; - log->debug(TAG, "total decoded mem chunks size: {}", totalSize); +// log->debug(TAG, "total decoded mem chunks size: {}", totalSize); char* gluedTogether = static_cast(malloc(totalSize)); - log->debug(TAG, "gluedTogether {}", static_cast(gluedTogether)); +// log->debug(TAG, "gluedTogether {}", static_cast(gluedTogether)); char* dest = gluedTogether; for (unsigned int i = 0 ; i < chunks.size(); i++) { @@ -276,7 +276,7 @@ void ImageOMX2::decode(char* inputData, int inputDataSize, char** outRawData, in void ImageOMX2::render(char* inputData, int inputDataSize, int imageWidth, int imageHeight, int imageStride) { - log->debug(TAG, "render: inputdataSize = {}", inputDataSize); +// log->debug(TAG, "render: inputdataSize = {}", inputDataSize); EGLPictureCreator* pictcreat = dynamic_cast(Osd::getInstance()); if (!pictcreat) throw 201; @@ -287,53 +287,53 @@ void ImageOMX2::render(char* inputData, int inputDataSize, int imageWidth, int i // The VGImage handle returned from vgCreateImage is stored in currentDecode.handle // The EGLImageKHR returned from eglCreateImageKHR is stored in currentDecode.reference - log->debug(TAG, "egl_render: disable input"); +// log->debug(TAG, "egl_render: disable input"); omx_eglrender->disableInput(); - log->debug(TAG, "egl_render: disable output"); +// log->debug(TAG, "egl_render: disable output"); omx_eglrender->disableOutput(); - log->debug(TAG, "egl_render: prep"); +// log->debug(TAG, "egl_render: prep"); omx_eglrender->prepareOutputPort(egl_display2); - log->debug(TAG, "egl_render: change state to idle"); +// log->debug(TAG, "egl_render: change state to idle"); omx_eglrender->changeState(OMX_StateIdle); - log->debug(TAG, "egl_render: prepareInputPort"); +// log->debug(TAG, "egl_render: prepareInputPort"); omx_eglrender->prepareInputPort(imageWidth, imageHeight, imageStride); - log->debug(TAG, "egl_render: enable input"); +// log->debug(TAG, "egl_render: enable input"); omx_eglrender->enableInput(false); - log->debug(TAG, "egl_render: allocate input buffers"); +// log->debug(TAG, "egl_render: allocate input buffers"); omx_eglrender->allocateInputBuffers(inputData); - log->debug(TAG, "Print port settings"); - omx_eglrender->printPortSettings(false); - log->debug(TAG, "egl_render: enable output"); +// log->debug(TAG, "Print port settings"); +// omx_eglrender->printPortSettings(false); +// log->debug(TAG, "egl_render: enable output"); omx_eglrender->enableOutput(false); - log->debug(TAG, "egl_render: allocate output buffer"); +// log->debug(TAG, "egl_render: allocate output buffer"); omx_eglrender->allocateEGLImageKHR(currentDecode.reference); - log->debug(TAG, "egl_render: change state to executing"); +// log->debug(TAG, "egl_render: change state to executing"); omx_eglrender->changeState(OMX_StateExecuting); - log->debug(TAG, "egl_render: sendtoinput"); +// log->debug(TAG, "egl_render: sendtoinput"); omx_eglrender->sendToInput(inputData, inputDataSize); - omx_eglrender->printPortSettings(true); +// omx_eglrender->printPortSettings(true); - log->debug(TAG, "egl_render: render"); +// log->debug(TAG, "egl_render: render"); omx_eglrender->render(); - log->debug(TAG, "egl_render: render done"); +// log->debug(TAG, "egl_render: render done"); - log->debug(TAG, "egl_render: change state to idle"); +// log->debug(TAG, "egl_render: change state to idle"); omx_eglrender->changeState(OMX_StateIdle); - log->debug(TAG, "egl_render: flush input commands"); - omx_eglrender->flushInputCommands(); - log->debug(TAG, "egl_render: flush output commands"); - omx_eglrender->flushOutputCommands(); - log->debug(TAG, "egl_render: disable input"); +// log->debug(TAG, "egl_render: flush input commands"); +// omx_eglrender->flushInputCommands(); +// log->debug(TAG, "egl_render: flush output commands"); +// omx_eglrender->flushOutputCommands(); +// log->debug(TAG, "egl_render: disable input"); omx_eglrender->disableInput(false); - log->debug(TAG, "egl_render: disable output"); +// log->debug(TAG, "egl_render: disable output"); omx_eglrender->disableOutput(false); - log->debug(TAG, "egl_render: deallocate output buffer header"); +// log->debug(TAG, "egl_render: deallocate output buffer header"); omx_eglrender->deallocateEGLImageKHR(); - log->debug(TAG, "egl_render: deallocate input buffer header"); +// log->debug(TAG, "egl_render: deallocate input buffer header"); omx_eglrender->deallocateInputBuffers(); - log->debug(TAG, "egl_render: change state to loaded"); +// log->debug(TAG, "egl_render: change state to loaded"); omx_eglrender->changeState(OMX_StateLoaded); } diff --git a/omx/omx.cc b/omx/omx.cc index 68225ac..a63200f 100644 --- a/omx/omx.cc +++ b/omx/omx.cc @@ -51,7 +51,7 @@ OMX_ERRORTYPE OMX::scb_EventHandler( OMX_IN OMX_HANDLETYPE handle, OMX_IN OMX_PTR appdata, OMX_IN OMX_EVENTTYPE event_type, OMX_IN OMX_U32 data1, OMX_IN OMX_U32 data2, OMX_IN OMX_PTR event_data) { - LogNT::getInstance()->debug("OMXSCB", "EventHandler {} {} {} {}", static_cast(handle_image_decode), static_cast(omx_image_decode), static_cast(handle_egl_render), static_cast(omx_egl_render)); +// LogNT::getInstance()->debug("OMXSCB", "EventHandler {} {} {} {}", static_cast(handle_image_decode), static_cast(omx_image_decode), static_cast(handle_egl_render), static_cast(omx_egl_render)); if (handle == handle_image_decode) return omx_image_decode->cb_EventHandler(handle, appdata, event_type, data1, data2, event_data); else if (handle == handle_egl_render) @@ -62,7 +62,7 @@ OMX_ERRORTYPE OMX::scb_EventHandler( OMX_ERRORTYPE OMX::scb_EmptyBufferDone(OMX_IN OMX_HANDLETYPE handle, OMX_IN OMX_PTR appdata, OMX_IN OMX_BUFFERHEADERTYPE* buffer) { - LogNT::getInstance()->debug("OMXSCB", "EmptyBufferDone {} {} {} {}", static_cast(handle_image_decode), static_cast(omx_image_decode), static_cast(handle_egl_render), static_cast(omx_egl_render)); +// LogNT::getInstance()->debug("OMXSCB", "EmptyBufferDone {} {} {} {}", static_cast(handle_image_decode), static_cast(omx_image_decode), static_cast(handle_egl_render), static_cast(omx_egl_render)); if (handle == handle_image_decode) return omx_image_decode->cb_EmptyBufferDone(handle, appdata, buffer); else if (handle == handle_egl_render) @@ -73,7 +73,7 @@ OMX_ERRORTYPE OMX::scb_EmptyBufferDone(OMX_IN OMX_HANDLETYPE handle, OMX_IN OMX_ OMX_ERRORTYPE OMX::scb_FillBufferDone(OMX_IN OMX_HANDLETYPE handle, OMX_IN OMX_PTR appdata, OMX_IN OMX_BUFFERHEADERTYPE* buffer) { - LogNT::getInstance()->debug("OMXSCB", "FillBufferDone {} {} {} {}", static_cast(handle_image_decode), static_cast(omx_image_decode), static_cast(handle_egl_render), static_cast(omx_egl_render)); +// LogNT::getInstance()->debug("OMXSCB", "FillBufferDone {} {} {} {}", static_cast(handle_image_decode), static_cast(omx_image_decode), static_cast(handle_egl_render), static_cast(omx_egl_render)); if (handle == handle_image_decode) return omx_image_decode->cb_FillBufferDone(handle, appdata, buffer); else if (handle == handle_egl_render) @@ -100,10 +100,10 @@ OMX::~OMX() // return true; // } -OMX_ERRORTYPE OMX::cb_EventHandler(OMX_IN OMX_HANDLETYPE handle, OMX_IN OMX_PTR appdata, OMX_IN OMX_EVENTTYPE event_type, OMX_IN OMX_U32 data1, OMX_IN OMX_U32 data2, OMX_IN OMX_PTR event_data) +OMX_ERRORTYPE OMX::cb_EventHandler(OMX_IN OMX_HANDLETYPE /* handle */, OMX_IN OMX_PTR appdata, OMX_IN OMX_EVENTTYPE event_type, OMX_IN OMX_U32 data1, OMX_IN OMX_U32 data2, OMX_IN OMX_PTR event_data) { //Log* l = Log::getInstance(); - log->debug(TAG, "CB: eventHandler {} {} {:#x} {:#x} {}", static_cast(handle), event_type, data1, data2, static_cast(event_data)); +// log->debug(TAG, "CB: eventHandler {} {} {:#x} {:#x} {}", static_cast(handle), event_type, data1, data2, static_cast(event_data)); eventsMutex.lock(); Event* incomingEvent = new Event{.appdata = appdata, .eventType = event_type, .data1 = data1, .data2 = data2, .event_data = event_data}; @@ -115,7 +115,7 @@ OMX_ERRORTYPE OMX::cb_EventHandler(OMX_IN OMX_HANDLETYPE handle, OMX_IN OMX_PTR eventsProcessorMutex.unlock(); eventsProcessorCond.notify_one(); - log->debug(TAG, "eventHandler end"); +// log->debug(TAG, "eventHandler end"); return OMX_ErrorNone; } @@ -165,7 +165,7 @@ void OMX::stopEventsProcessing() void OMX::eventsProcessorLoop() { - LogNT* log = LogNT::getInstance(); + //LogNT* log = LogNT::getInstance(); std::unique_lock ul(eventsProcessorMutex); // locks while(1) @@ -187,6 +187,7 @@ void OMX::eventsProcessorLoop() { event->isNew = false; + /* log->debug(TAG, "Event Processor Loop - event:"); if (event->eventType == 0) @@ -238,6 +239,8 @@ void OMX::eventsProcessorLoop() if (event->data1 == OMX_ErrorInsufficientResources) log->debug(TAG, "* =: OMX_ErrorInsufficientResources"); } + */ + } // end if event is new (then print it out) @@ -323,23 +326,23 @@ void OMX::eventsProcessorLoop() // Now we have an event and an eventWaiter // Still have the EventsMutex but we have released the eventWaitersMutex. - log->debug(TAG, "This event {} found an event waiter for it {}", static_cast(event), static_cast(eventWaiter)); +// log->debug(TAG, "This event {} found an event waiter for it {}", static_cast(event), static_cast(eventWaiter)); if (eventWaiter->waiting) { // FIXME look at whether eventWaiter could miss this signal - log->debug(TAG, "Notifying eventWaiter: {} on cond {}", static_cast(eventWaiter), static_cast(&eventWaiter->cond)); +// log->debug(TAG, "Notifying eventWaiter: {} on cond {}", static_cast(eventWaiter), static_cast(&eventWaiter->cond)); eventWaiter->cond.notify_one(); } else { - log->debug(TAG, "EventWaiter not waiting. Deleting {}", static_cast(eventWaiter)); +// log->debug(TAG, "EventWaiter not waiting. Deleting {}", static_cast(eventWaiter)); delete event; delete eventWaiter; } - log->debug(TAG, "Done processing eventWaiter, goaround events loop"); +// log->debug(TAG, "Done processing eventWaiter, goaround events loop"); } // end for each received event @@ -378,10 +381,10 @@ void OMX::enablePort(OMX_U32 port, bool enable, bool wait) OMX_COMMANDTYPE command = enable ? OMX_CommandPortEnable : OMX_CommandPortDisable; - log->debug(TAG, "en/disablePort: port: {:#x}, command: {:#x}", port, command); +// log->debug(TAG, "en/disablePort: port: {:#x}, command: {:#x}", port, command); error = OMX_SendCommand(componentHandle, command, port, 0); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SendCommand in OMX::enablePort()", error); - log->debug(TAG, "en/disablePort: port: {:#x}, command: {:#x} done", port, command); +// log->debug(TAG, "en/disablePort: port: {:#x}, command: {:#x} done", port, command); EventWaiter* eventWaiter = new EventWaiter(); eventWaiter->waiting = wait; @@ -392,16 +395,16 @@ void OMX::enablePort(OMX_U32 port, bool enable, bool wait) if (!wait) return; // && unlock. eventWaiter becomes owned by eventProcessor thread - log->debug(TAG, "en/disablePort: Going to wait on cond {}", static_cast(&eventWaiter->cond)); +// log->debug(TAG, "en/disablePort: Going to wait on cond {}", static_cast(&eventWaiter->cond)); eventWaiter->cond.wait(ul); // sleep this thread - log->debug(TAG, "en/disablePort: Back from wait on cond {}", static_cast(&eventWaiter->cond)); +// log->debug(TAG, "en/disablePort: Back from wait on cond {}", static_cast(&eventWaiter->cond)); ul.unlock(); if (eventWaiter->receivedEvent) { // The event processor thread received an event and saved it here - log->debug(TAG, "received event!"); +// log->debug(TAG, "received event!"); delete eventWaiter->receivedEvent; delete eventWaiter; } @@ -416,10 +419,10 @@ void OMX::changeState(OMX_STATETYPE reqState, bool wait) { OMX_STATETYPE currentState; OMX_GetState(componentHandle, ¤tState); - log->debug(TAG, "Current state: {}", currentState); +// log->debug(TAG, "Current state: {}", currentState); if (currentState == reqState) { - log->debug(TAG, "changeState return immediately, already in reqState"); +// log->debug(TAG, "changeState return immediately, already in reqState"); return; } @@ -436,15 +439,15 @@ void OMX::changeState(OMX_STATETYPE reqState, bool wait) if (!wait) return; // && unlock. eventWaiter becomes owned by eventProcessor thread - log->debug(TAG, "changeState: Going to wait on cond {}", static_cast(&eventWaiter->cond)); +// log->debug(TAG, "changeState: Going to wait on cond {}", static_cast(&eventWaiter->cond)); eventWaiter->cond.wait(ul); // sleep this thread - log->debug(TAG, "changeState: Back from wait on cond {}", static_cast(&eventWaiter->cond)); +// log->debug(TAG, "changeState: Back from wait on cond {}", static_cast(&eventWaiter->cond)); ul.unlock(); if (eventWaiter->receivedEvent) { // The event processor thread received an event and saved it here - log->debug(TAG, "received event!"); +// log->debug(TAG, "received event!"); delete eventWaiter->receivedEvent; delete eventWaiter; } @@ -471,9 +474,9 @@ void OMX::flushCommands(OMX_U32 port, bool wait) if (!wait) return; // && unlock. eventWaiter becomes owned by eventProcessor thread - log->debug(TAG, "flushCommands: Going to wait on cond {}", static_cast(&eventWaiter->cond)); +// log->debug(TAG, "flushCommands: Going to wait on cond {}", static_cast(&eventWaiter->cond)); eventWaiter->cond.wait(ul); // sleep this thread - log->debug(TAG, "flushCommands: Back from wait on cond {}", static_cast(&eventWaiter->cond)); +// log->debug(TAG, "flushCommands: Back from wait on cond {}", static_cast(&eventWaiter->cond)); ul.unlock(); if (!eventWaiter->receivedEvent) @@ -483,7 +486,7 @@ void OMX::flushCommands(OMX_U32 port, bool wait) } // The event processor thread received an event and saved it here - log->debug(TAG, "received event!"); +// log->debug(TAG, "received event!"); delete eventWaiter->receivedEvent; delete eventWaiter; } diff --git a/omx/omxeglrender.cc b/omx/omxeglrender.cc index 3533863..87cb866 100644 --- a/omx/omxeglrender.cc +++ b/omx/omxeglrender.cc @@ -49,7 +49,7 @@ bool OMX_EGL_Render::init() asprintf(&componentName, "%s", componentName_egl_render); OMX_ERRORTYPE error = OMX_GetHandle(&componentHandle, componentName, NULL, &callbacks); free(componentName); - log->debug(TAG, "HANDLE ALLOC: OMX_EGL_Render: {} error: {:#x}", static_cast(componentHandle), error); +// log->debug(TAG, "HANDLE ALLOC: OMX_EGL_Render: {} error: {:#x}", static_cast(componentHandle), error); if (error != OMX_ErrorNone) return false; handle_egl_render = componentHandle; @@ -65,7 +65,7 @@ bool OMX_EGL_Render::init() inputPort = p_param.nStartPortNumber; outputPort = p_param.nStartPortNumber + 1; - log->debug(TAG, "IN: {}, OUT: {}", inputPort, outputPort); +// log->debug(TAG, "IN: {}, OUT: {}", inputPort, outputPort); return true; } @@ -78,7 +78,7 @@ void OMX_EGL_Render::shutdown() void OMX_EGL_Render::prepareInputPort(OMX_U32 frameWidth, OMX_U32 frameHeight, OMX_U32 stride) { - log->debug(TAG, "prepareInputPort"); +// log->debug(TAG, "prepareInputPort"); // Calculate a slice height. It must be divisible by 16 and >= frameHeight // Temporarily use sliceHeight for remainder @@ -101,6 +101,7 @@ void OMX_EGL_Render::prepareInputPort(OMX_U32 frameWidth, OMX_U32 frameHeight, O OMX_ERRORTYPE error = OMX_GetParameter(componentHandle, OMX_IndexParamPortDefinition, &portConfig); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_GetParameter in OMX_EGL_Render::prepareInputPort()", error); + /* log->debug(TAG, "Recv from get:"); log->debug(TAG, "nPortIndex: {}", portConfig.nPortIndex); log->debug(TAG, "eDir: {}", portConfig.eDir); @@ -110,6 +111,7 @@ void OMX_EGL_Render::prepareInputPort(OMX_U32 frameWidth, OMX_U32 frameHeight, O log->debug(TAG, "bEnabled: {}", portConfig.bEnabled); log->debug(TAG, "bPopulated: {}", portConfig.bPopulated); log->debug(TAG, "eDomain: {}", portConfig.eDomain); + */ portConfig.nBufferCountActual = 1; portConfig.nBufferSize = inputPortBufferSize; @@ -120,14 +122,14 @@ void OMX_EGL_Render::prepareInputPort(OMX_U32 frameWidth, OMX_U32 frameHeight, O portConfig.format.video.nFrameHeight = frameHeight; portConfig.format.video.nSliceHeight = sliceHeight; - log->debug(TAG, "Setting buf count actual: {}, buf size: {}", portConfig.nBufferCountActual, portConfig.nBufferSize); - log->debug(TAG, "calling setParameter: w {} h {} str {} sli {}", portConfig.format.video.nFrameWidth, portConfig.format.video.nFrameHeight, - portConfig.format.video.nStride, portConfig.format.video.nSliceHeight); +// log->debug(TAG, "Setting buf count actual: {}, buf size: {}", portConfig.nBufferCountActual, portConfig.nBufferSize); +// log->debug(TAG, "calling setParameter: w {} h {} str {} sli {}", portConfig.format.video.nFrameWidth, portConfig.format.video.nFrameHeight, +// portConfig.format.video.nStride, portConfig.format.video.nSliceHeight); error = OMX_SetParameter(componentHandle, OMX_IndexParamPortDefinition, &portConfig); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SetParameter in OMX_EGL_Render::prepareInputPort()", error); - printPortSettings(false); +// printPortSettings(false); } void OMX_EGL_Render::prepareOutputPort(EGLDisplay egldisplay) @@ -152,10 +154,11 @@ void OMX_EGL_Render::allocateInputBuffers(char* data) { inBuffer1 = NULL; - log->debug(TAG, "Calling OMX_UseBuffer with data = {}", static_cast(data)); +// log->debug(TAG, "Calling OMX_UseBuffer with data = {}", static_cast(data)); OMX_ERRORTYPE error = OMX_UseBuffer(componentHandle, &inBuffer1, inputPort, static_cast(0), inputPortBufferSize, reinterpret_cast(data)); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_UseBuffer in OMX_EGL_Render::allocateInputBuffers()", error); + /* log->debug(TAG, "OMX_UseBuffer:"); log->debug(TAG, " nSize = {}", inBuffer1->nSize); log->debug(TAG, " pBuffer = {}", static_cast(inBuffer1->pBuffer)); @@ -167,6 +170,7 @@ void OMX_EGL_Render::allocateInputBuffers(char* data) log->debug(TAG, " nFlags = {:#x}", inBuffer1->nFlags); printPortSettings(false); + */ } void OMX_EGL_Render::allocateEGLImageKHR(EGLImageKHR eglimagekhr) @@ -174,7 +178,7 @@ void OMX_EGL_Render::allocateEGLImageKHR(EGLImageKHR eglimagekhr) OMX_ERRORTYPE error = OMX_UseEGLImage(componentHandle, &eglRenderOutputBufferHeader, outputPort, this, static_cast(eglimagekhr)); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_UseEGLImage in OMX_EGL_Render::allocateEGLImageKHR()", error); - printPortSettings(true); +// printPortSettings(true); } void OMX_EGL_Render::deallocateInputBuffers() @@ -195,7 +199,7 @@ void OMX_EGL_Render::deallocateEGLImageKHR() void OMX_EGL_Render::sendToInput(char* data, int dataSize) { - log->debug(TAG, "Starting sendToInput {}", dataSize); +// log->debug(TAG, "Starting sendToInput {}", dataSize); inBuffer1->nFilledLen = dataSize; inBuffer1->nOffset = 0; @@ -204,10 +208,10 @@ void OMX_EGL_Render::sendToInput(char* data, int dataSize) inBuffer1->nFlags |= OMX_BUFFERFLAG_EOS; inBuffer1->pBuffer = reinterpret_cast(data); - log->debug(TAG, "calling emptythisbuffer"); +// log->debug(TAG, "calling emptythisbuffer"); OMX_ERRORTYPE error = OMX_EmptyThisBuffer(componentHandle, inBuffer1); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_EmptyThisBuffer in OMX_EGL_Render::sendToInput()", error); - log->debug(TAG, "sendToInput done"); +// log->debug(TAG, "sendToInput done"); } void OMX_EGL_Render::render() @@ -220,6 +224,7 @@ void OMX_EGL_Render::render() bufferWithOutputPort->bufhead = eglRenderOutputBufferHeader; eglRenderOutputBufferHeader->pAppPrivate = static_cast(bufferWithOutputPort); + /* log->debug(TAG, "render: egl buffer header:"); log->debug(TAG, "{}", static_cast(eglRenderOutputBufferHeader->pBuffer)); log->debug(TAG, "{}", eglRenderOutputBufferHeader->nAllocLen); @@ -229,20 +234,21 @@ void OMX_EGL_Render::render() log->debug(TAG, "{}", eglRenderOutputBufferHeader->nInputPortIndex); log->debug(TAG, "{}", eglRenderOutputBufferHeader->nOutputPortIndex); log->debug(TAG, "{}", static_cast(eglRenderOutputBufferHeader->pAppPrivate)); - + */ std::unique_lock ul(bufferWithOutputPort->mutex); - log->debug(TAG, "calling fillthisbuffer. bufhead: {}, BufferWithOutput: {}", static_cast(eglRenderOutputBufferHeader), static_cast(bufferWithOutputPort)); +// log->debug(TAG, "calling fillthisbuffer. bufhead: {}, BufferWithOutput: {}", static_cast(eglRenderOutputBufferHeader), static_cast(bufferWithOutputPort)); OMX_ERRORTYPE error = OMX_FillThisBuffer(componentHandle, eglRenderOutputBufferHeader); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_FillThisBuffer in OMX_EGL_Render::render()", error); - log->debug(TAG, "done fillthisbuffer. bufhead: {}, BufferWithOutput: {}", static_cast(eglRenderOutputBufferHeader), static_cast(bufferWithOutputPort)); +// log->debug(TAG, "done fillthisbuffer. bufhead: {}, BufferWithOutput: {}", static_cast(eglRenderOutputBufferHeader), static_cast(bufferWithOutputPort)); bufferWithOutputPort->cond.wait(ul, [bufferWithOutputPort] { return bufferWithOutputPort->done; }); ul.unlock(); + /* log->debug(TAG, "receiveFromOutputPort signalled"); log->debug(TAG, "receiveFromOutput:"); @@ -253,6 +259,7 @@ void OMX_EGL_Render::render() log->debug(TAG, " nInputPortIndex = {}", eglRenderOutputBufferHeader->nInputPortIndex); log->debug(TAG, " nOutputPortIndex = {}", eglRenderOutputBufferHeader->nOutputPortIndex); log->debug(TAG, " nFlags = {:#x}", eglRenderOutputBufferHeader->nFlags); + */ delete bufferWithOutputPort; bufferWithOutputPort = NULL; @@ -311,6 +318,7 @@ void OMX_EGL_Render::printPortSettings(bool which) OMX_ERRORTYPE OMX_EGL_Render::cb_EmptyBufferDone(OMX_IN OMX_HANDLETYPE /*hcomp*/, OMX_IN OMX_PTR /*appdata*/, OMX_IN OMX_BUFFERHEADERTYPE* buffer) { + /* log->debug(TAG, "CB: EmptyBufferDone"); log->debug(TAG, " nSize = {}", buffer->nSize); log->debug(TAG, " nAllocLen = {}", buffer->nAllocLen); @@ -319,12 +327,13 @@ OMX_ERRORTYPE OMX_EGL_Render::cb_EmptyBufferDone(OMX_IN OMX_HANDLETYPE /*hcomp*/ log->debug(TAG, " nInputPortIndex = {}", buffer->nInputPortIndex); log->debug(TAG, " nOutputPortIndex = {}", buffer->nOutputPortIndex); log->debug(TAG, " nFlags = {:#x}", buffer->nFlags); + */ return OMX_ErrorNone; } OMX_ERRORTYPE OMX_EGL_Render::cb_FillBufferDone(OMX_IN OMX_HANDLETYPE hcomp, OMX_IN OMX_PTR appdata, OMX_IN OMX_BUFFERHEADERTYPE* buffer) { - log->debug(TAG, "CB: FillBufferDone, handle: {}, appdata: {}, buffer: {}", static_cast(hcomp), static_cast(appdata), static_cast(buffer)); +// log->debug(TAG, "CB: FillBufferDone, handle: {}, appdata: {}, buffer: {}", static_cast(hcomp), static_cast(appdata), static_cast(buffer)); struct BufferWithOutputPort* bufferWithOutputPort = static_cast(buffer->pAppPrivate); bufferWithOutputPort->mutex.lock(); diff --git a/omx/omximagedecode.cc b/omx/omximagedecode.cc index 06a4932..f8334d6 100644 --- a/omx/omximagedecode.cc +++ b/omx/omximagedecode.cc @@ -44,7 +44,7 @@ bool OMX_Image_Decode::init() asprintf(&componentName, "%s", componentName_image_decode); OMX_ERRORTYPE error = OMX_GetHandle(&componentHandle, componentName, NULL, &callbacks); free(componentName); - log->debug(TAG, "HANDLE ALLOC: omx_image_decode: {}", static_cast(componentHandle)); +// log->debug(TAG, "HANDLE ALLOC: omx_image_decode: {}", static_cast(componentHandle)); if (error != OMX_ErrorNone) return false; handle_image_decode = componentHandle; @@ -60,7 +60,7 @@ bool OMX_Image_Decode::init() inputPort = p_param.nStartPortNumber; outputPort = p_param.nStartPortNumber + 1; - log->debug(TAG, "IN: {}, OUT: {}", inputPort, outputPort); +// log->debug(TAG, "IN: {}, OUT: {}", inputPort, outputPort); return true; } @@ -84,14 +84,14 @@ void OMX_Image_Decode::prepareInputBuffers(int tdataSize) OMX_ERRORTYPE error = OMX_GetParameter(componentHandle, OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_GetParameter in OMX_Image_Decode::prepareInputBuffers()", error); - log->debug(TAG, "Defaults: bufferCountActual: {}, bufferCountMin: {}, nBufferSize: {}", - port_def_type.nBufferCountActual, port_def_type.nBufferCountMin, port_def_type.nBufferSize); +// log->debug(TAG, "Defaults: bufferCountActual: {}, bufferCountMin: {}, nBufferSize: {}", +// port_def_type.nBufferCountActual, port_def_type.nBufferCountMin, port_def_type.nBufferSize); port_def_type.nBufferCountActual = port_def_type.nBufferCountMin; if (dataSize > port_def_type.nBufferSize) port_def_type.nBufferSize = dataSize; - log->debug(TAG, "Setting buf count actual: {}, buf size: {}", - port_def_type.nBufferCountActual, port_def_type.nBufferSize); +// log->debug(TAG, "Setting buf count actual: {}, buf size: {}", +// port_def_type.nBufferCountActual, port_def_type.nBufferSize); error = OMX_SetParameter(componentHandle, OMX_IndexParamPortDefinition, &port_def_type); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SetParameter in OMX_Image_Decode::prepareInputBuffers()", error); @@ -112,17 +112,18 @@ void OMX_Image_Decode::setFormat() OMX_ERRORTYPE error = OMX_SetParameter(componentHandle, OMX_IndexParamImagePortFormat, &ft_type); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SetParameter in OMX_Image_Decode::setFormat()", error); - log->debug(TAG, "setFormat OK"); +// log->debug(TAG, "setFormat OK"); } void OMX_Image_Decode::setSliceHeight(int newSliceHeight) { outputPortSettings.format.image.nSliceHeight = newSliceHeight; - log->debug(TAG, "nSliceHeight: {}", outputPortSettings.format.image.nSliceHeight); +// log->debug(TAG, "nSliceHeight: {}", outputPortSettings.format.image.nSliceHeight); OMX_ERRORTYPE error = OMX_SetParameter(componentHandle, OMX_IndexParamPortDefinition, &outputPortSettings); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SetParameter in OMX_Image_Decode::setSliceHeight()", error); + /* { // Dump new independant output settings OMX_PARAM_PORTDEFINITIONTYPE indTest; @@ -150,6 +151,7 @@ void OMX_Image_Decode::setSliceHeight(int newSliceHeight) log->debug(TAG, "nSliceHeight: {}", indTest.format.image.nSliceHeight); log->debug(TAG, "eColorFormat: {:#x}", indTest.format.image.eColorFormat); } + */ } void OMX_Image_Decode::allocateInputBuffers(char* data) @@ -157,7 +159,7 @@ void OMX_Image_Decode::allocateInputBuffers(char* data) inBuffer1 = NULL; inBuffer2 = NULL; - log->debug(TAG, "Calling OMX_UseBuffer"); +// log->debug(TAG, "Calling OMX_UseBuffer"); OMX_ERRORTYPE error = OMX_UseBuffer(componentHandle, &inBuffer1, inputPort, static_cast(0), dataSize, reinterpret_cast(data)); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_UseBuffer 1 in OMX_Image_Decode::allocateInputBuffers()", error); @@ -192,17 +194,17 @@ void OMX_Image_Decode::deallocateOutputBuffer() void OMX_Image_Decode::sendToInput() { - log->debug(TAG, "Starting sendToInput"); +// log->debug(TAG, "Starting sendToInput"); inBuffer1->nFilledLen = dataSize; inBuffer1->nOffset = 0; inBuffer1->nTimeStamp = { 0, 0 }; inBuffer1->pAppPrivate = static_cast(0); inBuffer1->nFlags |= OMX_BUFFERFLAG_EOS; - log->debug(TAG, "calling emptythisbuffer"); +// log->debug(TAG, "calling emptythisbuffer"); OMX_ERRORTYPE error = OMX_EmptyThisBuffer(componentHandle, inBuffer1); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_EmptyThisBuffer in OMX_Image_Decode::sendToInput()", error); - log->debug(TAG, "sendToInput done"); +// log->debug(TAG, "sendToInput done"); } void OMX_Image_Decode::waitForOutputPortSettingsChange() @@ -230,7 +232,7 @@ void OMX_Image_Decode::waitForOutputPortSettingsChange() } // The event processor thread received an event and saved it here - log->debug(TAG, "received outputportsettingschanged event!"); +// log->debug(TAG, "received outputportsettingschanged event!"); delete eventWaiter->receivedEvent; delete eventWaiter; @@ -238,10 +240,10 @@ void OMX_Image_Decode::waitForOutputPortSettingsChange() outputPortSettings.nSize = sizeof(outputPortSettings); outputPortSettings.nVersion.nVersion = OMX_VERSION; outputPortSettings.nPortIndex = outputPort; - OMX_ERRORTYPE error = OMX_GetParameter(componentHandle, OMX_IndexParamPortDefinition, &outputPortSettings); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_GetParameter in OMX_Image_Decode::waitForOutputPortSettingsChange()", error); +/* log->debug(TAG, "Port def type from outputPort"); log->debug(TAG, "buffer count actual: {}", outputPortSettings.nBufferCountActual); log->debug(TAG, "eDir: {}", outputPortSettings.eDir); @@ -256,6 +258,7 @@ void OMX_Image_Decode::waitForOutputPortSettingsChange() log->debug(TAG, "nFrameHeight: {}", outputPortSettings.format.image.nFrameHeight); log->debug(TAG, "nStride: {}", outputPortSettings.format.image.nStride); log->debug(TAG, "nSliceHeight: {}", outputPortSettings.format.image.nSliceHeight); + */ } void OMX_Image_Decode::receiveFromOutput(char** data, int* nFlags) @@ -274,19 +277,19 @@ void OMX_Image_Decode::receiveFromOutput(char** data, int* nFlags) std::unique_lock ul(bufferWithOutputPort->mutex); - log->debug(TAG, "calling fillthisbuffer. bufhead: {}, BufferWithOutput: {}", static_cast(outputBufferHeader), static_cast(bufferWithOutputPort)); +// log->debug(TAG, "calling fillthisbuffer. bufhead: {}, BufferWithOutput: {}", static_cast(outputBufferHeader), static_cast(bufferWithOutputPort)); OMX_ERRORTYPE error; error = OMX_FillThisBuffer(componentHandle, outputBufferHeader); if (error != OMX_ErrorNone) throw OMX_Exception("OMX_FillThisBuffer in OMX_Image_Decode::receiveFromOutput()", error); - log->debug(TAG, "called fillthisbuffer. bufsize = {}", outputPortSettings.nBufferSize); +// log->debug(TAG, "called fillthisbuffer. bufsize = {}", outputPortSettings.nBufferSize); bufferWithOutputPort->cond.wait(ul, [bufferWithOutputPort] { return bufferWithOutputPort->done; }); ul.unlock(); - log->debug(TAG, "receiveFromOutputPort signalled"); +// log->debug(TAG, "receiveFromOutputPort signalled"); *data = static_cast(outputBufferMem); // caller takes ownership *nFlags = outputBufferHeader->nFlags; @@ -295,6 +298,7 @@ void OMX_Image_Decode::receiveFromOutput(char** data, int* nFlags) // The slice height is all important - can't trust nFilledLen + /* log->debug(TAG, "receiveFromOutput:"); log->debug(TAG, " nSize = {}", outputBufferHeader->nSize); log->debug(TAG, " nAllocLen = {}", outputBufferHeader->nAllocLen); @@ -303,6 +307,7 @@ void OMX_Image_Decode::receiveFromOutput(char** data, int* nFlags) log->debug(TAG, " nInputPortIndex = {}", outputBufferHeader->nInputPortIndex); log->debug(TAG, " nOutputPortIndex = {}", outputBufferHeader->nOutputPortIndex); log->debug(TAG, " nFlags = {:#x}", outputBufferHeader->nFlags); + */ delete bufferWithOutputPort; } @@ -327,6 +332,7 @@ void OMX_Image_Decode::getImageInfo(int* width, int* height, int* stride, int* s OMX_ERRORTYPE OMX_Image_Decode::cb_EmptyBufferDone(OMX_IN OMX_HANDLETYPE /*hcomp*/, OMX_IN OMX_PTR /*appdata*/, OMX_IN OMX_BUFFERHEADERTYPE* buffer) { + /* log->debug(TAG, "CB: EmptyBufferDone"); log->debug(TAG, " nSize = {}", buffer->nSize); log->debug(TAG, " nAllocLen = {}", buffer->nAllocLen); @@ -335,13 +341,13 @@ OMX_ERRORTYPE OMX_Image_Decode::cb_EmptyBufferDone(OMX_IN OMX_HANDLETYPE /*hcomp log->debug(TAG, " nInputPortIndex = {}", buffer->nInputPortIndex); log->debug(TAG, " nOutputPortIndex = {}", buffer->nOutputPortIndex); log->debug(TAG, " nFlags = {:#x}", buffer->nFlags); - + */ return OMX_ErrorNone; } OMX_ERRORTYPE OMX_Image_Decode::cb_FillBufferDone(OMX_IN OMX_HANDLETYPE hcomp, OMX_IN OMX_PTR appdata, OMX_IN OMX_BUFFERHEADERTYPE* buffer) { - log->debug(TAG, "CB: FillBufferDone, handle: {}, appdata: {}, buffer: {}", static_cast(hcomp), static_cast(appdata), static_cast(buffer)); +// log->debug(TAG, "CB: FillBufferDone, handle: {}, appdata: {}, buffer: {}", static_cast(hcomp), static_cast(appdata), static_cast(buffer)); struct BufferWithOutputPort* bufferWithOutputPort = static_cast(buffer->pAppPrivate); bufferWithOutputPort->mutex.lock(); diff --git a/osdvector.cc b/osdvector.cc index 97af092..e34fac5 100644 --- a/osdvector.cc +++ b/osdvector.cc @@ -990,7 +990,7 @@ void OsdVector::PictureReader::removeDecoder(PictureDecoder* decoder) void OsdVector::PictureReader::threadMethod() { OsdVector* osdvector = dynamic_cast(Osd::getInstance()); - LogNT::getInstance()->debug("PictureReader", "TVMedia Start Picture Reader"); +// LogNT::getInstance()->debug("PictureReader", "TVMedia Start Picture Reader"); std::unique_lock ul(threadMutex); // locked @@ -999,7 +999,7 @@ void OsdVector::PictureReader::threadMethod() threadCond.wait(ul, [this]{ return threadReqQuit || runLoop; }); // locked if (threadReqQuit) return; // unlock - LogNT::getInstance()->debug("PictureReader", "Running loop"); +// LogNT::getInstance()->debug("PictureReader", "Running loop"); runLoop = false; ul.unlock(); @@ -1027,7 +1027,7 @@ void OsdVector::PictureReader::threadMethod() if (processReceivedPictures()) miniRunAgain = true; decoders_lock.unlock(); - LogNT::getInstance()->debug("PictureReader", "miniRunAgain = true..."); +// LogNT::getInstance()->debug("PictureReader", "miniRunAgain = true..."); } while(miniRunAgain); -- 2.39.5