OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "remoting/base/decoder.h" // For UpdatedRects |
9 | 9 |
10 class Task; | 10 class Task; |
11 | 11 |
12 namespace remoting { | 12 namespace remoting { |
13 | 13 |
14 class FrameConsumer { | 14 class FrameConsumer { |
15 public: | 15 public: |
16 FrameConsumer() {} | 16 FrameConsumer() {} |
17 virtual ~FrameConsumer() {} | 17 virtual ~FrameConsumer() {} |
18 | 18 |
19 // Request a frame be allocated from the FrameConsumer. | 19 // Request a frame be allocated from the FrameConsumer. |
20 // | 20 // |
21 // If a frame cannot be allocated to fit the format, and height/width | 21 // If a frame cannot be allocated to fit the format, and |size| |
22 // requirements, |frame_out| will be set to NULL. | 22 // requirements, |frame_out| will be set to NULL. |
23 // | 23 // |
24 // An allocated frame will have at least the width and height requested, but | 24 // An allocated frame will have at least the |size| requested, but |
25 // may be bigger. Query the retrun frame for the actual frame size, stride, | 25 // may be bigger. Query the retrun frame for the actual frame size, |
26 // etc. | 26 // stride, etc. |
27 // | 27 // |
28 // The AllocateFrame call is asynchronous. From invocation, until when the | 28 // The AllocateFrame call is asynchronous. From invocation, until when the |
29 // |done| callback is invoked, |frame_out| should be considered to be locked | 29 // |done| callback is invoked, |frame_out| should be considered to be locked |
30 // by the FrameConsumer, must remain a valid pointer, and should not be | 30 // by the FrameConsumer, must remain a valid pointer, and should not be |
31 // examined or modified. After |done| is called, the |frame_out| will | 31 // examined or modified. After |done| is called, the |frame_out| will |
32 // contain a result of the allocation. If a frame could not be allocated, | 32 // contain a result of the allocation. If a frame could not be allocated, |
33 // |frame_out| will be NULL. | 33 // |frame_out| will be NULL. |
34 // | 34 // |
35 // All frames retrieved via the AllocateFrame call must be released by a | 35 // All frames retrieved via the AllocateFrame call must be released by a |
36 // corresponding call ReleaseFrame(scoped_refptr<VideoFrame>* frame_out. | 36 // corresponding call ReleaseFrame(scoped_refptr<VideoFrame>* frame_out. |
37 virtual void AllocateFrame(media::VideoFrame::Format format, | 37 virtual void AllocateFrame(media::VideoFrame::Format format, |
38 size_t width, | 38 const SkISize& size, |
39 size_t height, | |
40 base::TimeDelta timestamp, | |
41 base::TimeDelta duration, | |
42 scoped_refptr<media::VideoFrame>* frame_out, | 39 scoped_refptr<media::VideoFrame>* frame_out, |
43 Task* done) = 0; | 40 const base::Closure& done) = 0; |
44 | 41 |
45 virtual void ReleaseFrame(media::VideoFrame* frame) = 0; | 42 virtual void ReleaseFrame(media::VideoFrame* frame) = 0; |
46 | 43 |
47 // OnPartialFrameOutput() is called every time at least one rectangle of | 44 // OnPartialFrameOutput() is called every time at least one rectangle of |
48 // output is produced. The |frame| is guaranteed to have valid data for every | 45 // output is produced. The |frame| is guaranteed to have valid data for every |
49 // region included in the |rects| list. | 46 // region included in the |rects| list. |
50 // | 47 // |
51 // Both |frame| and |rects| are guaranteed to be valid until the |done| | 48 // Both |frame| and |rects| are guaranteed to be valid until the |done| |
52 // callback is invoked. | 49 // callback is invoked. |
53 virtual void OnPartialFrameOutput(media::VideoFrame* frame, | 50 virtual void OnPartialFrameOutput(media::VideoFrame* frame, |
54 RectVector* rects, | 51 RectVector* rects, |
55 Task* done) = 0; | 52 const base::Closure& done) = 0; |
56 | 53 |
57 private: | 54 private: |
58 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); | 55 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); |
59 }; | 56 }; |
60 | 57 |
61 } // namespace remoting | 58 } // namespace remoting |
62 | 59 |
63 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ | 60 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ |
OLD | NEW |