[vlc-devel] commit: Lua: new function vlc.input.add_subtitle ( Jean-Philippe André )

git version control git at videolan.org
Wed Nov 11 21:47:26 CET 2009


vlc | branch: master | Jean-Philippe André <jpeg at endymion.via.ecp.fr> | Wed Nov 11 19:57:13 2009 +0100| [16d88109d4e93a2ed8739ff2a2d59be2e7fedfc2] | committer: Jean-Philippe André 

Lua: new function vlc.input.add_subtitle

Load a subtitles stream given its URI

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

 modules/misc/lua/libs/input.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/modules/misc/lua/libs/input.c b/modules/misc/lua/libs/input.c
index fee0146..0c2e3de 100644
--- a/modules/misc/lua/libs/input.c
+++ b/modules/misc/lua/libs/input.c
@@ -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 }
 };
 




More information about the vlc-devel mailing list