changeset 31652:c49231cc0f95

Fix vo_tga RGB with alpha output on little-endian (blue and alpha were swapped), and simpify by letting libswscale do everything, since it nowadays supports alpha. This has the side-effect of actually producing a useful alpha channel when one is encoded in the video. Patch by Marton Balint [cus fazekas.hu]
author reimar
date Sun, 11 Jul 2010 21:25:06 +0000
parents 1b5102a113e0
children 39dbcbd0d1d5
files libvo/vo_tga.c
diffstat 1 files changed, 1 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_tga.c	Sun Jul 11 21:14:48 2010 +0000
+++ b/libvo/vo_tga.c	Sun Jul 11 21:25:06 2010 +0000
@@ -68,7 +68,6 @@
 
 /* locals vars */
 static int      frame_num = 0;
-static void     *line_buff;
 
 static void tga_make_header(uint8_t *h, int dx, int dy, int bpp)
 {
@@ -128,39 +127,6 @@
             int    wb;
 
             wb = ((bpp + 7) / 8) * dx;
-            if (bpp == 32) {
-                /* Setup the alpha channel for every pixel */
-                while (dy-- > 0) {
-                    uint8_t    *d;
-                    uint8_t    *s;
-                    int         x;
-
-                    s = buf;
-                    d = line_buff;
-                    for(x = 0; x < dx; x++) {
-                    #if HAVE_BIGENDIAN
-                        d[0] = s[3];
-                        d[1] = s[2];
-                        d[2] = s[1];
-                        d[3] = 0xff;
-                    #else
-                        d[0] = 0xff;
-                        d[1] = s[1];
-                        d[2] = s[2];
-                        d[3] = s[3];
-                    #endif
-                        d+=4;
-                        s+=4;
-                    }
-                    if (fwrite(line_buff, wb, 1, fo) != 1) {
-                        er = 4;
-                        break;
-                    }
-                    buf += stride;
-                }
-
-            }
-            else {
                 while (dy-- > 0) {
                     if (fwrite(buf, wb, 1, fo) != 1) {
                         er = 4;
@@ -168,7 +134,6 @@
                     }
                     buf += stride;
                 }
-            }
         }
         else {
             er = 2;
@@ -204,11 +169,6 @@
 
 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
 {
-    /* buffer for alpha */
-    if(line_buff){ free(line_buff); line_buff=NULL; }
-    if (format == (IMGFMT_BGR | 32)) {
-        line_buff = malloc(width * 4);
-    }
     return 0;
 }
 
@@ -236,7 +196,7 @@
     switch(format){
         case IMGFMT_BGR|15:
         case IMGFMT_BGR|24:
-        case IMGFMT_BGR|32:
+        case IMGFMT_BGRA:
             return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
     }
     return 0;
@@ -244,7 +204,6 @@
 
 static void uninit(void)
 {
-    if(line_buff){ free(line_buff); line_buff=NULL; }
 }
 
 static void check_events(void)