[vlc-commits] lua: libs: input: Allow subtitles to be autoselected

Hugo Beauzée-Luyssen git at videolan.org
Thu Sep 21 17:49:44 CEST 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Sep 21 13:50:55 2017 +0200| [d46d275d257afd4db6990ae5999f6288175e44f1] | committer: Hugo Beauzée-Luyssen

lua: libs: input: Allow subtitles to be autoselected

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d46d275d257afd4db6990ae5999f6288175e44f1
---

 modules/lua/libs/input.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/lua/libs/input.c b/modules/lua/libs/input.c
index 6614397c50..150bcb9d61 100644
--- a/modules/lua/libs/input.c
+++ b/modules/lua/libs/input.c
@@ -227,15 +227,18 @@ static int vlclua_input_item_stats( lua_State *L )
 static int vlclua_input_add_subtitle( lua_State *L )
 {
     input_thread_t *p_input = vlclua_get_input_internal( L );
+    bool b_autoselect = false;
     if( !p_input )
         return luaL_error( L, "can't add subtitle: no current input" );
     if( !lua_isstring( L, 1 ) )
         return luaL_error( L, "vlc.input.add_subtitle() usage: (path)" );
+    if( lua_gettop( L ) >= 2 )
+        b_autoselect = lua_toboolean( L, 2 );
     const char *psz_path = luaL_checkstring( L, 1 );
     char* psz_mrl = vlc_path2uri( psz_path, NULL );
     if( psz_mrl )
     {
-        input_AddSlave( p_input, SLAVE_TYPE_SPU, psz_mrl, false, false );
+        input_AddSlave( p_input, SLAVE_TYPE_SPU, psz_mrl, b_autoselect, true );
         free( psz_mrl );
     }
     vlc_object_release( p_input );



More information about the vlc-commits mailing list