mirror of https://github.com/mpv-player/mpv
Vobsub support tridx setting in .idx file.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25460 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
aaf4c414a6
commit
4a901e4db0
|
@ -344,6 +344,8 @@ static int
|
|||
vobsub_parse_custom_colors (sh_sub_t *sh, const char *start)
|
||||
{
|
||||
int use_custom_colors, i;
|
||||
const char *p;
|
||||
unsigned int tridx = 0;
|
||||
|
||||
use_custom_colors = 0;
|
||||
start += 14;
|
||||
|
@ -355,6 +357,8 @@ vobsub_parse_custom_colors (sh_sub_t *sh, const char *start)
|
|||
use_custom_colors = 0;
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] VobSub custom colors: %s\n",
|
||||
use_custom_colors ? "ON" : "OFF");
|
||||
if ((p = strstr(start, "tridx:")) != NULL)
|
||||
tridx = strtoul(p + 6, NULL, 2);
|
||||
if ((start = strstr(start, "colors:")) != NULL)
|
||||
{
|
||||
start += 7;
|
||||
|
@ -366,6 +370,8 @@ vobsub_parse_custom_colors (sh_sub_t *sh, const char *start)
|
|||
if (sscanf(start, "%06x", &tmp) != 1)
|
||||
break;
|
||||
sh->colors[i] = vobsub_rgb_to_yuv(tmp);
|
||||
if ((tridx << i) & 0x08)
|
||||
sh->colors[i] |= 1 << 31;
|
||||
start += 6;
|
||||
while ((*start == ',') || isspace(*start))
|
||||
start++;
|
||||
|
@ -373,8 +379,8 @@ vobsub_parse_custom_colors (sh_sub_t *sh, const char *start)
|
|||
if (i == 4)
|
||||
{
|
||||
sh->custom_colors = 4;
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] VobSub colors: %06x,"
|
||||
"%06x,%06x,%06x\n", sh->colors[0],
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] VobSub colors: %08x,"
|
||||
"%08x,%08x,%08x\n", sh->colors[0],
|
||||
sh->colors[1], sh->colors[2],
|
||||
sh->colors[3]);
|
||||
}
|
||||
|
|
2
spudec.c
2
spudec.c
|
@ -231,6 +231,8 @@ static void spudec_process_data(spudec_handle_t *this, packet_t *packet)
|
|||
this->stride = packet->stride;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
alpha[i] = mkalpha(packet->alpha[i]);
|
||||
if (this->custom && (this->cuspal[i] >> 31) != 0)
|
||||
alpha[i] = 0;
|
||||
if (alpha[i] == 0)
|
||||
cmap[i] = 0;
|
||||
else if (this->custom){
|
||||
|
|
15
vobsub.c
15
vobsub.c
|
@ -912,7 +912,7 @@ vobsub_parse_cuspal(vobsub_t *vob, const char *line)
|
|||
if (p - line !=6)
|
||||
return -1;
|
||||
tmp = strtoul(line, NULL, 16);
|
||||
vob->cuspal[n++] = vobsub_rgb_to_yuv(tmp);
|
||||
vob->cuspal[n++] |= vobsub_rgb_to_yuv(tmp);
|
||||
if (n==4)
|
||||
break;
|
||||
if(*p == ',')
|
||||
|
@ -922,14 +922,15 @@ vobsub_parse_cuspal(vobsub_t *vob, const char *line)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* don't know how to use tridx */
|
||||
static int
|
||||
vobsub_parse_tridx(const char *line)
|
||||
vobsub_parse_tridx(vobsub_t *vob, const char *line)
|
||||
{
|
||||
//tridx: XXXX
|
||||
int tridx;
|
||||
tridx = strtoul((line + 26), NULL, 16);
|
||||
tridx = ((tridx&0x1000)>>12) | ((tridx&0x100)>>7) | ((tridx&0x10)>>2) | ((tridx&1)<<3);
|
||||
int tridx, i;
|
||||
tridx = strtoul((line + 26), NULL, 2);
|
||||
for (i = 0; i < 4; ++i)
|
||||
if ((tridx << i) & 0x08)
|
||||
vob->cuspal[i] |= 1 << 31;
|
||||
return tridx;
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1018,7 @@ vobsub_parse_one_line(vobsub_t *vob, rar_stream_t *fd)
|
|||
res = vobsub_parse_timestamp(vob, line + 10);
|
||||
else if (strncmp("custom colors:", line, 14) == 0)
|
||||
//custom colors: ON/OFF, tridx: XXXX, colors: XXXXXX, XXXXXX, XXXXXX,XXXXXX
|
||||
res = vobsub_parse_cuspal(vob, line) + vobsub_parse_tridx(line) + vobsub_parse_custom(vob, line);
|
||||
res = vobsub_parse_cuspal(vob, line) + vobsub_parse_tridx(vob, line) + vobsub_parse_custom(vob, line);
|
||||
else if (strncmp("forced subs:", line, 12) == 0)
|
||||
res = vobsub_parse_forced_subs(vob, line + 12);
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue