summaryrefslogtreecommitdiffstats
path: root/subreader.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-21 17:19:59 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-21 17:19:59 +0000
commit16dc387ec2121cb545d6bf55cdb24faf86eeed6f (patch)
treea835e7c2914043948b079de3e45818f29a54e514 /subreader.c
parent6a3a406e8f304c3787a6feef88e9626608b87fdd (diff)
downloadmpv-16dc387ec2121cb545d6bf55cdb24faf86eeed6f.tar.bz2
mpv-16dc387ec2121cb545d6bf55cdb24faf86eeed6f.tar.xz
AQT type support patch by Jiri.Svoboda@seznam.cz
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2344 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subreader.c')
-rw-r--r--subreader.c53
1 files changed, 51 insertions, 2 deletions
diff --git a/subreader.c b/subreader.c
index 14736f1c33..456a1bfb89 100644
--- a/subreader.c
+++ b/subreader.c
@@ -37,6 +37,7 @@ int sub_format=-1; // 0 for microdvd
// 6 for ssa (Sub Station Alpha)
// 7 for ... erm ... dunnowhat. tell me if you know
// 8 for the glorious MPsub
+ // 9 for AQTitle
int eol(char p) {
return (p=='\r' || p=='\n' || p=='\0');
@@ -49,6 +50,7 @@ static inline void trail_space(char *s) {
while (i > 0 && isspace(s[i])) s[i--] = '\0';
}
+
subtitle *sub_read_line_sami(FILE *fd, subtitle *current) {
static char line[1001];
static char *s = NULL;
@@ -406,6 +408,47 @@ subtitle *sub_read_line_mpsub(FILE *fd, subtitle *current) {
}
}
+subtitle *previous_aqt_sub = NULL;
+
+subtitle *sub_read_line_aqt(FILE *fd,subtitle *current) {
+ char line[1001];
+
+ bzero (current, sizeof(subtitle));
+
+ while (1) {
+ // try to locate next subtitle
+ if (!fgets (line, 1000, fd))
+ return NULL;
+ if (!(sscanf (line, "-->> %ld", &(current->start)) <1))
+ break;
+ }
+
+ if (previous_aqt_sub != NULL)
+ previous_aqt_sub->end = current->start-1;
+
+ previous_aqt_sub = current;
+
+ if (!fgets (line, 1000, fd))
+ return NULL;
+
+ sub_readtext(&line,&current->text[0]);
+ current->lines = 1;
+ current->end = current->start; // will be corrected by next subtitle
+
+ if (!fgets (line, 1000, fd))
+ return current;;
+
+ sub_readtext(&line,&current->text[1]);
+ current->lines = 2;
+
+ if ((current->text[0]=="") && (current->text[1]=="")) {
+ // void subtitle -> end of previous marked and exit
+ previous_aqt_sub = NULL;
+ return NULL;
+ }
+
+ return current;
+}
int sub_autodetect (FILE *fd) {
char line[1001];
@@ -444,6 +487,8 @@ int sub_autodetect (FILE *fd) {
{sub_uses_time=0; return 8;}
if (sscanf (line, "FORMAT=TIM%c", &p)==1 && p=='E')
{sub_uses_time=1; return 8;}
+ if (strstr (line, "-->>"))
+ {sub_uses_time=0; return 9;}
}
return -1; // too many bad lines
@@ -530,7 +575,9 @@ subtitle* sub_read_file (char *filename) {
sub_read_line_rt,
sub_read_line_ssa,
sub_read_line_dunnowhat,
- sub_read_line_mpsub
+ sub_read_line_mpsub,
+ sub_read_line_aqt
+
};
fd=fopen (filename, "r"); if (!fd) return NULL;
@@ -612,7 +659,9 @@ char * sub_filename(char* path, char * fname )
".txt",
".TXT",
".ssa",
- ".SSA"};
+ ".SSA",
+ ".aqt",
+ ".AQT"};
if ( fname == NULL ) return NULL;