[vlc-devel] [PATCH] demux: mock: Add orientation option

Romain Vimont rom1v at videolabs.io
Thu Sep 17 13:22:18 CEST 2020


On Thu, Sep 17, 2020 at 01:00:15PM +0200, Alexandre Janniaux wrote:
> Hi,
> 
> On Thu, Sep 17, 2020 at 10:17:25AM +0200, Romain Vimont wrote:
> > On Thu, Sep 17, 2020 at 09:26:51AM +0200, Tanguy Dubroca wrote:
> > >
> > >
> > > On 9/16/20 5:31 PM, Rémi Denis-Courmont wrote:
> > > > Le keskiviikkona 16. syyskuuta 2020, 17.01.50 EEST Tanguy Dubroca a écrit :
> > > > > Usage: ./vlc 'mock://<mock options>;video_orientation=<orientation>'
> > > > >
> > > > > The video_orientation option is a simplification of the values from
> > > > > video_orientation_t. The possible values are:
> > > > >
> > > > > - normal
> > > > > - transposed / antitransposed
> > > > > - hflipped / vflipped
> > > > > - rotated_90 / rotated_180 / rotated_270
> > > > >
> > > > > Fix #25054
> > > > > ---
> > > > >   modules/demux/mock.c | 39 ++++++++++++++++++++++++++++++++++++++-
> > > > >   1 file changed, 38 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/modules/demux/mock.c b/modules/demux/mock.c
> > > > > index 3e40de176d..d2156132ea 100644
> > > > > --- a/modules/demux/mock.c
> > > > > +++ b/modules/demux/mock.c
> > > > > @@ -118,6 +118,10 @@ var_Read_float(const char *psz)
> > > > >       return atof(psz);
> > > > >   }
> > > > >
> > > > > +typedef char* orientation_str_t;
> > > > Yuck, no please. A character pointer is a character point.
> > > I agree that a bare char* would be better, but in this case a typedef
> > > is necessary to make the macro generate a valid call. The OVERRIDE_OPTION
> > > macro generates a call like this:
> > >
> > > var_Read ## type(...)
> > >
> > > So using a bare char* would not work.
> >
> > For simplicity, maybe the orientation should just be exposed as an
> > integer? (it's just a mock)
> 
> It's just a mock, but the goal is to use it in integration tests so
> I believe having a more self-explaining and reliable way to achieve
> this is preferred here.

More self-explaining: yes, once the value is written.

However, running the mock to test different orientations will require to
find the exact string name for each video_orientation_t value (instead
of just providing the value). Since the mock directly binds the raw
values read from the options for all other fields (including values
expressed in ticks), I think it should do the same for this one for
simplicity.

But I'm bikeshedding, both ways are ok to me.

> 
> Regards,
> --
> Alexandre Janniaux
> Videolabs
> _______________________________________________
> 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