blob: 8338591244b3d395be23328b428d4822dce0a908 [file] [log] [blame]
pbos@webrtc.org29d58392013-05-16 12:08:03 +00001/*
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef TEST_GL_GL_RENDERER_H_
12#define TEST_GL_GL_RENDERER_H_
pbos@webrtc.org29d58392013-05-16 12:08:03 +000013
mflodman@webrtc.org7f944f32013-05-27 15:52:38 +000014#ifdef WEBRTC_MAC
15#include <OpenGL/gl.h>
16#else
pbos@webrtc.org29d58392013-05-16 12:08:03 +000017#include <GL/gl.h>
mflodman@webrtc.org7f944f32013-05-27 15:52:38 +000018#endif
pbos@webrtc.org29d58392013-05-16 12:08:03 +000019
Yves Gerey3e707812018-11-28 16:47:49 +010020#include <stddef.h>
21#include <stdint.h>
22
23#include "api/video/video_frame.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020024#include "test/video_renderer.h"
pbos@webrtc.org1ecee9a2013-05-29 11:34:32 +000025
pbos@webrtc.org29d58392013-05-16 12:08:03 +000026namespace webrtc {
27namespace test {
28
29class GlRenderer : public VideoRenderer {
30 public:
nisseeb83a1a2016-03-21 01:27:56 -070031 void OnFrame(const webrtc::VideoFrame& frame) override;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000032
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};
Yves Gerey665174f2018-06-19 15:03:05 +020049} // namespace test
50} // namespace webrtc
pbos@webrtc.org29d58392013-05-16 12:08:03 +000051
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020052#endif // TEST_GL_GL_RENDERER_H_