blob: 8add60d964d85eca12d62e3bce3e73042a8848d3 [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_LINUX_GLX_RENDERER_H_
12#define TEST_LINUX_GLX_RENDERER_H_
pbos@webrtc.org29d58392013-05-16 12:08:03 +000013
pbos@webrtc.org29d58392013-05-16 12:08:03 +000014#include <GL/glx.h>
Yves Gerey3e707812018-11-28 16:47:49 +010015#include <X11/X.h>
pbos@webrtc.orgf5d4cb12013-05-17 13:44:48 +000016#include <X11/Xlib.h>
Yves Gerey3e707812018-11-28 16:47:49 +010017#include <stddef.h>
pbos@webrtc.org29d58392013-05-16 12:08:03 +000018
Yves Gerey3e707812018-11-28 16:47:49 +010019#include "api/video/video_frame.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "test/gl/gl_renderer.h"
pbos@webrtc.org29d58392013-05-16 12:08:03 +000021
22namespace webrtc {
23namespace test {
24
25class GlxRenderer : public GlRenderer {
26 public:
Yves Gerey665174f2018-06-19 15:03:05 +020027 static GlxRenderer* Create(const char* window_title,
28 size_t width,
pbos@webrtc.org29d58392013-05-16 12:08:03 +000029 size_t height);
30 virtual ~GlxRenderer();
31
nisseeb83a1a2016-03-21 01:27:56 -070032 void OnFrame(const webrtc::VideoFrame& frame) override;
pbos@webrtc.org0d852d52015-02-09 15:14:36 +000033
pbos@webrtc.org29d58392013-05-16 12:08:03 +000034 private:
35 GlxRenderer(size_t width, size_t height);
36
37 bool Init(const char* window_title);
38 void Resize(size_t width, size_t height);
39 void Destroy();
40
pbos@webrtc.org29d58392013-05-16 12:08:03 +000041 size_t width_, height_;
42
43 Display* display_;
44 Window window_;
45 GLXContext context_;
46};
Yves Gerey665174f2018-06-19 15:03:05 +020047} // namespace test
48} // namespace webrtc
pbos@webrtc.org29d58392013-05-16 12:08:03 +000049
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020050#endif // TEST_LINUX_GLX_RENDERER_H_