blob: 7682d3c91899ea081b400048692f079551101ac3 [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
Peter Boström7623ce42015-12-09 12:13:30 +010011#ifndef WEBRTC_TEST_GL_GL_RENDERER_H_
12#define WEBRTC_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
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000020#include "webrtc/test/video_renderer.h"
pbos@webrtc.org1ecee9a2013-05-29 11:34:32 +000021#include "webrtc/typedefs.h"
22
pbos@webrtc.org29d58392013-05-16 12:08:03 +000023
24namespace webrtc {
25namespace test {
26
27class GlRenderer : public VideoRenderer {
28 public:
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070029 void RenderFrame(const webrtc::VideoFrame& frame,
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000030 int time_to_render_ms) override;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000031
32 protected:
33 GlRenderer();
34
35 void Init();
36 void Destroy();
37
38 void ResizeViewport(size_t width, size_t height);
39
40 private:
41 bool is_init_;
42 uint8_t* buffer_;
43 GLuint texture_;
44 size_t width_, height_, buffer_size_;
45
46 void ResizeVideo(size_t width, size_t height);
47};
48} // test
49} // webrtc
50
Peter Boström7623ce42015-12-09 12:13:30 +010051#endif // WEBRTC_TEST_GL_GL_RENDERER_H_