| 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_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H
_ |
| 6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_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 #include "cc/output/copy_output_request.h" |
| 10 | 11 |
| 11 namespace gfx { | 12 namespace gfx { |
| 12 class Rect; | 13 class Rect; |
| 13 } // namespace gfx | 14 } // namespace gfx |
| 14 | 15 |
| 15 namespace media { | 16 namespace media { |
| 16 class VideoFrame; | 17 class VideoFrame; |
| 17 } // namespace media | 18 } // namespace media |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 37 // |timestamp| is the time when the frame was painted. | 38 // |timestamp| is the time when the frame was painted. |
| 38 // | 39 // |
| 39 // 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 |
| 40 // 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 |
| 41 // 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. |
| 42 // | 43 // |
| 43 // |region_in_frame| is the location within the Videoframe where the | 44 // |region_in_frame| is the location within the Videoframe where the |
| 44 // captured content resides, with the rest of the VideoFrame blacked out. | 45 // captured content resides, with the rest of the VideoFrame blacked out. |
| 45 typedef base::Callback<void(base::TimeTicks /* timestamp */, | 46 typedef base::Callback<void(base::TimeTicks /* timestamp */, |
| 46 const gfx::Rect& /* region_in_frame */, | 47 const gfx::Rect& /* region_in_frame */, |
| 47 bool /* frame_captured */)> DeliverFrameCallback; | 48 bool /* frame_captured */)> |
| 49 DeliverFrameCallback; |
| 48 | 50 |
| 49 // Called when a new frame is going to be presented at time | 51 // Called when a new frame is going to be presented at time |
| 50 // |present_time| with |damage_rect| being the region of the frame that has | 52 // |present_time| with |damage_rect| being the region of the frame that has |
| 51 // changed since the last frame. The implementation decides whether the | 53 // changed since the last frame. The implementation decides whether the |
| 52 // current frame should be captured or not. | 54 // current frame should be captured or not. |
| 53 // | 55 // |
| 54 // Return true if the current frame should be captured. If so, |storage| | 56 // Return true if the current frame should be captured. If so, |storage| |
| 55 // will be set to hold an appropriately sized and allocated buffer into which | 57 // will be set to hold an appropriately sized and allocated buffer into which |
| 56 // to copy the frame. The platform presenter will perform scaling and color | 58 // to copy the frame. The platform presenter will perform scaling and color |
| 57 // space conversion to fit into the output frame. | 59 // space conversion to fit into the output frame. |
| 58 // | 60 // |
| 59 // Destination format is determined by |storage|, currently only | 61 // Destination format is determined by |storage|, currently only |
| 60 // media::PIXEL_FORMAT_YV12 is supported. Platform layer will perform color | 62 // media::PIXEL_FORMAT_YV12 is supported. Platform layer will perform color |
| 61 // space conversion if needed. | 63 // space conversion if needed. |
| 62 // | 64 // |
| 63 // When the frame is available |callback| will be called. It is up to the | 65 // When the frame is available |callback| will be called. It is up to the |
| 64 // platform layer to decide when to deliver a captured frame. | 66 // platform layer to decide when to deliver a captured frame. |
| 65 // | 67 // |
| 66 // Return false if the current frame should not be captured. | 68 // Return false if the current frame should not be captured. |
| 67 virtual bool ShouldCaptureFrame(const gfx::Rect& damage_rect, | 69 virtual bool ShouldCaptureFrame(const gfx::Rect& damage_rect, |
| 68 base::TimeTicks present_time, | 70 base::TimeTicks present_time, |
| 69 scoped_refptr<media::VideoFrame>* storage, | 71 scoped_refptr<media::VideoFrame>* storage, |
| 70 DeliverFrameCallback* callback) = 0; | 72 DeliverFrameCallback* callback) = 0; |
| 73 |
| 74 virtual const base::UnguessableToken& GetSourceIdForCopyRequest() = 0; |
| 71 }; | 75 }; |
| 72 | 76 |
| 73 } // namespace content | 77 } // namespace content |
| 74 | 78 |
| 75 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_ | 79 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBE
R_H_ |
| OLD | NEW |