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

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

Issue 2606983002: Media Capture Depth Stream Extensions API: focal length and depth range. (Closed)
Patch Set: base::Optional and nits, thanks mcasas@. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: media/capture/video/fake_video_capture_device_factory.cc
diff --git a/media/capture/video/fake_video_capture_device_factory.cc b/media/capture/video/fake_video_capture_device_factory.cc
index d20749c2723fc05483314e89352fbc691c48bd86..5cda9f9d38bd8c534e80953a0f53ce9acc373b90 100644
--- a/media/capture/video/fake_video_capture_device_factory.cc
+++ b/media/capture/video/fake_video_capture_device_factory.cc
@@ -15,11 +15,14 @@
namespace {
+static const size_t kDepthDeviceIndex = 1;
+static const char kDepthDeviceId[] = "/dev/video1";
+
// Factory has one device by default; I420. If there are more, the second device
// is of Y16 format while the rest are I420.
media::VideoPixelFormat GetPixelFormat(const std::string& device_id) {
- return (device_id == "/dev/video1") ? media::PIXEL_FORMAT_Y16
- : media::PIXEL_FORMAT_I420;
+ return (device_id == kDepthDeviceId) ? media::PIXEL_FORMAT_Y16
+ : media::PIXEL_FORMAT_I420;
}
}
@@ -82,6 +85,17 @@ void FakeVideoCaptureDeviceFactory::GetDeviceDescriptors(
#endif
);
}
+
+ // Fill the camera calibration information for depth device.
+ if (device_descriptors->size() <= kDepthDeviceIndex)
+ return;
+ VideoCaptureDeviceDescriptor& depth_device(
+ (*device_descriptors)[kDepthDeviceIndex]);
+ depth_device.camera_calibration.emplace();
+ depth_device.camera_calibration->focal_length_x = 135.0;
+ depth_device.camera_calibration->focal_length_y = 135.6;
+ depth_device.camera_calibration->depth_near = 0.0;
+ depth_device.camera_calibration->depth_far = 65.535;
}
void FakeVideoCaptureDeviceFactory::GetSupportedFormats(

Powered by Google App Engine
This is Rietveld 408576698