[vlc-devel] [PATCH 3/5] input: only check for idx files when subtitles come from the user

Thomas Guillem thomas at gllm.fr
Sat Feb 13 18:43:47 CET 2016


---
 src/input/input.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index ae3683d..2f8088e 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -103,7 +103,7 @@ enum {
 };
 
 static void input_SubtitleAdd( input_thread_t *, const char *, unsigned );
-static void input_SubtitleFileAdd( input_thread_t *, const char *, unsigned );
+static void input_SubtitleFileAdd( input_thread_t *, const char *, unsigned, bool );
 static void input_ChangeState( input_thread_t *p_input, int i_state ); /* TODO fix name */
 
 #undef input_Create
@@ -946,7 +946,7 @@ static void LoadSubtitles( input_thread_t *p_input )
     if( psz_subtitle != NULL )
     {
         msg_Dbg( p_input, "forced subtitle: %s", psz_subtitle );
-        input_SubtitleFileAdd( p_input, psz_subtitle, i_flags );
+        input_SubtitleFileAdd( p_input, psz_subtitle, i_flags, true );
         i_flags = SUB_NOFLAG;
     }
 
@@ -962,7 +962,7 @@ static void LoadSubtitles( input_thread_t *p_input )
             if( !psz_subtitle || strcmp( psz_subtitle, ppsz_subs[i] ) )
             {
                 i_flags |= SUB_CANFAIL;
-                input_SubtitleFileAdd( p_input, ppsz_subs[i], i_flags );
+                input_SubtitleFileAdd( p_input, ppsz_subs[i], i_flags, false );
                 i_flags = SUB_NOFLAG;
             }
 
@@ -1868,7 +1868,7 @@ static bool Control( input_thread_t *p_input,
 
         case INPUT_CONTROL_ADD_SUBTITLE:
             if( val.psz_string )
-                input_SubtitleFileAdd( p_input, val.psz_string, SUB_FORCED );
+                input_SubtitleFileAdd( p_input, val.psz_string, SUB_FORCED, true );
             break;
 
         case INPUT_CONTROL_ADD_SLAVE:
@@ -2812,12 +2812,13 @@ static void input_SubtitleAdd( input_thread_t *p_input,
 }
 
 static void input_SubtitleFileAdd( input_thread_t *p_input,
-                                   const char *psz_subtitle, unsigned i_flags )
+                                   const char *psz_subtitle, unsigned i_flags,
+                                   bool b_check_idx )
 {
     /* if we are provided a subtitle.sub file,
      * see if we don't have a subtitle.idx and use it instead */
     char *psz_idxpath = NULL;
-    char *psz_extension = strrchr( psz_subtitle, '.');
+    char *psz_extension = b_check_idx ? strrchr( psz_subtitle, '.') : NULL;
     if( psz_extension && strcmp( psz_extension, ".sub" ) == 0 )
     {
         psz_idxpath = strdup( psz_subtitle );
-- 
2.7.0



More information about the vlc-devel mailing list