]> git.vomp.tv Git - vompclient.git/blob - imageomx.h
More compiler warning fixes
[vompclient.git] / imageomx.h
1 /*
2     Copyright 2004-2005 Chris Tallon, 2009,2012, 2014 Marten Richter
3
4     This file is part of VOMP.
5
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.
10
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.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #ifndef IMAGEOMX_H
22 #define IMAGEOMX_H
23
24 #include <stdio.h>
25 #include <unistd.h>
26 #include <fcntl.h>
27 #include <sys/ioctl.h>
28
29 #include <EGL/egl.h>
30 #include <EGL/eglext.h>
31
32 #include "defines.h"
33 #include "osdvector.h"
34 #include "videoomx.h"
35
36
37 class EGLPictureCreator {
38 public:
39         virtual bool getEGLPicture(struct OsdVector::PictureInfo & info, EGLDisplay * display ) = 0;
40 };
41
42
43
44 class ImageOMX : public OsdVector::PictureDecoder
45 {
46   friend class VideoOMX;
47   public:
48     ImageOMX(OsdVector::PictureReader * treader);
49     virtual ~ImageOMX();
50
51     void init();
52     void shutdown();
53
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);
57
58   private:
59
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);
62
63
64         bool intDecodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, EGLPictureCreator* egl_pict, VideoOMX *video);
65
66     void ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* bulibaver);
67     void ReturnFillOMXBuffer(OMX_BUFFERHEADERTYPE* buffer);
68
69
70         OMX_HANDLETYPE omx_imag_decode;
71         OMX_HANDLETYPE omx_egl_render;
72
73         OMX_U32 omx_image_input_port;
74         OMX_U32 omx_image_output_port;
75
76         OMX_U32 omx_egl_input_port;
77         OMX_U32 omx_egl_output_port;
78
79
80         int AllocateCodecsOMX( unsigned char * buffer, unsigned int length);
81         int DeAllocateCodecsOMX();
82
83         int PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsigned int length);
84         int DestroyInputBufsOMX();
85         int DestroyInputBufsOMXwhilePlaying();
86
87         enum ImageFormats {
88                 Unsupported,
89                 Jpeg,
90                 PNG
91         };
92
93         enum ImageFormats curformat;
94
95
96
97         vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
98         list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
99         //list<OMX_BUFFERHEADERTYPE*> output_bufs_omx_full;
100         Mutex input_bufs_omx_mutex;
101
102     bool omx_running;
103     bool omx_first_frame;
104     bool omx_egl_filled;
105
106     OMX_BUFFERHEADERTYPE *buf_head_egl;
107
108     int initted;
109
110     char L_VPE_OMX_IMAGE_DECODER[128];
111     char L_VPE_OMX_EGL_REND[128];
112
113   protected:
114       OsdVector::PictureInfo pictInf;
115           bool pictInfValid;
116
117 };
118
119 #endif