From 93d3e8cce67a51f00c98a68b4849658fe600d98c Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Mon, 15 Nov 2021 17:07:38 +0000 Subject: [PATCH] 61 CWFs --- omx/omx.cc | 17 ++++++++++++++- omx/omxeglrender.cc | 40 ++++++++++++++++++++++++++++++++++-- omx/omximagedecode.cc | 48 ++++++++++++++++++++++++++++++++++++++++--- osdvector.h | 2 +- 4 files changed, 100 insertions(+), 7 deletions(-) diff --git a/omx/omx.cc b/omx/omx.cc index a63200f..2c18f3e 100644 --- a/omx/omx.cc +++ b/omx/omx.cc @@ -23,7 +23,7 @@ #include "omx.h" -static const char* TAG = "OMX"; +//static const char* TAG = "OMX"; // Static variable storage @@ -372,7 +372,10 @@ void OMX::enablePort(OMX_U32 port, bool enable, bool wait) pdt.nSize = sizeof(pdt); pdt.nVersion.nVersion = OMX_VERSION; pdt.nPortIndex = port; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" error = OMX_GetParameter(componentHandle, OMX_IndexParamPortDefinition, &pdt); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_GetParameter in OMX::enablePort()", error); if (pdt.bEnabled == enable) return; // already in requested state @@ -382,7 +385,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); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" error = OMX_SendCommand(componentHandle, command, port, 0); + #pragma GCC diagnostic pop 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); @@ -418,7 +424,10 @@ void OMX::enablePort(OMX_U32 port, bool enable, bool wait) void OMX::changeState(OMX_STATETYPE reqState, bool wait) { OMX_STATETYPE currentState; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_GetState(componentHandle, ¤tState); + #pragma GCC diagnostic pop // log->debug(TAG, "Current state: {}", currentState); if (currentState == reqState) { @@ -427,7 +436,10 @@ void OMX::changeState(OMX_STATETYPE reqState, bool wait) } std::unique_lock ul(eventWaitersMutex); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_SendCommand(componentHandle, OMX_CommandStateSet, reqState, 0); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SendCommand in OMX::changeState()", error); EventWaiter* eventWaiter = new EventWaiter(); @@ -462,7 +474,10 @@ void OMX::flushCommands(OMX_U32 port, bool wait) { std::unique_lock ul(eventWaitersMutex); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_SendCommand(componentHandle, OMX_CommandFlush, port, NULL); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SendCommand in OMX::flushCommands()", error); EventWaiter* eventWaiter = new EventWaiter(); diff --git a/omx/omxeglrender.cc b/omx/omxeglrender.cc index 87cb866..f5e0f8d 100644 --- a/omx/omxeglrender.cc +++ b/omx/omxeglrender.cc @@ -59,7 +59,10 @@ bool OMX_EGL_Render::init() p_param.nSize = sizeof(p_param); p_param.nVersion.nVersion = OMX_VERSION; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" error = OMX_GetParameter(componentHandle, OMX_IndexParamVideoInit, &p_param); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) return false; inputPort = p_param.nStartPortNumber; @@ -98,7 +101,10 @@ void OMX_EGL_Render::prepareInputPort(OMX_U32 frameWidth, OMX_U32 frameHeight, O portConfig.nVersion.nVersion = OMX_VERSION; portConfig.nPortIndex = inputPort; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_GetParameter(componentHandle, OMX_IndexParamPortDefinition, &portConfig); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_GetParameter in OMX_EGL_Render::prepareInputPort()", error); /* @@ -126,7 +132,10 @@ void OMX_EGL_Render::prepareInputPort(OMX_U32 frameWidth, OMX_U32 frameHeight, O // 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); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" error = OMX_SetParameter(componentHandle, OMX_IndexParamPortDefinition, &portConfig); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SetParameter in OMX_EGL_Render::prepareInputPort()", error); // printPortSettings(false); @@ -140,13 +149,19 @@ void OMX_EGL_Render::prepareOutputPort(EGLDisplay egldisplay) port_def_type.nVersion.nVersion = OMX_VERSION; port_def_type.nPortIndex = outputPort; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_GetParameter(componentHandle, OMX_IndexParamPortDefinition, &port_def_type); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_GetParameter in OMX_EGL_Render::prep()", error); port_def_type.nBufferCountActual = 1; port_def_type.format.video.pNativeWindow = egldisplay; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" error = OMX_SetParameter(componentHandle, OMX_IndexParamPortDefinition, &port_def_type); // set port def: buffer count actual = 1 + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SetParameter in OMX_EGL_Render::prep()", error); } @@ -155,7 +170,10 @@ void OMX_EGL_Render::allocateInputBuffers(char* data) inBuffer1 = NULL; // log->debug(TAG, "Calling OMX_UseBuffer with data = {}", static_cast(data)); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_UseBuffer(componentHandle, &inBuffer1, inputPort, static_cast(0), inputPortBufferSize, reinterpret_cast(data)); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_UseBuffer in OMX_EGL_Render::allocateInputBuffers()", error); /* @@ -175,7 +193,10 @@ void OMX_EGL_Render::allocateInputBuffers(char* data) void OMX_EGL_Render::allocateEGLImageKHR(EGLImageKHR eglimagekhr) { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_UseEGLImage(componentHandle, &eglRenderOutputBufferHeader, outputPort, this, static_cast(eglimagekhr)); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_UseEGLImage in OMX_EGL_Render::allocateEGLImageKHR()", error); // printPortSettings(true); @@ -183,7 +204,10 @@ void OMX_EGL_Render::allocateEGLImageKHR(EGLImageKHR eglimagekhr) void OMX_EGL_Render::deallocateInputBuffers() { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_FreeBuffer(componentHandle, inputPort, inBuffer1); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_FreeBuffer in OMX_EGL_Render::deallocateInputBuffers()", error); inBuffer1 = NULL; @@ -191,7 +215,10 @@ void OMX_EGL_Render::deallocateInputBuffers() void OMX_EGL_Render::deallocateEGLImageKHR() { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_FreeBuffer(componentHandle, outputPort, eglRenderOutputBufferHeader); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_FreeBuffer in OMX_EGL_Render::deallocateEGLImageKHR()", error); eglRenderOutputBufferHeader = NULL; @@ -209,7 +236,10 @@ void OMX_EGL_Render::sendToInput(char* data, int dataSize) inBuffer1->pBuffer = reinterpret_cast(data); // log->debug(TAG, "calling emptythisbuffer"); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_EmptyThisBuffer(componentHandle, inBuffer1); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_EmptyThisBuffer in OMX_EGL_Render::sendToInput()", error); // log->debug(TAG, "sendToInput done"); } @@ -240,7 +270,10 @@ void OMX_EGL_Render::render() // log->debug(TAG, "calling fillthisbuffer. bufhead: {}, BufferWithOutput: {}", static_cast(eglRenderOutputBufferHeader), static_cast(bufferWithOutputPort)); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_FillThisBuffer(componentHandle, eglRenderOutputBufferHeader); + #pragma GCC diagnostic pop 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)); @@ -294,7 +327,10 @@ void OMX_EGL_Render::printPortSettings(bool which) portSettings.nPortIndex = inputPort; } + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_GetParameter(componentHandle, OMX_IndexParamPortDefinition, &portSettings); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_GetParameter in OMX_EGL_Render::printPortSettings()", error); log->debug(TAG, " nPortIndex: {}", portSettings.nPortIndex); @@ -316,7 +352,7 @@ void OMX_EGL_Render::printPortSettings(bool which) log->debug(TAG, " eColorFormat: {:#x}", portSettings.format.video.eColorFormat); } -OMX_ERRORTYPE OMX_EGL_Render::cb_EmptyBufferDone(OMX_IN OMX_HANDLETYPE /*hcomp*/, OMX_IN OMX_PTR /*appdata*/, OMX_IN OMX_BUFFERHEADERTYPE* buffer) +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"); @@ -331,7 +367,7 @@ OMX_ERRORTYPE OMX_EGL_Render::cb_EmptyBufferDone(OMX_IN OMX_HANDLETYPE /*hcomp*/ 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) +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)); diff --git a/omx/omximagedecode.cc b/omx/omximagedecode.cc index f8334d6..f9b531a 100644 --- a/omx/omximagedecode.cc +++ b/omx/omximagedecode.cc @@ -21,7 +21,7 @@ #include "omximagedecode.h" -static const char* TAG = "OMX_Image_Decode"; +// static const char* TAG = "OMX_Image_Decode"; OMX_Image_Decode::OMX_Image_Decode() { @@ -54,7 +54,10 @@ bool OMX_Image_Decode::init() p_param.nSize = sizeof(p_param); p_param.nVersion.nVersion = OMX_VERSION; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" error = OMX_GetParameter(componentHandle, OMX_IndexParamImageInit, &p_param); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) return false; inputPort = p_param.nStartPortNumber; @@ -81,7 +84,10 @@ void OMX_Image_Decode::prepareInputBuffers(int tdataSize) port_def_type.nVersion.nVersion = OMX_VERSION; port_def_type.nPortIndex = inputPort; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_GetParameter(componentHandle, OMX_IndexParamPortDefinition, &port_def_type); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_GetParameter in OMX_Image_Decode::prepareInputBuffers()", error); // log->debug(TAG, "Defaults: bufferCountActual: {}, bufferCountMin: {}, nBufferSize: {}", @@ -93,7 +99,10 @@ void OMX_Image_Decode::prepareInputBuffers(int tdataSize) // log->debug(TAG, "Setting buf count actual: {}, buf size: {}", // port_def_type.nBufferCountActual, port_def_type.nBufferSize); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" error = OMX_SetParameter(componentHandle, OMX_IndexParamPortDefinition, &port_def_type); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SetParameter in OMX_Image_Decode::prepareInputBuffers()", error); } @@ -110,7 +119,10 @@ void OMX_Image_Decode::setFormat() // only outputs JPEG decoded images in YUV420, because of course it does. // ft_type.eCompressionFormat = OMX_IMAGE_CodingJPEG; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_SetParameter(componentHandle, OMX_IndexParamImagePortFormat, &ft_type); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SetParameter in OMX_Image_Decode::setFormat()", error); // log->debug(TAG, "setFormat OK"); } @@ -120,7 +132,10 @@ void OMX_Image_Decode::setSliceHeight(int newSliceHeight) outputPortSettings.format.image.nSliceHeight = newSliceHeight; // log->debug(TAG, "nSliceHeight: {}", outputPortSettings.format.image.nSliceHeight); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_SetParameter(componentHandle, OMX_IndexParamPortDefinition, &outputPortSettings); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_SetParameter in OMX_Image_Decode::setSliceHeight()", error); /* @@ -160,34 +175,52 @@ void OMX_Image_Decode::allocateInputBuffers(char* data) inBuffer2 = NULL; // log->debug(TAG, "Calling OMX_UseBuffer"); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_UseBuffer(componentHandle, &inBuffer1, inputPort, static_cast(0), dataSize, reinterpret_cast(data)); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_UseBuffer 1 in OMX_Image_Decode::allocateInputBuffers()", error); // Hardcoded assumption - image_decode has min 2 input buffers + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" error = OMX_UseBuffer(componentHandle, &inBuffer2, inputPort, static_cast(0), 0, NULL); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_UseBuffer 2 in OMX_Image_Decode::allocateInputBuffers()", error); } void OMX_Image_Decode::allocateOutputBuffer() { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_UseBuffer(componentHandle, &outputBufferHeader, outputPort, static_cast(0), outputPortSettings.nBufferSize, (OMX_U8*)NULL); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_UseBuffer in OMX_Image_Decode::allocateOutputBuffer()", error); } void OMX_Image_Decode::deallocateInputBuffers() { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_FreeBuffer(componentHandle, inputPort, inBuffer1); + #pragma GCC diagnostic pop inBuffer1 = NULL; if (error != OMX_ErrorNone) throw OMX_Exception("OMX_FreeBuffer 1 in OMX_Image_Decode::deallocateInputBuffers()", error); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" error = OMX_FreeBuffer(componentHandle, inputPort, inBuffer2); + #pragma GCC diagnostic pop inBuffer2 = NULL; if (error != OMX_ErrorNone) throw OMX_Exception("OMX_FreeBuffer 2 in OMX_Image_Decode::deallocateInputBuffers()", error); } void OMX_Image_Decode::deallocateOutputBuffer() { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_FreeBuffer(componentHandle, outputPort, outputBufferHeader); + #pragma GCC diagnostic pop outputBufferHeader = NULL; if (error != OMX_ErrorNone) throw OMX_Exception("OMX_FreeBuffer in OMX_Image_Decode::deallocateOutputBuffer()", error); } @@ -202,7 +235,10 @@ void OMX_Image_Decode::sendToInput() inBuffer1->nFlags |= OMX_BUFFERFLAG_EOS; // log->debug(TAG, "calling emptythisbuffer"); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_EmptyThisBuffer(componentHandle, inBuffer1); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_EmptyThisBuffer in OMX_Image_Decode::sendToInput()", error); // log->debug(TAG, "sendToInput done"); } @@ -240,7 +276,10 @@ void OMX_Image_Decode::waitForOutputPortSettingsChange() outputPortSettings.nSize = sizeof(outputPortSettings); outputPortSettings.nVersion.nVersion = OMX_VERSION; outputPortSettings.nPortIndex = outputPort; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" OMX_ERRORTYPE error = OMX_GetParameter(componentHandle, OMX_IndexParamPortDefinition, &outputPortSettings); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_GetParameter in OMX_Image_Decode::waitForOutputPortSettingsChange()", error); /* @@ -281,7 +320,10 @@ void OMX_Image_Decode::receiveFromOutput(char** data, int* nFlags) OMX_ERRORTYPE error; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wold-style-cast" error = OMX_FillThisBuffer(componentHandle, outputBufferHeader); + #pragma GCC diagnostic pop if (error != OMX_ErrorNone) throw OMX_Exception("OMX_FillThisBuffer in OMX_Image_Decode::receiveFromOutput()", error); // log->debug(TAG, "called fillthisbuffer. bufsize = {}", outputPortSettings.nBufferSize); @@ -330,7 +372,7 @@ void OMX_Image_Decode::getImageInfo(int* width, int* height, int* stride, int* s *sliceHeight = outputPortSettings.format.image.nSliceHeight; } -OMX_ERRORTYPE OMX_Image_Decode::cb_EmptyBufferDone(OMX_IN OMX_HANDLETYPE /*hcomp*/, OMX_IN OMX_PTR /*appdata*/, OMX_IN OMX_BUFFERHEADERTYPE* buffer) +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"); @@ -345,7 +387,7 @@ OMX_ERRORTYPE OMX_Image_Decode::cb_EmptyBufferDone(OMX_IN OMX_HANDLETYPE /*hcomp 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) +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)); diff --git a/osdvector.h b/osdvector.h index cdf4fe5..4b7ae5f 100644 --- a/osdvector.h +++ b/osdvector.h @@ -286,7 +286,7 @@ class OsdVector : public Osd, public MessageReceiver class PictureDecoder { public: - PictureDecoder(PictureReader* treader) {/* reader = treader; */}; + PictureDecoder(PictureReader* /*treader*/) {/* reader = treader; */}; virtual ~PictureDecoder() {}; // its is always guaranted, that after getDecodedPicture a call to decodePicture follows, if the return value was true; -- 2.39.5