[vlc-devel] [PATCH 4/7] player: Add a on_playback_restore_queried callback

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Jan 22 14:35:43 CET 2020


On Wed, Jan 22, 2020, at 1:55 PM, Thomas Guillem wrote:
> 
> 
> On Tue, Jan 21, 2020, at 16:18, Hugo Beauzée-Luyssen wrote:
> > And use it to ask the user if they want to resume the playback position
> > when a last position is known by the media library
> > ---
> >  include/vlc_player.h                        | 16 ++++++++++++++++
> >  modules/gui/qt/player/player_controller.cpp |  3 ++-
> >  modules/gui/skins2/src/vlcproc.cpp          |  1 +
> >  src/player/input.c                          |  1 +
> >  src/player/medialib.c                       |  3 +++
> >  src/player/player.c                         |  5 +++++
> >  6 files changed, 28 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/vlc_player.h b/include/vlc_player.h
> > index 52dc703609..8da6111294 100644
> > --- a/include/vlc_player.h
> > +++ b/include/vlc_player.h
> > @@ -3032,6 +3032,22 @@ struct vlc_player_cbs
> >       */
> >      void (*on_cork_changed)(vlc_player_t *player, unsigned cork_count,
> >                              void *data);
> > +
> > +    /**
> > +     * Called to query the user about restoring the previous playback position
> > +     *
> > +     * If this callback isn't provided, the user won't be asked to restore
> > +     * the previous playback position, effectively causing
> > +     * VLC_PLAYER_RESTORE_PLAYBACK_POS_ASK to be handled as
> > +     * VLC_PLAYER_RESTORE_PLAYBACK_POS_NEVER
> > +     *
> > +     * The implementation can react to this callback by calling
> > +     * vlc_player_RestorePlaybackPos(), or by discarding the event.
> 
> I would prefer to add a bool * to this callback. Set to true or false 
> by the user to restore or not.
> 
> That way, we don't need to expose vlc_player_RestorePlaybackPos() and 
> simplity the API a little.

This would mean that the callback is blocking, which doesn't seem like a good idea.
The user might take a few seconds to click "resume" or simply ignore the prompt.


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


More information about the vlc-devel mailing list