1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef MEDIA_CAST_TEST_LINUX_OUTPUT_WINDOW_H_
6#define MEDIA_CAST_TEST_LINUX_OUTPUT_WINDOW_H_
7
8#include <X11/Xlib.h>
9#include <X11/Xutil.h>
10#include <sys/ipc.h>
11#include <sys/shm.h>
12#include <X11/extensions/XShm.h>
13
14#include <string>
15
16#include "base/memory/ref_counted.h"
17#include "base/memory/scoped_ptr.h"
18
19namespace media {
20class VideoFrame;
21}
22
23namespace media {
24namespace cast {
25namespace test {
26
27class LinuxOutputWindow {
28 public:
29  LinuxOutputWindow(int x_pos,
30                    int y_pos,
31                    int width,
32                    int height,
33                    const std::string& name);
34  virtual ~LinuxOutputWindow();
35
36  void RenderFrame(const scoped_refptr<media::VideoFrame>& video_frame);
37
38 private:
39  void CreateWindow(int x_pos,
40                    int y_pos,
41                    int width,
42                    int height,
43                    const std::string& name);
44  Display* display_;
45  Window window_;
46  XShmSegmentInfo shminfo_;
47  GC gc_;
48  XImage* image_;
49};
50
51}  // namespace test
52}  // namespace cast
53}  // namespace media
54
55#endif  // MEDIA_CAST_TEST_LINUX_OUTPUT_WINDOW_H_
56