[vlc-commits] luasd: set description field by directly calling script descriptor

Pierre Ynard git at videolan.org
Wed Nov 16 08:43:41 CET 2016


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Wed Nov 16 08:37:43 2016 +0100| [189bbeab68f70283985454cce4a7d227bcc7fc36] | committer: Pierre Ynard

luasd: set description field by directly calling script descriptor

Instead of expecting the longname to be passed in the config chain and
parsing it from there

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

 modules/lua/services_discovery.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/modules/lua/services_discovery.c b/modules/lua/services_discovery.c
index 51d9d9f..e86ef4c 100644
--- a/modules/lua/services_discovery.c
+++ b/modules/lua/services_discovery.c
@@ -118,15 +118,6 @@ int Open_LuaSD( vlc_object_t *p_this )
         psz_name = strdup(p_sd->psz_name);
     }
 
-    p_sd->description = p_sd->psz_name;
-
-    for( const config_chain_t *cc = p_sd->p_cfg; cc != NULL; cc = cc->p_next )
-        if( strcmp( cc->psz_name, "longname" ) == 0 )
-        {
-            p_sd->description = cc->psz_value;
-            break;
-        }
-
     if( !( p_sys = malloc( sizeof( services_discovery_sys_t ) ) ) )
     {
         free( psz_name );
@@ -176,6 +167,12 @@ int Open_LuaSD( vlc_object_t *p_this )
         lua_pop( L, 1 );
         goto error;
     }
+
+    // No strdup(), just don't remove the string from the lua stack
+    p_sd->description = vlclua_sd_description( p_sd, L, p_sys->psz_filename );
+    if( p_sd->description == NULL )
+        p_sd->description = p_sd->psz_name;
+
     p_sys->L = L;
     vlc_mutex_init( &p_sys->lock );
     vlc_cond_init( &p_sys->cond );



More information about the vlc-commits mailing list