[vlc-devel] [PATCH] lib: player: add back disabled tracks

Thomas Guillem thomas at gllm.fr
Mon Jan 27 16:46:45 CET 2020


Finally,

I would like to apply this patch and deprecate the following functions for VLC 4.0

libvlc_video_set_track
libvlc_video_set_spu
libvlc_audio_set_track

The goal is to remove them for VLC 5.0.

And for VLC 4.0, add libvlc_media_player_select/unselect() that will copy the behavior of vlc_player.
The main change: tracks won't be identified by an int but by a refcounted opaque struct.

On Mon, Jan 20, 2020, at 15:45, Thomas Guillem wrote:
> Currently, the libvlc media player API doesn't benefit of all the improvement I did on the vlc_player.
> Example: the track selection is still done with the int i_id that could change midstream. You can't know the vout used by a ES track, you can't know if the vout is main one or a secondary one.
> 
> It's not planned to do it for 4.0, we just ported the implementation (libvlc mediaplayer implementation use vlc_player). I guess it's better to wait a little, see if the vlc_player API need improvements before copying the API for LibVLC.
> 
> The question is, do we (if so, when) want to update the libvlc media player API ?
> 
> On Mon, Jan 20, 2020, at 14:41, Rémi Denis-Courmont wrote:
>> I have to disagree for the simple reason that I don't want to break the LibVLC API again in 5.0 (nor do I want to retain piles of legacy backward compatibility code).
>> 
>> Le 20 janvier 2020 12:13:12 GMT+02:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>>> So, can I push this patch ? In that case, we could plan a libvlc media_player rework for 5.0 (that will be like the vlc_player one).
>>> 
>>> On Thu, Jan 16, 2020, at 16:21, Thomas Guillem wrote:
>>>> After more consideration, I really prefer not changing the LibVLC API 
>>>> again (so, keeping this patch), I explain:
>>>> 
>>>> I really like the new vlc_player API (OK, I wrote it...). Ideally this 
>>>> API should be exposed directly via LibVLC, but we can't really do it 
>>>> since the vlc_player is new and can be modified again (and LibVLC API 
>>>> should not be modified as frequently as CORE API).
>>>> 
>>>> What I propose/would like: add a new LibVLC media_player API for 5.0 
>>>> (or more) that is a copy of the vlc_player one (directly or via a 
>>>> wrapper). If we do that, we might want to not change the LibVLC API for 
>>>> 4.0 since it will change again in 5.0.
>>>> 
>>>> On Thu, Jan 16, 2020, at 16:08, Alexandre Janniaux wrote:
>>>>> Hi,
>>>>> 
>>>>> I agree against the backward compatibility choice,
>>>>> otherwise we might want to change the function naming to
>>>>> enforce this change.
>>>>> 
>>>>> It doesn't feel urgent to change this behaviour for VLC 4.0.
>>>>> 
>>>>> Regards,
>>>>> --
>>>>> Alexandre Janniaux
>>>>> Videolabs
>>>>> 
>>>>> On Thu, Jan 16, 2020 at 03:02:48PM +0100, Thomas Guillem wrote:
>>>>>>  Regression from vlc_player.h port. libvlc_media_player expose the "disable"
>>>>>>  track. A -1 id is still a good choice to disable a track, cf
>>>>>>  src/input/es_out.c, a valid i_id can't be negative.  lib/audio.c        |  7 +++++++
>>>>>>   lib/media_player.c | 18 ++++++++++++++++--
>>>>>>   lib/video.c        | 14 ++++++++++++++
>>>>>>   3 files changed, 37 insertions(+), 2 deletions(-)
>>>>>> 
>>>>>>  diff --git a/lib/audio.c b/lib/audio.c
>>>>>>  index aab84cd47a9..8222300707d 100644
>>>>>>  --- a/lib/audio.c
>>>>>>  +++ b/lib/audio.c
>>>>>>  @@ -375,6 +375,13 @@ int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track )
>>>>>>       vlc_player_t *player = p_mi->player;
>>>>>>       vlc_player_Lock(player);
>>>>>> 
>>>>>>  +    if (i_track < 0)
>>>>>>  +    {
>>>>>>  +        vlc_player_UnselectTrackCategory(player, AUDIO_ES);
>>>>>>  +        i_ret = 0;
>>>>>>  +        goto end;
>>>>>>  +    }
>>>>>>  +
>>>>>>       size_t count = vlc_player_GetAudioTrackCount(player);
>>>>>>       for( size_t i = 0; i < count; i++ )
>>>>>>       {
>>>>>>  diff --git a/lib/media_player.c b/lib/media_player.c
>>>>>>  index cdb6ba0b8c5..e21ab5c1998 100644
>>>>>>  --- a/lib/media_player.c
>>>>>>  +++ b/lib/media_player.c
>>>>>>  @@ -1671,14 +1671,28 @@ libvlc_track_description_t *
>>>>>>                                         enum es_format_category_e cat )
>>>>>>   {
>>>>>>       vlc_player_t *player = p_mi->player;
>>>>>>  -    vlc_player_Lock(player);
>>>>>> 
>>>>>>       libvlc_track_description_t *ret, **pp = &ret;
>>>>>> 
>>>>>>  +    /* Add the "Disable" track */
>>>>>>  +    libvlc_track_description_t *tr = malloc(sizeof (*tr));
>>>>>>  +    if (unlikely(tr == NULL))
>>>>>>  +        return NULL;
>>>>>>  +    tr->i_id = -1;
>>>>>>  +    tr->psz_name = strdup(_("Disable"));
>>>>>>  +    if (unlikely(!tr->psz_name))
>>>>>>  +    {
>>>>>>  +        free(tr);
>>>>>>  +        return NULL;
>>>>>>  +    }
>>>>>>  +    *pp = tr;
>>>>>>  +    pp = &tr->p_next;
>>>>>>  +
>>>>>>  +    vlc_player_Lock(player);
>>>>>>       size_t count = vlc_player_GetTrackCount(player, cat);
>>>>>>       for (size_t i = 0; i < count; i++)
>>>>>>       {
>>>>>>  -        libvlc_track_description_t *tr = malloc(sizeof (*tr));
>>>>>>  +        tr = malloc(sizeof (*tr));
>>>>>>           if (unlikely(tr == NULL))
>>>>>>           {
>>>>>>               libvlc_printerr("Not enough memory");
>>>>>>  diff --git a/lib/video.c b/lib/video.c
>>>>>>  index 6f8e6d7f59a..9772945a958 100644
>>>>>>  --- a/lib/video.c
>>>>>>  +++ b/lib/video.c
>>>>>>  @@ -317,6 +317,13 @@ int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu )
>>>>>>       vlc_player_t *player = p_mi->player;
>>>>>>       vlc_player_Lock(player);
>>>>>> 
>>>>>>  +    if (i_spu < 0)
>>>>>>  +    {
>>>>>>  +        vlc_player_UnselectTrackCategory(player, SPU_ES);
>>>>>>  +        i_ret = 0;
>>>>>>  +        goto end;
>>>>>>  +    }
>>>>>>  +
>>>>>>       size_t count = vlc_player_GetSubtitleTrackCount(player);
>>>>>>       for (size_t i = 0; i < count; i++)
>>>>>>       {
>>>>>>  @@ -488,6 +495,13 @@ int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track )
>>>>>>       vlc_player_t *player = p_mi->player;
>>>>>>       vlc_player_Lock(player);
>>>>>> 
>>>>>>  +    if (i_track < 0)
>>>>>>  +    {
>>>>>>  +        vlc_player_UnselectTrackCategory(player, VIDEO_ES);
>>>>>>  +        i_ret = 0;
>>>>>>  +        goto end;
>>>>>>  +    }
>>>>>>  +
>>>>>>       size_t count = vlc_player_GetVideoTrackCount(player);
>>>>>>       for( size_t i = 0; i < count; i++ )
>>>>>>       {
>>>>>>  --
>>>>>>  2.20.1 vlc-devel mailing list
>>>>>>  To unsubscribe or modify your subscription options:
>>>>>>  https://mailman.videolan.org/listinfo/vlc-devel
>>>>> vlc-devel mailing list
>>>>> To unsubscribe or modify your subscription options:
>>>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>> vlc-devel mailing list
>>>> To unsubscribe or modify your subscription options:
>>>> https://mailman.videolan.org/listinfo/vlc-devel
>>> 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é. 
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> 
> _______________________________________________
> 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/20200127/1f7b1408/attachment.html>


More information about the vlc-devel mailing list