]> git.sesse.net Git - vlc/commitdiff
Lua: new function vlc.input.add_subtitle
authorJean-Philippe André <jpeg@endymion.via.ecp.fr>
Wed, 11 Nov 2009 18:57:13 +0000 (19:57 +0100)
committerJean-Philippe André <jpeg@endymion.via.ecp.fr>
Wed, 11 Nov 2009 20:41:19 +0000 (21:41 +0100)
Load a subtitles stream given its URI

modules/misc/lua/libs/input.c

index fee0146eebba3e53da22b9bbb502072978aca442..0c2e3de64b8a4a59882d88224b66ff8cc2212dfb 100644 (file)
@@ -137,6 +137,19 @@ static int vlclua_input_stats( lua_State *L )
     return 1;
 }
 
+static int vlclua_input_add_subtitle( lua_State *L )
+{
+    input_thread_t *p_input = vlclua_get_input_internal( L );
+    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: (url)" );
+    const char *psz_url = luaL_checkstring( L, 1 );
+    input_AddSubtitle( p_input, psz_url, false );
+    vlc_object_release( p_input );
+    return 1;
+}
+
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -145,6 +158,7 @@ static const luaL_Reg vlclua_input_reg[] = {
     { "is_playing", vlclua_is_playing },
     { "get_title", vlclua_get_title },
     { "stats", vlclua_input_stats },
+    { "add_subtitle", vlclua_input_add_subtitle },
     { NULL, NULL }
 };