[Mplayer-cvslog] CVS: main configure,1.50,1.51 subreader.c,1.10,1.11
Dariush Pietrzak
eyck at users.sourceforge.net
Tue May 22 13:09:28 CEST 2001
- Previous message: [Mplayer-cvslog] CVS: main/libac3 config.h,NONE,1.1 Makefile,1.3,1.4 bswap.h,1.1.1.1,1.2
- Next message: [Mplayer-cvslog] CVS: main/debian files,1.2,1.3 mplayer.conf,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv14116
Modified Files:
configure subreader.c
Log Message:
Preliminary support for RT-type subs.
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -r1.50 -r1.51
*** configure 2001/05/22 07:45:35 1.50
--- configure 2001/05/22 11:09:26 1.51
***************
*** 1,3 ****
! #!/bin/sh
#
--- 1,3 ----
! #!/bin/bash
#
Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** subreader.c 2001/05/17 09:17:16 1.10
--- subreader.c 2001/05/22 11:09:26 1.11
***************
*** 25,28 ****
--- 25,29 ----
// 3 for SAMI (smi)
// 4 for vplayer format
+ // 5 for RT format
int eol(char p) {
***************
*** 254,259 ****
--- 255,300 ----
}
+ 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) {
char line[1001];
***************
*** 276,280 ****
if (sscanf (line, "%d:%d:%d:", &i, &i, &i )==3)
{sub_uses_time=1;return 4;}
!
}
--- 317,324 ----
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;}
}
***************
*** 287,291 ****
int n_max;
subtitle *first;
! subtitle * (*func[5])(FILE *fd,subtitle *dest)=
{
sub_read_line_microdvd,
--- 331,335 ----
int n_max;
subtitle *first;
! subtitle * (*func[6])(FILE *fd,subtitle *dest)=
{
sub_read_line_microdvd,
***************
*** 293,297 ****
sub_read_line_third,
sub_read_line_sami,
! sub_read_line_vplayer
};
--- 337,342 ----
sub_read_line_third,
sub_read_line_sami,
! sub_read_line_vplayer,
! sub_read_line_rt
};
***************
*** 345,349 ****
char * sub_tmp = NULL;
int i;
! #define SUB_EXTS 6
char * sub_exts[SUB_EXTS] =
{ ".sub",
--- 390,394 ----
char * sub_tmp = NULL;
int i;
! #define SUB_EXTS 10
char * sub_exts[SUB_EXTS] =
{ ".sub",
***************
*** 352,356 ****
".SRT",
".smi",
! ".SMI"};
if ( fname == NULL ) return NULL;
--- 397,405 ----
".SRT",
".smi",
! ".SMI",
! ".rt",
! ".RT",
! ".txt",
! ".TXT"};
if ( fname == NULL ) return NULL;
_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
- Previous message: [Mplayer-cvslog] CVS: main/libac3 config.h,NONE,1.1 Makefile,1.3,1.4 bswap.h,1.1.1.1,1.2
- Next message: [Mplayer-cvslog] CVS: main/debian files,1.2,1.3 mplayer.conf,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list