RDK Documentation (Open Sourced RDK Components)
AampcliShader.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2022 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 /**
21  * @file AampcliShader.h
22  * @brief AampcliShader header file
23  */
24 
25 #ifndef AAMPCLISHADER_H
26 #define AAMPCLISHADER_H
27 
28 #include <mutex>
29 #include "AampDefine.h"
30 
31 #ifdef RENDER_FRAMES_IN_APP_CONTEXT
32 #ifdef __APPLE__
33 #define GL_SILENCE_DEPRECATION
34 #include <OpenGL/gl3.h>
35 #include <GLUT/glut.h>
36 #else //Linux
37 #include <GL/glew.h>
38 #include <GL/gl.h>
39 #include <GL/freeglut.h>
40 #endif
41 #include <glm/glm.hpp>
42 #include <glm/gtc/matrix_transform.hpp>
43 #include <glm/gtc/type_ptr.hpp>
44 #endif
45 
46 
47 #ifdef RENDER_FRAMES_IN_APP_CONTEXT
48 #define ATTRIB_VERTEX 0
49 #define ATTRIB_TEXTURE 1
50 #endif
51 
52 
53 #ifdef RENDER_FRAMES_IN_APP_CONTEXT
54 typedef struct{
55  int width = 0;
56  int height = 0;
57  uint8_t *yuvBuffer = NULL;
58 }AppsinkData;
59 
60 class Shader
61 {
62  public:
63  static const int FPS = 60;
64  static AppsinkData appsinkData;
65  static std::mutex appsinkData_mutex;
66  static GLuint mProgramID;
67  static GLuint id_y, id_u, id_v; // texture id
68  static GLuint textureUniformY, textureUniformU,textureUniformV;
69  static GLuint _vertexArray;
70  static GLuint _vertexBuffer[2];
71  static GLfloat currentAngleOfRotation;
72 
73  GLuint LoadShader(GLenum type);
74  void InitShaders();
75  static void glRender(void);
76  static void updateYUVFrame(uint8_t *buffer, int size, int width, int height);
77  static void timer(int v);
78 };
79 #endif
80 
81 #endif // AAMPCLISHADER_H
AampDefine.h
Macros for Aamp.