internal.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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__INTERNAL__H
  22. #define IJKSDL__IJKSDL_GLES2__INTERNAL__H
  23. #include <assert.h>
  24. #include <stdlib.h>
  25. #include "ijksdl/ijksdl_fourcc.h"
  26. #include "ijksdl/ijksdl_log.h"
  27. #include "ijksdl/ijksdl_gles2.h"
  28. #include "ijksdl/ijksdl_vout.h"
  29. #define IJK_GLES_STRINGIZE(x) #x
  30. #define IJK_GLES_STRINGIZE2(x) IJK_GLES_STRINGIZE(x)
  31. #define IJK_GLES_STRING(x) IJK_GLES_STRINGIZE2(x)
  32. typedef struct IJK_GLES2_Renderer_Opaque IJK_GLES2_Renderer_Opaque;
  33. typedef struct IJK_GLES2_Renderer
  34. {
  35. IJK_GLES2_Renderer_Opaque *opaque;
  36. GLuint program;
  37. GLuint vertex_shader;
  38. GLuint fragment_shader;
  39. GLuint plane_textures[IJK_GLES2_MAX_PLANE];
  40. GLuint av4_position;
  41. GLuint av2_texcoord;
  42. GLuint um4_mvp;
  43. GLuint us2_sampler[IJK_GLES2_MAX_PLANE];
  44. GLuint um3_color_conversion;
  45. GLboolean (*func_use)(IJK_GLES2_Renderer *renderer);
  46. GLsizei (*func_getBufferWidth)(IJK_GLES2_Renderer *renderer, SDL_VoutOverlay *overlay);
  47. GLboolean (*func_uploadTexture)(IJK_GLES2_Renderer *renderer, SDL_VoutOverlay *overlay);
  48. GLvoid (*func_destroy)(IJK_GLES2_Renderer *renderer);
  49. GLsizei buffer_width;
  50. GLsizei visible_width;
  51. GLfloat texcoords[8];
  52. GLfloat vertices[8];
  53. int vertices_changed;
  54. int format;
  55. int gravity;
  56. GLsizei layer_width;
  57. GLsizei layer_height;
  58. int frame_width;
  59. int frame_height;
  60. int frame_sar_num;
  61. int frame_sar_den;
  62. GLsizei last_buffer_width;
  63. } IJK_GLES2_Renderer;
  64. typedef struct IJK_GLES_Matrix
  65. {
  66. GLfloat m[16];
  67. } IJK_GLES_Matrix;
  68. void IJK_GLES2_loadOrtho(IJK_GLES_Matrix *matrix, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far);
  69. const char *IJK_GLES2_getVertexShader_default();
  70. const char *IJK_GLES2_getFragmentShader_yuv420p();
  71. const char *IJK_GLES2_getFragmentShader_yuv444p10le();
  72. const char *IJK_GLES2_getFragmentShader_yuv420sp();
  73. const char *IJK_GLES2_getFragmentShader_rgb();
  74. const GLfloat *IJK_GLES2_getColorMatrix_bt709();
  75. const GLfloat *IJK_GLES2_getColorMatrix_bt601();
  76. IJK_GLES2_Renderer *IJK_GLES2_Renderer_create_base(const char *fragment_shader_source);
  77. IJK_GLES2_Renderer *IJK_GLES2_Renderer_create_yuv420p();
  78. IJK_GLES2_Renderer *IJK_GLES2_Renderer_create_yuv444p10le();
  79. IJK_GLES2_Renderer *IJK_GLES2_Renderer_create_yuv420sp();
  80. IJK_GLES2_Renderer *IJK_GLES2_Renderer_create_yuv420sp_vtb(SDL_VoutOverlay *overlay);
  81. IJK_GLES2_Renderer *IJK_GLES2_Renderer_create_rgb565();
  82. IJK_GLES2_Renderer *IJK_GLES2_Renderer_create_rgb888();
  83. IJK_GLES2_Renderer *IJK_GLES2_Renderer_create_rgbx8888();
  84. #endif