gl_renderer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef TEST_GL_GL_RENDERER_H_
  11. #define TEST_GL_GL_RENDERER_H_
  12. #ifdef WEBRTC_MAC
  13. #include <OpenGL/gl.h>
  14. #else
  15. #include <GL/gl.h>
  16. #endif
  17. #include <stddef.h>
  18. #include <stdint.h>
  19. #include "api/video/video_frame.h"
  20. #include "test/video_renderer.h"
  21. namespace webrtc {
  22. namespace test {
  23. class GlRenderer : public VideoRenderer {
  24. public:
  25. void OnFrame(const webrtc::VideoFrame& frame) override;
  26. protected:
  27. GlRenderer();
  28. void Init();
  29. void Destroy();
  30. void ResizeViewport(size_t width, size_t height);
  31. private:
  32. bool is_init_;
  33. uint8_t* buffer_;
  34. GLuint texture_;
  35. size_t width_, height_, buffer_size_;
  36. void ResizeVideo(size_t width, size_t height);
  37. };
  38. } // namespace test
  39. } // namespace webrtc
  40. #endif // TEST_GL_GL_RENDERER_H_