blob: 955ebd082da24656d8ecfdafea218a4bea827f52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_GPU_GPU_VIDEO_LAYER_GLX_H_
#define CHROME_GPU_GPU_VIDEO_LAYER_GLX_H_
#pragma once
#include "app/surface/transport_dib.h"
#include "app/x11_util.h"
#include "base/basictypes.h"
#include "base/process.h"
#include "ipc/ipc_channel.h"
class GpuViewX;
class GpuThread;
class GpuVideoLayerGLX : public IPC::Channel::Listener {
public:
GpuVideoLayerGLX(GpuViewX* view,
GpuThread* gpu_thread,
int32 routing_id,
const gfx::Size& size);
virtual ~GpuVideoLayerGLX();
// Renders the video layer using the current GL context with respect to the
// given |viewport_size|.
//
// TODO(scherkus): we also need scrolling information to determine where
// exactly to place our quad.
void Render(const gfx::Size& viewport_size);
// IPC::Channel::Listener implementation.
virtual void OnMessageReceived(const IPC::Message& message);
virtual void OnChannelConnected(int32 peer_pid);
virtual void OnChannelError();
private:
// Message handlers.
void OnPaintToVideoLayer(base::ProcessId source_process_id,
TransportDIB::Id id,
const gfx::Rect& bitmap_rect);
// Calculates vertices for |object| relative to |world|, where |world| is
// assumed to represent a full-screen quad. |vertices| should be an array of
// 8 floats.
//
// TODO(scherkus): not sure how to describe what this does.
static void CalculateVertices(const gfx::Size& world,
const gfx::Rect& object,
float* vertices);
// GPU process related.
GpuViewX* view_;
GpuThread* gpu_thread_;
int32 routing_id_;
// The native size of the incoming YUV frames.
gfx::Size native_size_;
// The target absolute position and size of the RGB frames.
gfx::Rect target_rect_;
// The target absolute position and size expressed as quad vertices.
float target_vertices_[8];
// 3 textures, one for each plane.
unsigned int textures_[3];
// Shader program for YUV->RGB conversion.
unsigned int program_;
DISALLOW_COPY_AND_ASSIGN(GpuVideoLayerGLX);
};
#endif // CHROME_GPU_GPU_VIDEO_LAYER_GLX_H_
|