subtitle_microdvd.c.svn-base

来自「psp播放器PPA源码,在MSYS/CYGWIN环境下编译(GNU-C)」· SVN-BASE 代码 · 共 83 行

SVN-BASE
83
字号
/*PMP ModCopyright (C) 2006 RaphaelE-mail:   raphael@fx-world.orgThis program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*//*microdvd subtitle format parser*/#include "subtitle_microdvd.h"#include "common/mem64.h"#include "common/libminiconv.h"struct subtitle_frame_struct* subtitle_parse_microdvd( FILE *f, char* charset, unsigned int rate, unsigned int scale )	{	if (!f) return(0);		struct subtitle_frame_struct *p = (struct subtitle_frame_struct*)malloc_64( sizeof(struct subtitle_frame_struct) );	if (p==0) return(0);	p->p_string[0] = '\0';		int result = fscanf( f, "{%i}{%i}", &p->p_start_frame, &p->p_end_frame );	if (result==EOF)		{		free_64(p);		return(0);		}		char c;	int i = 0;	p->p_num_lines = 1;	while (i<max_subtitle_string-1)		{		c = fgetc(f);		if (c=='\n' || c==EOF) break;		if (c=='|')			{			p->p_string[i++]='\n';			p->p_num_lines++;			}		else			{			p->p_string[i++]=c;			}		}	p->p_string[i] = '\0';		if ( miniConvHaveSubtitleConv(charset) ) {		char* temp_str = miniConvSubtitleConv(p->p_string, charset);		if( temp_str != NULL ) {			strncpy(p->p_string, temp_str, max_subtitle_string-1);		}	}	else if ( miniConvHaveDefaultSubtitleConv() ){		char* temp_str = miniConvDefaultSubtitleConv(p->p_string);		if( temp_str != NULL ) {			strncpy(p->p_string, temp_str, max_subtitle_string-1);		}	}		return(p);	}	

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?