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

Side by Side Diff: remoting/host/video_frame_capturer.h

Issue 11363128: Converted VideoFrameCapturer callbacks into a VideoFrameCapturer::Delegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More Mac compilation issues. Created 8 years, 1 month 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
« no previous file with comments | « remoting/host/host_mock_objects.cc ('k') | remoting/host/video_frame_capturer_fake.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_HOST_VIDEO_FRAME_CAPTURER_H_ 5 #ifndef REMOTING_HOST_VIDEO_FRAME_CAPTURER_H_
6 #define REMOTING_HOST_VIDEO_FRAME_CAPTURER_H_ 6 #define REMOTING_HOST_VIDEO_FRAME_CAPTURER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // 43 //
44 // (4) Stop 44 // (4) Stop
45 // This is when post-capture steps are executed, such as releasing the 45 // This is when post-capture steps are executed, such as releasing the
46 // assertion that prevents the display from sleeping. 46 // assertion that prevents the display from sleeping.
47 // 47 //
48 // Implementation has to ensure the following guarantees: 48 // Implementation has to ensure the following guarantees:
49 // 1. Double buffering 49 // 1. Double buffering
50 // Since data can be read while another capture action is happening. 50 // Since data can be read while another capture action is happening.
51 class VideoFrameCapturer { 51 class VideoFrameCapturer {
52 public: 52 public:
53 // CaptureCompletedCallback is called when the capturer has completed. 53 // Provides callbacks used by the capturer to pass captured video frames and
54 typedef base::Callback<void(scoped_refptr<CaptureData>)> 54 // mouse cursor shapes to the processing pipeline.
55 CaptureCompletedCallback; 55 class Delegate {
56 public:
57 virtual ~Delegate() {}
56 58
57 // CursorShapeChangedCallback is called when the cursor shape has changed. 59 // Called when the capturer has completed. |capture_data| describes
58 typedef base::Callback<void(scoped_ptr<protocol::CursorShapeInfo>)> 60 // a captured frame.
59 CursorShapeChangedCallback; 61 virtual void OnCaptureCompleted(
62 scoped_refptr<CaptureData> capture_data) = 0;
63
64 // Called when the cursor shape has changed.
65 virtual void OnCursorShapeChanged(
66 scoped_ptr<protocol::CursorShapeInfo> cursor_shape) = 0;
67 };
60 68
61 virtual ~VideoFrameCapturer() {} 69 virtual ~VideoFrameCapturer() {}
62 70
63 // Create platform-specific capturer. 71 // Create platform-specific capturer.
64 static VideoFrameCapturer* Create(); 72 static VideoFrameCapturer* Create();
65 73
66 #if defined(OS_LINUX) 74 #if defined(OS_LINUX)
67 // Set whether the VideoFrameCapturer should try to use X DAMAGE support if it 75 // Set whether the VideoFrameCapturer should try to use X DAMAGE support if it
68 // is available. This needs to be called before the VideoFrameCapturer is 76 // is available. This needs to be called before the VideoFrameCapturer is
69 // created. 77 // created.
70 // This is used by the Virtual Me2Me host, since the XDamage extension is 78 // This is used by the Virtual Me2Me host, since the XDamage extension is
71 // known to work reliably in this case. 79 // known to work reliably in this case.
72 80
73 // TODO(lambroslambrou): This currently sets a global flag, referenced during 81 // TODO(lambroslambrou): This currently sets a global flag, referenced during
74 // VideoFrameCapturer::Create(). This is a temporary solution, until the 82 // VideoFrameCapturer::Create(). This is a temporary solution, until the
75 // DesktopEnvironment class is refactored to allow applications to control 83 // DesktopEnvironment class is refactored to allow applications to control
76 // the creation of various stubs (including the VideoFrameCapturer) - see 84 // the creation of various stubs (including the VideoFrameCapturer) - see
77 // http://crbug.com/104544 85 // http://crbug.com/104544
78 static void EnableXDamage(bool enable); 86 static void EnableXDamage(bool enable);
79 #endif // defined(OS_LINUX) 87 #endif // defined(OS_LINUX)
80 88
81 // Called at the beginning of a capturing session. 89 // Called at the beginning of a capturing session. |delegate| must remain
82 virtual void Start( 90 // valid until Stop() is called.
83 const CursorShapeChangedCallback& callback) = 0; 91 virtual void Start(Delegate* delegate) = 0;
84 92
85 // Called at the end of a capturing session. 93 // Called at the end of a capturing session.
86 virtual void Stop() = 0; 94 virtual void Stop() = 0;
87 95
88 // Return the pixel format of the screen. 96 // Returns the pixel format of the screen.
89 virtual media::VideoFrame::Format pixel_format() const = 0; 97 virtual media::VideoFrame::Format pixel_format() const = 0;
90 98
91 // Invalidate the specified region. 99 // Invalidates the specified region.
92 virtual void InvalidateRegion(const SkRegion& invalid_region) = 0; 100 virtual void InvalidateRegion(const SkRegion& invalid_region) = 0;
93 101
94 // Capture the screen data associated with each of the accumulated 102 // Captures the screen data associated with each of the accumulated
95 // dirty region. 103 // dirty region. When the capture is complete, the delegate is notified even
96 // When the capture is complete, |callback| is called even if the dirty region 104 // if the dirty region is empty.
97 // is empty.
98 // 105 //
99 // It is OK to call this method while another thread is reading 106 // It is OK to call this method while another thread is reading
100 // data of the previous capture. 107 // data of the previous capture. There can be at most one concurrent read
101 // There can be at most one concurrent read going on when this 108 // going on when this method is called.
102 // method is called. 109 virtual void CaptureInvalidRegion() = 0;
103 virtual void CaptureInvalidRegion(
104 const CaptureCompletedCallback& callback) = 0;
105 110
106 // Get the size of the most recently captured screen. 111 // Get the size of the most recently captured screen.
107 virtual const SkISize& size_most_recent() const = 0; 112 virtual const SkISize& size_most_recent() const = 0;
108 }; 113 };
109 114
110 } // namespace remoting 115 } // namespace remoting
111 116
112 #endif // REMOTING_HOST_VIDEO_FRAME_CAPTURER_H_ 117 #endif // REMOTING_HOST_VIDEO_FRAME_CAPTURER_H_
OLDNEW
« no previous file with comments | « remoting/host/host_mock_objects.cc ('k') | remoting/host/video_frame_capturer_fake.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698