| 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 CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 // Called when a captured frame is available or the frame is no longer | 34 // Called when a captured frame is available or the frame is no longer |
| 35 // needed by the platform layer. | 35 // needed by the platform layer. |
| 36 // | 36 // |
| 37 // If |frame_captured| is true then frame provided contains valid content and | 37 // If |frame_captured| is true then frame provided contains valid content and |
| 38 // |timestamp| is the time when the frame was painted. | 38 // |timestamp| is the time when the frame was painted. |
| 39 // | 39 // |
| 40 // If |frame_captured| is false then the content in frame provided is | 40 // If |frame_captured| is false then the content in frame provided is |
| 41 // invalid. There was an error during the process of frame capture or the | 41 // invalid. There was an error during the process of frame capture or the |
| 42 // platform layer is shutting down. |timestamp| is also invalid in this case. | 42 // platform layer is shutting down. |timestamp| is also invalid in this case. |
| 43 // |
| 44 // |region_in_frame| is the location within the Videoframe where the |
| 45 // captured content resides, with the rest of the VideoFrame blacked out. |
| 43 typedef base::Callback<void(base::TimeTicks /* timestamp */, | 46 typedef base::Callback<void(base::TimeTicks /* timestamp */, |
| 47 const gfx::Rect& /* region_in_frame */, |
| 44 bool /* frame_captured */)> DeliverFrameCallback; | 48 bool /* frame_captured */)> DeliverFrameCallback; |
| 45 | 49 |
| 46 // Called when a new frame is going to be presented at time | 50 // Called when a new frame is going to be presented at time |
| 47 // |present_time| with |damage_rect| being the region of the frame that has | 51 // |present_time| with |damage_rect| being the region of the frame that has |
| 48 // changed since the last frame. The implementation decides whether the | 52 // changed since the last frame. The implementation decides whether the |
| 49 // current frame should be captured or not. | 53 // current frame should be captured or not. |
| 50 // | 54 // |
| 51 // Return true if the current frame should be captured. If so, |storage| | 55 // Return true if the current frame should be captured. If so, |storage| |
| 52 // will be set to hold an appropriately sized and allocated buffer into which | 56 // will be set to hold an appropriately sized and allocated buffer into which |
| 53 // to copy the frame. The platform presenter will perform scaling and color | 57 // to copy the frame. The platform presenter will perform scaling and color |
| 54 // space conversion to fit into the output frame. | 58 // space conversion to fit into the output frame. |
| 55 // | 59 // |
| 56 // Destination format is determined by |storage|, currently only | 60 // Destination format is determined by |storage|, currently only |
| 57 // media::PIXEL_FORMAT_YV12 is supported. Platform layer will perform color | 61 // media::PIXEL_FORMAT_YV12 is supported. Platform layer will perform color |
| 58 // space conversion if needed. | 62 // space conversion if needed. |
| 59 // | 63 // |
| 60 // When the frame is available |callback| will be called. It is up to the | 64 // When the frame is available |callback| will be called. It is up to the |
| 61 // platform layer to decide when to deliver a captured frame. | 65 // platform layer to decide when to deliver a captured frame. |
| 62 // | 66 // |
| 63 // Return false if the current frame should not be captured. | 67 // Return false if the current frame should not be captured. |
| 64 virtual bool ShouldCaptureFrame(const gfx::Rect& damage_rect, | 68 virtual bool ShouldCaptureFrame(const gfx::Rect& damage_rect, |
| 65 base::TimeTicks present_time, | 69 base::TimeTicks present_time, |
| 66 scoped_refptr<media::VideoFrame>* storage, | 70 scoped_refptr<media::VideoFrame>* storage, |
| 67 DeliverFrameCallback* callback) = 0; | 71 DeliverFrameCallback* callback) = 0; |
| 68 }; | 72 }; |
| 69 | 73 |
| 70 } // namespace content | 74 } // namespace content |
| 71 | 75 |
| 72 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ | 76 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ |
| OLD | NEW |