OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_CLIENT_X11_VIEW_H_ | 5 #ifndef REMOTING_CLIENT_X11_VIEW_H_ |
6 #define REMOTING_CLIENT_X11_VIEW_H_ | 6 #define REMOTING_CLIENT_X11_VIEW_H_ |
7 | 7 |
8 #include "base/basictypes.h" | |
9 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/task.h" |
10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| 11 #include "remoting/base/decoder.h" // For UpdatedRects |
| 12 #include "remoting/client/frame_consumer.h" |
11 #include "remoting/client/chromoting_view.h" | 13 #include "remoting/client/chromoting_view.h" |
12 | 14 |
13 typedef unsigned long XID; | 15 typedef unsigned long XID; |
14 typedef struct _XDisplay Display; | 16 typedef struct _XDisplay Display; |
15 | 17 |
16 namespace remoting { | 18 namespace remoting { |
17 | 19 |
18 // A ChromotingView implemented using X11 and XRender. | 20 // A ChromotingView implemented using X11 and XRender. |
19 class X11View : public ChromotingView { | 21 class X11View : public ChromotingView, public FrameConsumer { |
20 public: | 22 public: |
21 X11View(); | 23 X11View(); |
22 virtual ~X11View(); | 24 virtual ~X11View(); |
23 | 25 |
24 // ChromotingView implementations. | 26 // ChromotingView implementations. |
25 virtual bool Initialize(); | 27 virtual bool Initialize(); |
26 virtual void TearDown(); | 28 virtual void TearDown(); |
27 virtual void Paint(); | 29 virtual void Paint(); |
28 virtual void SetSolidFill(uint32 color); | 30 virtual void SetSolidFill(uint32 color); |
29 virtual void UnsetSolidFill(); | 31 virtual void UnsetSolidFill(); |
30 virtual void SetViewport(int x, int y, int width, int height); | 32 virtual void SetViewport(int x, int y, int width, int height); |
31 virtual void SetHostScreenSize(int width, int height); | 33 |
32 virtual void HandleBeginUpdateStream(ChromotingHostMessage* msg); | 34 // FrameConsumer implementation. |
33 virtual void HandleUpdateStreamPacket(ChromotingHostMessage* msg); | 35 virtual void AllocateFrame(media::VideoFrame::Format format, |
34 virtual void HandleEndUpdateStream(ChromotingHostMessage* msg); | 36 size_t width, |
| 37 size_t height, |
| 38 base::TimeDelta timestamp, |
| 39 base::TimeDelta duration, |
| 40 scoped_refptr<media::VideoFrame>* frame_out, |
| 41 Task* done); |
| 42 virtual void ReleaseFrame(media::VideoFrame* frame); |
| 43 virtual void OnPartialFrameOutput(media::VideoFrame* frame, |
| 44 UpdatedRects* rects, |
| 45 Task* done); |
35 | 46 |
36 Display* display() { return display_; } | 47 Display* display() { return display_; } |
37 | 48 |
38 private: | 49 private: |
39 void InitPaintTarget(); | 50 void InitPaintTarget(); |
40 void OnPartialDecodeDone(); | 51 void PaintRect(media::VideoFrame* frame, const gfx::Rect& clip); |
41 void OnDecodeDone(); | |
42 | 52 |
43 Display* display_; | 53 Display* display_; |
44 XID window_; | 54 XID window_; |
45 | 55 |
46 // A picture created in the X server that represents drawing area of the | 56 // A picture created in the X server that represents drawing area of the |
47 // window. | 57 // window. |
48 XID picture_; | 58 XID picture_; |
49 | 59 |
50 DISALLOW_COPY_AND_ASSIGN(X11View); | 60 DISALLOW_COPY_AND_ASSIGN(X11View); |
51 }; | 61 }; |
52 | 62 |
53 } // namespace remoting | 63 } // namespace remoting |
54 | 64 |
55 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::X11View); | 65 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::X11View); |
56 | 66 |
57 #endif // REMOTING_CLIENT_X11_VIEW_H_ | 67 #endif // REMOTING_CLIENT_X11_VIEW_H_ |
OLD | NEW |