[vlc-commits] codec/avcodec/swscale: Support VLC_CODEC_BGRA

Jean-Paul Saman git at videolan.org
Mon May 12 17:00:22 CEST 2014


vlc | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Thu Apr  3 15:35:36 2014 +0200| [eae2f440af1d7e79019adc4da5f871d0592d9f91] | committer: Jean-Paul Saman

codec/avcodec/swscale: Support VLC_CODEC_BGRA

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eae2f440af1d7e79019adc4da5f871d0592d9f91
---

 modules/codec/avcodec/chroma.c |    1 +
 modules/video_chroma/swscale.c |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/chroma.c b/modules/codec/avcodec/chroma.c
index 7f067ea..fbbe29a 100644
--- a/modules/codec/avcodec/chroma.c
+++ b/modules/codec/avcodec/chroma.c
@@ -128,6 +128,7 @@ static const struct
 
     {VLC_CODEC_RGBA, PIX_FMT_RGBA, 0, 0, 0 },
     {VLC_CODEC_ARGB, PIX_FMT_ARGB, 0, 0, 0 },
+    {VLC_CODEC_BGRA, PIX_FMT_BGRA, 0, 0, 0 },
     {VLC_CODEC_GREY, PIX_FMT_GRAY8, 0, 0, 0},
 
      /* Paletized RGB */
diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
index 6559078..2763e43 100644
--- a/modules/video_chroma/swscale.c
+++ b/modules/video_chroma/swscale.c
@@ -274,6 +274,10 @@ static void FixParameters( int *pi_fmt, bool *pb_has_a, bool *pb_swap_uv, vlc_fo
         *pi_fmt = PIX_FMT_BGR32_1;
         *pb_has_a = true;
         break;
+    case VLC_CODEC_BGRA:
+        *pi_fmt = PIX_FMT_RGB32;
+        *pb_has_a = true;
+        break;
     case VLC_CODEC_YV12:
         *pi_fmt = PIX_FMT_YUV420P;
         *pb_swap_uv = true;
@@ -648,7 +652,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         /* We extract the A plane to rescale it, and then we reinject it. */
         if( p_fmti->i_chroma == VLC_CODEC_RGBA )
             ExtractA( p_sys->p_src_a, p_src, p_fmti->i_visible_width * p_sys->i_extend_factor, p_fmti->i_visible_height, OFFSET_A );
-        else if( p_fmti->i_chroma == VLC_CODEC_ARGB )
+        else if( p_fmti->i_chroma == VLC_CODEC_ARGB || p_fmti->i_chroma == VLC_CODEC_BGRA )
             ExtractA( p_sys->p_src_a, p_src, p_fmti->i_visible_width * p_sys->i_extend_factor, p_fmti->i_visible_height, 0 );
         else
             plane_CopyPixels( p_sys->p_src_a->p, p_src->p+A_PLANE );
@@ -656,7 +660,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         Convert( p_filter, p_sys->ctxA, p_sys->p_dst_a, p_sys->p_src_a, p_fmti->i_visible_height, 0, 1, false, false );
         if( p_fmto->i_chroma == VLC_CODEC_RGBA )
             InjectA( p_dst, p_sys->p_dst_a, p_fmto->i_visible_width * p_sys->i_extend_factor, p_fmto->i_visible_height, OFFSET_A );
-        else if( p_fmto->i_chroma == VLC_CODEC_ARGB )
+        else if( p_fmto->i_chroma == VLC_CODEC_ARGB || p_fmto->i_chroma == VLC_CODEC_BGRA )
             InjectA( p_dst, p_sys->p_dst_a, p_fmto->i_visible_width * p_sys->i_extend_factor, p_fmto->i_visible_height, 0 );
         else
             plane_CopyPixels( p_dst->p+A_PLANE, p_sys->p_dst_a->p );
@@ -666,7 +670,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         /* We inject a complete opaque alpha plane */
         if( p_fmto->i_chroma == VLC_CODEC_RGBA )
             FillA( &p_dst->p[0], OFFSET_A );
-        else if( p_fmto->i_chroma == VLC_CODEC_ARGB )
+        else if( p_fmto->i_chroma == VLC_CODEC_ARGB || p_fmto->i_chroma == VLC_CODEC_BGRA )
             FillA( &p_dst->p[0], 0 );
         else
             FillA( &p_dst->p[A_PLANE], 0 );



More information about the vlc-commits mailing list