[MPlayer-cvslog] r25460 - in trunk: libmpdemux/demux_mkv.c spudec.c vobsub.c
ulion
subversion at mplayerhq.hu
Wed Dec 19 09:35:40 CET 2007
Author: ulion
Date: Wed Dec 19 09:35:40 2007
New Revision: 25460
Log:
Vobsub support tridx setting in .idx file.
Modified:
trunk/libmpdemux/demux_mkv.c
trunk/spudec.c
trunk/vobsub.c
Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c (original)
+++ trunk/libmpdemux/demux_mkv.c Wed Dec 19 09:35:40 2007
@@ -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
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
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
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]);
}
Modified: trunk/spudec.c
==============================================================================
--- trunk/spudec.c (original)
+++ trunk/spudec.c Wed Dec 19 09:35:40 2007
@@ -231,6 +231,8 @@ static void spudec_process_data(spudec_h
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){
Modified: trunk/vobsub.c
==============================================================================
--- trunk/vobsub.c (original)
+++ trunk/vobsub.c Wed Dec 19 09:35:40 2007
@@ -912,7 +912,7 @@ vobsub_parse_cuspal(vobsub_t *vob, const
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
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
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 {
More information about the MPlayer-cvslog
mailing list