[libcamera-devel] [PATCH] gstreamer: Support planar formats

paul.elder at ideasonboard.com paul.elder at ideasonboard.com
Wed Sep 22 07:00:30 CEST 2021


Hi Kieran,

On Tue, Sep 21, 2021 at 04:35:15PM +0100, Kieran Bingham wrote:
> Existing pipeline handlers already support planar YUV formats.
> Extend the gstreamer format map to incorporate them.
> 
> While here, split the formats into distinct groups.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>

> ---
>  src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index 0af91c1acb67..5636f3e7e1a6 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -16,19 +16,32 @@ static struct {
>  	GstVideoFormat gst_format;
>  	PixelFormat format;
>  } format_map[] = {
> +	/* Compressed */
>  	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
> +
> +	/* RGB */
>  	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
>  	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
>  	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
> +
> +	/* YUV Semiplanar */
>  	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
>  	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
>  	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
>  	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
>  	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
> +
> +	/* YUV Packed */
>  	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
>  	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
>  	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
>  	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
> +
> +	/* Planar Formats */
> +	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
> +	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
> +	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },
> +
>  	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
>  };
>  
> -- 
> 2.30.2
> 


More information about the libcamera-devel mailing list