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

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

Issue 24079003: Add VideoCaptureDevice::GetDeviceSupportedFormats to interface + implementation for Linux and Fake (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed parameter device_name from GetDeviceSupportedFormats. Added explanation to VCD interface. Created 7 years, 3 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
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 #include "media/video/capture/fake_video_capture_device.h" 5 #include "media/video/capture/fake_video_capture_device.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 return; // Wrong state. 142 return; // Wrong state.
143 } 143 }
144 capture_thread_.Stop(); 144 capture_thread_.Stop();
145 state_ = kIdle; 145 state_ = kIdle;
146 } 146 }
147 147
148 const VideoCaptureDevice::Name& FakeVideoCaptureDevice::device_name() { 148 const VideoCaptureDevice::Name& FakeVideoCaptureDevice::device_name() {
149 return device_name_; 149 return device_name_;
150 } 150 }
151 151
152 void FakeVideoCaptureDevice::GetDeviceSupportedFormats(
153 VideoCaptureFormats* capture_formats) {
154 media::VideoCaptureCapability capture_format;
155 capture_format.color = media::PIXEL_FORMAT_I420;
156 capture_format.width = 640;
157 capture_format.height = 480;
158 capture_format.frame_rate = GetFrameRate();
159 capture_formats->insert(capture_formats->end(), capture_format);
160 }
161
162 int FakeVideoCaptureDevice::GetFrameRate() const {
163 return (1000 / kFakeCaptureTimeoutMs);
164 }
165
152 void FakeVideoCaptureDevice::OnCaptureTask() { 166 void FakeVideoCaptureDevice::OnCaptureTask() {
153 if (state_ != kCapturing) { 167 if (state_ != kCapturing) {
154 return; 168 return;
155 } 169 }
156 170
157 const size_t frame_size = VideoFrame::AllocationSize( 171 const size_t frame_size = VideoFrame::AllocationSize(
158 VideoFrame::I420, 172 VideoFrame::I420,
159 gfx::Size(capture_format_.width, capture_format_.height)); 173 gfx::Size(capture_format_.width, capture_format_.height));
160 memset(fake_frame_.get(), 0, frame_size); 174 memset(fake_frame_.get(), 0, frame_size);
161 175
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 media::VideoCaptureCapability(800, 260 media::VideoCaptureCapability(800,
247 600, 261 600,
248 30, 262 30,
249 PIXEL_FORMAT_I420, 263 PIXEL_FORMAT_I420,
250 0, 264 0,
251 false, 265 false,
252 VariableResolutionVideoCaptureDevice)); 266 VariableResolutionVideoCaptureDevice));
253 267
254 capabilities_roster_index_ = 0; 268 capabilities_roster_index_ = 0;
255 } 269 }
256
257 } // namespace media 270 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698