[vlc-commits] Extensions: support embbeded icon data

Jean-Philippe André git at videolan.org
Sat Jan 22 00:56:47 CET 2011


vlc | branch: master | Jean-Philippe André <jpeg at videolan.org> | Wed Jan 19 00:24:39 2011 +0100| [cdcd09f9f1993e796d46e53202b5d0129ffe3acb] | committer: Jean-Philippe André

Extensions: support embbeded icon data

In Lua files, embed an image file (PNG, ...) in a string.

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

 include/vlc_extensions.h     |    2 ++
 modules/misc/lua/extension.c |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/vlc_extensions.h b/include/vlc_extensions.h
index 89fb714..95068b6 100644
--- a/include/vlc_extensions.h
+++ b/include/vlc_extensions.h
@@ -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;
diff --git a/modules/misc/lua/extension.c b/modules/misc/lua/extension.c
index bb03d26..f2a3261 100644
--- a/modules/misc/lua/extension.c
+++ b/modules/misc/lua/extension.c
@@ -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
         {



More information about the vlc-commits mailing list