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 OMXIMAGEDECODE_H
21 #define OMXIMAGEDECODE_H
25 class OMX_Image_Decode : public OMX
31 virtual ~OMX_Image_Decode();
36 void prepareInputBuffers(int dataSize); // throws
37 void setFormat(); // throws
38 void setSliceHeight(int sliceHeight); // throws
40 void allocateInputBuffers(char* data); // throws
41 void allocateOutputBuffer();
43 void deallocateInputBuffers(); // throws
44 void deallocateOutputBuffer(); // throws
46 void sendToInput(); // throws
48 void waitForOutputPortSettingsChange(); // throws
49 void receiveFromOutput(char** data, int* nFlags); // throws // caller frees data
50 void getImageInfo(int* width, int* height, int* stride, int* sliceHeight);
52 void enableInput(bool wait = true) { enablePort(inputPort, true, wait); } // throws
53 void disableInput(bool wait = true) { enablePort(inputPort, false, wait); } // throws
54 void enableOutput(bool wait = true) { enablePort(outputPort, true, wait); } // throws
55 void disableOutput(bool wait = true) { enablePort(outputPort, false, wait); } // throws
56 void flushInputCommands(bool wait = true) { flushCommands(inputPort, wait); }
57 void flushOutputCommands(bool wait = true) { flushCommands(outputPort, wait); }
59 // Buffers callback overrides
61 OMX_ERRORTYPE cb_FillBufferDone(
62 OMX_IN OMX_HANDLETYPE handle, OMX_IN OMX_PTR appdata, OMX_IN OMX_BUFFERHEADERTYPE* buffer) override;
64 OMX_ERRORTYPE cb_EmptyBufferDone(
65 OMX_IN OMX_HANDLETYPE handle, OMX_IN OMX_PTR appdata, OMX_IN OMX_BUFFERHEADERTYPE* buffer) override;
71 OMX_BUFFERHEADERTYPE* inBuffer1{};
72 OMX_BUFFERHEADERTYPE* inBuffer2{};
74 unsigned int dataSize{};
76 OMX_PARAM_PORTDEFINITIONTYPE outputPortSettings;
78 OMX_BUFFERHEADERTYPE* outputBufferHeader{};