[vlc-devel] [PATCH 8/9] lua: sd: Remove sd media browsing
Thomas Guillem
thomas at gllm.fr
Mon Mar 4 14:17:58 CET 2019
On Mon, Mar 4, 2019, at 12:34, Rémi Denis-Courmont wrote:
> Nack. This feature is the only sane way to debug SD in a clean runtime environment at the moment. Qt definitely is not.
There is an other way to debug SD, using the libvlc media discoverer test.
You can get a list of all SD modules:
$ ./test_libvlc_media_discoverer
testapi: == getting list of media_discoverer for 0 category ==
testapi: = discoverer: name: 'v4l', longname: 'Video capture' =
testapi: = discoverer: name: 'disc', longname: 'Discs' =
testapi: = discoverer: name: 'xcb_apps', longname: 'Screen capture' =
testapi: = discoverer: name: 'mtp', longname: 'MTP devices' =
testapi: = discoverer: name: 'pulse', longname: 'Audio capture' =
testapi: == getting list of media_discoverer for 1 category ==
testapi: = discoverer: name: 'avahi', longname: 'Zeroconf network services' =
testapi: = discoverer: name: 'microdns', longname: 'mDNS Network Discovery' =
testapi: = discoverer: name: 'upnp', longname: 'Universal Plug'n'Play' =
testapi: = discoverer: name: 'sap', longname: 'Network streams (SAP)' =
testapi: == getting list of media_discoverer for 2 category ==
testapi: = discoverer: name: 'podcast', longname: 'Podcasts' =
testapi: == getting list of media_discoverer for 3 category ==
testapi: = discoverer: name: 'video_dir', longname: 'My Videos' =
testapi: = discoverer: name: 'audio_dir', longname: 'My Music' =
testapi: = discoverer: name: 'picture_dir', longname: 'My Pictures' =
And also run discovery modules by their names.
$ ./test_libvlc_media_discoverer microdns
testapi: creating and starting discoverer microdns
testapi: Press any keys to stop
testapi: item added(0): 'sftp://192.168.1.35:22'
testapi: item added(1): 'smb://192.168.1.115:445'
testapi: item added(2): 'smb://192.168.1.61:445'
testapi: item added(3): 'smb://192.168.1.146:445'
testapi: item added(4): 'smb://192.168.1.213:445'
testapi: item added(5): 'rtsp://169.254.224.172:554'
We could use your reasoning from the "libvlc: dump object types abd names when leaking" discussion.
> ...
> 2) This pokes into the internals and ossifies the implementation. And the developer most likely to have to fight with this upon future refactoring is me or my successor. You're optimising for your convenience at the expense of somebody else here.
>
> And in all likelihood, it takes no more code to script this within a memory debugger than this patch.
(replace script with libvlc sample code that is already written in tests)
I think that the service discovery API should be hidden (and use vlc_media_tree/source API instead). This is the only remaining code that will use it after the big switch to player/playlist/media_source.
>
> Le 4 mars 2019 12:53:28 GMT+02:00, Romain Vimont <rom1v at videolabs.io> a écrit :
>> Services discovery media were displayed via the old playlist, which
>> allowed to display their tree.
>>
>> The new playlist is not a tree, but a list, so it can't be used to
>> display services discovery trees. This lua API is only used from
>> cli.lua, and we consider it's not worth it to implement this feature for
>> now, so just remove it. modules/lua/extension.c | 1 -
>> modules/lua/intf.c | 1 -
>> modules/lua/libs/sd.c | 57 -----------------------------------------
>> share/lua/intf/cli.lua | 23 -----------------
>> 4 files changed, 82 deletions(-)
>>
>> diff --git a/modules/lua/extension.c b/modules/lua/extension.c
>> index 475bd06767..ba25d432a8 100644
>> --- a/modules/lua/extension.c
>> +++ b/modules/lua/extension.c
>> @@ -840,7 +840,6 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr,
>> luaopen_object( L );
>> luaopen_osd( L );
>> luaopen_playlist( L );
>> - luaopen_sd_intf( L );
>> luaopen_stream( L );
>> luaopen_strings( L );
>> luaopen_variables( L );
>> diff --git a/modules/lua/intf.c b/modules/lua/intf.c
>> index cd906b4591..63c902bf21 100644
>> --- a/modules/lua/intf.c
>> +++ b/modules/lua/intf.c
>> @@ -274,7 +274,6 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name )
>> luaopen_object( L );
>> luaopen_osd( L );
>> luaopen_playlist( L );
>> - luaopen_sd_intf( L );
>> luaopen_stream( L );
>> luaopen_strings( L );
>> luaopen_variables( L );
>> diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
>> index a35091154d..d0dc85d6c2 100644
>> --- a/modules/lua/libs/sd.c
>> +++ b/modules/lua/libs/sd.c
>> @@ -398,60 +398,3 @@ void luaopen_sd_sd( lua_State *L )
>> luaL_register( L, NULL, vlclua_sd_sd_reg );
>> lua_setfield( L, -2, "sd" );
>> }
>> -
>> -
>> -/*** SD management (for user interfaces) ***/
>> -
>> -static int vlclua_sd_get_services_names( lua_State *L )
>> -{
>> - playlist_t *p_playlist = vlclua_get_playlist_internal( L );
>> - char **ppsz_longnames;
>> - char **ppsz_names = vlc_sd_GetNames( p_playlist, &ppsz_longnames, NULL );
>> - if( !ppsz_names )
>> - return 0;
>> -
>> - char **ppsz_longname = ppsz_longnames;
>> - char **ppsz_name = ppsz_names;
>> - lua_settop( L, 0 );
>> - lua_newtable( L );
>> - for( ; *ppsz_name; ppsz_name++,ppsz_longname++ )
>> - {
>> - lua_pushstring( L, *ppsz_longname );
>> - lua_setfield( L, -2, *ppsz_name );
>> - free( *ppsz_name );
>> - free( *ppsz_longname );
>> - }
>> - free( ppsz_names );
>> - free( ppsz_longnames );
>> - return 1;
>> -}
>> -
>> -static int vlclua_sd_add( lua_State *L )
>> -{
>> - const char *psz_sd = luaL_checkstring( L, 1 );
>> - playlist_t *p_playlist = vlclua_get_playlist_internal( L );
>> - int i_ret = playlist_ServicesDiscoveryAdd( p_playlist, psz_sd );
>> - return vlclua_push_ret( L, i_ret );
>> -}
>> -
>> -static int vlclua_sd_remove( lua_State *L )
>> -{
>> - const char *psz_sd = luaL_checkstring( L, 1 );
>> - playlist_t *p_playlist = vlclua_get_playlist_internal( L );
>> - int i_ret = playlist_ServicesDiscoveryRemove( p_playlist, psz_sd );
>> - return vlclua_push_ret( L, i_ret );
>> -}
>> -
>> -static const luaL_Reg vlclua_sd_intf_reg[] = {
>> - { "get_services_names", vlclua_sd_get_services_names },
>> - { "add", vlclua_sd_add },
>> - { "remove", vlclua_sd_remove },
>> - { NULL, NULL }
>> -};
>> -
>> -void luaopen_sd_intf( lua_State *L )
>> -{
>> - lua_newtable( L );
>> - luaL_register( L, NULL, vlclua_sd_intf_reg );
>> - lua_setfield( L, -2, "sd" );
>> -}
>> diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
>> index 58501d10d5..02c6967abb 100644
>> --- a/share/lua/intf/cli.lua
>> +++ b/share/lua/intf/cli.lua
>> @@ -250,26 +250,6 @@ function playlist_sort(name,client,arg)
>> end
>> end
>>
>> -function sd_add(name,client,arg)
>> - vlc.sd.add(arg)
>> - client:append(arg.." enabled.")
>> -end
>> -
>> -function sd_remove(name,client,arg)
>> - vlc.sd.remove(arg)
>> - client:append(arg.." disabled.")
>> -end
>> -
>> -function services_discovery(name,client,arg)
>> - local sd = vlc.sd.get_services_names()
>> - client:append("+----[ Services discovery ]")
>> - for n,ln in pairs(sd) do
>> - client:append("| "..n..": " .. ln)
>> - end
>> - client:append("+----[ End of services discovery ]")
>> - client:append("Enabled services discovery sources appear in the playlist.")
>> -end
>> -
>> function load_vlm(name, client, value)
>> if vlm == nil then
>> vlm = vlc.vlm()
>> @@ -585,9 +565,6 @@ commands_ordered = {
>> { "delete"; { func = skip2(vlc.playlist.delete); args = "[X]"; help = "delete item X in playlist" } };
>> { "move"; { func = move; args = "[X][Y]"; help = "move item X in playlist after Y" } };
>> { "sort"; { func = playlist_sort; args = "key"; help = "sort the playlist" } };
>> - { "sd"; { func = services_discovery; args = "[sd]"; help = "show services discovery or toggle" } };
>> - { "sd_add"; { func = sd_add; args = "sd"; help = "add services discovery" } };
>> - { "sd_remove"; { func = sd_remove; args = "sd"; help = "remove services discovery" } };
>> { "play"; { func = skip2(vlc.playlist.play); help = "play stream" } };
>> { "stop"; { func = skip2(vlc.playlist.stop); help = "stop stream" } };
>> { "next"; { func = skip2(vlc.playlist.next); help = "next playlist item" } };
>
> --
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190304/f8b27eed/attachment.html>
More information about the vlc-devel
mailing list