[vlc-devel] [PATCH 1/2] Remember the original URL of an item to its meta-url
Mario Speiß
1034-135 at online.de
Sun Jan 6 17:52:17 CET 2013
Memory leakage removed (hopefully).
Regards,
Mario
---
modules/lua/vlc.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index 0c43e07..89269e1
--- a/modules/lua/vlc.c
+++ b/modules/lua/vlc.c
@@ -486,6 +486,7 @@ int vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
/* playlist key item path */
if( lua_isstring( L, -1 ) )
{
+ const char *psz_oldurl = NULL;
const char *psz_path = NULL;
char *psz_u8path = NULL;
const char *psz_name = NULL;
@@ -495,6 +496,8 @@ int vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
input_item_t *p_input;
/* Read path and name */
+ psz_oldurl = input_item_GetURI( p_parent );
+ msg_Dbg( p_this, "old path: %s", psz_oldurl );
psz_path = lua_tostring( L, -1 );
msg_Dbg( p_this, "Path: %s", psz_path );
lua_getfield( L, -2, "name" );
@@ -542,6 +545,17 @@ int vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
/* Read meta data: item must be on top of stack */
vlclua_read_meta_data( p_this, L, p_input );
+ //copy the original URL to the meta data, if "URL" is still empty
+ char* url = input_item_GetURL( p_input );
+ if( url == NULL )
+ {
+ EnsureUTF8( psz_oldurl );
+ msg_Dbg( p_this, "meta-URL: %s", psz_oldurl );
+ input_item_SetURL ( p_input, psz_oldurl );
+ }
+ free( url );
+ free( psz_oldurl );
+
/* Read custom meta data: item must be on top of stack*/
vlclua_read_custom_meta_data( p_this, L, p_input );
--
1.7.5.4
More information about the vlc-devel
mailing list