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 #include "remoting/capturer/video_frame_capturer.h" | 5 #include "remoting/capturer/video_frame_capturer.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 public: | 79 public: |
80 VideoFrameCapturerWin(); | 80 VideoFrameCapturerWin(); |
81 explicit VideoFrameCapturerWin(SharedBufferFactory* shared_buffer_factory); | 81 explicit VideoFrameCapturerWin(SharedBufferFactory* shared_buffer_factory); |
82 virtual ~VideoFrameCapturerWin(); | 82 virtual ~VideoFrameCapturerWin(); |
83 | 83 |
84 // Overridden from VideoFrameCapturer: | 84 // Overridden from VideoFrameCapturer: |
85 virtual void Start(Delegate* delegate) OVERRIDE; | 85 virtual void Start(Delegate* delegate) OVERRIDE; |
86 virtual void Stop() OVERRIDE; | 86 virtual void Stop() OVERRIDE; |
87 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; | 87 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; |
88 virtual void CaptureFrame() OVERRIDE; | 88 virtual void CaptureFrame() OVERRIDE; |
89 virtual const SkISize& size_most_recent() const OVERRIDE; | |
90 | 89 |
91 private: | 90 private: |
92 // Make sure that the device contexts match the screen configuration. | 91 // Make sure that the device contexts match the screen configuration. |
93 void PrepareCaptureResources(); | 92 void PrepareCaptureResources(); |
94 | 93 |
95 // Creates a CaptureData instance wrapping the current framebuffer and | 94 // Creates a CaptureData instance wrapping the current framebuffer and |
96 // notifies |delegate_|. | 95 // notifies |delegate_|. |
97 void CaptureRegion(const SkRegion& region, | 96 void CaptureRegion(const SkRegion& region, |
98 const base::Time& capture_start_time); | 97 const base::Time& capture_start_time); |
99 | 98 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // Wrap the captured frame into CaptureData structure and invoke | 267 // Wrap the captured frame into CaptureData structure and invoke |
269 // the completion callback. | 268 // the completion callback. |
270 SkRegion invalid_region; | 269 SkRegion invalid_region; |
271 helper_.SwapInvalidRegion(&invalid_region); | 270 helper_.SwapInvalidRegion(&invalid_region); |
272 CaptureRegion(invalid_region, capture_start_time); | 271 CaptureRegion(invalid_region, capture_start_time); |
273 | 272 |
274 // Check for cursor shape update. | 273 // Check for cursor shape update. |
275 CaptureCursor(); | 274 CaptureCursor(); |
276 } | 275 } |
277 | 276 |
278 const SkISize& VideoFrameCapturerWin::size_most_recent() const { | |
279 return helper_.size_most_recent(); | |
280 } | |
281 | |
282 void VideoFrameCapturerWin::Start(Delegate* delegate) { | 277 void VideoFrameCapturerWin::Start(Delegate* delegate) { |
283 DCHECK(delegate_ == NULL); | 278 DCHECK(delegate_ == NULL); |
284 | 279 |
285 delegate_ = delegate; | 280 delegate_ = delegate; |
286 | 281 |
287 // Load dwmapi.dll dynamically since it is not available on XP. | 282 // Load dwmapi.dll dynamically since it is not available on XP. |
288 if (!dwmapi_library_.is_valid()) { | 283 if (!dwmapi_library_.is_valid()) { |
289 FilePath path(base::GetNativeLibraryName(UTF8ToUTF16(kDwmapiLibraryName))); | 284 FilePath path(base::GetNativeLibraryName(UTF8ToUTF16(kDwmapiLibraryName))); |
290 dwmapi_library_.Reset(base::LoadNativeLibrary(path, NULL)); | 285 dwmapi_library_.Reset(base::LoadNativeLibrary(path, NULL)); |
291 } | 286 } |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 | 589 |
595 // static | 590 // static |
596 scoped_ptr<VideoFrameCapturer> VideoFrameCapturer::CreateWithFactory( | 591 scoped_ptr<VideoFrameCapturer> VideoFrameCapturer::CreateWithFactory( |
597 SharedBufferFactory* shared_buffer_factory) { | 592 SharedBufferFactory* shared_buffer_factory) { |
598 scoped_ptr<VideoFrameCapturerWin> capturer( | 593 scoped_ptr<VideoFrameCapturerWin> capturer( |
599 new VideoFrameCapturerWin(shared_buffer_factory)); | 594 new VideoFrameCapturerWin(shared_buffer_factory)); |
600 return capturer.PassAs<VideoFrameCapturer>(); | 595 return capturer.PassAs<VideoFrameCapturer>(); |
601 } | 596 } |
602 | 597 |
603 } // namespace remoting | 598 } // namespace remoting |
OLD | NEW |