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

Unified Diff: media/video/capture/fake_video_capture_device.cc

Issue 74703002: RELAND 29423003: Added video capture capabilities retrieval and caching to VideoCaptureManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: media/video/capture/fake_video_capture_device.cc
diff --git a/media/video/capture/fake_video_capture_device.cc b/media/video/capture/fake_video_capture_device.cc
index c36670c70e784563c3fa9b677540ae2bab22dd25..90778a242c57443842cd9e7b30577f8e50e052ec 100644
--- a/media/video/capture/fake_video_capture_device.cc
+++ b/media/video/capture/fake_video_capture_device.cc
@@ -19,15 +19,23 @@ namespace media {
static const int kFakeCaptureTimeoutMs = 50;
static const int kFakeCaptureBeepCycle = 20; // Visual beep every 1s.
static const int kFakeCaptureCapabilityChangePeriod = 30;
-enum { kNumberOfFakeDevices = 2 };
+int FakeVideoCaptureDevice::number_of_fake_devices_ = 2;
bool FakeVideoCaptureDevice::fail_next_create_ = false;
+void FakeVideoCaptureDevice::SetNumberOfFakeDevices(int num) {
+ number_of_fake_devices_ = num;
+}
+
+int FakeVideoCaptureDevice::NumberOfFakeDevices(void) {
tommi (sloooow) - chröme 2013/11/18 09:38:18 remove void
+ return number_of_fake_devices_;
+}
+
void FakeVideoCaptureDevice::GetDeviceNames(Names* const device_names) {
// Empty the name list.
device_names->erase(device_names->begin(), device_names->end());
- for (int n = 0; n < kNumberOfFakeDevices; n++) {
+ for (int n = 0; n < number_of_fake_devices_; n++) {
tommi (sloooow) - chröme 2013/11/18 09:38:18 ++n
Name name(base::StringPrintf("fake_device_%d", n),
base::StringPrintf("/dev/video%d", n));
device_names->push_back(name);
@@ -37,12 +45,19 @@ void FakeVideoCaptureDevice::GetDeviceNames(Names* const device_names) {
void FakeVideoCaptureDevice::GetDeviceSupportedFormats(
const Name& device,
VideoCaptureCapabilities* formats) {
- VideoCaptureCapability capture_format;
- capture_format.color = media::PIXEL_FORMAT_I420;
- capture_format.width = 640;
- capture_format.height = 480;
- capture_format.frame_rate = 1000 / kFakeCaptureTimeoutMs;
- formats->push_back(capture_format);
+ formats->clear();
tommi (sloooow) - chröme 2013/11/18 09:38:18 don't do this. If the array must be empty, do DCH
+ VideoCaptureCapability capture_format_640x480;
tommi (sloooow) - chröme 2013/11/18 09:38:18 why not use the ctor that accepts width, height, c
+ capture_format_640x480.color = media::PIXEL_FORMAT_I420;
+ capture_format_640x480.width = 640;
+ capture_format_640x480.height = 480;
+ capture_format_640x480.frame_rate = 1000 / kFakeCaptureTimeoutMs;
+ formats->push_back(capture_format_640x480);
+ VideoCaptureCapability capture_format_320x240;
+ capture_format_320x240.color = media::PIXEL_FORMAT_I420;
+ capture_format_320x240.width = 320;
+ capture_format_320x240.height = 240;
+ capture_format_320x240.frame_rate = 1000 / kFakeCaptureTimeoutMs;
+ formats->push_back(capture_format_320x240);
}
VideoCaptureDevice* FakeVideoCaptureDevice::Create(const Name& device_name) {
@@ -50,7 +65,7 @@ VideoCaptureDevice* FakeVideoCaptureDevice::Create(const Name& device_name) {
fail_next_create_ = false;
return NULL;
}
- for (int n = 0; n < kNumberOfFakeDevices; ++n) {
+ for (int n = 0; n < number_of_fake_devices_; ++n) {
std::string possible_id = base::StringPrintf("/dev/video%d", n);
if (device_name.id().compare(possible_id) == 0) {
return new FakeVideoCaptureDevice();

Powered by Google App Engine
This is Rietveld 408576698