summaryrefslogtreecommitdiff
path: root/v4l2++/src
diff options
context:
space:
mode:
Diffstat (limited to 'v4l2++/src')
-rw-r--r--v4l2++/src/pixelformats.cpp15
-rw-r--r--v4l2++/src/videodevice.cpp2
2 files changed, 14 insertions, 3 deletions
diff --git a/v4l2++/src/pixelformats.cpp b/v4l2++/src/pixelformats.cpp
index 1c8453f..b7ecc7b 100644
--- a/v4l2++/src/pixelformats.cpp
+++ b/v4l2++/src/pixelformats.cpp
@@ -290,10 +290,23 @@ static const map<PixelFormat, PixelFormatInfo> format_info_array = {
} },
};
+PixelFormat DRMFourCCToPixelFormat(const std::string& fourcc)
+{
+ // Handle the formats which differ between DRM and V4L2
+ if (fourcc == "RG16")
+ return PixelFormat::RGB565;
+ if (fourcc == "XR24")
+ return PixelFormat::XRGB8888;
+ if (fourcc == "RG24")
+ return PixelFormat::RGB888;
+
+ return FourCCToPixelFormat(fourcc);
+}
+
const struct PixelFormatInfo& get_pixel_format_info(PixelFormat format)
{
if (!format_info_array.count(format))
- throw invalid_argument("get_pixel_format_info: Unsupported pixelformat");
+ throw invalid_argument("v4l2: get_pixel_format_info: Unsupported pixelformat");
return format_info_array.at(format);
}
diff --git a/v4l2++/src/videodevice.cpp b/v4l2++/src/videodevice.cpp
index 5ab7099..858b82b 100644
--- a/v4l2++/src/videodevice.cpp
+++ b/v4l2++/src/videodevice.cpp
@@ -133,8 +133,6 @@ static void v4l2_set_format(int fd, PixelFormat fmt, uint32_t width, uint32_t he
ASSERT(p.sizeimage == p.bytesperline * height / pfpi.ysub);
}
} else {
- ASSERT(pfi.num_planes == 1);
-
v4lfmt.fmt.pix.pixelformat = (uint32_t)fmt;
v4lfmt.fmt.pix.width = width;
v4lfmt.fmt.pix.height = height;