[vlc-devel] [RFC PATCH 1/2] core: add vlc_player_t (input manager)

Steve Lhomme robux4 at ycbcr.xyz
Mon Sep 17 11:00:41 CEST 2018


On 17/09/2018 09:11, Thomas Guillem wrote:
>
> On Mon, Sep 17, 2018, at 08:41, Thomas Guillem wrote:
>> On Fri, Sep 14, 2018, at 15:32, Rémi Denis-Courmont wrote:
>>> Le jeudi 6 septembre 2018, 14:11:31 EEST Thomas Guillem a écrit :
>>>> ---
>>>> +
>>>> +/**
>>>> + * Get the started state.
>>>> + *
>>>> + * @param player locked player instance
>>>> + * @return true if the player is started (vlc_player_Start() succeeded and
>>>> + * vlc_player_cbs.on_playback_event didn't send a stopped/dead event).
>>>> + */
>>>> +VLC_API bool
>>>> +vlc_player_IsStarted(vlc_player_t *player);
>>> const? Ditto following functions.
>> Yes.
> Hum, I remember why I didn't put const:
>
> ../../src/input/player.c:158:23: warning: passing argument 1 of ‘vlc_assert_locked’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
>       vlc_assert_locked(&player->lock);
>
> 2 choices: Assert locks or const when possible ?

As Romain said, it's better not to put it in case the internal 
implementation changes. And anyway the current implementation is not 
correct with there's a const. So I wouldn't use it, even if from the 
outside reading the state of the player should not modify it.


More information about the vlc-devel mailing list