vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Tue Apr 18 23:25:52 2017 +0300| [4d20314357f91f7f433ef460ba610ccb51ea101e] | committer: Rémi Denis-Courmont
lua: remove no longer used arguments and return value > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4d20314357f91f7f433ef460ba610ccb51ea101e --- modules/lua/demux.c | 2 +- modules/lua/vlc.c | 58 ++++++++++++++++++++--------------------------------- modules/lua/vlc.h | 6 +++--- 3 files changed, 26 insertions(+), 40 deletions(-) diff --git a/modules/lua/demux.c b/modules/lua/demux.c index acf3509620..38fee11a43 100644 --- a/modules/lua/demux.c +++ b/modules/lua/demux.c @@ -268,7 +268,7 @@ static int Demux( demux_t *p_demux ) } if( lua_gettop( L ) ) - vlclua_playlist_add_internal( p_demux, L, NULL, p_current_input, 0 ); + vlclua_playlist_add_internal( p_demux, L, p_current_input ); else msg_Err( p_demux, "Script went completely foobar" ); diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c index db3bb4afa6..ed95ac039b 100644 --- a/modules/lua/vlc.c +++ b/modules/lua/vlc.c @@ -544,25 +544,19 @@ out: } #undef vlclua_playlist_add_internal -int vlclua_playlist_add_internal(vlc_object_t *obj, lua_State *L, - playlist_t *playlist, input_item_t *parent, - bool play) +void vlclua_playlist_add_internal(vlc_object_t *obj, lua_State *L, + input_item_t *parent) { - int count = 0; - - assert(parent != NULL || playlist != NULL); + bool post = false; /* playlist */ if (!lua_istable(L, -1)) { msg_Warn(obj, "Playlist should be a table."); - return 0; + return; } - input_item_node_t *node = NULL; - - if (parent != NULL) - node = input_item_node_Create(parent); + input_item_node_t *node = input_item_node_Create(parent); lua_pushnil(L); @@ -572,49 +566,41 @@ int vlclua_playlist_add_internal(vlc_object_t *obj, lua_State *L, input_item_t *item = vlclua_read_input_item(obj, L); if (item != NULL) { - /* Append item to playlist */ - if (node != NULL) /* Add to node */ + /* copy the original URL to the meta data, + * if "URL" is still empty */ + char *url = input_item_GetURL(item); + if (url == NULL) { - /* copy the original URL to the meta data, - * if "URL" is still empty */ - char *url = input_item_GetURL(item); - if (url == NULL) + url = input_item_GetURI(parent); + if (likely(url != NULL)) { - url = input_item_GetURI(parent); - if (likely(url != NULL)) - { - EnsureUTF8(url); - msg_Dbg(obj, "meta-URL: %s", url); - input_item_SetURL(item, url); - } + EnsureUTF8(url); + msg_Dbg(obj, "meta-URL: %s", url); + input_item_SetURL(item, url); } - free(url); + } + free(url); - input_item_CopyOptions(item, parent); + input_item_CopyOptions(item, parent); + + if (likely(node != NULL)) /* Add to node */ input_item_node_AppendItem(node, item); - } - else if (likely(parent == NULL)) - /* Play or Enqueue (preparse) */ - /* FIXME: playlist_AddInput() can fail */ - playlist_AddInput(playlist, item, play ? PLAYLIST_GO : 0, - true); input_item_Release(item); - count++; + post = true; } /* pop the value, keep the key for the next lua_next() call */ lua_pop(L, 1); } /* playlist */ - if (node != NULL) + if (likely(node != NULL)) { - if (count > 0) + if (post) input_item_node_PostAndDelete(node); else input_item_node_Delete(node); } - return count; } static int vlc_sd_probe_Open( vlc_object_t *obj ) diff --git a/modules/lua/vlc.h b/modules/lua/vlc.h index 972b35f1da..7b979cd4f1 100644 --- a/modules/lua/vlc.h +++ b/modules/lua/vlc.h @@ -182,9 +182,9 @@ void vlclua_read_custom_meta_data( vlc_object_t *, lua_State *, #define vlclua_read_custom_meta_data( a, b, c ) vlclua_read_custom_meta_data( VLC_OBJECT( a ), b, c ) input_item_t *vlclua_read_input_item(vlc_object_t *, lua_State *); -int vlclua_playlist_add_internal( vlc_object_t *, lua_State *, playlist_t *, - input_item_t *, bool ); -#define vlclua_playlist_add_internal( a, b, c, d, e ) vlclua_playlist_add_internal( VLC_OBJECT( a ), b, c, d, e ) +void vlclua_playlist_add_internal(vlc_object_t *, lua_State *, input_item_t *); +#define vlclua_playlist_add_internal( a, b, c ) \ + vlclua_playlist_add_internal( VLC_OBJECT( a ), b, c ) int vlclua_add_modules_path( lua_State *, const char *psz_filename ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
