diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-09-29 19:05:13 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-02 04:18:08 +0200 |
commit | 2b01fc067844d82524b2e6e9fde8e424687d85d3 (patch) | |
tree | 530396166b7e1598b8ef73b5ed063257948dec39 | |
parent | b4c7efdfe1d528ea0a2e8ae0e3e68537729e5a64 (diff) | |
download | mpv-2b01fc067844d82524b2e6e9fde8e424687d85d3.tar.bz2 mpv-2b01fc067844d82524b2e6e9fde8e424687d85d3.tar.xz |
spudec: support "clear" packet type
Support "clear" packets that contain no data but instead clear the
screen at a given time.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32410 b3059339-0415-0410-9bf9-f77b7e298cf2
Reindent.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32411 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | spudec.c | 28 |
1 files changed, 15 insertions, 13 deletions
@@ -1367,20 +1367,22 @@ void spudec_set_paletted(void *this, const uint8_t *pal_img, int pal_stride, packet->start_col = x; packet->start_row = y; packet->data_len = 2 * stride * h; - packet->packet = malloc(packet->data_len); - img = packet->packet; - aimg = packet->packet + stride * h; - for (i = 0; i < 256; i++) { - uint32_t pixel = pal[i]; - int alpha = pixel >> 24; - int gray = (((pixel & 0x000000ff) >> 0) + - ((pixel & 0x0000ff00) >> 7) + - ((pixel & 0x00ff0000) >> 16)) >> 2; - gray = FFMIN(gray, alpha); - g8a8_pal[i] = (-alpha << 8) | gray; + if (packet->data_len) { // size 0 is a special "clear" packet + packet->packet = malloc(packet->data_len); + img = packet->packet; + aimg = packet->packet + stride * h; + for (i = 0; i < 256; i++) { + uint32_t pixel = pal[i]; + int alpha = pixel >> 24; + int gray = (((pixel & 0x000000ff) >> 0) + + ((pixel & 0x0000ff00) >> 7) + + ((pixel & 0x00ff0000) >> 16)) >> 2; + gray = FFMIN(gray, alpha); + g8a8_pal[i] = (-alpha << 8) | gray; + } + pal2gray_alpha(g8a8_pal, pal_img, pal_stride, + img, aimg, stride, w, h); } - pal2gray_alpha(g8a8_pal, pal_img, pal_stride, - img, aimg, stride, w, h); packet->start_pts = 0; packet->end_pts = 0x7fffffff; if (pts != MP_NOPTS_VALUE) |