2 Copyright 2021 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP. If not, see <https://www.gnu.org/licenses/>.
20 #ifndef OMXEGLRENDER_H
21 #define OMXEGLRENDER_H
23 #include <VG/openvg.h>
25 #include <EGL/eglext.h>
29 class OMX_EGL_Render : public OMX
35 virtual ~OMX_EGL_Render();
40 void prepareInputPort(OMX_U32 frameWidth, OMX_U32 frameHeight, OMX_U32 stride); // throws
41 void prepareOutputPort(EGLDisplay egldisplay); // throws
43 void allocateInputBuffers(char* buffer); // throws
44 void allocateEGLImageKHR(EGLImageKHR eglimagekhr); // throws
46 void deallocateInputBuffers(); // throws
47 void deallocateEGLImageKHR(); // throws
49 void sendToInput(char* data, int dataSize); // throws
50 void render(); // throws
52 void printPortSettings(bool which); // throws
54 // Buffers callback overrides
56 OMX_ERRORTYPE cb_FillBufferDone(
57 OMX_IN OMX_HANDLETYPE handle, OMX_IN OMX_PTR appdata, OMX_IN OMX_BUFFERHEADERTYPE* buffer) override;
59 OMX_ERRORTYPE cb_EmptyBufferDone(
60 OMX_IN OMX_HANDLETYPE handle, OMX_IN OMX_PTR appdata, OMX_IN OMX_BUFFERHEADERTYPE* buffer) override;
62 void enableInput(bool wait = true) { enablePort(inputPort, true, wait); } // throws
63 void disableInput(bool wait = true) { enablePort(inputPort, false, wait); } // throws
64 void enableOutput(bool wait = true) { enablePort(outputPort, true, wait); } // throws
65 void disableOutput(bool wait = true) { enablePort(outputPort, false, wait); } // throws
66 void flushInputCommands(bool wait = true) { flushCommands(inputPort, wait); } // throws
67 void flushOutputCommands(bool wait = true) { flushCommands(outputPort, wait); } // throws
74 OMX_BUFFERHEADERTYPE* inBuffer1 = NULL;
75 OMX_BUFFERHEADERTYPE* eglRenderOutputBufferHeader;
77 int inputPortBufferSize{};