[vlc-devel] [PATCHv2 08/13] input/input: simplify LoadSubtitles flags use

Thomas Guillem thomas at gllm.fr
Tue May 3 19:02:35 CEST 2016


---
 src/input/input.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 5d1b379..9910ec3 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1029,14 +1029,12 @@ static void LoadSubtitles( input_thread_t *p_input )
         var_SetInteger( p_input, "spu-delay", (mtime_t)i_delay * 100000 );
 
     /* Look for and add subtitle files */
-    unsigned i_flags = SUB_FORCED;
 
     char *psz_subtitle = var_GetNonEmptyString( p_input, "sub-file" );
     if( psz_subtitle != NULL )
     {
         msg_Dbg( p_input, "forced subtitle: %s", psz_subtitle );
-        input_SubtitleFileAdd( p_input, psz_subtitle, i_flags, true );
-        i_flags = SUB_NOFLAG;
+        input_SubtitleFileAdd( p_input, psz_subtitle, SUB_FORCED, true );
     }
 
     if( var_GetBool( p_input, "sub-autodetect-file" ) )
@@ -1071,9 +1069,7 @@ static void LoadSubtitles( input_thread_t *p_input )
         for( int i = 0; i < i_slaves && pp_slaves[i] != NULL; i++ )
         {
             const char *psz_uri = pp_slaves[i]->psz_uri;
-            i_flags |= SUB_CANFAIL;
-            input_SubtitleAdd( p_input, psz_uri, i_flags );
-            i_flags = SUB_NOFLAG;
+            input_SubtitleAdd( p_input, psz_uri, SUB_CANFAIL );
 
             input_item_slave_Delete( pp_slaves[i] );
         }
@@ -1110,9 +1106,8 @@ static void LoadSubtitles( input_thread_t *p_input )
         {
             var_SetString( p_input, "sub-description", a->psz_description ? a->psz_description : "");
 
-            input_SubtitleAdd( p_input, psz_mrl, i_flags );
+            input_SubtitleAdd( p_input, psz_mrl, SUB_NOFLAG );
 
-            i_flags = SUB_NOFLAG;
             free( psz_mrl );
         }
         vlc_input_attachment_Delete( a );
-- 
2.8.0.rc3



More information about the vlc-devel mailing list