From fd82342bbda46547289d8655fea15c88cd9ca397 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Wed, 6 Sep 2023 15:26:48 +0200 Subject: [PATCH] waylandsink: Move format caps list to shared library So it can be shared and more easily updated. While on it, order the formats according to the documentation for GstVideo.VIDEO_FORMATS_ALL. Part-of: --- .../docs/plugins/gst_plugins_cache.json | 4 ++-- .../gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c | 7 +------ .../gst-plugins-bad/ext/wayland/gstwaylandsink.c | 7 +------ .../gst-libs/gst/wayland/gstwlvideoformat.h | 12 ++++++++++++ 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json b/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json index 9e1a12086a..1ad1e7642b 100644 --- a/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json +++ b/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json @@ -31183,7 +31183,7 @@ "long-name": "Gtk Wayland Video Sink", "pad-templates": { "sink": { - "caps": "video/x-raw:\n format: { BGRx, BGRA, RGBx, xBGR, xRGB, RGBA, ABGR, ARGB, RGB, BGR, RGB16, BGR16, YUY2, YVYU, UYVY, AYUV, NV12, NV21, NV16, NV61, YUV9, YVU9, Y41B, I420, YV12, Y42B, v308 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(memory:DMABuf):\n format: DMA_DRM\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "caps": "video/x-raw:\n format: { AYUV, ABGR, ARGB, BGRA, RGBA, YUV9, YVU9, Y41B, I420, YV12, NV12, NV21, Y42B, NV16, NV61, UYVY, YUY2, YVYU, BGRx, RGBx, xBGR, xRGB, v308, BGR, RGB, BGR16, RGB16 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(memory:DMABuf):\n format: DMA_DRM\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", "direction": "sink", "presence": "always" } @@ -239346,7 +239346,7 @@ "long-name": "wayland video sink", "pad-templates": { "sink": { - "caps": "video/x-raw:\n format: { BGRx, BGRA, RGBx, xBGR, xRGB, RGBA, ABGR, ARGB, RGB, BGR, RGB16, BGR16, YUY2, YVYU, UYVY, AYUV, NV12, NV21, NV16, NV61, YUV9, YVU9, Y41B, I420, YV12, Y42B, v308 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(memory:DMABuf):\n format: DMA_DRM\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "caps": "video/x-raw:\n format: { AYUV, ABGR, ARGB, BGRA, RGBA, YUV9, YVU9, Y41B, I420, YV12, NV12, NV21, Y42B, NV16, NV61, UYVY, YUY2, YVYU, BGRx, RGBx, xBGR, xRGB, v308, BGR, RGB, BGR16, RGB16 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(memory:DMABuf):\n format: DMA_DRM\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", "direction": "sink", "presence": "always" } diff --git a/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c b/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c index b2cdadd5d6..71d0100eae 100644 --- a/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c +++ b/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c @@ -42,15 +42,10 @@ #define GST_CAT_DEFAULT gst_debug_gtk_wayland_sink GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); -#define WL_VIDEO_FORMATS \ - "{ BGRx, BGRA, RGBx, xBGR, xRGB, RGBA, ABGR, ARGB, RGB, BGR, " \ - "RGB16, BGR16, YUY2, YVYU, UYVY, AYUV, NV12, NV21, NV16, NV61, " \ - "YUV9, YVU9, Y41B, I420, YV12, Y42B, v308 }" - static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (WL_VIDEO_FORMATS) ";" + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_WL_VIDEO_FORMATS) ";" GST_VIDEO_DMA_DRM_CAPS_MAKE) ); diff --git a/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c b/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c index 1c597f2135..8911be4152 100644 --- a/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c +++ b/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c @@ -69,15 +69,10 @@ enum GST_DEBUG_CATEGORY (gstwayland_debug); #define GST_CAT_DEFAULT gstwayland_debug -#define WL_VIDEO_FORMATS \ - "{ BGRx, BGRA, RGBx, xBGR, xRGB, RGBA, ABGR, ARGB, RGB, BGR, " \ - "RGB16, BGR16, YUY2, YVYU, UYVY, AYUV, NV12, NV21, NV16, NV61, " \ - "YUV9, YVU9, Y41B, I420, YV12, Y42B, v308 }" - static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (WL_VIDEO_FORMATS) ";" + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_WL_VIDEO_FORMATS) ";" GST_VIDEO_DMA_DRM_CAPS_MAKE) ); diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/wayland/gstwlvideoformat.h b/subprojects/gst-plugins-bad/gst-libs/gst/wayland/gstwlvideoformat.h index 3fdac8d2e7..0a37434c9a 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/wayland/gstwlvideoformat.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/wayland/gstwlvideoformat.h @@ -29,6 +29,18 @@ G_BEGIN_DECLS +/** + * GST_WL_VIDEO_FORMATS: + * + * A list of supported video formats for use in cap templates. + * + * Since: 1.24 + */ +#define GST_WL_VIDEO_FORMATS \ + "{ AYUV, ABGR, ARGB, BGRA, RGBA, YUV9, YVU9, Y41B, I420, YV12, " \ + "NV12, NV21, Y42B, NV16, NV61, UYVY, YUY2, YVYU, BGRx, RGBx, xBGR, xRGB, " \ + "v308, BGR, RGB, BGR16, RGB16 }" + GST_WL_API void gst_wl_videoformat_init_once (void);