summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure2
-rw-r--r--debian/files2
-rw-r--r--debian/mplayer.conf3
-rw-r--r--subreader.c59
4 files changed, 57 insertions, 9 deletions
diff --git a/configure b/configure
index adf35d2e53..f7793e4980 100755
--- a/configure
+++ b/configure
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# MPlayer configurator. (C) 2000 Pontscho/fresh!mindworkz
diff --git a/debian/files b/debian/files
index 24cc330b07..e71caa5ad0 100644
--- a/debian/files
+++ b/debian/files
@@ -1 +1 @@
-mplayer_0.17a-1_i386.deb unknown optional
+mplayer_0.17a-2_i386.deb unknown optional
diff --git a/debian/mplayer.conf b/debian/mplayer.conf
index 32a80dab97..82efec6b6c 100644
--- a/debian/mplayer.conf
+++ b/debian/mplayer.conf
@@ -41,7 +41,6 @@ zoom=no # Enable software scaling (powerful CPU needed)
##
sound = 1
-nosound = nein
mixer = /dev/mixer
master = no # no : set PCM volume yes : set MASTER volume
@@ -83,7 +82,7 @@ ffactor = 1
# forcexv = yes # force XVideo even if not detected
-# nodshow # disable usage of DirectShow video codecs
+# nodshow = 1 # disable usage of DirectShow video codecs
##
## You can also include other configfiles
diff --git a/subreader.c b/subreader.c
index d0cb84567d..1a0c54cd03 100644
--- a/subreader.c
+++ b/subreader.c
@@ -24,6 +24,7 @@ int sub_format=-1; // 0 for microdvd
// 2 for the third format (what's this?)
// 3 for SAMI (smi)
// 4 for vplayer format
+ // 5 for RT format
int eol(char p) {
return (p=='\r' || p=='\n' || p=='\0');
@@ -253,6 +254,46 @@ subtitle *sub_read_line_vplayer(FILE *fd,subtitle *current) {
return current;
}
+subtitle *sub_read_line_rt(FILE *fd,subtitle *current) {
+ //TODO: This format uses quite rich (sub/super)set of xhtml
+ // I couldn't check it since DTD is not included.
+ // WARNING: full XML parses can be required for proper parsing
+ char line[1001];
+ int a1,a2,a3,a4,b1,b2,b3,b4;
+ char *p=NULL,*next=NULL;
+ int i,len,plen;
+
+ bzero (current, sizeof(current));
+
+ while (!current->text[0]) {
+ if (!fgets (line, 1000, fd)) return NULL;
+ //TODO: it seems that format of time is not easily determined, it may be 1:12, 1:12.0 or 0:1:12.0
+ //to describe the same moment in time. Maybe there are even more formats in use.
+ //if ((len=sscanf (line, "<Time Begin=\"%d:%d:%d.%d\" End=\"%d:%d:%d.%d\"",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4)) < 8)
+ plen=a1=a2=a3=a4=b1=b2=b3=b4=0;
+ if (
+ ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d\" %*[Ee]nd=\"%d:%d\"%*[^<]<clear/>%n",&a2,&a3,&b2,&b3,&plen)) < 4) &&
+ ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d\" %*[Ee]nd=\"%d:%d.%d\"%*[^<]<clear/>%n",&a2,&a3,&b2,&b3,&b4,&plen)) < 5) &&
+// ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d.%d\" %*[Ee]nd=\"%d:%d\"%*[^<]<clear/>%n",&a2,&a3,&a4,&b2,&b3,&plen)) < 5) &&
+ ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d.%d\" %*[Ee]nd=\"%d:%d.%d\"%*[^<]<clear/>%n",&a2,&a3,&a4,&b2,&b3,&b4,&plen)) < 6) &&
+ ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d:%d.%d\" %*[Ee]nd=\"%d:%d:%d.%d\"%*[^<]<clear/>%n",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4,&plen)) < 8)
+ )
+ continue;
+ current->start = a1*360000+a2*6000+a3*100+a4/10;
+ current->end = b1*360000+b2*6000+b3*100+b4/10;
+ p=line; p+=plen;i=0;
+ // TODO: I don't know what kind of convention is here for marking multiline subs, maybe <br/> like in xml?
+ next = strstr(line,"<clear/>")+8;i=0;
+ while ((next =sub_readtext (next, &(current->text[i])))) {
+ if (current->text[i]==ERR) {return ERR;}
+ i++;
+ if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return;}
+ }
+ current->lines=i+1;
+ }
+ return current;
+}
+
int sub_autodetect (FILE *fd) {
@@ -275,7 +316,10 @@ int sub_autodetect (FILE *fd) {
{sub_uses_time=1; return 3;}
if (sscanf (line, "%d:%d:%d:", &i, &i, &i )==3)
{sub_uses_time=1;return 4;}
-
+ //TODO: just checking if first line of sub starts with "<" is WAY
+ // to weak test for RT
+ if (strcmp("<",line))
+ {sub_uses_time=1;return 5;}
}
return -1; // too many bad lines
@@ -286,13 +330,14 @@ subtitle* sub_read_file (char *filename) {
FILE *fd;
int n_max;
subtitle *first;
- subtitle * (*func[5])(FILE *fd,subtitle *dest)=
+ subtitle * (*func[6])(FILE *fd,subtitle *dest)=
{
sub_read_line_microdvd,
sub_read_line_subrip,
sub_read_line_third,
sub_read_line_sami,
- sub_read_line_vplayer
+ sub_read_line_vplayer,
+ sub_read_line_rt
};
fd=fopen (filename, "r"); if (!fd) return NULL;
@@ -344,14 +389,18 @@ char * sub_filename( char * fname )
char * sub_name = NULL;
char * sub_tmp = NULL;
int i;
-#define SUB_EXTS 6
+#define SUB_EXTS 10
char * sub_exts[SUB_EXTS] =
{ ".sub",
".SUB",
".srt",
".SRT",
".smi",
- ".SMI"};
+ ".SMI",
+ ".rt",
+ ".RT",
+ ".txt",
+ ".TXT"};
if ( fname == NULL ) return NULL;
for( i=strlen( fname );i>0;i-- )