* sub.c
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
- * $Id: sub.c,v 1.42 2004/01/26 20:02:15 gbazin Exp $
+ * $Id: sub.c,v 1.43 2004/01/26 20:26:54 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
p_sub->p_es = NULL;
p_sub->i_subtitles = 0;
p_sub->subtitle = NULL;
+ p_sub->p_vobsub_file = 0;
p_sub->p_input = p_input;
if( !psz_name || !*psz_name )
if( p_sub->i_subtitles >= i_max )
{
i_max += 128;
- if( p_sub->subtitle )
+ if( !( p_sub->subtitle = realloc( p_sub->subtitle,
+ sizeof(subtitle_t) * i_max ) ) )
{
- if( !( p_sub->subtitle = realloc( p_sub->subtitle,
- sizeof( subtitle_t ) * i_max ) ) )
- {
- msg_Err( p_sub, "out of memory");
- return VLC_ENOMEM;
- }
- }
- else
- {
- if( !( p_sub->subtitle = malloc( sizeof( subtitle_t ) * i_max ) ) )
- {
- msg_Err( p_sub, "out of memory");
- return VLC_ENOMEM;
- }
+ msg_Err( p_sub, "out of memory");
+ return VLC_ENOMEM;
}
}
if( pf_read_subtitle( p_sub, &txt,
* sub.h
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
- * $Id: sub.h,v 1.13 2004/01/26 20:02:15 gbazin Exp $
+ * $Id: sub.h,v 1.14 2004/01/26 20:26:54 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
msg_Info( p_sub, "subtitle stopped" );
if( p_sub )
{
+ p_sub->pf_close( p_sub );
vlc_object_detach( p_sub );
if( p_sub->p_module )
{
* decoders.
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
- * $Id: input.c,v 1.278 2004/01/26 20:02:15 gbazin Exp $
+ * $Id: input.c,v 1.279 2004/01/26 20:26:54 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
char **tmp2 = tmp;
for( i = 0; *tmp2 != NULL; i++ )
{
- if( ( p_sub = subtitle_New( p_input, *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 );
}
+ free( *tmp2++ );
}
- free(tmp);
+ free( tmp );
}
es_out_Control( p_input->p_es_out, ES_OUT_SET_ACTIVE, VLC_TRUE );
* subtitles.c
*****************************************************************************
* Copyright (C) 2003-2004 VideoLAN
- * $Id: subtitles.c,v 1.9 2004/01/26 19:20:10 gbazin Exp $
+ * $Id: subtitles.c,v 1.10 2004/01/26 20:26:54 gbazin Exp $
*
* Authors: Derk-Jan Hartman <hartman at videolan.org>
* This is adapted code from the GPL'ed MPlayer (http://mplayerhq.hu)
if( strcmp(sub_exts[i], tmp_fname_ext ) == 0 )
{
b_found = 1;
- msg_Dbg( p_this, "found a possible subtitle: %s", de->d_name );
+ msg_Dbg( p_this, "found a possible subtitle: %s",
+ de->d_name );
break;
}
}
if( b_found )
{
int i_prio = 0;
- if( !i_prio && strcmp( tmp_fname_trim, f_fname_trim ) == 0 )
+ if( !i_prio && !strcmp( tmp_fname_trim, f_fname_trim ) )
{
/* matches the movie name exactly */
i_prio = 4;
}
- if( !i_prio && ( tmp = strstr( tmp_fname_trim, f_fname_trim ) ) )
+ if( !i_prio &&
+ ( tmp = strstr( tmp_fname_trim, f_fname_trim ) ) )
{
/* contains the movie name */
tmp += strlen( f_fname_trim );
if( i_prio >= fuzzy.i_int )
{
- sprintf( tmpresult, "%s%s", j == 0 ? f_dir : psz_path, de->d_name );
- msg_Dbg( p_this, "autodetected subtitle: %s with priority %d", de->d_name, i_prio );
+ sprintf( tmpresult, "%s%s", j == 0 ? f_dir : psz_path,
+ de->d_name );
+ msg_Dbg( p_this, "autodetected subtitle: %s with "
+ "priority %d", de->d_name, i_prio );
if( ( f = fopen( tmpresult, "rt" ) ) )
{
fclose( f );
result[i_sub_count].priority = i_prio;
- result[i_sub_count].psz_fname = strdup( tmpresult );
+ result[i_sub_count].psz_fname = strdup(tmpresult);
i_sub_count++;
}
}
-
}
if( i_sub_count >= MAX_SUBTITLE_FILES ) break;
}
free( result );
return result2;
}
-