[vlc-devel] [PATCH 5/5] input: change "sub-file" option to "sub-url"

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


---
 modules/gui/qt4/components/open_panels.cpp |  2 +-
 src/input/input.c                          |  6 +++++-
 src/input/var.c                            |  1 +
 src/libvlc-module.c                        | 13 +++++++------
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index d62c20d..4589911 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -280,7 +280,7 @@ void FileOpenPanel::updateMRL()
 
     /* Options */
     if( ui.subGroupBox->isChecked() &&  !ui.subInput->text().isEmpty() ) {
-        mrl.append( " :sub-file=" + colon_escape( ui.subInput->text() ) );
+        mrl.append( " :sub-url=" + colon_escape( ui.subInput->text() ) );
     }
 
     emit methodChanged( "file-caching" );
diff --git a/src/input/input.c b/src/input/input.c
index bbc4fd7..78f3173 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -942,7 +942,10 @@ static void LoadSubtitles( input_thread_t *p_input )
     /* Look for and add subtitle files */
     unsigned i_flags = SUB_FORCED;
 
-    char *psz_subtitle = var_GetNonEmptyString( p_input, "sub-file" );
+    char *psz_subtitle = var_GetNonEmptyString( p_input, "sub-url" );
+    if( psz_subtitle == NULL )
+        psz_subtitle = var_GetNonEmptyString( p_input, "sub-file" );
+
     if( psz_subtitle != NULL )
     {
         msg_Dbg( p_input, "forced subtitle: %s", psz_subtitle );
@@ -1146,6 +1149,7 @@ static int Init( input_thread_t * p_input )
             var_SetString( p_input, "input-slave", "" );
             var_SetInteger( p_input, "input-repeat", 0 );
             var_SetString( p_input, "sub-file", "" );
+            var_SetString( p_input, "sub-url", "" );
             var_SetBool( p_input, "sub-autodetect-file", false );
         }
     }
diff --git a/src/input/var.c b/src/input/var.c
index 025a798..f3cdf17 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -433,6 +433,7 @@ void input_ConfigVarInit ( input_thread_t *p_input )
         var_Create( p_input, "sub-track-id",
                     VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
 
+        var_Create( p_input, "sub-url", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
         var_Create( p_input, "sub-file", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
         var_Create( p_input, "sub-autodetect-file", VLC_VAR_BOOL |
                     VLC_VAR_DOINHERIT );
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index c3e4a01..0d5bd6f 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -740,10 +740,10 @@ static const char *const ppsz_prefres[] = {
     "Look for a subtitle file in those paths too, if your subtitle " \
     "file was not found in the current directory.")
 
-#define SUB_FILE_TEXT N_("Use subtitle file")
-#define SUB_FILE_LONGTEXT N_( \
-    "Load this subtitle file. To be used when autodetect cannot detect " \
-    "your subtitle file.")
+#define SUB_URL_TEXT N_("Use subtitle url")
+#define SUB_URL_LONGTEXT N_( \
+    "Load this subtitle url. To be used when autodetect cannot detect " \
+    "your subtitle url.")
 
 /* DVD and VCD devices */
 #define DVD_DEV_TEXT N_("DVD device")
@@ -1623,8 +1623,9 @@ vlc_module_begin ()
                 TEXTRENDERER_LONGTEXT, true )
 
     set_section( N_("Subtitles") , NULL )
-    add_loadfile( "sub-file", NULL, SUB_FILE_TEXT,
-                  SUB_FILE_LONGTEXT, false )
+    add_obsolete_string( "sub-file" ) /* deprecated since 3.0.0 */
+    add_string( "sub-url", NULL, SUB_URL_TEXT,
+                  SUB_URL_LONGTEXT, false )
         change_safe()
     add_bool( "sub-autodetect-file", true,
                  SUB_AUTO_TEXT, SUB_AUTO_LONGTEXT, false )
-- 
2.7.0



More information about the vlc-devel mailing list