[RFC PATCH v1 2/5] apps: cam: sdl_texture: Add single plane generic texture
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Wed Apr 23 01:40:09 CEST 2025
Hi Barnabás,
Thank you for the patch.
On Mon, Apr 21, 2025 at 05:51:06PM +0200, Barnabás Pőcze wrote:
> Add the `SDLTexture1Plane` type that can be instantiated with
> an arbitrary SDL pixel format and that uses `SDL_UpdateTexture()`
> to update the texture using exactly a single plane.
You can squash patches 2/5, 3/5 and 4/5 together. The commit message can
be reworded to explain how SDLTextureYUYV is generalized for later use
with other 1-plane formats.
> Signed-off-by: Barnabás Pőcze <barnabas.pocze at ideasonboard.com>
> ---
> src/apps/cam/sdl_texture_1plane.h | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
> create mode 100644 src/apps/cam/sdl_texture_1plane.h
>
> diff --git a/src/apps/cam/sdl_texture_1plane.h b/src/apps/cam/sdl_texture_1plane.h
> new file mode 100644
> index 000000000..ded35c589
> --- /dev/null
> +++ b/src/apps/cam/sdl_texture_1plane.h
> @@ -0,0 +1,18 @@
> +#pragma once
> +
> +#include <assert.h>
> +
> +#include "sdl_texture.h"
> +
> +class SDLTexture1Plane final : public SDLTexture
> +{
> +public:
> + using SDLTexture::SDLTexture;
> +
> + void update(libcamera::Span<const libcamera::Span<const uint8_t>> data) override
> + {
> + assert(data.size() == 1);
> + assert(data[0].size_bytes() == std::size_t(rect_.h * stride_));
> + SDL_UpdateTexture(ptr_, nullptr, data[0].data(), stride_);
No need to pass &rect_ as the second argument, like done by
SDLTextureYUYV ?
> + }
> +};
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list