xref: /aosp_15_r20/external/webrtc/test/gl/gl_renderer.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 
11 #ifndef TEST_GL_GL_RENDERER_H_
12 #define TEST_GL_GL_RENDERER_H_
13 
14 #ifdef WEBRTC_MAC
15 #include <OpenGL/gl.h>
16 #else
17 #include <GL/gl.h>
18 #endif
19 
20 #include <stddef.h>
21 #include <stdint.h>
22 
23 #include "api/video/video_frame.h"
24 #include "test/video_renderer.h"
25 
26 namespace webrtc {
27 namespace test {
28 
29 class GlRenderer : public VideoRenderer {
30  public:
31   void OnFrame(const webrtc::VideoFrame& frame) override;
32 
33  protected:
34   GlRenderer();
35 
36   void Init();
37   void Destroy();
38 
39   void ResizeViewport(size_t width, size_t height);
40 
41  private:
42   bool is_init_;
43   uint8_t* buffer_;
44   GLuint texture_;
45   size_t width_, height_, buffer_size_;
46 
47   void ResizeVideo(size_t width, size_t height);
48 };
49 }  // namespace test
50 }  // namespace webrtc
51 
52 #endif  // TEST_GL_GL_RENDERER_H_
53