OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FRAME_CONSUMER_H_ | 5 #ifndef REMOTING_CLIENT_FRAME_CONSUMER_H_ |
6 #define REMOTING_CLIENT_FRAME_CONSUMER_H_ | 6 #define REMOTING_CLIENT_FRAME_CONSUMER_H_ |
7 | 7 |
8 #include "remoting/base/decoder.h" // For UpdatedRects | 8 #include "third_party/skia/include/core/SkRect.h" |
9 #include "third_party/skia/include/core/SkRegion.h" | |
10 #include "third_party/skia/include/core/SkSize.h" | |
11 | |
12 namespace pp { | |
13 class ImageData; | |
14 } // namespace pp | |
9 | 15 |
10 namespace remoting { | 16 namespace remoting { |
11 | 17 |
12 class FrameConsumer { | 18 class FrameConsumer { |
13 public: | 19 public: |
14 FrameConsumer() {} | 20 FrameConsumer() {} |
15 virtual ~FrameConsumer() {} | 21 virtual ~FrameConsumer() {} |
16 | 22 |
17 // Request a frame be allocated from the FrameConsumer. | 23 // The frame producer calls this method to return a drawing buffer containing |
18 // | 24 // pixels that need to be flushed to the screen. |region| specifies the region |
19 // If a frame cannot be allocated to fit the format, and |size| | 25 // of the frame to be flushed. I.e. the coordinates are relative to the frame, |
20 // requirements, |frame_out| will be set to NULL. | 26 // not to the clipping area. |
Wez
2012/02/17 23:42:17
nit: nor to the |buffer| coordinates
Wez
2012/02/17 23:42:17
Can you rephrase this comment to be more in keepin
alexeypa (please no reviews)
2012/02/21 23:00:44
Done.
| |
21 // | 27 virtual void PaintBuffer(const SkISize& view_size, |
22 // An allocated frame will have at least the |size| requested, but | 28 const SkIRect& clip_area, |
Wez
2012/02/17 23:42:17
If the top-left of |buffer| is assumed to match |c
| |
23 // may be bigger. Query the retrun frame for the actual frame size, | 29 pp::ImageData* buffer, |
Wez
2012/02/17 23:42:17
Hmmm. We really want a PP_Resource equivalent of
alexeypa (please no reviews)
2012/02/21 23:00:44
Well, we can introduce a wrapper object that carri
Wez
2012/02/23 00:11:09
OK!
| |
24 // stride, etc. | 30 const SkRegion& region) = 0; |
25 // | |
26 // The AllocateFrame call is asynchronous. From invocation, until when the | |
27 // |done| callback is invoked, |frame_out| should be considered to be locked | |
28 // by the FrameConsumer, must remain a valid pointer, and should not be | |
29 // examined or modified. After |done| is called, the |frame_out| will | |
30 // contain a result of the allocation. If a frame could not be allocated, | |
31 // |frame_out| will be NULL. | |
32 // | |
33 // All frames retrieved via the AllocateFrame call must be released by a | |
34 // corresponding call ReleaseFrame(scoped_refptr<VideoFrame>* frame_out. | |
35 virtual void AllocateFrame(media::VideoFrame::Format format, | |
36 const SkISize& size, | |
37 scoped_refptr<media::VideoFrame>* frame_out, | |
38 const base::Closure& done) = 0; | |
39 | 31 |
40 virtual void ReleaseFrame(media::VideoFrame* frame) = 0; | 32 // The frame producer returns the drawing buffers that could not be used for |
33 // drawing because of various reasons (shutdown is in progress, the view area | |
34 // has changed, etc.) by calling ReturnBuffer(). | |
35 virtual void ReturnBuffer(pp::ImageData* buffer) = 0; | |
Wez
2012/02/17 23:42:17
scoped_ptr<>?
alexeypa (please no reviews)
2012/02/21 23:00:44
No, this pointer does not carry ownership. The con
| |
41 | 36 |
42 // OnPartialFrameOutput() is called every time at least one rectangle of | 37 // Set the dimension of the entire host screen. |
43 // output is produced. The |frame| is guaranteed to have valid data for all | 38 virtual void SetScreenSize(const SkISize& screen_size) = 0; |
Wez
2012/02/17 23:42:17
This is the only API with a Chromoting-specific na
alexeypa (please no reviews)
2012/02/21 23:00:44
SetSourceSize(). Done.
| |
44 // of |region|. | |
45 // | |
46 // Both |frame| and |region| are guaranteed to be valid until the |done| | |
47 // callback is invoked. | |
48 virtual void OnPartialFrameOutput(media::VideoFrame* frame, | |
49 SkRegion* region, | |
50 const base::Closure& done) = 0; | |
51 | 39 |
52 private: | 40 private: |
53 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); | 41 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); |
54 }; | 42 }; |
55 | 43 |
56 } // namespace remoting | 44 } // namespace remoting |
57 | 45 |
58 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ | 46 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ |
OLD | NEW |