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

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

Issue 1124723006: VideoCaptureDeviceLinux: Add support for SPLANE+DMABUF V4L2 type capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « media/video/capture/linux/v4l2_capture_delegate.cc ('k') | media/video/capture/video_capture_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 966e4f7b90b22f4fa4941755b8996b8a08686890..51746bb7a750de87788864c69e0fe4e7d65751bb 100644
--- a/media/video/capture/linux/video_capture_device_factory_linux.cc
+++ b/media/video/capture/linux/video_capture_device_factory_linux.cc
@@ -11,12 +11,14 @@
#else
#include <linux/videodev2.h>
#endif
+#include <linux/version.h>
#include <sys/ioctl.h>
#include "base/files/file_enumerator.h"
#include "base/files/scoped_file.h"
#include "base/posix/eintr_wrapper.h"
#include "base/strings/stringprintf.h"
+//#include "content/common/gpu/gpu_memory_buffer_factory.h"
emircan 2015/05/06 03:06:26 Can be erased.
mcasas 2015/05/06 21:44:42 Done.
#if defined(OS_CHROMEOS)
#include "media/video/capture/linux/video_capture_device_chromeos.h"
#endif
@@ -183,11 +185,23 @@ void VideoCaptureDeviceFactoryLinux::GetDeviceNames(
!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) &&
!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE)) &&
HasUsableFormats(fd.get(), cap.capabilities)) {
- device_names->push_back(VideoCaptureDevice::Name(
- base::StringPrintf("%s", cap.card), unique_id,
+ VideoCaptureDevice::Name::CaptureApiType api_type =
(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE)
? VideoCaptureDevice::Name::V4L2_MULTI_PLANE
- : VideoCaptureDevice::Name::V4L2_SINGLE_PLANE));
+ : VideoCaptureDevice::Name::V4L2_SINGLE_PLANE;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
+ // For SPLANE API, check if we support Dma-Buf based capture.
+ if (api_type == VideoCaptureDevice::Name::V4L2_SINGLE_PLANE) {
+ v4l2_requestbuffers r_buffer = {};
+ r_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ r_buffer.memory = V4L2_MEMORY_DMABUF;
+ r_buffer.count = 1u;
+ if (HANDLE_EINTR(ioctl(fd.get(), VIDIOC_REQBUFS, &r_buffer)) >= 0)
+ api_type = VideoCaptureDevice::Name::V4L2_SINGLE_PLANE_DMABUF;
+ }
emircan 2015/05/06 03:06:26 I think, we should also check if the usable "fourc
mcasas 2015/05/06 21:44:42 We still need to figure out indeed where to check
+#endif
+ device_names->push_back(VideoCaptureDevice::Name(
+ base::StringPrintf("%s", cap.card), unique_id, api_type));
}
}
}
« no previous file with comments | « media/video/capture/linux/v4l2_capture_delegate.cc ('k') | media/video/capture/video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698