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

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

Issue 2398463003: 16 bit capture and GPU&CPU memory buffer support.
Patch Set: fixes. 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 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 38ef6054ecb237593f6ec916050fb036b80aa2b0..cdf4f50aa16a933a1fc2906b506619b346428a8d 100644
--- a/media/capture/video/fake_video_capture_device_factory.cc
+++ b/media/capture/video/fake_video_capture_device_factory.cc
@@ -13,6 +13,15 @@
#include "build/build_config.h"
#include "media/base/media_switches.h"
+namespace {
+
+media::VideoPixelFormat get_pixelformat(const std::string& device_id) {
+ if (device_id == "/dev/video1")
+ return media::PIXEL_FORMAT_Y16;
+ return media::PIXEL_FORMAT_I420;
+}
+}
+
namespace media {
// Cap the frame rate command line input to reasonable values.
@@ -22,7 +31,7 @@ static const float kFakeCaptureMaxFrameRate = 60.0f;
static const float kFakeCaptureDefaultFrameRate = 20.0f;
FakeVideoCaptureDeviceFactory::FakeVideoCaptureDeviceFactory()
- : number_of_devices_(1),
+ : number_of_devices_(2),
fake_vcd_ownership_(FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS),
frame_rate_(kFakeCaptureDefaultFrameRate) {}
@@ -35,8 +44,8 @@ std::unique_ptr<VideoCaptureDevice> FakeVideoCaptureDeviceFactory::CreateDevice(
for (int n = 0; n < number_of_devices_; ++n) {
std::string possible_id = base::StringPrintf("/dev/video%d", n);
if (device_descriptor.device_id.compare(possible_id) == 0) {
- return std::unique_ptr<VideoCaptureDevice>(
- new FakeVideoCaptureDevice(fake_vcd_ownership_, frame_rate_));
+ return std::unique_ptr<VideoCaptureDevice>(new FakeVideoCaptureDevice(
+ fake_vcd_ownership_, frame_rate_, get_pixelformat(possible_id)));
}
}
return std::unique_ptr<VideoCaptureDevice>();
@@ -72,8 +81,8 @@ void FakeVideoCaptureDeviceFactory::GetSupportedFormats(
gfx::Size(1920, 1080)};
supported_formats->clear();
for (const auto& size : supported_sizes) {
- supported_formats->push_back(
- VideoCaptureFormat(size, frame_rate_, media::PIXEL_FORMAT_I420));
+ supported_formats->push_back(VideoCaptureFormat(
+ size, frame_rate_, get_pixelformat(device_descriptor.device_id)));
}
}
« no previous file with comments | « media/capture/video/fake_video_capture_device.cc ('k') | media/capture/video/fake_video_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698