mcst-linux-kernel/patches-2024.06.26/gst-plugins-base-1.22.5/rm19142-ximagesink-color-fi...

47 lines
1.6 KiB
Diff

--- a/gst-libs/gst/video/video-format.c 2024-05-14 13:32:24.237210048 +0000
+++ b/gst-libs/gst/video/video-format.c 2024-05-14 13:38:21.696160763 +0000
@@ -7321,6 +7321,29 @@
}
static GstVideoFormat
+gst_video_format_from_rgb32_masks_be (int red_mask, int green_mask, int blue_mask)
+{
+ if (red_mask == 0xff000000 && green_mask == 0x00ff0000 &&
+ blue_mask == 0x0000ff00) {
+ return GST_VIDEO_FORMAT_xBGR;
+ }
+ if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 &&
+ blue_mask == 0xff000000) {
+ return GST_VIDEO_FORMAT_xRGB;
+ }
+ if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 &&
+ blue_mask == 0x000000ff) {
+ return GST_VIDEO_FORMAT_BGRx;
+ }
+ if (red_mask == 0x000000ff && green_mask == 0x0000ff00 &&
+ blue_mask == 0x00ff0000) {
+ return GST_VIDEO_FORMAT_RGBx;
+ }
+
+ return GST_VIDEO_FORMAT_UNKNOWN;
+}
+
+static GstVideoFormat
gst_video_format_from_rgba32_masks (int red_mask, int green_mask,
int blue_mask, int alpha_mask)
{
@@ -7435,9 +7458,12 @@
format = GST_VIDEO_FORMAT_BGR10A2_LE;
} else if (depth == 30 && bpp == 32) {
format = GST_VIDEO_FORMAT_r210;
- } else if (depth == 24 && bpp == 32) {
+ } else if (depth == 24 && bpp == 32 && endianness == G_LITTLE_ENDIAN) {
format = gst_video_format_from_rgb32_masks (red_mask, green_mask,
blue_mask);
+ } else if (depth == 24 && bpp == 32 && endianness == G_BIG_ENDIAN) {
+ format = gst_video_format_from_rgb32_masks_be (red_mask, green_mask,
+ blue_mask);
} else if (depth == 32 && bpp == 32 && !alpha_mask) {
format = gst_video_format_from_rgb32_masks (red_mask, green_mask,
blue_mask);