Commit fea39c18 authored by Ronan's avatar Ronan
Browse files

Merge commit 'd1e6b825'

parents 1c8e0703 d1e6b825
......@@ -50,6 +50,7 @@ set(HEADER_FILES
msitc.h
msjava.h
msjpegwriter.h
msogl.h
msmediaplayer.h
msqueue.h
msrtp.h
......
......@@ -28,6 +28,7 @@ mediastreamer2_include_HEADERS=allfilters.h \
msgenericplc.h \
msinterfaces.h \
msitc.h \
msogl.h \
msjava.h \
msjpegwriter.h \
msmediaplayer.h \
......@@ -57,4 +58,3 @@ mediastreamer2_include_HEADERS=allfilters.h \
msudp.h
EXTRA_DIST=$(mediastreamer2_include_HEADERS)
......@@ -96,9 +96,6 @@ struct _MSVideoDisplayDecodingSupport {
#define MS_VIDEO_DISPLAY_SET_DEVICE_ORIENTATION \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,11,int)
#define MS_VIDEO_DISPLAY_CALL_GENERIC_RENDER \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,12,void*)
/**
* Interface definitions for players
**/
......
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef msogl_h
#define msogl_h
#ifdef __IOS
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#elif defined(__APPLE__)
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#elif defined(ANDROID)
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#elif defined(_WIN32)
#include <windows.h>
#include <GL/gl.h>
#elif !defined(QOPENGLFUNCTIONS_H) // glew is already included by QT.
#include <GL/glew.h>
#endif
// =============================================================================
typedef void (*resolveGlActiveTexture)(GLenum texture);
typedef void (*resolveGlAttachShader)(GLuint program, GLuint shader);
typedef void (*resolveGlBindAttribLocation)(GLuint program, GLuint index, const char *name);
typedef void (*resolveGlBindBuffer)(GLenum target, GLuint buffer);
typedef void (*resolveGlBindFramebuffer)(GLenum target, GLuint framebuffer);
typedef void (*resolveGlBindRenderbuffer)(GLenum target, GLuint renderbuffer);
typedef void (*resolveGlBindTexture)(GLenum target, GLuint texture);
typedef void (*resolveGlBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef void (*resolveGlBlendEquation)(GLenum mode);
typedef void (*resolveGlBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
typedef void (*resolveGlBlendFunc)(GLenum sfactor, GLenum dfactor);
typedef void (*resolveGlBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
typedef void (*resolveGlBufferData)(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
typedef void (*resolveGlBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
typedef GLenum (*resolveGlCheckFramebufferStatus)(GLenum target);
typedef void (*resolveGlClear)(GLbitfield mask);
typedef void (*resolveGlClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef void (*resolveGlClearDepthf)(GLclampf depth);
typedef void (*resolveGlClearStencil)(GLint s);
typedef void (*resolveGlColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
typedef void (*resolveGlCompileShader)(GLuint shader);
typedef void (*resolveGlCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
typedef void (*resolveGlCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
typedef void (*resolveGlCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
typedef void (*resolveGlCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
typedef GLuint (*resolveGlCreateProgram)(void);
typedef GLuint (*resolveGlCreateShader)(GLenum type);
typedef void (*resolveGlCullFace)(GLenum mode);
typedef void (*resolveGlDeleteBuffers)(GLsizei n, const GLuint *buffers);
typedef void (*resolveGlDeleteFramebuffers)(GLsizei n, const GLuint *framebuffers);
typedef void (*resolveGlDeleteProgram)(GLuint program);
typedef void (*resolveGlDeleteRenderbuffers)(GLsizei n, const GLuint *renderbuffers);
typedef void (*resolveGlDeleteShader)(GLuint shader);
typedef void (*resolveGlDeleteTextures)(GLsizei n, const GLuint *textures);
typedef void (*resolveGlDepthFunc)(GLenum func);
typedef void (*resolveGlDepthMask)(GLboolean flag);
typedef void (*resolveGlDepthRangef)(GLclampf zNear, GLclampf zFar);
typedef void (*resolveGlDetachShader)(GLuint program, GLuint shader);
typedef void (*resolveGlDisable)(GLenum cap);
typedef void (*resolveGlDisableVertexAttribArray)(GLuint index);
typedef void (*resolveGlDrawArrays)(GLenum mode, GLint first, GLsizei count);
typedef void (*resolveGlDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
typedef void (*resolveGlEnable)(GLenum cap);
typedef void (*resolveGlEnableVertexAttribArray)(GLuint index);
typedef void (*resolveGlFinish)(void);
typedef void (*resolveGlFlush)(void);
typedef void (*resolveGlFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef void (*resolveGlFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (*resolveGlFrontFace)(GLenum mode);
typedef void (*resolveGlGenBuffers)(GLsizei n, GLuint *buffers);
typedef void (*resolveGlGenFramebuffers)(GLsizei n, GLuint *framebuffers);
typedef void (*resolveGlGenRenderbuffers)(GLsizei n, GLuint *renderbuffers);
typedef void (*resolveGlGenTextures)(GLsizei n, GLuint *textures);
typedef void (*resolveGlGenerateMipmap)(GLenum target);
typedef void (*resolveGlGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name);
typedef void (*resolveGlGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name);
typedef void (*resolveGlGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders);
typedef GLint (*resolveGlGetAttribLocation)(GLuint program, const char *name);
typedef void (*resolveGlGetBooleanv)(GLenum pname, GLboolean *params);
typedef void (*resolveGlGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params);
typedef GLenum (*resolveGlGetError)(void);
typedef void (*resolveGlGetFloatv)(GLenum pname, GLfloat *params);
typedef void (*resolveGlGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
typedef void (*resolveGlGetIntegerv)(GLenum pname, GLint *params);
typedef void (*resolveGlGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei *length, char *infolog);
typedef void (*resolveGlGetProgramiv)(GLuint program, GLenum pname, GLint *params);
typedef void (*resolveGlGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint *params);
typedef void (*resolveGlGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei *length, char *infolog);
typedef void (*resolveGlGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
typedef void (*resolveGlGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei *length, char *source);
typedef void (*resolveGlGetShaderiv)(GLuint shader, GLenum pname, GLint *params);
typedef const GLubyte *(*resolveGlGetString)(GLenum name);
typedef void (*resolveGlGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params);
typedef void (*resolveGlGetTexParameteriv)(GLenum target, GLenum pname, GLint *params);
typedef GLint (*resolveGlGetUniformLocation)(GLuint program, const char *name);
typedef void (*resolveGlGetUniformfv)(GLuint program, GLint location, GLfloat *params);
typedef void (*resolveGlGetUniformiv)(GLuint program, GLint location, GLint *params);
typedef void (*resolveGlGetVertexAttribPointerv)(GLuint index, GLenum pname, void **pointer);
typedef void (*resolveGlGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat *params);
typedef void (*resolveGlGetVertexAttribiv)(GLuint index, GLenum pname, GLint *params);
typedef void (*resolveGlHint)(GLenum target, GLenum mode);
typedef GLboolean (*resolveGlIsBuffer)(GLuint buffer);
typedef GLboolean (*resolveGlIsEnabled)(GLenum cap);
typedef GLboolean (*resolveGlIsFramebuffer)(GLuint framebuffer);
typedef GLboolean (*resolveGlIsProgram)(GLuint program);
typedef GLboolean (*resolveGlIsRenderbuffer)(GLuint renderbuffer);
typedef GLboolean (*resolveGlIsShader)(GLuint shader);
typedef GLboolean (*resolveGlIsTexture)(GLuint texture);
typedef void (*resolveGlLineWidth)(GLfloat width);
typedef void (*resolveGlLinkProgram)(GLuint program);
typedef void (*resolveGlPixelStorei)(GLenum pname, GLint param);
typedef void (*resolveGlPolygonOffset)(GLfloat factor, GLfloat units);
typedef void (*resolveGlReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
typedef void (*resolveGlReleaseShaderCompiler)(void);
typedef void (*resolveGlRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (*resolveGlSampleCoverage)(GLclampf value, GLboolean invert);
typedef void (*resolveGlScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (*resolveGlShaderBinary)(GLint n, const GLuint *shaders, GLenum binaryformat, const void *binary, GLint length);
typedef void (*resolveGlShaderSource)(GLuint shader, GLsizei count, const char **string, const GLint *length);
typedef void (*resolveGlStencilFunc)(GLenum func, GLint ref, GLuint mask);
typedef void (*resolveGlStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask);
typedef void (*resolveGlStencilMask)(GLuint mask);
typedef void (*resolveGlStencilMaskSeparate)(GLenum face, GLuint mask);
typedef void (*resolveGlStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
typedef void (*resolveGlStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
typedef void (*resolveGlTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (*resolveGlTexParameterf)(GLenum target, GLenum pname, GLfloat param);
typedef void (*resolveGlTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params);
typedef void (*resolveGlTexParameteri)(GLenum target, GLenum pname, GLint param);
typedef void (*resolveGlTexParameteriv)(GLenum target, GLenum pname, const GLint *params);
typedef void (*resolveGlTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (*resolveGlUniform1f)(GLint location, GLfloat x);
typedef void (*resolveGlUniform1fv)(GLint location, GLsizei count, const GLfloat *v);
typedef void (*resolveGlUniform1i)(GLint location, GLint x);
typedef void (*resolveGlUniform1iv)(GLint location, GLsizei count, const GLint *v);
typedef void (*resolveGlUniform2f)(GLint location, GLfloat x, GLfloat y);
typedef void (*resolveGlUniform2fv)(GLint location, GLsizei count, const GLfloat *v);
typedef void (*resolveGlUniform2i)(GLint location, GLint x, GLint y);
typedef void (*resolveGlUniform2iv)(GLint location, GLsizei count, const GLint *v);
typedef void (*resolveGlUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z);
typedef void (*resolveGlUniform3fv)(GLint location, GLsizei count, const GLfloat *v);
typedef void (*resolveGlUniform3i)(GLint location, GLint x, GLint y, GLint z);
typedef void (*resolveGlUniform3iv)(GLint location, GLsizei count, const GLint *v);
typedef void (*resolveGlUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (*resolveGlUniform4fv)(GLint location, GLsizei count, const GLfloat *v);
typedef void (*resolveGlUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w);
typedef void (*resolveGlUniform4iv)(GLint location, GLsizei count, const GLint *v);
typedef void (*resolveGlUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (*resolveGlUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (*resolveGlUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (*resolveGlUseProgram)(GLuint program);
typedef void (*resolveGlValidateProgram)(GLuint program);
typedef void (*resolveGlVertexAttrib1f)(GLuint indx, GLfloat x);
typedef void (*resolveGlVertexAttrib1fv)(GLuint indx, const GLfloat *values);
typedef void (*resolveGlVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y);
typedef void (*resolveGlVertexAttrib2fv)(GLuint indx, const GLfloat *values);
typedef void (*resolveGlVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
typedef void (*resolveGlVertexAttrib3fv)(GLuint indx, const GLfloat *values);
typedef void (*resolveGlVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (*resolveGlVertexAttrib4fv)(GLuint indx, const GLfloat *values);
typedef void (*resolveGlVertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *ptr);
typedef void (*resolveGlViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
// -----------------------------------------------------------------------------
struct OpenGlFunctions {
resolveGlActiveTexture glActiveTexture;
resolveGlAttachShader glAttachShader;
resolveGlBindAttribLocation glBindAttribLocation;
// resolveGlBindBuffer glBindBuffer;
// resolveGlBindFramebuffer glBindFramebuffer;
// resolveGlBindRenderbuffer glBindRenderbuffer;
resolveGlBindTexture glBindTexture;
// resolveGlBlendColor glBlendColor;
// resolveGlBlendEquation glBlendEquation;
// resolveGlBlendEquationSeparate glBlendEquationSeparate;
// resolveGlBlendFunc glBlendFunc;
// resolveGlBlendFuncSeparate glBlendFuncSeparate;
// resolveGlBufferData glBufferData;
// resolveGlBufferSubData glBufferSubData;
// resolveGlCheckFramebufferStatus glCheckFramebufferStatus;
resolveGlClear glClear;
resolveGlClearColor glClearColor;
// resolveGlClearDepthf glClearDepthf;
// resolveGlClearStencil glClearStencil;
// resolveGlColorMask glColorMask;
resolveGlCompileShader glCompileShader;
// resolveGlCompressedTexImage2D glCompressedTexImage2D;
// resolveGlCompressedTexSubImage2D glCompressedTexSubImage2D;
// resolveGlCopyTexImage2D glCopyTexImage2D;
// resolveGlCopyTexSubImage2D glCopyTexSubImage2D;
resolveGlCreateProgram glCreateProgram;
resolveGlCreateShader glCreateShader;
// resolveGlCullFace glCullFace;
// resolveGlDeleteBuffers glDeleteBuffers;
// resolveGlDeleteFramebuffers glDeleteFramebuffers;
resolveGlDeleteProgram glDeleteProgram;
//resolveGlDeleteRenderbuffers glDeleteRenderbuffers;
resolveGlDeleteShader glDeleteShader;
resolveGlDeleteTextures glDeleteTextures;
// resolveGlDepthFunc glDepthFunc;
// resolveGlDepthMask glDepthMask;
// resolveGlDepthRangef glDepthRangef;
// resolveGlDetachShader glDetachShader;
resolveGlDisable glDisable;
// resolveGlDisableVertexAttribArray glDisableVertexAttribArray;
resolveGlDrawArrays glDrawArrays;
// resolveGlDrawElements glDrawElements;
// resolveGlEnable glEnable;
resolveGlEnableVertexAttribArray glEnableVertexAttribArray;
// resolveGlFinish glFinish;
// resolveGlFlush glFlush;
// resolveGlFramebufferRenderbuffer glFramebufferRenderbuffer;
// resolveGlFramebufferTexture2D glFramebufferTexture2D;
// resolveGlFrontFace glFrontFace;
// resolveGlGenBuffers glGenBuffers;
// resolveGlGenFramebuffers glGenFramebuffers;
// resolveGlGenRenderbuffers glGenRenderbuffers;
resolveGlGenTextures glGenTextures;
// resolveGlGenerateMipmap glGenerateMipmap;
// resolveGlGetActiveAttrib glGetActiveAttrib;
// resolveGlGetActiveUniform glGetActiveUniform;
// resolveGlGetAttachedShaders glGetAttachedShaders;
// resolveGlGetAttribLocation glGetAttribLocation;
// resolveGlGetBooleanv glGetBooleanv;
// resolveGlGetBufferParameteriv glGetBufferParameteriv;
resolveGlGetError glGetError;
// resolveGlGetFloatv glGetFloatv;
// resolveGlGetFramebufferAttachmentParameteriv glGetFramebufferAttachmentParameteriv;
// resolveGlGetIntegerv glGetIntegerv;
resolveGlGetProgramInfoLog glGetProgramInfoLog;
resolveGlGetProgramiv glGetProgramiv;
// resolveGlGetRenderbufferParameteriv glGetRenderbufferParameteriv;
resolveGlGetShaderInfoLog glGetShaderInfoLog;
// resolveGlGetShaderPrecisionFormat glGetShaderPrecisionFormat;
// resolveGlGetShaderSource glGetShaderSource;
resolveGlGetShaderiv glGetShaderiv;
resolveGlGetString glGetString;
// resolveGlGetTexParameterfv glGetTexParameterfv;
// resolveGlGetTexParameteriv glGetTexParameteriv;
resolveGlGetUniformLocation glGetUniformLocation;
// resolveGlGetUniformfv glGetUniformfv;
// resolveGlGetUniformiv glGetUniformiv;
// resolveGlGetVertexAttribPointerv glGetVertexAttribPointerv;
// resolveGlGetVertexAttribfv glGetVertexAttribfv;
// resolveGlGetVertexAttribiv glGetVertexAttribiv;
// resolveGlHint glHint;
// resolveGlIsBuffer glIsBuffer;
// resolveGlIsEnabled glIsEnabled;
// resolveGlIsFramebuffer glIsFramebuffer;
// resolveGlIsProgram glIsProgram;
// resolveGlIsRenderbuffer glIsRenderbuffer;
// resolveGlIsShader glIsShader;
// resolveGlIsTexture glIsTexture;
// resolveGlLineWidth glLineWidth;
resolveGlLinkProgram glLinkProgram;
resolveGlPixelStorei glPixelStorei;
// resolveGlPolygonOffset glPolygonOffset;
// resolveGlReadPixels glReadPixels;
// resolveGlReleaseShaderCompiler glReleaseShaderCompiler;
// resolveGlRenderbufferStorage glRenderbufferStorage;
// resolveGlSampleCoverage glSampleCoverage;
// resolveGlScissor glScissor;
// resolveGlShaderBinary glShaderBinary;
resolveGlShaderSource glShaderSource;
// resolveGlStencilFunc glStencilFunc;
// resolveGlStencilFuncSeparate glStencilFuncSeparate;
// resolveGlStencilMask glStencilMask;
// resolveGlStencilMaskSeparate glStencilMaskSeparate;
// resolveGlStencilOp glStencilOp;
// resolveGlStencilOpSeparate glStencilOpSeparate;
resolveGlTexImage2D glTexImage2D;
// resolveGlTexParameterf glTexParameterf;
// resolveGlTexParameterfv glTexParameterfv;
resolveGlTexParameteri glTexParameteri;
// resolveGlTexParameteriv glTexParameteriv;
resolveGlTexSubImage2D glTexSubImage2D;
resolveGlUniform1f glUniform1f;
// resolveGlUniform1fv glUniform1fv;
resolveGlUniform1i glUniform1i;
// resolveGlUniform1iv glUniform1iv;
// resolveGlUniform2f glUniform2f;
// resolveGlUniform2fv glUniform2fv;
// resolveGlUniform2i glUniform2i;
// resolveGlUniform2iv glUniform2iv;
// resolveGlUniform3f glUniform3f;
// resolveGlUniform3fv glUniform3fv;
// resolveGlUniform3i glUniform3i;
// resolveGlUniform3iv glUniform3iv;
// resolveGlUniform4f glUniform4f;
// resolveGlUniform4fv glUniform4fv;
// resolveGlUniform4i glUniform4i;
// resolveGlUniform4iv glUniform4iv;
// resolveGlUniformMatrix2fv glUniformMatrix2fv;
// resolveGlUniformMatrix3fv glUniformMatrix3fv;
resolveGlUniformMatrix4fv glUniformMatrix4fv;
resolveGlUseProgram glUseProgram;
resolveGlValidateProgram glValidateProgram;
// resolveGlVertexAttrib1f glVertexAttrib1f;
// resolveGlVertexAttrib1fv glVertexAttrib1fv;
// resolveGlVertexAttrib2f glVertexAttrib2f;
// resolveGlVertexAttrib2fv glVertexAttrib2fv;
// resolveGlVertexAttrib3f glVertexAttrib3f;
// resolveGlVertexAttrib3fv glVertexAttrib3fv;
// resolveGlVertexAttrib4f glVertexAttrib4f;
// resolveGlVertexAttrib4fv glVertexAttrib4fv;
resolveGlVertexAttribPointer glVertexAttribPointer;
resolveGlViewport glViewport;
};
typedef struct OpenGlFunctions OpenGlFunctions;
#define MS_OGL_RENDER MS_FILTER_METHOD_NO_ARG(MS_OGL_ID, 0)
#endif
......@@ -311,10 +311,12 @@ if(ENABLE_VIDEO)
if(APPLE)
if(IOS)
list(APPEND VOIP_SOURCE_FILES_C
utils/opengl_functions.c
utils/opengl_functions.h
utils/opengles_display.c
utils/opengles_display.h
utils/shaderUtil.c
utils/shaderUtil.h
utils/shader_util.c
utils/shader_util.h
voip/scaler.c
)
list(APPEND VOIP_SOURCE_FILES_OBJC
......@@ -329,10 +331,12 @@ if(ENABLE_VIDEO)
)
list(APPEND VOIP_SOURCE_FILES_C
utils/opengl_functions.c
utils/opengl_functions.h
utils/opengles_display.c
utils/opengles_display.h
utils/shaderUtil.c
utils/shaderUtil.h
utils/shader_util.c
utils/shader_util.h
)
endif()
endif()
......@@ -345,10 +349,12 @@ if(ENABLE_VIDEO)
android/mediacodech264enc.c
android/android-display.c
android/android-opengl-display.c
utils/opengl_functions.c
utils/opengl_functions.h
utils/opengles_display.c
utils/opengles_display.h
utils/shaderUtil.c
utils/shaderUtil.h
utils/shader_util.c
utils/shader_util.h
voip/scaler.c
)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
......@@ -390,8 +396,9 @@ if(ENABLE_VIDEO)
endif()
if(GLX_FOUND)
list(APPEND VOIP_SOURCE_FILES_C
utils/opengl_functions.c
utils/opengles_display.c
utils/shaderUtil.c
utils/shader_util.c
videofilters/generic_opengl_display.c
videofilters/glxvideo.c
)
......
......@@ -230,7 +230,7 @@ libmediastreamer_voip_la_LIBTOOLFLAGS= --tag=CC
if BUILD_VIDEO
GLDISPLAY_FILES = utils/shaderUtil.c utils/shaderUtil.h utils/debug.h utils/opengles_display.c utils/opengles_display.h
GLDISPLAY_FILES = utils/opengl_functions.c utils/opengl_functions.h utils/shader_util.c utils/shader_util.h utils/opengl_debug.h utils/opengles_display.c utils/opengles_display.h
if BUILD_MACOSX
libmediastreamer_voip_la_SOURCES+= videofilters/videotoolbox.c
......
......@@ -64,7 +64,7 @@ static void android_display_uninit(MSFilter *f){
AndroidDisplay *ad=(AndroidDisplay*)f->data;
JNIEnv *jenv=ms_get_jni_env();
ms_message("%s %p %p", __FUNCTION__, f, ad->ogl);
if (ad->ogl) {
/* clear native ptr, to prevent rendering to occur now that ptr is invalid */
if (ad->android_video_window)
......@@ -98,7 +98,7 @@ static void android_display_process(MSFilter *f){
} else {
ms_warning("%s: opengldisplay not ready (%p)", __FUNCTION__, ad->ogl);
}
jenv=ms_get_jni_env();
(*jenv)->CallVoidMethod(jenv,ad->android_video_window,ad->request_render_id);
}
......@@ -119,11 +119,11 @@ static int android_display_set_window(MSFilter *f, void *arg){
jobject old_window;
if (window == ad->android_video_window) return 0;
ms_filter_lock(f);
old_window=ad->android_video_window;
if (ad->android_video_window) {
ms_message("Clearing old opengles_display (%p)", ad->ogl);
/* clear native ptr, to prevent rendering to occur now that ptr is invalid */
......@@ -132,15 +132,15 @@ static int android_display_set_window(MSFilter *f, void *arg){
ogl_display_uninit(ad->ogl, FALSE);
ms_free(ad->ogl);
ad->ogl = ogl_display_new();
}
if (window) {
ad->android_video_window=(*jenv)->NewGlobalRef(jenv, window);
ms_message("Sending opengles_display pointer (%p)", ad->ogl);
(*jenv)->CallVoidMethod(jenv,window,ad->set_opengles_display_id, (jlong)ad->ogl);
}else ad->android_video_window=NULL;
if (old_window)
(*jenv)->DeleteGlobalRef(jenv, old_window);
......
/*
File: debug.h
File: opengl_debug.h
Abstract: Utility functions for debugging.
Version: 1.13
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
......@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
......@@ -40,13 +40,15 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2014 Apple Inc. All Rights Reserved.
*/
#define glError() { \
GLenum err = glGetError(); \
Original file modified by Belledonne Communications, Grenoble, France
Copyright (C) 2017
*/
#define glError(f) { \
GLenum err = f->glGetError(); \
if (err != GL_NO_ERROR) { \
printf("glError: %04x caught at %s:%u\n", err, __FILE__, __LINE__); \
} \
......
#include "opengl_functions.h"
// =============================================================================
void opengl_functions_default_init (OpenGlFunctions *f) {
#if !defined(_WIN32)
f->glActiveTexture = glActiveTexture;
f->glAttachShader = glAttachShader;
f->glBindAttribLocation = glBindAttribLocation;
f->glBindTexture = glBindTexture;
f->glClear = glClear;
f->glClearColor = glClearColor;
f->glCompileShader = glCompileShader;
f->glCreateProgram = glCreateProgram;
f->glCreateShader = glCreateShader;
f->glDeleteProgram = glDeleteProgram;
f->glDeleteShader = glDeleteShader;
f->glDeleteTextures = glDeleteTextures;
f->glDisable = glDisable;
f->glDrawArrays = glDrawArrays;
f->glEnableVertexAttribArray = glEnableVertexAttribArray;
f->glGenTextures = glGenTextures;
f->glGetError = glGetError;
f->glGetProgramInfoLog = glGetProgramInfoLog;
f->glGetProgramiv = glGetProgramiv;
f->glGetShaderInfoLog = glGetShaderInfoLog;
f->glGetShaderiv = glGetShaderiv;
f->glGetString = glGetString;
f->glGetUniformLocation = glGetUniformLocation;
f->glLinkProgram = glLinkProgram;
f->glPixelStorei = glPixelStorei;
f->glShaderSource = (resolveGlShaderSource)glShaderSource;
f->glTexImage2D = glTexImage2D;
f->glTexParameteri = glTexParameteri;
f->glTexSubImage2D = glTexSubImage2D;
f->glUniform1f = glUniform1f;
f->glUniform1i = glUniform1i;
f->glUniformMatrix4fv = glUniformMatrix4fv;
f->glUseProgram = glUseProgram;
f->glValidateProgram = glValidateProgram;
f->glVertexAttribPointer = glVertexAttribPointer;
f->glViewport = glViewport;
#endif
}
/*
* opengl_functions.c
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.