diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-07-11 21:25:06 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-02 04:14:44 +0200 |
commit | a7308d35461dcb5a39de03f59a3619427414ac24 (patch) | |
tree | bb5b7eeda30fcff7a2f1d627dea21dd55924f908 /libvo | |
parent | 4505a8f06ac7f7b11fe0a1478f6ccfb9b3d559c2 (diff) | |
download | mpv-a7308d35461dcb5a39de03f59a3619427414ac24.tar.bz2 mpv-a7308d35461dcb5a39de03f59a3619427414ac24.tar.xz |
vo_tag: fix RGB with alpha output on little-endian
Fix vo_tga RGB with alpha output on little-endian (blue and alpha were
swapped), and simplify 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]
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31718 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vo_tga.c | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/libvo/vo_tga.c b/libvo/vo_tga.c index 1c92b03207..b4ad24b1ee 100644 --- a/libvo/vo_tga.c +++ b/libvo/vo_tga.c @@ -67,7 +67,6 @@ const LIBVO_EXTERN (tga) /* 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) { @@ -127,39 +126,6 @@ static int write_tga( char *file, int bpp, int dx, int dy, uint8_t *buf, int str 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; @@ -167,7 +133,6 @@ static int write_tga( char *file, int bpp, int dx, int dy, uint8_t *buf, int str } buf += stride; } - } } else { er = 2; @@ -203,11 +168,6 @@ static uint32_t draw_image(mp_image_t* mpi) 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; } @@ -235,7 +195,7 @@ static int query_format(uint32_t format) 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; @@ -243,7 +203,6 @@ static int query_format(uint32_t format) static void uninit(void) { - if(line_buff){ free(line_buff); line_buff=NULL; } } static void check_events(void) |