summaryrefslogtreecommitdiffstats
path: root/subreader.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-28 13:42:24 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-28 13:42:24 +0000
commitd3b9403406dfed411b5ac2f5c0675aa9d660c2fa (patch)
tree2e60abf2b4738569f0825d3d8f3ac343f7d8a7e4 /subreader.c
parent17c39c4e5794ecf8771e218e40843ad211f2ae71 (diff)
downloadmpv-d3b9403406dfed411b5ac2f5c0675aa9d660c2fa.tar.bz2
mpv-d3b9403406dfed411b5ac2f5c0675aa9d660c2fa.tar.xz
Attached is a small patch to fix a couple of problems I found when using
.SSA subtitle files: 1) A comma appears at the beggining of the text. From comments on the code this seems to be a delicated matter, so I just added a conditional to eliminate the comma if it is at the beggining of the string. 2) It looks like this format uses {*} for attributes, like {/fs36} to select "font size 36pt". These things becomes really annoying when displayed with the real text ;-), so I added a simple filter to collapse all the text enclosed with { and }. Salvador Eduardo Tropea <salvador@inti.gov.ar> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8603 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subreader.c')
-rw-r--r--subreader.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/subreader.c b/subreader.c
index 019e1fc4b8..50c4456b1d 100644
--- a/subreader.c
+++ b/subreader.c
@@ -425,7 +425,7 @@ subtitle *sub_read_line_ssa(FILE *fd,subtitle *current) {
char line[LINE_LEN+1],
line3[LINE_LEN+1],
- *line2;
+ *line2,*so,*de;
char *tmp;
do {
@@ -448,6 +448,21 @@ subtitle *sub_read_line_ssa(FILE *fd,subtitle *current) {
}
if(comma < max_comma)max_comma = comma;
+ /* eliminate the trailing comma */
+ if(*line2 == ',') line2++;
+ /* eliminate any text enclosed with {}, they are font and color settings */
+ so=de=line2;
+ while (*so) {
+ if(*so == '{') {
+ for (; *so && *so!='}'; *so++);
+ if(*so) so++;
+ }
+ if(*so) {
+ *de=*so;
+ so++; de++;
+ }
+ }
+ *de=*so;
current->lines=0;num=0;
current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1;