[vlc-devel] [PATCH] player: input: Store tracks presence in the ml struct

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Sep 17 16:50:21 CEST 2020


On Thu, Sep 17, 2020, at 4:48 PM, Francois Cartegnie wrote:
> Le 17/09/2020 à 16:30, Hugo Beauzée-Luyssen a écrit :
> > In order to be able to probe the media type after it is stopped and its
> > track vectors have been emptied.
> > ---
> >  src/player/input.c    | 5 +++++
> >  src/player/medialib.c | 4 ++--
> >  src/player/player.h   | 5 +++++
> >  3 files changed, 12 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/player/input.c b/src/player/input.c
> > index 59b4f7345d..5e6913734e 100644
> > --- a/src/player/input.c
> > +++ b/src/player/input.c
> > @@ -498,6 +498,10 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,
> >              if (!trackpriv)
> >                  break;
> >  
> > +            if (!input->ml.has_video_tracks && ev->fmt->i_cat == VIDEO_ES)
> > +                input->ml.has_video_tracks = true;
> > +            else if (!input->ml.has_audio_tracks && ev->fmt->i_cat == AUDIO_ES)
> > +                input->ml.has_audio_tracks = true;
> what about something more generic like
> 
> trackavailbits |= (1 << (ev->fmt->i_cat));
> 

The likeliness of other track types being added here is rather low, so I preferred to use a version that is more readable (IMO) rather than something that will work for other cases.

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list