[vlc-devel] commit: lua: Expose extra meta through vlc.item.metas. (Pierre d'Herbemont )
git version control
git at videolan.org
Fri Jan 15 16:40:23 CET 2010
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Wed Jan 13 12:55:43 2010 +0100| [d9322881a7873940b0bb6cd3d963b0a445ca906e] | committer: Pierre d'Herbemont
lua: Expose extra meta through vlc.item.metas.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d9322881a7873940b0bb6cd3d963b0a445ca906e
---
modules/misc/lua/libs/input.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/modules/misc/lua/libs/input.c b/modules/misc/lua/libs/input.c
index 87dd668..2530355 100644
--- a/modules/misc/lua/libs/input.c
+++ b/modules/misc/lua/libs/input.c
@@ -124,7 +124,7 @@ static int vlclua_input_metas_internal( lua_State *L, input_item_t *p_item )
lua_pushstring( L, psz_meta );
lua_setfield( L, -2, "filename" );
free( psz_meta );
-
+
#define PUSH_META( n, m ) \
psz_meta = input_item_GetMeta( p_item, vlc_meta_ ## n ); \
lua_pushstring( L, psz_meta ); \
@@ -151,6 +151,21 @@ static int vlclua_input_metas_internal( lua_State *L, input_item_t *p_item )
#undef PUSH_META
+ vlc_mutex_lock(&p_item->lock);
+ if (p_item->p_meta) {
+ char ** names = vlc_meta_CopyExtraNames(p_item->p_meta);
+ for(int i = 0; names[i]; i++)
+ {
+ const char *meta = vlc_meta_GetExtra(p_item->p_meta, names[i]);
+ lua_pushstring( L, meta );
+ lua_setfield( L, -2, names[i] );
+ printf("setting %s=%s\n", names[i], meta);
+ free(names[i]);
+ }
+ free(names);
+ }
+ vlc_mutex_unlock(&p_item->lock);
+
return 1;
}
@@ -261,7 +276,7 @@ static int vlclua_input_item_get( lua_State *L, input_item_t *p_item )
}
lua_setmetatable(L, -2);
-
+
return 1;
}
More information about the vlc-devel
mailing list