libcamera: v4l2_videodevice: Drop toV4L2PixelFormat()
The V4L2VideoDevice::toV4L2PixelFormat() function is incorrectly implemented, as it will pick a multi-planar format if the device supports the multi-planar API, even if only single-planar formats are supported. This currently works because the implementation calls V4L2PixelFormat::fromPixelFormat(), which ignores the multiplanar argument and always returns a single-planar format. Fixing this isn't trivial. As we don't need to support multi-planar V4L2 formats at this point, drop the function instead of pretending everything is fine, and call V4L2PixelFormat::fromPixelFormat() directly from pipeline handlers. As the single-planar case is the most common, set the multiplanar argument to false by default to avoid long lines. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
This commit is contained in:
@@ -46,7 +46,7 @@ int SimpleConverter::Stream::configure(const StreamConfiguration &inputCfg,
|
||||
const StreamConfiguration &outputCfg)
|
||||
{
|
||||
V4L2PixelFormat videoFormat =
|
||||
m2m_->output()->toV4L2PixelFormat(inputCfg.pixelFormat);
|
||||
V4L2PixelFormat::fromPixelFormat(inputCfg.pixelFormat);
|
||||
|
||||
V4L2DeviceFormat format;
|
||||
format.fourcc = videoFormat;
|
||||
@@ -71,7 +71,7 @@ int SimpleConverter::Stream::configure(const StreamConfiguration &inputCfg,
|
||||
}
|
||||
|
||||
/* Set the pixel format and size on the output. */
|
||||
videoFormat = m2m_->capture()->toV4L2PixelFormat(outputCfg.pixelFormat);
|
||||
videoFormat = V4L2PixelFormat::fromPixelFormat(outputCfg.pixelFormat);
|
||||
format = {};
|
||||
format.fourcc = videoFormat;
|
||||
format.size = outputCfg.size;
|
||||
@@ -210,7 +210,7 @@ std::vector<PixelFormat> SimpleConverter::formats(PixelFormat input)
|
||||
* enumerate the conversion capabilities on its output (V4L2 capture).
|
||||
*/
|
||||
V4L2DeviceFormat v4l2Format;
|
||||
v4l2Format.fourcc = m2m_->output()->toV4L2PixelFormat(input);
|
||||
v4l2Format.fourcc = V4L2PixelFormat::fromPixelFormat(input);
|
||||
v4l2Format.size = { 1, 1 };
|
||||
|
||||
int ret = m2m_->output()->setFormat(&v4l2Format);
|
||||
@@ -281,7 +281,7 @@ SimpleConverter::strideAndFrameSize(const PixelFormat &pixelFormat,
|
||||
const Size &size)
|
||||
{
|
||||
V4L2DeviceFormat format;
|
||||
format.fourcc = m2m_->capture()->toV4L2PixelFormat(pixelFormat);
|
||||
format.fourcc = V4L2PixelFormat::fromPixelFormat(pixelFormat);
|
||||
format.size = size;
|
||||
|
||||
int ret = m2m_->capture()->tryFormat(&format);
|
||||
|
||||
Reference in New Issue
Block a user