2 Copyright 2004-2005 Chris Tallon, 2009,2012, 2014 Marten Richter
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/>.
26 #include <sys/ioctl.h>
30 #include <EGL/eglext.h>
33 #include "osdvector.h"
37 class EGLPictureCreator {
39 virtual bool getEGLPicture(struct OsdVector::PictureInfo & info, EGLDisplay * display ) = 0;
44 class ImageOMX : public OsdVector::PictureDecoder
46 friend class VideoOMX;
48 ImageOMX(OsdVector::PictureReader * treader);
54 unsigned char* decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, bool freemem);
55 bool getDecodedPicture(struct OsdVector::PictureInfo& pict_inf);
56 void freeReference(void * ref);
60 static OMX_ERRORTYPE EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp,OMX_IN OMX_PTR appdata,OMX_IN OMX_BUFFERHEADERTYPE* bulibaver);
61 static OMX_ERRORTYPE FillBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp, OMX_IN OMX_PTR appdata,OMX_IN OMX_BUFFERHEADERTYPE* bulibaver);
64 bool intDecodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, EGLPictureCreator* egl_pict, VideoOMX *video);
66 void ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* bulibaver);
67 void ReturnFillOMXBuffer(OMX_BUFFERHEADERTYPE* buffer);
70 OMX_HANDLETYPE omx_imag_decode;
71 OMX_HANDLETYPE omx_egl_render;
73 OMX_U32 omx_image_input_port;
74 OMX_U32 omx_image_output_port;
76 OMX_U32 omx_egl_input_port;
77 OMX_U32 omx_egl_output_port;
80 int AllocateCodecsOMX( unsigned char * buffer, unsigned int length);
81 int DeAllocateCodecsOMX();
83 int PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsigned int length);
84 int DestroyInputBufsOMX();
85 int DestroyInputBufsOMXwhilePlaying();
93 enum ImageFormats curformat;
97 std::vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
98 std::list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
99 //list<OMX_BUFFERHEADERTYPE*> output_bufs_omx_full;
100 std::mutex input_bufs_omx_mutex;
103 bool omx_first_frame;
106 OMX_BUFFERHEADERTYPE *buf_head_egl;
110 char L_VPE_OMX_IMAGE_DECODER[128];
111 char L_VPE_OMX_EGL_REND[128];
114 OsdVector::PictureInfo pictInf;