ijksdl_gles2.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2016 Bilibili
  3. * copyright (c) 2016 Zhang Rui <bbcallen@gmail.com>
  4. *
  5. * This file is part of ijkPlayer.
  6. *
  7. * ijkPlayer is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * ijkPlayer is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with ijkPlayer; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #ifndef IJKSDL__IJKSDL_GLES2_H
  22. #define IJKSDL__IJKSDL_GLES2_H
  23. #ifdef __APPLE__
  24. #include <OpenGLES/ES2/gl.h>
  25. #include <OpenGLES/ES2/glext.h>
  26. #else
  27. #include <GLES2/gl2.h>
  28. #include <GLES2/gl2ext.h>
  29. #include <GLES2/gl2platform.h>
  30. #endif
  31. typedef struct SDL_VoutOverlay SDL_VoutOverlay;
  32. /*
  33. * Common
  34. */
  35. #ifdef DEBUG
  36. #define IJK_GLES2_checkError_TRACE(op)
  37. #define IJK_GLES2_checkError_DEBUG(op)
  38. #else
  39. #define IJK_GLES2_checkError_TRACE(op) IJK_GLES2_checkError(op)
  40. #define IJK_GLES2_checkError_DEBUG(op) IJK_GLES2_checkError(op)
  41. #endif
  42. void IJK_GLES2_printString(const char *name, GLenum s);
  43. void IJK_GLES2_checkError(const char *op);
  44. GLuint IJK_GLES2_loadShader(GLenum shader_type, const char *shader_source);
  45. /*
  46. * Renderer
  47. */
  48. #define IJK_GLES2_MAX_PLANE 3
  49. typedef struct IJK_GLES2_Renderer IJK_GLES2_Renderer;
  50. IJK_GLES2_Renderer *IJK_GLES2_Renderer_create(SDL_VoutOverlay *overlay);
  51. void IJK_GLES2_Renderer_reset(IJK_GLES2_Renderer *renderer);
  52. void IJK_GLES2_Renderer_free(IJK_GLES2_Renderer *renderer);
  53. void IJK_GLES2_Renderer_freeP(IJK_GLES2_Renderer **renderer);
  54. GLboolean IJK_GLES2_Renderer_setupGLES();
  55. GLboolean IJK_GLES2_Renderer_isValid(IJK_GLES2_Renderer *renderer);
  56. GLboolean IJK_GLES2_Renderer_isFormat(IJK_GLES2_Renderer *renderer, int format);
  57. GLboolean IJK_GLES2_Renderer_use(IJK_GLES2_Renderer *renderer);
  58. GLboolean IJK_GLES2_Renderer_renderOverlay(IJK_GLES2_Renderer *renderer, SDL_VoutOverlay *overlay);
  59. #define IJK_GLES2_GRAVITY_RESIZE (0) // Stretch to fill view bounds.
  60. #define IJK_GLES2_GRAVITY_RESIZE_ASPECT (1) // Preserve aspect ratio; fit within view bounds.
  61. #define IJK_GLES2_GRAVITY_RESIZE_ASPECT_FILL (2) // Preserve aspect ratio; fill view bounds.
  62. GLboolean IJK_GLES2_Renderer_setGravity(IJK_GLES2_Renderer *renderer, int gravity, GLsizei view_width, GLsizei view_height);
  63. #endif