* sub.c
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
- * $Id: sub.c,v 1.27 2003/10/08 21:03:36 gbazin Exp $
+ * $Id: sub.c,v 1.28 2003/10/11 22:40:04 hartman Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
static int sub_open ( subtitle_demux_t *p_sub,
input_thread_t *p_input,
char *psz_name,
- mtime_t i_microsecperframe );
+ mtime_t i_microsecperframe,
+ int i_track_id );
static int sub_demux( subtitle_demux_t *p_sub, mtime_t i_maxdate );
static int sub_seek ( subtitle_demux_t *p_sub, mtime_t i_date );
static void sub_close( subtitle_demux_t *p_sub );
static int sub_open ( subtitle_demux_t *p_sub,
input_thread_t *p_input,
char *psz_name,
- mtime_t i_microsecperframe )
+ mtime_t i_microsecperframe,
+ int i_track_id )
{
text_t txt;
vlc_value_t val;
/* *** add subtitle ES *** */
vlc_mutex_lock( &p_input->stream.stream_lock );
p_sub->p_es = input_AddES( p_input, p_input->stream.p_selected_program,
- 0xff, // FIXME
+ 0xff - i_track_id, /* FIXME */
SPU_ES, NULL, 0 );
vlc_mutex_unlock( &p_input->stream.stream_lock );
- p_sub->p_es->i_stream_id = 0xff; // FIXME
+ p_sub->p_es->i_stream_id = 0xff - i_track_id; /* FIXME */
p_sub->p_es->i_fourcc = VLC_FOURCC( 's','u','b','t' );
p_sub->i_previously_selected = 0;
* sub.h
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
- * $Id: sub.h,v 1.7 2003/08/23 19:20:29 hartman Exp $
+ * $Id: sub.h,v 1.8 2003/10/11 22:40:05 hartman Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
int (*pf_open) ( struct subtitle_demux_s *p_sub,
input_thread_t*p_input,
char *psz_name,
- mtime_t i_microsecperframe );
+ mtime_t i_microsecperframe,
+ int i_track_id );
int (*pf_demux)( struct subtitle_demux_s *p_sub, mtime_t i_maxdate );
int (*pf_seek) ( struct subtitle_demux_s *p_sub, mtime_t i_date );
void (*pf_close)( struct subtitle_demux_s *p_sub );
*****************************************************************************/
static inline subtitle_demux_t *subtitle_New( input_thread_t *p_input,
char *psz_name,
- mtime_t i_microsecperframe );
+ mtime_t i_microsecperframe,
+ int i_track_id );
/*****************************************************************************
* subtitle_Select: Select the related subtitle ES.
*****************************************************************************/
static inline
subtitle_demux_t *subtitle_New( input_thread_t *p_input,
char *psz_name,
- mtime_t i_microsecperframe )
+ mtime_t i_microsecperframe,
+ int i_track_id )
{
subtitle_demux_t *p_sub;
p_sub->pf_open( p_sub,
p_input,
psz_name,
- i_microsecperframe ) >=0 )
+ i_microsecperframe,
+ i_track_id ) >=0 )
{
msg_Info( p_input, "subtitle started" );
* decoders.
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- * $Id: input.c,v 1.246 2003/10/08 21:01:07 gbazin Exp $
+ * $Id: input.c,v 1.247 2003/10/11 22:40:05 hartman Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
var_Create( p_input, "spu-channel", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-file", VLC_VAR_FILE | VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-autodetect-file", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
+ var_Create( p_input, "sub-autodetect-fuzzy", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_input, "sub-file", &val );
if( val.psz_string && *val.psz_string )
{
- if( ( p_sub = subtitle_New( p_input, strdup(val.psz_string), i_microsecondperframe ) ) )
+ if( ( p_sub = subtitle_New( p_input, strdup(val.psz_string), i_microsecondperframe, 0 ) ) )
{
TAB_APPEND( p_input->p_sys->i_sub, p_input->p_sys->sub, p_sub );
subtitle_Select( p_sub );
var_Get( p_input, "sub-autodetect-file", &val );
if( val.b_bool )
{
+ int i;
char **tmp = subtitles_Detect( p_input, "", p_input->psz_source );
char **tmp2 = tmp;
- while (*tmp2)
+ for( i = 0; *tmp2 != NULL; i++ )
{
- if( ( p_sub = subtitle_New( p_input, strdup(*tmp2++), i_microsecondperframe ) ) )
+ if( ( p_sub = subtitle_New( p_input, strdup(*tmp2++), i_microsecondperframe, i ) ) )
{
TAB_APPEND( p_input->p_sys->i_sub, p_input->p_sys->sub, p_sub );
}
* subtitles.c
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: subtitles.c,v 1.3 2003/10/02 00:16:05 hartman Exp $
+ * $Id: subtitles.c,v 1.4 2003/10/11 22:40:05 hartman Exp $
*
* Authors: Derk-Jan Hartman <hartman at videolan.org>
* This is adapted code from the GPL'ed MPlayer (http://mplayerhq.hu)
*/
#define MAX_SUBTITLE_FILES 128
-/**
- * This determines how fuzzy the returned results will be.
- *
- * Currently set to 3, other options are:
- * 0 = nothing
- * 1 = any subtitle file
- * 2 = any sub file containing movie name
- * 3 = sub file matching movie name exactly
- * 4 = sub file matching movie name with additional chars
- */
-#define SUB_FUZZY 3
/**
* The possible extentions for subtitle files we support
/* variables to be used for derivatives FILE *f */
char *tmp_fname_noext, *tmp_fname_trim, *tmp_fname_ext, *tmpresult;
+ vlc_value_t fuzzy;
int len, i, j, i_sub_count;
subfn *result; /* unsorted results */
char **result2; /* sorted results */
strcpy_strip_ext( f_fname_noext, f_fname );
strcpy_trim( f_fname_trim, f_fname_noext );
-
+ var_Get( p_this, "sub-autodetect-fuzzy", &fuzzy );
+
+
for( j = 0; j <= 1; j++)
{
d = opendir( j == 0 ? f_dir : psz_path );
/* doesn't contain the movie name */
if( j == 0 ) i_prio = 1;
}
-
- if( i_prio >= SUB_FUZZY )
+
+ 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 );
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.h,v 1.94 2003/10/08 19:40:42 gbazin Exp $
+ * $Id: libvlc.h,v 1.95 2003/10/11 22:40:05 hartman Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
#define AUDIO_FILTER_TEXT N_("Audio filters")
#define AUDIO_FILTER_LONGTEXT N_( \
- "This allows you to add audio postprocessing filters, to modify" \
+ "This allows you to add audio postprocessing filters, to modify " \
"the sound.")
#define HEADPHONE_TEXT N_("Headphone virtual spatialization effect")
"Automatically detect a subtitle file, if no subtitle filename is " \
"specified."
+#define SUB_FUZZY_TEXT N_("Subtitle autodection fuzziness")
+#define SUB_FUZZY_LONGTEXT \
+ "This determines how fuzzy subtitle and movie filenaming matching " \
+ "will be. Options are:\n" \
+ "0 = no subtitles autodetected\n" \
+ "1 = any subtitle file\n" \
+ "2 = any subtitle file containing the movie name\n" \
+ "3 = subtitle file matching the movie name with additional chars\n" \
+ "4 = subtitle file matching the movie name exactly"
+
#define SUB_FILE_TEXT N_("Use subtitle file")
#define SUB_FILE_LONGTEXT \
"Load this subtitle file. To be used when autodetect cannot detect " \
INPUT_SUBT_TEXT, INPUT_SUBT_LONGTEXT, VLC_TRUE );
add_bool( "sub-autodetect-file", VLC_TRUE, NULL,
SUB_AUTO_TEXT, SUB_AUTO_LONGTEXT, VLC_FALSE );
+ add_integer( "sub-autodetect-fuzzy", 3, NULL,
+ SUB_FUZZY_TEXT, SUB_FUZZY_LONGTEXT, VLC_TRUE );
add_file( "sub-file", NULL, NULL,
SUB_FILE_TEXT, SUB_FILE_LONGTEXT, VLC_TRUE );