[vlc-devel] [PATCH] lua: renderers: Allow module name to be omitted
Rémi Denis-Courmont
remi at remlab.net
Mon Aug 10 10:44:00 CEST 2020
Hi,
Insanity in the GUI is not motivation for insanity in the API. As long as Chromecast was the only renderer, it didn't matter. That's VLC 3. We can't do it that way in 4.x, unless we drop UPnP.
Le 10 août 2020 10:37:39 GMT+03:00, "Hugo Beauzée-Luyssen" <hugo at beauzee.fr> a écrit :
>On Mon, Jun 29, 2020, at 3:48 PM, Rémi Denis-Courmont wrote:
>> 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 );
>>
>>
>
>Hi,
>
>This is mostly to be consistent with both Qt and macOS UIs. All
>renderer discovery modules have expose the same functionalities but
>they might expose slightly different names.
>Also, I'm not sure we should require a name in this API, but that's on
>me since I forgot to address it before pushing.
>
>--
> Hugo Beauzée-Luyssen
> hugo at beauzee.fr
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200810/471a215e/attachment.html>
More information about the vlc-devel
mailing list