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

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: Addressed perkj@ comments Created 7 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
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 16 matching lines...) Expand all
27 // Empty the name list. 27 // Empty the name list.
28 device_names->erase(device_names->begin(), device_names->end()); 28 device_names->erase(device_names->begin(), device_names->end());
29 29
30 for (int n = 0; n < kNumberOfFakeDevices; n++) { 30 for (int n = 0; n < kNumberOfFakeDevices; n++) {
31 Name name(base::StringPrintf("fake_device_%d", n), 31 Name name(base::StringPrintf("fake_device_%d", n),
32 base::StringPrintf("/dev/video%d", n)); 32 base::StringPrintf("/dev/video%d", n));
33 device_names->push_back(name); 33 device_names->push_back(name);
34 } 34 }
35 } 35 }
36 36
37 void FakeVideoCaptureDevice::GetDeviceSupportedFormats(
38 const Name& device,
39 VideoCaptureFormats* formats) {
40 VideoCaptureCapability capture_format;
41 capture_format.color = media::PIXEL_FORMAT_I420;
42 capture_format.width = 640;
43 capture_format.height = 480;
44 capture_format.frame_rate = 1000 / kFakeCaptureTimeoutMs;
45 formats->push_back(capture_format);
46 }
47
37 VideoCaptureDevice* FakeVideoCaptureDevice::Create(const Name& device_name) { 48 VideoCaptureDevice* FakeVideoCaptureDevice::Create(const Name& device_name) {
38 if (fail_next_create_) { 49 if (fail_next_create_) {
39 fail_next_create_ = false; 50 fail_next_create_ = false;
40 return NULL; 51 return NULL;
41 } 52 }
42 for (int n = 0; n < kNumberOfFakeDevices; ++n) { 53 for (int n = 0; n < kNumberOfFakeDevices; ++n) {
43 std::string possible_id = base::StringPrintf("/dev/video%d", n); 54 std::string possible_id = base::StringPrintf("/dev/video%d", n);
44 if (device_name.id().compare(possible_id) == 0) { 55 if (device_name.id().compare(possible_id) == 0) {
45 return new FakeVideoCaptureDevice(); 56 return new FakeVideoCaptureDevice();
46 } 57 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 30, 239 30,
229 PIXEL_FORMAT_I420, 240 PIXEL_FORMAT_I420,
230 0, 241 0,
231 false, 242 false,
232 VariableResolutionVideoCaptureDevice)); 243 VariableResolutionVideoCaptureDevice));
233 244
234 capabilities_roster_index_ = 0; 245 capabilities_roster_index_ = 0;
235 } 246 }
236 247
237 } // namespace media 248 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698