[vlc-devel] [PATCH 1/6] qt: add scale method on VLCTick

Abel Tesfaye abeltesfaye45 at gmail.com
Sat Jun 1 14:08:11 CEST 2019


Hello,

But that will end up rounding the ticks to milliseconds/seconds

On Sat, 1 Jun 2019 at 12:58, Alexandre Janniaux <ajanni at videolabs.io> wrote:

> Hi,
>
> vlc_tick doesn't really have meaning in the GUI world.
>
> Instead of adding a scale function on vlctick for UI purpose,
> you should wrap conversion methods to units that have meaning
> like seconds or milliseconds, matching the existing vlctick
> API. Then the computation can be done in primitive type.
>
> Greats,
>
> --
> Alexandre Janniaux
> VideoLabs
>
> On Fri, May 31, 2019 at 02:00:52PM +0300, Abel Tesfaye wrote:
> > From: Abel Tesfaye <Abeltesfaye45 at gmail.com>
> >
> > ---
> >  modules/gui/qt/util/vlctick.cpp | 5 +++++
> >  modules/gui/qt/util/vlctick.hpp | 1 +
> >  2 files changed, 6 insertions(+)
> >
> > diff --git a/modules/gui/qt/util/vlctick.cpp
> b/modules/gui/qt/util/vlctick.cpp
> > index bd0074da54..6cbf6f553a 100644
> > --- a/modules/gui/qt/util/vlctick.cpp
> > +++ b/modules/gui/qt/util/vlctick.cpp
> > @@ -49,3 +49,8 @@ QString VLCTick::toString() const
> >                  .arg(min, 2, 10, QChar('0'))
> >                  .arg(sec, 2, 10, QChar('0'));
> >  }
> > +
> > +VLCTick VLCTick::scale(float scalar) const
> > +{
> > +    return VLCTick(m_ticks*scalar);
> > +}
> > \ No newline at end of file
> > diff --git a/modules/gui/qt/util/vlctick.hpp
> b/modules/gui/qt/util/vlctick.hpp
> > index 19ea5d1db5..e6f8f2b2aa 100644
> > --- a/modules/gui/qt/util/vlctick.hpp
> > +++ b/modules/gui/qt/util/vlctick.hpp
> > @@ -39,6 +39,7 @@ public:
> >       * @return time as HH:MM:SS
> >       */
> >      Q_INVOKABLE QString toString() const;
> > +    Q_INVOKABLE VLCTick scale(float) const;
> >
> >  private:
> >      vlc_tick_t m_ticks;
> > --
> > 2.21.0
> >
> > _______________________________________________
> > 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/20190601/38332e90/attachment.html>


More information about the vlc-devel mailing list