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

Unified Diff: media/video/capture/linux/video_capture_device_factory_linux.cc

Issue 967793002: Linux Video Capture: Add V4L2VideoCaptureDelegate{Single,Multi}Plane. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: magjed@ comments Created 5 years, 9 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/video/capture/linux/video_capture_device_factory_linux.cc
diff --git a/media/video/capture/linux/video_capture_device_factory_linux.cc b/media/video/capture/linux/video_capture_device_factory_linux.cc
index 9bbc50a7f9c1f26af89030e4547a6b5e23a0d621..966e4f7b90b22f4fa4941755b8996b8a08686890 100644
--- a/media/video/capture/linux/video_capture_device_factory_linux.cc
+++ b/media/video/capture/linux/video_capture_device_factory_linux.cc
@@ -25,7 +25,7 @@
namespace media {
static bool HasUsableFormats(int fd, uint32 capabilities) {
- const std::list<int>& usable_fourccs =
+ const std::list<uint32_t>& usable_fourccs =
VideoCaptureDeviceLinux::GetListOfUsableFourCCs(false);
static const struct {
@@ -48,6 +48,7 @@ static bool HasUsableFormats(int fd, uint32 capabilities) {
}
}
}
+ DLOG(ERROR) << "No usable formats found";
return false;
}
@@ -182,9 +183,11 @@ void VideoCaptureDeviceFactoryLinux::GetDeviceNames(
!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) &&
!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE)) &&
HasUsableFormats(fd.get(), cap.capabilities)) {
- VideoCaptureDevice::Name device_name(base::StringPrintf("%s", cap.card),
- unique_id);
- device_names->push_back(device_name);
+ device_names->push_back(VideoCaptureDevice::Name(
+ base::StringPrintf("%s", cap.card), unique_id,
+ (cap.capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE)
+ ? VideoCaptureDevice::Name::V4L2_MULTI_PLANE
+ : VideoCaptureDevice::Name::V4L2_SINGLE_PLANE));
}
}
}
@@ -200,10 +203,14 @@ void VideoCaptureDeviceFactoryLinux::GetDeviceSupportedFormats(
return;
supported_formats->clear();
- const v4l2_buf_type kCaptureTypes[] = {V4L2_BUF_TYPE_VIDEO_CAPTURE,
- V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE};
- for (const auto& buf_type : kCaptureTypes)
- GetSupportedFormatsForV4L2BufferType(fd.get(), buf_type, supported_formats);
+ DCHECK_NE(device.capture_api_type(),
+ VideoCaptureDevice::Name::API_TYPE_UNKNOWN);
+ const v4l2_buf_type buf_type =
+ (device.capture_api_type() == VideoCaptureDevice::Name::V4L2_MULTI_PLANE)
+ ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
+ : V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ GetSupportedFormatsForV4L2BufferType(fd.get(), buf_type, supported_formats);
+
return;
}

Powered by Google App Engine
This is Rietveld 408576698