]> git.sesse.net Git - vlc/commitdiff
Extensions: support embbeded icon data
authorJean-Philippe André <jpeg@videolan.org>
Tue, 18 Jan 2011 23:24:39 +0000 (00:24 +0100)
committerJean-Philippe André <jpeg@videolan.org>
Fri, 21 Jan 2011 23:42:08 +0000 (00:42 +0100)
In Lua files, embed an image file (PNG, ...) in a string.

include/vlc_extensions.h
modules/misc/lua/extension.c

index 89fb71483f92cf3c1a58cdf5f715eb00bb79a45b..95068b6a1ef6ebfa6c46e4eac050c9a4cc4bb0bf 100644 (file)
@@ -43,6 +43,8 @@ typedef struct extension_t {
     char *psz_url;            /**< A URL to the official page (ro) */
     char *psz_description;    /**< Full description (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_t;
index bb03d266a2300146b8a36f9ede61310fae8442ef..f2a3261dbbe8e0ce2ce45bda1e5944faa30516b0 100644 (file)
@@ -357,6 +357,20 @@ int ScanLuaCallback( vlc_object_t *p_this, const char *psz_script,
             lua_getfield( L, -1, "version" );
             p_ext->psz_version = luaL_strdupornull( 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
         {