[Mplayer-cvslog] CVS: main subreader.c,1.9,1.10 subreader.h,1.4,1.5

Dariush Pietrzak eyck at users.sourceforge.net
Thu May 17 11:17:18 CEST 2001


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

Modified Files:
	subreader.c subreader.h 
Log Message:
Support for vplayer subtitles


Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** subreader.c	2001/05/06 02:26:00	1.9
--- subreader.c	2001/05/17 09:17:16	1.10
***************
*** 24,27 ****
--- 24,28 ----
  		     // 2 for the third format (what's this?)
  		    // 3 for SAMI (smi)
+ 		   // 4 for vplayer format
  
  int eol(char p) {
***************
*** 215,219 ****
--- 216,259 ----
  }
  
+ subtitle *sub_read_line_vplayer(FILE *fd,subtitle *current) {
+ 	char line[1001];
+ 	char line2[1001];
+ 	int a1,a2,a3,b1,b2,b3;
+ 	int setime,etime;
+ 	char *p=NULL, *q=NULL, *l=NULL,*next;
+ 	int i,len,len2;
+ 
+ 	bzero (current, sizeof(current));
+ 
+ 	while (!current->text[0]) {
+ 		if (!fgets (line, 1000, fd)) return NULL;
+ 		if ((len=sscanf (line, "%d:%d:%d:",&a1,&a2,&a3)) < 3)
+ 			continue;
+ 		if (!fgets (line2, 1000, fd)) return NULL;
+ 		if ((len2=sscanf (line2, "%d:%d:%d:",&b1,&b2,&b3)) < 3)
+ 			continue;
+ 		// przewiñ o linijkê do ty³u:
+ 		fseek(fd,-strlen(line2),SEEK_CUR);
+ 
+ 		current->start = a1*360000+a2*6000+a3*100;
+ 		current->end   = b1*360000+b2*6000+b3*100;
+ 		// teraz czas na wkopiowanie stringu
+ 		p=line;	p+=9;i=0;
+ 		if (*p!='|') {
+ 			//
+ 			next = p,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];
***************
*** 234,237 ****
--- 274,280 ----
  	if (strstr (line, "<SAMI>"))
  		{sub_uses_time=1; return 3;}
+ 	if (sscanf (line, "%d:%d:%d:",     &i, &i, &i )==3)
+ 		{sub_uses_time=1;return 4;}
+ 
      }
  
***************
*** 244,253 ****
      int n_max;
      subtitle *first;
!     subtitle * (*func[4])(FILE *fd,subtitle *dest)=
      {
  	    sub_read_line_microdvd,
  	    sub_read_line_subrip,
  	    sub_read_line_third,
! 	    sub_read_line_sami
      };
  
--- 287,297 ----
      int n_max;
      subtitle *first;
!     subtitle * (*func[5])(FILE *fd,subtitle *dest)=
      {
  	    sub_read_line_microdvd,
  	    sub_read_line_subrip,
  	    sub_read_line_third,
! 	    sub_read_line_sami,
! 	    sub_read_line_vplayer
      };
  

Index: subreader.h
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** subreader.h	2001/04/24 21:39:18	1.4
--- subreader.h	2001/05/17 09:17:16	1.5
***************
*** 10,13 ****
--- 10,14 ----
  			 // 2 for the third format
  			// 3 for SAMI (smi)
+ 		       // 4 for vplayer format
  
  #define SUB_MAX_TEXT 5
***************
*** 26,28 ****
  char * sub_filename( char * fname );
  
! #endif
\ No newline at end of file
--- 27,29 ----
  char * sub_filename( char * fname );
  
! #endif


_______________________________________________
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