1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef VIDEOTEX_H
17 #define VIDEOTEX_H
18 
19 #include "BaseRenderCallback.h"
20 #include "StreamHandler.h"
21 #include "TexWrapper.h"
22 
23 #include <EGL/egl.h>
24 #include <EGL/eglext.h>
25 #include <GLES2/gl2.h>
26 #include <GLES2/gl2ext.h>
27 #include <GLES3/gl3.h>
28 #include <GLES3/gl3ext.h>
29 #include <android/hardware/automotive/evs/1.0/IEvsEnumerator.h>
30 
31 namespace android {
32 namespace automotive {
33 namespace evs {
34 namespace support {
35 
36 using ::android::hardware::automotive::evs::V1_0::BufferDesc;
37 
38 class VideoTex : public TexWrapper {
39 public:
40     VideoTex() = delete;
41     VideoTex(EGLDisplay glDisplay);
42     virtual ~VideoTex();
43 
44     // returns true if the texture contents were updated
45     bool refresh(const BufferDesc& imageBuffer);
46 
47 private:
48     EGLDisplay mDisplay;
49     EGLImageKHR mKHRimage = EGL_NO_IMAGE_KHR;
50 };
51 }  // namespace support
52 }  // namespace evs
53 }  // namespace automotive
54 }  // namespace android
55 
56 #endif  // VIDEOTEX_H
57