| OLD | NEW |
| (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 REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ | |
| 6 #define REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "remoting/host/video_frame_capturer.h" | |
| 10 #include "remoting/host/video_frame_capturer_helper.h" | |
| 11 | |
| 12 namespace remoting { | |
| 13 | |
| 14 // A VideoFrameCapturerFake generates artificial image for testing purpose. | |
| 15 // | |
| 16 // VideoFrameCapturerFake is double-buffered as required by VideoFrameCapturer. | |
| 17 // See remoting/host/video_frame_capturer.h. | |
| 18 class VideoFrameCapturerFake : public VideoFrameCapturer { | |
| 19 public: | |
| 20 VideoFrameCapturerFake(); | |
| 21 virtual ~VideoFrameCapturerFake(); | |
| 22 | |
| 23 // Overridden from VideoFrameCapturer: | |
| 24 virtual void Start(Delegate* delegate) OVERRIDE; | |
| 25 virtual void Stop() OVERRIDE; | |
| 26 virtual media::VideoFrame::Format pixel_format() const OVERRIDE; | |
| 27 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; | |
| 28 virtual void CaptureFrame() OVERRIDE; | |
| 29 virtual const SkISize& size_most_recent() const OVERRIDE; | |
| 30 | |
| 31 private: | |
| 32 // Generates an image in the front buffer. | |
| 33 void GenerateImage(); | |
| 34 | |
| 35 // Called when the screen configuration is changed. | |
| 36 void ScreenConfigurationChanged(); | |
| 37 | |
| 38 Delegate* delegate_; | |
| 39 | |
| 40 SkISize size_; | |
| 41 int bytes_per_row_; | |
| 42 int box_pos_x_; | |
| 43 int box_pos_y_; | |
| 44 int box_speed_x_; | |
| 45 int box_speed_y_; | |
| 46 | |
| 47 VideoFrameCapturerHelper helper_; | |
| 48 | |
| 49 // We have two buffers for the screen images as required by Capturer. | |
| 50 static const int kNumBuffers = 2; | |
| 51 scoped_array<uint8> buffers_[kNumBuffers]; | |
| 52 | |
| 53 // The current buffer with valid data for reading. | |
| 54 int current_buffer_; | |
| 55 | |
| 56 // Format of pixels returned in buffer. | |
| 57 media::VideoFrame::Format pixel_format_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(VideoFrameCapturerFake); | |
| 60 }; | |
| 61 | |
| 62 } // namespace remoting | |
| 63 | |
| 64 #endif // REMOTING_HOST_VIDEO_FRAME_CAPTURER_FAKE_H_ | |
| OLD | NEW |