Index: media/gpu/generic_v4l2_device.cc |
diff --git a/media/gpu/generic_v4l2_device.cc b/media/gpu/generic_v4l2_device.cc |
index 830d004e6b8b374496e14bd9d12ffde9164cd6ee..11b470cf8ba91980fe25e931175ddb074e542622 100644 |
--- a/media/gpu/generic_v4l2_device.cc |
+++ b/media/gpu/generic_v4l2_device.cc |
@@ -418,23 +418,24 @@ void GenericV4L2Device::EnumerateDevicesForType(Type type) { |
static const std::string kJpegDecoderDevicePattern = "/dev/jpeg-dec"; |
std::string device_pattern; |
- v4l2_buf_type buf_type; |
+ std::vector<v4l2_buf_type> buf_types; |
switch (type) { |
case Type::kDecoder: |
device_pattern = kDecoderDevicePattern; |
- buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; |
+ buf_types.push_back(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); |
break; |
case Type::kEncoder: |
device_pattern = kEncoderDevicePattern; |
- buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
+ buf_types.push_back(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); |
break; |
case Type::kImageProcessor: |
device_pattern = kImageProcessorDevicePattern; |
- buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; |
+ buf_types.push_back(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); |
break; |
case Type::kJpegDecoder: |
device_pattern = kJpegDecoderDevicePattern; |
- buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT; |
+ buf_types.push_back(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); |
+ buf_types.push_back(V4L2_BUF_TYPE_VIDEO_OUTPUT); |
break; |
} |
@@ -457,11 +458,13 @@ void GenericV4L2Device::EnumerateDevicesForType(Type type) { |
if (!OpenDevicePath(path, type)) |
continue; |
- const auto& supported_pixelformats = |
- EnumerateSupportedPixelformats(buf_type); |
- if (!supported_pixelformats.empty()) { |
- DVLOG(1) << "Found device: " << path; |
- devices.push_back(std::make_pair(path, supported_pixelformats)); |
+ for (const auto& buf_type : buf_types) { |
+ const auto& supported_pixelformats = |
+ EnumerateSupportedPixelformats(buf_type); |
+ if (!supported_pixelformats.empty()) { |
+ DVLOG(1) << "Found device: " << path; |
+ devices.push_back(std::make_pair(path, supported_pixelformats)); |
+ } |
} |
CloseDevice(); |