* sub.c
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
- * $Id: sub.c,v 1.41 2004/01/25 20:05:29 hartman Exp $
+ * $Id: sub.c,v 1.42 2004/01/26 20:02:15 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
i_line_max += 100;
txt->line = realloc( txt->line, i_line_max * sizeof( char*) );
}
- printf( "hoi, %s", txt->line );
}
fclose( f );
/*****************************************************************************
* sub_open: Open a subtitle file and add subtitle ES
*****************************************************************************/
-static int sub_open ( subtitle_demux_t *p_sub,
- input_thread_t *p_input,
- char *psz_name,
- mtime_t i_microsecperframe,
- int i_track_id )
+static int sub_open( subtitle_demux_t *p_sub, input_thread_t *p_input,
+ char *psz_name, mtime_t i_microsecperframe,
+ int i_track_id )
{
text_t txt;
vlc_value_t val;
- es_format_t fmt;
- char *psz_vobname;
-
- int i;
- int i_sub_type;
- int i_max;
- int (*pf_read_subtitle)( subtitle_demux_t *, text_t *, subtitle_t *, mtime_t ) = NULL;
+ es_format_t fmt;
+ int i, i_sub_type, i_max;
+ int (*pf_read_subtitle)( subtitle_demux_t *, text_t *, subtitle_t *,
+ mtime_t ) = NULL;
p_sub->i_sub_type = SUB_TYPE_UNKNOWN;
p_sub->p_es = NULL;
if( !psz_name || !*psz_name )
{
msg_Err( p_sub, "no subtitle file specified" );
- if( psz_name ) free( psz_name );
return VLC_EGENERIC;
}
if( text_load( &txt, psz_name ) )
{
msg_Err( p_sub, "cannot open `%s' subtitle file", psz_name );
- free( psz_name );
return VLC_EGENERIC;
}
-
+
msg_Dbg( p_sub, "opened `%s'", psz_name );
- psz_vobname = strdup( psz_name );
- free( psz_name );
var_Get( p_sub, "sub-fps", &val );
if( val.i_int >= 1.0 )
/* *** add subtitle ES *** */
if( p_sub->i_sub_type == SUB_TYPE_VOBSUB )
{
- int i_len = strlen( psz_vobname );
- char *extension = psz_vobname + i_len - 4;
-
- strcpy( extension, ".sub" );
+ int i_len = strlen( psz_name );
+ char *psz_vobname = strdup(psz_name);
+
+ strcpy( psz_vobname + i_len - 4, ".sub" );
/* open file */
if( !( p_sub->p_vobsub_file = fopen( psz_vobname, "rb" ) ) )
{
msg_Err( p_sub, "couldn't open .sub Vobsub file: %s", psz_vobname );
}
- if( psz_vobname ) free( psz_vobname );
+ free( psz_vobname );
es_format_Init( &fmt, SPU_ES, VLC_FOURCC( 's','p','u',' ' ) );
}
* sub.h
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
- * $Id: sub.h,v 1.12 2004/01/25 20:05:29 hartman Exp $
+ * $Id: sub.h,v 1.13 2004/01/26 20:02:15 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
p_sub->p_module = module_Need( p_sub, "subtitle demux", "" );
if( p_sub->p_module &&
- p_sub->pf_open( p_sub,
- p_input,
- psz_name,
- i_microsecperframe,
+ p_sub->pf_open( p_sub, p_input, psz_name, i_microsecperframe,
i_track_id ) >=0 )
{
msg_Info( p_input, "subtitle started" );
* decoders.
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
- * $Id: input.c,v 1.277 2004/01/25 17:16:05 zorglub Exp $
+ * $Id: input.c,v 1.278 2004/01/26 20:02:15 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
{
if( !strncmp( p_item->pp_categories[i]->psz_name, _("Options"), 7 ) )
{
- msg_Dbg(p_input,"Parsing %i options for item",
- p_item->pp_categories[i]->i_infos );
+ msg_Dbg( p_input,"Parsing %i options for item",
+ p_item->pp_categories[i]->i_infos );
for( j = 0; j< p_item->pp_categories[i]->i_infos ; j++ )
{
- msg_Dbg(p_input,"Option : %s",
+ msg_Dbg( p_input,"Option : %s",
p_item->pp_categories[i]->pp_infos[j]->psz_name);
ParseOption( p_input,
p_item->pp_categories[i]->pp_infos[j]->psz_value);
char **tmp2 = tmp;
for( i = 0; *tmp2 != NULL; i++ )
{
- if( ( p_sub = subtitle_New( p_input, strdup(*tmp2++),
+ if( ( p_sub = subtitle_New( p_input, *tmp2++,
i_microsecondperframe, i ) ) )
{
TAB_APPEND( p_input->p_sys->i_sub, p_input->p_sys->sub, p_sub );