Chromium Code Reviews| 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)); |
| } |
| } |
| } |