[vlc-devel] [PATCH] lua: renderers: Allow module name to be omitted
Rémi Denis-Courmont
remi at remlab.net
Mon Jun 29 15:48:58 CEST 2020
Le maanantaina 29. kesäkuuta 2020, 12.54.12 EEST Hugo Beauzée-Luyssen a écrit
:
> ---
> modules/lua/libs/renderers.c | 32 ++++++++++++++++++++++++++++++--
> 1 file changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/modules/lua/libs/renderers.c b/modules/lua/libs/renderers.c
> index 822b7ad237..3e132a95a8 100644
> --- a/modules/lua/libs/renderers.c
> +++ b/modules/lua/libs/renderers.c
> @@ -179,11 +179,39 @@ static int vlclua_rd_create( lua_State* L )
> vlc_vector_init( &sys->items );
> vlc_mutex_init( &sys->mutex );
> sys->last_renderer_id = 0;
> + sys->rd = NULL;
>
> vlc_object_t *this = vlclua_get_this( L );
> - const char* name = luaL_checkstring( L, 1 );
> + const char* name = lua_tostring( L, 1 );
> +
> + if ( name )
> + {
> + sys->rd = vlc_rd_new( this, name, &sys->owner );
> + }
> + else
> + {
> + char** names;
> + char** longnames;
> + if ( vlc_rd_get_names( this, &names, &longnames ) != VLC_SUCCESS )
> + {
> + vlc_vector_destroy( &sys->items );
> + return 0;
> + }
> + int i = 0;
> + while ( sys->rd == NULL && names[i] != NULL )
> + {
> + sys->rd = vlc_rd_new( this, names[i], &sys->owner );
> + ++i;
> + }
> + for ( i = 0; names[i] != NULL; ++i )
> + {
> + free( names[i] );
> + free( longnames[i] );
> + }
> + free( longnames );
> + free( names );
> + }
If there are more than one renderer, that gives you whatever.
I can't grasp in what usage scenario this would be intended.
>
> - sys->rd = vlc_rd_new( this, name, &sys->owner );
> if ( !sys->rd )
> {
> vlc_vector_destroy( &sys->items );
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list