"subviewer1"
};
-vlc_module_begin();
- set_shortname( N_("Subtitles"));
- set_description( N_("Text subtitles parser") );
- set_capability( "demux", 0 );
- set_category( CAT_INPUT );
- set_subcategory( SUBCAT_INPUT_DEMUX );
+vlc_module_begin ()
+ set_shortname( N_("Subtitles"))
+ set_description( N_("Text subtitles parser") )
+ set_capability( "demux", 0 )
+ set_category( CAT_INPUT )
+ set_subcategory( SUBCAT_INPUT_DEMUX )
add_float( "sub-fps", 0.0, NULL,
N_("Frames per second"),
- SUB_FPS_LONGTEXT, true );
+ SUB_FPS_LONGTEXT, true )
add_integer( "sub-delay", 0, NULL,
N_("Subtitles delay"),
- SUB_DELAY_LONGTEXT, true );
+ SUB_DELAY_LONGTEXT, true )
add_string( "sub-type", "auto", NULL, N_("Subtitles format"),
- SUB_TYPE_LONGTEXT, true );
+ SUB_TYPE_LONGTEXT, true )
change_string_list( ppsz_sub_type, NULL, NULL );
- set_callbacks( Open, Close );
+ set_callbacks( Open, Close )
- add_shortcut( "subtitle" );
-vlc_module_end();
+ add_shortcut( "subtitle" )
+vlc_module_end ()
/*****************************************************************************
* Prototypes:
/* Quit on unknown subtitles */
if( p_sys->i_type == SUB_TYPE_UNKNOWN )
{
- msg_Err( p_demux, "failed to recognize subtitle type" );
+ msg_Warn( p_demux, "failed to recognize subtitle type" );
free( p_sys );
return VLC_EGENERIC;
}
return ParseSubRipSubViewer( p_demux, p_subtitle,
"%d:%d:%d.%d,%d:%d:%d.%d",
- true );
+ true )
}
/* ParseSSA
const char *s = TextGetLine( txt );
if( !s )
+ {
+ free( psz_text );
return VLC_EGENERIC;
+ }
if( strstr( s, "FORMAT" ) )
{
psz_temp = malloc( strlen(s) );
if( !psz_temp )
+ {
+ free( psz_text );
return VLC_ENOMEM;
+ }
if( sscanf( s, "FORMAT=%[^\r\n]", psz_temp ) )
{
const char *s = TextGetLine( txt );
if( !s )
+ {
+ free( psz_text );
return VLC_EGENERIC;
+ }
int i_len = strlen( s );
if( i_len == 0 )
}
}
- while( psz_text[ strlen( psz_text ) - 1 ] == '\\' )
- {
+ while( psz_text[ strlen( psz_text ) - 1 ] == '\\' )
+ {
const char *s2 = TextGetLine( txt );
if( !s2 )
+ {
+ free( psz_orig );
return VLC_EGENERIC;
+ }
int i_len = strlen( s2 );
if( i_len == 0 )
psz_orig = psz_text;
strcat( psz_text, s2 );
- }
+ }
/* Skip the blanks */
while( *psz_text == ' ' || *psz_text == '\t' ) psz_text++;
demux_sys_t *p_sys = p_demux->p_sys;
text_t *txt = &p_sys->txt;
char *psz_text = NULL;
- char psz_end[12]= "", psz_begin[12] = "";
for( ;; )
{
int h1 = 0, m1 = 0, s1 = 0, f1 = 0;
int h2 = 0, m2 = 0, s2 = 0, f2 = 0;
const char *s = TextGetLine( txt );
+ free( psz_text );
if( !s )
- {
- free( psz_text );
return VLC_EGENERIC;
- }
psz_text = malloc( strlen( s ) + 1 );
if( !psz_text )
char *psz_temp = strcasestr( s, "<time");
if( psz_temp != NULL )
{
+ char psz_end[12], psz_begin[12];
/* Line has begin and end */
if( ( sscanf( psz_temp,
- "<%*[t|T]ime %*[b|B]egin=\"%[^\"]\" %*[e|E]nd=\"%[^\"]%*[^>]%[^\n\r]",
+ "<%*[t|T]ime %*[b|B]egin=\"%11[^\"]\" %*[e|E]nd=\"%11[^\"]%*[^>]%[^\n\r]",
psz_begin, psz_end, psz_text) != 3 ) &&
/* Line has begin and no end */
( sscanf( psz_temp,
- "<%*[t|T]ime %*[b|B]egin=\"%[^\"]\"%*[^>]%[^\n\r]",
+ "<%*[t|T]ime %*[b|B]egin=\"%11[^\"]\"%*[^>]%[^\n\r]",
psz_begin, psz_text ) != 2) )
/* Line is not recognized */
{
- free( psz_text );
continue;
}
}
break;
}
- /* Line is not recognized */
- else
- {
- free( psz_text );
- continue;
- }
}
/* Get the following Lines */
const char *s = TextGetLine( txt );
if( !s )
+ {
+ free( psz_text );
return VLC_EGENERIC;
+ }
int i_len = strlen( s );
if( i_len == 0 ) break;
char *s = TextGetLine( txt );
if( !s )
+ {
+ free( psz_text );
return VLC_EGENERIC;
+ }
if( sscanf( s, "[%d:%d:%d]", &h2, &m2, &s2 ) == 3 )
p_subtitle->i_stop = ( (int64_t)h2 * 3600*1000 +
s = TextGetLine( txt );
if( !s )
+ {
+ free( psz_text );
return VLC_EGENERIC;
+ }
if( sscanf( s, "[%d:%d:%d]", &h2, &m2, &s2 ) == 3 )
p_subtitle->i_stop = ( (int64_t)h2 * 3600*1000 +