[vlc-devel] [PATCH] player: input: Store tracks presence in the ml struct
Alexandre Janniaux
ajanni at videolabs.io
Thu Sep 17 20:31:09 CEST 2020
Hi,
On Thu, Sep 17, 2020 at 04:50:21PM +0200, Hugo Beauzée-Luyssen wrote:
> 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.
It could be suggested to use no if condition for that:
input->ml.has_video_tracks |= !input->ml.has_video_tracks
&& ev->fmt->i_cat == VIDEO_ES;
input->ml.has_audio_tracks |= !input->ml.has_audio_tracks
&& ev->fmt->i_cat == AUDIO_ES)
That's purely subjective and esthetical though, so that
is no more than an optional suggestion!
Regards,
--
Alexandre Janniaux
Videolabs
More information about the vlc-devel
mailing list