Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(746)

Side by Side Diff: content/port/browser/render_widget_host_view_frame_subscriber.h

Issue 12277023: Define frame subscription interface and implementation on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed one header Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_
6 #define CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_
7
8 #include "base/callback.h"
9 #include "base/time.h"
10
11 namespace gfx {
12 class Rect;
13 class Size;
14 } // namespace gfx
15
16 namespace media {
17 class VideoFrame;
18 } // namespace media
19
20 namespace content {
21
22 // Defines an interface for listening to events of frame presentation and to
23 // instruct the platform layer (i.e. RenderWidgetHostViewPort) to copy a frame.
24 //
25 // Further processing is possible (e.g. scale and clip) through this
26 // interface. See ShouldCaptureFrame() for details.
27 //
28 // Objects of this class live on the UI thread.
piman 2013/02/22 20:45:47 How will this work on non-aura windows?
Alpha Left Google 2013/02/22 21:05:38 Present has to go through UI thread somehow, we pl
piman 2013/02/22 21:18:54 No, it doesn't in the general case. On windows, th
29 class RenderWidgetHostViewFrameSubscriber {
30 public:
31 virtual ~RenderWidgetHostViewFrameSubscriber() {}
32
33 // Called when a captured frame is available or the frame is no longer
34 // needed by the platform layer.
35 //
36 // If |frame_captured| is true then frame provided contains valid content and
37 // |timestamp| is the time when the frame was painted.
38 //
39 // 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 // platform layer is shutting down. |timestamp| is also invalid in this case.
42 typedef base::Callback<void(
43 bool /* frame_captured */,
44 base::Time /* timestamp */)> DeliverFrameCallback;
45
46 // Called when a new frame is going to be presented. Implementation can
47 // decide whether the current frame should be captured or not. Frame size
48 // is given such that implementor can choose to apply scaling and clipping
49 // to the frame captured. |src_size| is the size of the frame going to be
50 // presented, |src_subrect| will be set to choose clipping rectangle and
51 // |dst_subrect| will be set to choose destination rectangle.
52 //
53 // Return true if the current frame should be captured. If so, |storage|
54 // should will be set to hold an appropriately sized and allocated buffer
55 // into which to copy the frame.
56 //
57 // Destination format is determined by |storage|, currently only
58 // media::VideoFrame::YV12 is supported. Platform layer will perform color
59 // space conversion if needed.
piman 2013/02/22 20:45:47 So, that leaves the RWHV responsible for doing the
Alpha Left Google 2013/02/22 21:05:38 Without our team we went back and forth with this.
piman 2013/02/22 21:18:54 "simplyfy" = maybe for you, but really it means mo
60 //
61 // When the frame is available |callback| will be called. It is up to the
62 // platform layer to decide when to deliver a captured frame.
63 //
64 // Return false if the current frame should not be captured.
65 virtual bool ShouldCaptureFrame(
66 const gfx::Size& src_size,
67 gfx::Rect* src_subrect,
68 gfx::Rect* dst_subrect,
piman 2013/02/22 20:45:47 do we really need dst_subrect, or simply dst_size?
Alpha Left Google 2013/02/22 21:05:38 Yes because of letter boxing. Implementation of Fr
piman 2013/02/22 21:18:54 Not sure I understand... why would we want to carr
69 scoped_refptr<media::VideoFrame>* storage,
70 DeliverFrameCallback* callback) = 0;
71 };
72
73 } // namespace content
74
75 #endif // CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_FRAME_SUBSCRIBER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698