[vlc-devel] [PATCH] blend: support BGRA blending

Steve Lhomme robUx4 at videolabs.io
Mon Apr 27 17:56:25 CEST 2015


--
tested with some colourful karaoke
looking at the code, there's a change VLC_CODEC_ARGB is not handled properly
---
 modules/video_filter/blend.cpp      | 14 +++++++++++---
 src/video_output/vout_subpictures.c |  2 ++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/modules/video_filter/blend.cpp b/modules/video_filter/blend.cpp
index befe886..b9b3a97 100644
--- a/modules/video_filter/blend.cpp
+++ b/modules/video_filter/blend.cpp
@@ -268,9 +268,15 @@ public:
     CPictureRGBX(const CPicture &cfg) : CPicture(cfg)
     {
         if (has_alpha) {
-            offset_r = 0;
-            offset_g = 1;
-            offset_b = 2;
+            if (fmt->i_chroma == VLC_CODEC_BGRA) {
+                offset_r = 2;
+                offset_g = 1;
+                offset_b = 0;
+            } else {
+                offset_r = 0;
+                offset_g = 1;
+                offset_b = 2;
+            }
             offset_a = 3;
         } else {
 #ifdef WORDS_BIGENDIAN
@@ -403,6 +409,7 @@ typedef CPictureYUVPacked<0, 3, 1> CPictureYVYU;
 typedef CPictureYUVPacked<1, 2, 0> CPictureVYUY;
 
 typedef CPictureRGBX<4, true>  CPictureRGBA;
+typedef CPictureRGBX<4, true>  CPictureBGRA;
 typedef CPictureRGBX<4, false> CPictureRGB32;
 typedef CPictureRGBX<3, false> CPictureRGB24;
 
@@ -565,6 +572,7 @@ static const struct {
     RGB(VLC_CODEC_RGB24,    CPictureRGB24,    convertNone),
     RGB(VLC_CODEC_RGB32,    CPictureRGB32,    convertNone),
     RGB(VLC_CODEC_RGBA,     CPictureRGBA,     convertNone),
+    RGB(VLC_CODEC_BGRA,     CPictureBGRA,     convertNone),
 
     YUV(VLC_CODEC_YV9,      CPictureYV9,      convertNone),
     YUV(VLC_CODEC_I410,     CPictureI410_8,   convertNone),
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index b3f0152..5ed60c3 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -1433,12 +1433,14 @@ subpicture_t *spu_Render(spu_t *spu,
         VLC_CODEC_YUVA,
         VLC_CODEC_RGBA,
         VLC_CODEC_ARGB,
+        VLC_CODEC_BGRA,
         VLC_CODEC_YUVP,
         0,
     };
     static const vlc_fourcc_t chroma_list_default_rgb[] = {
         VLC_CODEC_RGBA,
         VLC_CODEC_ARGB,
+        VLC_CODEC_BGRA,
         VLC_CODEC_YUVA,
         VLC_CODEC_YUVP,
         0,
-- 
2.3.2




More information about the vlc-devel mailing list