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

Side by Side Diff: media/capture/video/fake_video_capture_device.h

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « media/capture/video/blob_utils.cc ('k') | media/capture/video/fake_video_capture_device.cc » ('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 // Implementation of a fake VideoCaptureDevice class. Used for testing other 5 // Implementation of a fake VideoCaptureDevice class. Used for testing other
6 // video capture classes when no real hardware is available. 6 // video capture classes when no real hardware is available.
7 7
8 #ifndef MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_H_ 8 #ifndef MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_H_
9 #define MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_H_ 9 #define MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_H_
10 10
(...skipping 12 matching lines...) Expand all
23 namespace media { 23 namespace media {
24 24
25 class CAPTURE_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice { 25 class CAPTURE_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice {
26 public: 26 public:
27 enum class BufferOwnership { 27 enum class BufferOwnership {
28 OWN_BUFFERS, 28 OWN_BUFFERS,
29 CLIENT_BUFFERS, 29 CLIENT_BUFFERS,
30 }; 30 };
31 31
32 FakeVideoCaptureDevice(BufferOwnership buffer_ownership, 32 FakeVideoCaptureDevice(BufferOwnership buffer_ownership,
33 float fake_capture_rate); 33 float fake_capture_rate,
34 VideoPixelFormat pixel_format = PIXEL_FORMAT_I420);
34 ~FakeVideoCaptureDevice() override; 35 ~FakeVideoCaptureDevice() override;
35 36
36 // VideoCaptureDevice implementation. 37 // VideoCaptureDevice implementation.
37 void AllocateAndStart(const VideoCaptureParams& params, 38 void AllocateAndStart(const VideoCaptureParams& params,
38 std::unique_ptr<Client> client) override; 39 std::unique_ptr<Client> client) override;
39 void StopAndDeAllocate() override; 40 void StopAndDeAllocate() override;
40 void GetPhotoCapabilities(GetPhotoCapabilitiesCallback callback) override; 41 void GetPhotoCapabilities(GetPhotoCapabilitiesCallback callback) override;
41 void SetPhotoOptions(mojom::PhotoSettingsPtr settings, 42 void SetPhotoOptions(mojom::PhotoSettingsPtr settings,
42 SetPhotoOptionsCallback callback) override; 43 SetPhotoOptionsCallback callback) override;
43 void TakePhoto(TakePhotoCallback callback) override; 44 void TakePhoto(TakePhotoCallback callback) override;
44 45
45 private: 46 private:
46 void CaptureUsingOwnBuffers(base::TimeTicks expected_execution_time); 47 void CaptureUsingOwnBuffers(base::TimeTicks expected_execution_time);
47 void CaptureUsingClientBuffers(base::TimeTicks expected_execution_time); 48 void CaptureUsingClientBuffers(base::TimeTicks expected_execution_time);
48 void BeepAndScheduleNextCapture( 49 void BeepAndScheduleNextCapture(
49 base::TimeTicks expected_execution_time, 50 base::TimeTicks expected_execution_time,
50 const base::Callback<void(base::TimeTicks)>& next_capture); 51 const base::Callback<void(base::TimeTicks)>& next_capture);
51 52
52 // |thread_checker_| is used to check that all methods are called in the 53 // |thread_checker_| is used to check that all methods are called in the
53 // correct thread that owns the object. 54 // correct thread that owns the object.
54 base::ThreadChecker thread_checker_; 55 base::ThreadChecker thread_checker_;
55 56
56 const BufferOwnership buffer_ownership_; 57 const BufferOwnership buffer_ownership_;
57 // Frame rate of the fake video device. 58 // Frame rate of the fake video device.
58 const float fake_capture_rate_; 59 const float fake_capture_rate_;
60 // Pixel format of all device streams.
61 const VideoPixelFormat pixel_format_;
59 62
60 std::unique_ptr<VideoCaptureDevice::Client> client_; 63 std::unique_ptr<VideoCaptureDevice::Client> client_;
61 // |fake_frame_| is used for capturing on Own Buffers. 64 // |fake_frame_| is used for capturing on Own Buffers.
62 std::unique_ptr<uint8_t[]> fake_frame_; 65 std::unique_ptr<uint8_t[]> fake_frame_;
63 // Time when the next beep occurs. 66 // Time when the next beep occurs.
64 base::TimeDelta beep_time_; 67 base::TimeDelta beep_time_;
65 // Time since the fake video started rendering frames. 68 // Time since the fake video started rendering frames.
66 base::TimeDelta elapsed_time_; 69 base::TimeDelta elapsed_time_;
67 VideoCaptureFormat capture_format_; 70 VideoCaptureFormat capture_format_;
68 71
69 uint32_t current_zoom_; 72 uint32_t current_zoom_;
70 73
71 // The system time when we receive the first frame. 74 // The system time when we receive the first frame.
72 base::TimeTicks first_ref_time_; 75 base::TimeTicks first_ref_time_;
73 // FakeVideoCaptureDevice post tasks to itself for frame construction and 76 // FakeVideoCaptureDevice post tasks to itself for frame construction and
74 // needs to deal with asynchronous StopAndDeallocate(). 77 // needs to deal with asynchronous StopAndDeallocate().
75 base::WeakPtrFactory<FakeVideoCaptureDevice> weak_factory_; 78 base::WeakPtrFactory<FakeVideoCaptureDevice> weak_factory_;
76 79
77 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); 80 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice);
78 }; 81 };
79 82
80 } // namespace media 83 } // namespace media
81 84
82 #endif // MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_H_ 85 #endif // MEDIA_CAPTURE_VIDEO_FAKE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW
« no previous file with comments | « media/capture/video/blob_utils.cc ('k') | media/capture/video/fake_video_capture_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698