[vlc-devel] [PATCH 2/2] lua/libs/input: add URL property to metadata

Filip Roséen filip at atch.se
Sun Nov 6 16:38:05 CET 2016


It is very common to be interested in not only the filename of a
certain entity, but also the location where it resides.

These changes adds "URL" as a property to the metadata-table,
containing what the name implies.
---
 modules/lua/libs/input.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/lua/libs/input.c b/modules/lua/libs/input.c
index 1887676..5fa7430 100644
--- a/modules/lua/libs/input.c
+++ b/modules/lua/libs/input.c
@@ -119,6 +119,9 @@ static int vlclua_input_metas_internal( lua_State *L, input_item_t *p_item )
     char* psz_uri = input_item_GetURI( p_item );
     char* psz_filename = psz_uri ? strrchr( psz_uri, '/' ) : NULL;
 
+    lua_pushstring( L, psz_uri );
+    lua_setfield( L, -2, "URL" );
+
     if( psz_filename && psz_filename[1] == '\0' )
     {
         psz_filename[0] = '\0';
-- 
2.10.2



More information about the vlc-devel mailing list