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 // Accepts a buffer to be painted to the screen. The buffer's dimensions and |
24 // relative position within the frame are specified by |clip_area|. Only | |
25 // pixels within |region| are painted. The function assumes that the passed | |
Wez
2012/02/23 00:11:09
nit: within |region| and |clip_area|? Or must |re
alexeypa (please no reviews)
2012/02/23 17:10:33
Reworded the comment to mention that only pixels w
| |
26 // buffer was scaled to fit a window having |view_size| dimentions. | |
18 // | 27 // |
19 // If a frame cannot be allocated to fit the format, and |size| | 28 // N.B. Both |clip_area| and |region| are in output coordinates relative to |
20 // requirements, |frame_out| will be set to NULL. | 29 // the frame. |
21 // | 30 virtual void PaintBuffer(const SkISize& view_size, |
22 // An allocated frame will have at least the |size| requested, but | 31 const SkIRect& clip_area, |
23 // may be bigger. Query the retrun frame for the actual frame size, | 32 pp::ImageData* buffer, |
24 // stride, etc. | 33 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 | 34 |
40 virtual void ReleaseFrame(media::VideoFrame* frame) = 0; | 35 // Accepts a buffer that couldn't be used for drawing for any reason (shutdown |
36 // is in progress, the view area has changed, etc.). The accepted buffer can | |
37 // be freed or reused for another drawing operation. | |
38 virtual void ReturnBuffer(pp::ImageData* buffer) = 0; | |
41 | 39 |
42 // OnPartialFrameOutput() is called every time at least one rectangle of | 40 // Set the dimension of the entire host screen. |
43 // output is produced. The |frame| is guaranteed to have valid data for all | 41 virtual void SetSourceSize(const SkISize& source_size) = 0; |
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 | 42 |
52 private: | 43 private: |
53 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); | 44 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); |
54 }; | 45 }; |
55 | 46 |
56 } // namespace remoting | 47 } // namespace remoting |
57 | 48 |
58 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ | 49 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ |
OLD | NEW |