mirror of https://github.com/mpv-player/mpv
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
This commit is contained in:
parent
b4c7efdfe1
commit
2b01fc0678
28
spudec.c
28
spudec.c
|
@ -1367,20 +1367,22 @@ void spudec_set_paletted(void *this, const uint8_t *pal_img, int pal_stride,
|
||||||
packet->start_col = x;
|
packet->start_col = x;
|
||||||
packet->start_row = y;
|
packet->start_row = y;
|
||||||
packet->data_len = 2 * stride * h;
|
packet->data_len = 2 * stride * h;
|
||||||
packet->packet = malloc(packet->data_len);
|
if (packet->data_len) { // size 0 is a special "clear" packet
|
||||||
img = packet->packet;
|
packet->packet = malloc(packet->data_len);
|
||||||
aimg = packet->packet + stride * h;
|
img = packet->packet;
|
||||||
for (i = 0; i < 256; i++) {
|
aimg = packet->packet + stride * h;
|
||||||
uint32_t pixel = pal[i];
|
for (i = 0; i < 256; i++) {
|
||||||
int alpha = pixel >> 24;
|
uint32_t pixel = pal[i];
|
||||||
int gray = (((pixel & 0x000000ff) >> 0) +
|
int alpha = pixel >> 24;
|
||||||
((pixel & 0x0000ff00) >> 7) +
|
int gray = (((pixel & 0x000000ff) >> 0) +
|
||||||
((pixel & 0x00ff0000) >> 16)) >> 2;
|
((pixel & 0x0000ff00) >> 7) +
|
||||||
gray = FFMIN(gray, alpha);
|
((pixel & 0x00ff0000) >> 16)) >> 2;
|
||||||
g8a8_pal[i] = (-alpha << 8) | gray;
|
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->start_pts = 0;
|
||||||
packet->end_pts = 0x7fffffff;
|
packet->end_pts = 0x7fffffff;
|
||||||
if (pts != MP_NOPTS_VALUE)
|
if (pts != MP_NOPTS_VALUE)
|
||||||
|
|
Loading…
Reference in New Issue