Commit cdcd09f9 authored by Jean-Philippe André's avatar Jean-Philippe André

Extensions: support embbeded icon data

In Lua files, embed an image file (PNG, ...) in a string.
parent b4269ba7
...@@ -43,6 +43,8 @@ typedef struct extension_t { ...@@ -43,6 +43,8 @@ typedef struct extension_t {
char *psz_url; /**< A URL to the official page (ro) */ char *psz_url; /**< A URL to the official page (ro) */
char *psz_description; /**< Full description (ro) */ char *psz_description; /**< Full description (ro) */
char *psz_shortdescription; /**< Short description (eg. 1 line) (ro) */ char *psz_shortdescription; /**< Short description (eg. 1 line) (ro) */
char *p_icondata; /**< Embedded data for the icon (ro) */
int i_icondata_size; /**< Size of that data */
extension_sys_t *p_sys; /**< Reserved for the manager module */ extension_sys_t *p_sys; /**< Reserved for the manager module */
} extension_t; } extension_t;
......
...@@ -357,6 +357,20 @@ int ScanLuaCallback( vlc_object_t *p_this, const char *psz_script, ...@@ -357,6 +357,20 @@ int ScanLuaCallback( vlc_object_t *p_this, const char *psz_script,
lua_getfield( L, -1, "version" ); lua_getfield( L, -1, "version" );
p_ext->psz_version = luaL_strdupornull( L, -1 ); p_ext->psz_version = luaL_strdupornull( L, -1 );
lua_pop( L, 1 ); lua_pop( L, 1 );
/* Get icon data */
lua_getfield( L, -1, "icon" );
if( !lua_isnil( L, -1 ) && lua_isstring( L, -1 ) )
{
int len = lua_strlen( L, -1 );
p_ext->p_icondata = malloc( len );
if( p_ext->p_icondata )
{
p_ext->i_icondata_size = len;
memcpy( p_ext->p_icondata, lua_tostring( L, -1 ), len );
}
}
lua_pop( L, 1 );
} }
else else
{ {
......
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