comparison libmpdemux/demux_mkv.c @ 25432:7957b8762195

Vobsub support tridx setting in .idx file.
author ulion
date Wed, 19 Dec 2007 08:35:40 +0000
parents fb719ee583b5
children 3d5fb36693ac
comparison
equal deleted inserted replaced
25431:40bda123d2e7 25432:7957b8762195
342 342
343 static int 343 static int
344 vobsub_parse_custom_colors (sh_sub_t *sh, const char *start) 344 vobsub_parse_custom_colors (sh_sub_t *sh, const char *start)
345 { 345 {
346 int use_custom_colors, i; 346 int use_custom_colors, i;
347 const char *p;
348 unsigned int tridx = 0;
347 349
348 use_custom_colors = 0; 350 use_custom_colors = 0;
349 start += 14; 351 start += 14;
350 while (isspace(*start)) 352 while (isspace(*start))
351 start++; 353 start++;
353 use_custom_colors = 1; 355 use_custom_colors = 1;
354 else if (!strncasecmp(start, "OFF", 3) || (*start == '0')) 356 else if (!strncasecmp(start, "OFF", 3) || (*start == '0'))
355 use_custom_colors = 0; 357 use_custom_colors = 0;
356 mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] VobSub custom colors: %s\n", 358 mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] VobSub custom colors: %s\n",
357 use_custom_colors ? "ON" : "OFF"); 359 use_custom_colors ? "ON" : "OFF");
360 if ((p = strstr(start, "tridx:")) != NULL)
361 tridx = strtoul(p + 6, NULL, 2);
358 if ((start = strstr(start, "colors:")) != NULL) 362 if ((start = strstr(start, "colors:")) != NULL)
359 { 363 {
360 start += 7; 364 start += 7;
361 while (isspace(*start)) 365 while (isspace(*start))
362 start++; 366 start++;
364 { 368 {
365 unsigned int tmp; 369 unsigned int tmp;
366 if (sscanf(start, "%06x", &tmp) != 1) 370 if (sscanf(start, "%06x", &tmp) != 1)
367 break; 371 break;
368 sh->colors[i] = vobsub_rgb_to_yuv(tmp); 372 sh->colors[i] = vobsub_rgb_to_yuv(tmp);
373 if ((tridx << i) & 0x08)
374 sh->colors[i] |= 1 << 31;
369 start += 6; 375 start += 6;
370 while ((*start == ',') || isspace(*start)) 376 while ((*start == ',') || isspace(*start))
371 start++; 377 start++;
372 } 378 }
373 if (i == 4) 379 if (i == 4)
374 { 380 {
375 sh->custom_colors = 4; 381 sh->custom_colors = 4;
376 mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] VobSub colors: %06x," 382 mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] VobSub colors: %08x,"
377 "%06x,%06x,%06x\n", sh->colors[0], 383 "%08x,%08x,%08x\n", sh->colors[0],
378 sh->colors[1], sh->colors[2], 384 sh->colors[1], sh->colors[2],
379 sh->colors[3]); 385 sh->colors[3]);
380 } 386 }
381 } 387 }
382 if (!use_custom_colors) 388 if (!use_custom_colors)