Commit 16d88109 authored by Jean-Philippe André's avatar Jean-Philippe André

Lua: new function vlc.input.add_subtitle

Load a subtitles stream given its URI
parent 72be12b3
...@@ -137,6 +137,19 @@ static int vlclua_input_stats( lua_State *L ) ...@@ -137,6 +137,19 @@ static int vlclua_input_stats( lua_State *L )
return 1; 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[] = { ...@@ -145,6 +158,7 @@ static const luaL_Reg vlclua_input_reg[] = {
{ "is_playing", vlclua_is_playing }, { "is_playing", vlclua_is_playing },
{ "get_title", vlclua_get_title }, { "get_title", vlclua_get_title },
{ "stats", vlclua_input_stats }, { "stats", vlclua_input_stats },
{ "add_subtitle", vlclua_input_add_subtitle },
{ NULL, NULL } { NULL, NULL }
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment