[vlc-devel] [PATCH] lib: player: add back disabled tracks
Thomas Guillem
thomas at gllm.fr
Mon Jan 20 11:13:12 CET 2020
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
More information about the vlc-devel
mailing list