[MPlayer-cvslog] r37598 - trunk/sub/subassconvert.c
rtogni
subversion at mplayerhq.hu
Mon Jan 18 22:44:41 CET 2016
Author: rtogni
Date: Mon Jan 18 22:44:40 2016
New Revision: 37598
Log:
Fix attribute parsing at SRT subtitles
When displaying formatted subtitles (-ass mode) the code only checks for
color= inside the font tag, and mistake other attributes (eg. back-color= )
as text colour.
This patch fixes it by checking for a space in front of color=
Patch by Stefan Pöschel basic master gmx de
Modified:
trunk/sub/subassconvert.c
Modified: trunk/sub/subassconvert.c
==============================================================================
--- trunk/sub/subassconvert.c Sat Jan 16 16:59:56 2016 (r37597)
+++ trunk/sub/subassconvert.c Mon Jan 18 22:44:40 2016 (r37598)
@@ -195,19 +195,19 @@ void subassconvert_subrip(const char *or
int has_valid_attr = 0;
*tag = tag[-1]; // keep values from previous tag
- line += 6;
+ line += 5; // don't skip space!
while (*line && *line != '>') {
- if (strncmp(line, "size=", 5) == 0) {
- line += 5;
+ if (strncmp(line, " size=", 6) == 0) {
+ line += 6;
if (*line == '"') line++;
tag->size = strtol(line, &line, 10);
if (!tag->size)
break;
append_text(&new_line, "{\\fs%d}", tag->size);
has_valid_attr = 1;
- } else if (strncmp(line, "color=", 6) == 0) {
- line += 6;
+ } else if (strncmp(line, " color=", 7) == 0) {
+ line += 7;
if (*line == '"') line++;
if (*line == '#') {
// #RRGGBB format
@@ -241,10 +241,10 @@ void subassconvert_subrip(const char *or
}
append_text(&new_line, "{\\c&H%06X&}", tag->color & 0xffffff);
has_valid_attr = 1;
- } else if (strncmp(line, "face=\"", 6) == 0) {
+ } else if (strncmp(line, " face=\"", 7) == 0) {
/* Font face attribute */
int len;
- line += 6;
+ line += 7;
len = indexof(line, '"');
if (len <= 0)
break;
More information about the MPlayer-cvslog
mailing list