[Mplayer-cvslog] CVS: main subreader.c,1.15,1.16 subreader.h,1.6,1.7

Megyer Laszlo laaz at users.sourceforge.net
Thu May 31 20:08:26 CEST 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv13410

Modified Files:
	subreader.c subreader.h 
Log Message:
Added support for .ssa subtitles


Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** subreader.c	2001/05/31 02:07:34	1.15
--- subreader.c	2001/05/31 18:08:23	1.16
***************
*** 22,29 ****
  int sub_format=-1;     // 0 for microdvd
  		      // 1 for SubRip
! 		     // 2 for the third format (what's this?)
  		    // 3 for SAMI (smi)
  		   // 4 for vplayer format
  		  // 5 for RT format
  
  int eol(char p) {
--- 22,30 ----
  int sub_format=-1;     // 0 for microdvd
  		      // 1 for SubRip
! 		     // 2 for SubViewer
  		    // 3 for SAMI (smi)
  		   // 4 for vplayer format
  		  // 5 for RT format
+ 		 // 6 for ssa (Sub Station Alpha)
  
  int eol(char p) {
***************
*** 296,300 ****
--- 297,321 ----
  }
  
+ subtitle *sub_read_line_ssa(FILE *fd,subtitle *current) {
+ 	int hour1, min1, sec1, hunsec1,
+ 	    hour2, min2, sec2, hunsec2, nothing;
+ 	
+ 	char line[1000],
+ 	     line2[1000];
+ 	do {
+ 		if (!fgets (line, 1000, fd)) return NULL;
+ 	} while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d,"
+ 			"*Default,%d,%d,%d,%d,,%[^\n\r]", &nothing, &hour1, &min1,
+ 			&sec1, &hunsec1,
+ 			&hour2, &min2, &sec2, &hunsec2, &nothing,
+ 			&nothing, &nothing, &nothing, line2) < 14);
+ 	current->lines=1;
+ 	current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1;
+ 	current->end   = 360000*hour2 + 6000*min2 + 100*sec2 + hunsec2;
+ 	current->text[0]=(char *) malloc(strlen(line2)+1);
+ 	strcpy(current->text[0],line2);
  
+ 	return current;
+ }
  
  int sub_autodetect (FILE *fd) {
***************
*** 321,327 ****
  	// too weak test for RT
  	// Please someone who knows the format of RT... FIX IT!!!
! 	// It may conflict with other sub formats in the future
  	if ( *line == '<' )
  		{sub_uses_time=1;return 5;}
      }
  
--- 342,353 ----
  	// too weak test for RT
  	// Please someone who knows the format of RT... FIX IT!!!
! 	// It may conflict with other sub formats in the future (actually it doesn't)
  	if ( *line == '<' )
  		{sub_uses_time=1;return 5;}
+ 
+ 	// I have only seen only 1 piece of .ssa file.
+ 	// It may be not correct (tell me if it's not)
+ 	if (!memcmp(line, "Dialogue: Marked", 16))
+ 		{sub_uses_time=1; return 6;}
      }
  
***************
*** 334,338 ****
      int n_max;
      subtitle *first;
!     subtitle * (*func[6])(FILE *fd,subtitle *dest)=
      {
  	    sub_read_line_microdvd,
--- 360,364 ----
      int n_max;
      subtitle *first;
!     subtitle * (*func[7])(FILE *fd,subtitle *dest)=
      {
  	    sub_read_line_microdvd,
***************
*** 341,345 ****
  	    sub_read_line_sami,
  	    sub_read_line_vplayer,
! 	    sub_read_line_rt
      };
  
--- 367,372 ----
  	    sub_read_line_sami,
  	    sub_read_line_vplayer,
! 	    sub_read_line_rt,
! 	    sub_read_line_ssa
      };
  

Index: subreader.h
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** subreader.h	2001/05/27 20:59:58	1.6
--- subreader.h	2001/05/31 18:08:24	1.7
***************
*** 11,15 ****
  			// 3 for SAMI (smi)
  		       // 4 for vplayer format
! 
  #define SUB_MAX_TEXT 5
  
--- 11,15 ----
  			// 3 for SAMI (smi)
  		       // 4 for vplayer format
! 		      // other stuff in subreader.c
  #define SUB_MAX_TEXT 5
  


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list