[vlc-devel] [PATCH] lua: Expose media tracks through lua bindings

Pierre Ynard linkfanel at yahoo.fr
Sun Jan 1 02:49:28 CET 2017


Happy New Year,

Can you explain what the purpose of and use cases for this new API are,
how it is not redundant with vlclua_input_item_info(), etc...? Also
please patch the API documentation too.

> +    for ( int i = 0; i < p_item->i_es; ++i )
> +    {

> +        lua_rawseti( L, -2, i );
> +    }

I think lua table are indexed starting from 1 instead of 0?...

What's the reason for the choice of exposed fields? Limited
implementation, avoiding bloat...? Does the ES ID really need to be
exposed to lua scripts?

> +void luaopen_input_constants( lua_State *L )
> +{
> +    lua_newtable(L);
> +    lua_pushinteger( L, VIDEO_ES );
> +    lua_setfield( L, -2, "video" );
> +    lua_pushinteger( L, AUDIO_ES );
> +    lua_setfield( L, -2, "audio" );
> +    lua_pushinteger( L, SPU_ES );
> +    lua_setfield( L, -2, "spu" );
> +    lua_pushinteger( L, UNKNOWN_ES );
> +    lua_setfield( L, -2, "unknown" );
> +    lua_setfield( L, -2, "tracks" );
> +}

That looks over-complicated, bloats the variable namespace, and the
lua code I can imagine to use it looks kinda awkward. I think it would
probably be better to expose the type as a string field in the track
table, or maybe split the tracks into groups indexed by type, or
something else.

-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list