<div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 18 Jun 2019 at 11:27 PM, Thomas Guillem <<a href="mailto:thomas@gllm.fr">thomas@gllm.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u><div></div><div><div><br></div><div><br></div><div>On Tue, Jun 18, 2019, at 18:21, Roland Bewick wrote:<br></div><blockquote type="cite" id="m_-5888934914291001619qt"><div><br></div><div><div><br></div><div class="m_-5888934914291001619qt-gmail_quote"><div class="m_-5888934914291001619qt-gmail_attr" dir="ltr">On Tue, 18 Jun 2019 at 10:54 PM, Thomas Guillem <<a href="mailto:thomas@gllm.fr" target="_blank">thomas@gllm.fr</a>> wrote:<br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204,204,204);border-left-style:solid;border-left-width:1px;padding-left:1ex" class="m_-5888934914291001619qt-gmail_quote"><div><br></div><div><br></div><div>On Tue, Jun 18, 2019, at 17:38, Roland Bewick wrote:<br></div><div> > <br></div><div> > On 18/06/2019 10:28 PM, Thomas Guillem wrote:<br></div><div> > > ---<br></div><div> > >   include/vlc_player.h                          | 90 +++++++++--------<br></div><div> > >   .../gui/macosx/playlist/VLCPlayerController.m | 27 ++---<br></div><div> > >   .../gui/qt/components/player_controller.cpp   | 35 ++++---<br></div><div> > >   src/input/player.c                            | 98 +++++++++----------<br></div><div> > >   src/libvlccore.sym                            |  5 +-<br></div><div> > >   test/src/input/player.c                       | 15 +--<br></div><div> > >   6 files changed, 130 insertions(+), 140 deletions(-)<br></div><div> > ><br></div><div> > > diff --git a/include/vlc_player.h b/include/vlc_player.h<br></div><div> > > index 403f405d52..3882ae29cf 100644<br></div><div> > > --- a/include/vlc_player.h<br></div><div> > > +++ b/include/vlc_player.h<br></div><div> > > @@ -281,8 +281,7 @@ enum vlc_player_seek_speed<br></div><div> > >    *<br></div><div> > >    * @see vlc_player_SeekByPos()<br></div><div> > >    * @see vlc_player_SeekByTime()<br></div><div> > > - * @see vlc_player_SetAudioDelay()<br></div><div> > > - * @see vlc_player_SetSubtitleDelay()<br></div><div> > > + * @see vlc_player_SetCategoryDelay()<br></div><div> > >    */<br></div><div> > >   enum vlc_player_whence<br></div><div> > >   {<br></div><div> > > @@ -671,28 +670,17 @@ struct vlc_player_cbs<br></div><div> > >           bool enabled, void *data);<br></div><div> > >   <br></div><div> > >       /**<br></div><div> > > -     * Called when the player audio delay has changed<br></div><div> > > +     * Called when the player category delay has changed<br></div><div> > >        *<br></div><div> > > -     * @see vlc_player_SetAudioDelay()<br></div><div> > > +     * @see vlc_player_SetCategoryDelay()<br></div><div> > >        *<br></div><div> > >        * @param player locked player instance<br></div><div> > > +     * @param cat AUDIO_ES or SPU_ES<br></div><div> > >        * @param new_delay audio delay<br></div><div> > >        * @param data opaque pointer set by vlc_player_AddListener()<br></div><div> > >        */<br></div><div> > > -    void (*on_audio_delay_changed)(vlc_player_t *player,<br></div><div> > > -        vlc_tick_t new_delay, void *data);<br></div><div> > > -<br></div><div> > > -    /**<br></div><div> > > -     * Called when the player subtitle delay has changed<br></div><div> > > -     *<br></div><div> > > -     * @see vlc_player_SetSubtitleDelay()<br></div><div> > > -     *<br></div><div> > > -     * @param player locked player instance<br></div><div> > > -     * @param new_delay subtitle delay<br></div><div> > > -     * @param data opaque pointer set by vlc_player_AddListener()<br></div><div> > > -     */<br></div><div> > > -    void (*on_subtitle_delay_changed)(vlc_player_t *player,<br></div><div> > > -        vlc_tick_t new_delay, void *data);<br></div><div> > > +    void (*on_category_delay_changed)(vlc_player_t *player,<br></div><div> > > +         enum es_format_category_e cat, vlc_tick_t new_delay, void *data);<br></div><div> > >   <br></div><div> > >       /**<br></div><div> > >        * Called when associated subtitle has changed<br></div><div> > > @@ -2404,52 +2392,70 @@ vlc_player_ToggleRecording(vlc_player_t *player)<br></div><div> > >   }<br></div><div> > >   <br></div><div> > >   /**<br></div><div> > > - * Get the audio delay for the current media<br></div><div> > > + * Get the delay of a category<br></div><div> > >    *<br></div><div> > > - * @see vlc_player_cbs.on_audio_delay_changed<br></div><div> > > + * @see vlc_player_cbs.on_category_delay_changed<br></div><div> > >    *<br></div><div> > >    * @param player locked player instance<br></div><div> > > + * @param cat AUDIO_ES or SPU_ES (VIDEO_ES not supported yet)<br></div><div> > >    */<br></div><div> > >   VLC_API vlc_tick_t<br></div><div> > > -vlc_player_GetAudioDelay(vlc_player_t *player);<br></div><div> > > +vlc_player_GetCategoryDelay(vlc_player_t *player, enum es_format_category_e cat);<br></div><div> > <br></div><div> > With dual track support coming, how will you get the secondary subtitle <br></div><div> > delay using this function? will you add an additional parameter here?<br></div><div> <br></div><div> I plan to use new functions:<br></div><div> <br></div><div> vlc_player_SetTrackDelay(vlc_player_t *, vlc_es_id_t *es_id, vlc_tick_t delay, whence);<br></div><div> vlc_player_GetTrackDelay(vlc_player_t *, vlc_es_id_t *es_id, vlc_tick_t delay, whence);<br></div><div> <br></div><div> Calling vlc_player_SetTrackDelay() will overide delay previously set for that category and vice-versa.<br></div></blockquote><div dir="auto"><br></div><div dir="auto">To me it seems weird if setting the delay for the secondary subtitle track overrides the subtitle category delay. <br></div></div></div></blockquote><div><br></div></div><div><div>Indeed, that's not what I meant to say. Setting the delay for a secondary subtitle track will only change the delay for that track. But it you call  vlc_player_SetCategoryDelay() afterward, it will override the delay for all tracks.<br></div><div><br></div><div>Or we can decide that vlc_player_SetCategoryDelay() will set the delay only for the primary track of a category, but that is weird too.</div></div></blockquote><div dir="auto"><br></div><div dir="auto">It seems like once secondary tracks are enabled, you have to interact at the track level and forget about using the getCategoryDelay function.</div><div dir="auto"><br></div><div dir="auto">However, what if no track is not loaded yet or dual tracks is disabled? Then, interacting at the category level makes more sense. </div><div dir="auto"><br></div><div dir="auto">One potential problem I see is that you won’t be able to set a secondary subtitle delay until you select a secondary subtitle track (you need a valid es id). I think that might be how it worked previously though (eg. using the subtitle sync GUI before selecting a sub track)</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><br></div><div><br></div><blockquote type="cite" id="m_-5888934914291001619qt"><div><div class="m_-5888934914291001619qt-gmail_quote"><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204,204,204);border-left-style:solid;border-left-width:1px;padding-left:1ex" class="m_-5888934914291001619qt-gmail_quote"><div><br></div><div><br></div><div>Users will still be able to setup delay without taking care of tracks with vlc_player_SetCategoryDelay().<br></div></blockquote><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204,204,204);border-left-style:solid;border-left-width:1px;padding-left:1ex" class="m_-5888934914291001619qt-gmail_quote"><div><br></div><div><br></div><div>By the way, here is my WIP branch<a rel="noreferrer" href="https://code.videolan.org/tguillem/vlc/commits/multiple-es/2" target="_blank">https://code.videolan.org/tguillem/vlc/commits/multiple-es/2</a> that is based on your work.<br></div></blockquote></div></div></blockquote></div><div><blockquote type="cite" id="m_-5888934914291001619qt"><div><div class="m_-5888934914291001619qt-gmail_quote"><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204,204,204);border-left-style:solid;border-left-width:1px;padding-left:1ex" class="m_-5888934914291001619qt-gmail_quote"><div> It's not ready to be sent on the ML. I started from your commits, but did some modifications (I let your authorship). Do you agree with that ? As you can see, this branch is not complete and miss your last commits.<br></div></blockquote><div dir="auto"><br></div><div dir="auto">Yes, that’s fine. I can see you are making some good improvements :-)<br></div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204,204,204);border-left-style:solid;border-left-width:1px;padding-left:1ex" class="m_-5888934914291001619qt-gmail_quote"><div><br></div><div><br></div><div>><br></div><div> > >   <br></div><div> > >   /**<br></div><div> > > - * Set the audio delay for the current media<br></div><div> > > + * Set the delay of one category for the current media<br></div><div> > >    *<br></div><div> > >    * @note A successful call will trigger the<br></div><div> > > - * vlc_player_cbs.on_audio_delay_changed event.<br></div><div> > > + * vlc_player_cbs.on_category_delay_changed event.<br></div><div> > >    *<br></div><div> > >    * @param player locked player instance<br></div><div> > > + * @param cat AUDIO_ES or SPU_ES (VIDEO_ES not supported yet)<br></div><div> > >    * @param delay a valid time<br></div><div> > >    * @param whence absolute or relative<br></div><div> > > + * @return VLC_SUCCESS or VLC_EGENERIC if the category is not handled<br></div><div> > >    */<br></div><div> > > -VLC_API void<br></div><div> > > +VLC_API int<br></div><div> > > +vlc_player_SetCategoryDelay(vlc_player_t *player, enum es_format_category_e cat,<br></div><div> > > +                            vlc_tick_t delay, enum vlc_player_whence whence);<br></div><div> > > +<br></div><div> > > +/**<br></div><div> > > + * Helper to get the audio delay<br></div><div> > > + */<br></div><div> > > +static inline vlc_tick_t<br></div><div> > > +vlc_player_GetAudioDelay(vlc_player_t *player)<br></div><div> > > +{<br></div><div> > > +    return vlc_player_GetCategoryDelay(player, AUDIO_ES);<br></div><div> > > +}<br></div><div> > > +<br></div><div> > > +/**<br></div><div> > > + * Helper to set the audio delay<br></div><div> > > + */<br></div><div> > > +static inline void<br></div><div> > >   vlc_player_SetAudioDelay(vlc_player_t *player, vlc_tick_t delay,<br></div><div> > > -                         enum vlc_player_whence whence);<br></div><div> > > +                         enum vlc_player_whence whence)<br></div><div> > > +<br></div><div> > > +{<br></div><div> > > +    vlc_player_SetCategoryDelay(player, AUDIO_ES, delay, whence);<br></div><div> > > +}<br></div><div> > >   <br></div><div> > >   /**<br></div><div> > > - * Get the subtitle delay for the current media<br></div><div> > > - *<br></div><div> > > - * @see vlc_player_cbs.on_subtitle_delay_changed<br></div><div> > > - *<br></div><div> > > - * @param player locked player instance<br></div><div> > > + * Helper to get the subtitle delay<br></div><div> > >    */<br></div><div> > > -VLC_API vlc_tick_t<br></div><div> > > -vlc_player_GetSubtitleDelay(vlc_player_t *player);<br></div><div> > > +static inline vlc_tick_t<br></div><div> > > +vlc_player_GetSubtitleDelay(vlc_player_t *player)<br></div><div> > > +{<br></div><div> > > +    return vlc_player_GetCategoryDelay(player, SPU_ES);<br></div><div> > > +}<br></div><div> > >   <br></div><div> > >   /**<br></div><div> > > - * Set the subtitle delay for the current media<br></div><div> > > - *<br></div><div> > > - * @note A successful call will trigger the<br></div><div> > > - * vlc_player_cbs.on_subtitle_delay_changed event.<br></div><div> > > - *<br></div><div> > > - * @param player locked player instance<br></div><div> > > - * @param delay a valid time<br></div><div> > > - * @param whence absolute or relative<br></div><div> > > + * Helper to set the subtitle delay<br></div><div> > >    */<br></div><div> > > -VLC_API void<br></div><div> > > +static inline void<br></div><div> > >   vlc_player_SetSubtitleDelay(vlc_player_t *player, vlc_tick_t delay,<br></div><div> > > -                            enum vlc_player_whence whence);<br></div><div> > > +                            enum vlc_player_whence whence)<br></div><div> > > +{<br></div><div> > > +    vlc_player_SetCategoryDelay(player, SPU_ES, delay, whence);<br></div><div> > > +}<br></div><div> > >   <br></div><div> > >   /**<br></div><div> > >    * Set the subtitle text scaling factor<br></div><div> > > diff --git a/modules/gui/macosx/playlist/VLCPlayerController.m b/modules/gui/macosx/playlist/VLCPlayerController.m<br></div><div> > > index 04f71258d0..a3478417ae 100644<br></div><div> > > --- a/modules/gui/macosx/playlist/VLCPlayerController.m<br></div><div> > > +++ b/modules/gui/macosx/playlist/VLCPlayerController.m<br></div><div> > > @@ -284,21 +284,23 @@ static void cb_player_teletext_transparency_changed(vlc_player_t *p_player, bool<br></div><div> > >       });<br></div><div> > >   }<br></div><div> > >   <br></div><div> > > -static void cb_player_audio_delay_changed(vlc_player_t *p_player, vlc_tick_t newDelay, void *p_data)<br></div><div> > > +static void cb_player_category_delay_changed(vlc_player_t *p_player, enum es_format_category_e cat,<br></div><div> > > +                                             vlc_tick_t newDelay, void *p_data)<br></div><div> > >   {<br></div><div> > >       VLC_UNUSED(p_player);<br></div><div> > >       dispatch_async(dispatch_get_main_queue(), ^{<br></div><div> > >           VLCPlayerController *playerController = (__bridge VLCPlayerController *)p_data;<br></div><div> > > -        [playerController audioDelayChanged:newDelay];<br></div><div> > > -    });<br></div><div> > > -}<br></div><div> > > -<br></div><div> > > -static void cb_player_subtitle_delay_changed(vlc_player_t *p_player, vlc_tick_t newDelay, void *p_data)<br></div><div> > > -{<br></div><div> > > -    VLC_UNUSED(p_player);<br></div><div> > > -    dispatch_async(dispatch_get_main_queue(), ^{<br></div><div> > > -        VLCPlayerController *playerController = (__bridge VLCPlayerController *)p_data;<br></div><div> > > -        [playerController subtitlesDelayChanged:newDelay];<br></div><div> > > +        switch (cat)<br></div><div> > > +        {<br></div><div> > > +            case AUDIO_ES:<br></div><div> > > +                [playerController audioDelayChanged:newDelay];<br></div><div> > > +                break;<br></div><div> > > +            case SPU_ES:<br></div><div> > > +                [playerController subtitlesDelayChanged:newDelay];<br></div><div> > > +                break;<br></div><div> > > +            default:<br></div><div> > > +                vlc_assert_unreachable();<br></div><div> > > +        }<br></div><div> > >       });<br></div><div> > >   }<br></div><div> > >   <br></div><div> > > @@ -464,8 +466,7 @@ static const struct vlc_player_cbs player_callbacks = {<br></div><div> > >       cb_player_teletext_enabled_changed,<br></div><div> > >       cb_player_teletext_page_changed,<br></div><div> > >       cb_player_teletext_transparency_changed,<br></div><div> > > -    cb_player_audio_delay_changed,<br></div><div> > > -    cb_player_subtitle_delay_changed,<br></div><div> > > +    cb_player_category_delay_changed,<br></div><div> > >       cb_player_associated_subs_fps_changed,<br></div><div> > >       cb_player_renderer_changed,<br></div><div> > >       cb_player_record_changed,<br></div><div> > > diff --git a/modules/gui/qt/components/player_controller.cpp b/modules/gui/qt/components/player_controller.cpp<br></div><div> > > index 3e386daf69..aeb5954cfa 100644<br></div><div> > > --- a/modules/gui/qt/components/player_controller.cpp<br></div><div> > > +++ b/modules/gui/qt/components/player_controller.cpp<br></div><div> > > @@ -579,25 +579,25 @@ static void on_player_teletext_transparency_changed(vlc_player_t *, bool enabled<br></div><div> > >       });<br></div><div> > >   }<br></div><div> > >   <br></div><div> > > -static void on_player_audio_delay_changed(vlc_player_t *, vlc_tick_t new_delay,<br></div><div> > > +static void on_player_category_delay_changed(vlc_player_t *,<br></div><div> > > +                               enum es_format_category_e cat, vlc_tick_t new_delay,<br></div><div> > >                                  void *data)<br></div><div> > >   {<br></div><div> > >       PlayerControllerPrivate* that = static_cast<PlayerControllerPrivate*>(data);<br></div><div> > > -    msg_Dbg( that->p_intf, "on_player_audio_delay_changed");<br></div><div> > > -    that->callAsync([that,new_delay] (){<br></div><div> > > -        that->m_audioDelay = new_delay;<br></div><div> > > -        emit that->q_func()->audioDelayChanged( new_delay );<br></div><div> > > -    });<br></div><div> > > -}<br></div><div> > > -<br></div><div> > > -static void on_player_subtitle_delay_changed(vlc_player_t *, vlc_tick_t new_delay,<br></div><div> > > -                                  void *data)<br></div><div> > > -{<br></div><div> > > -    PlayerControllerPrivate* that = static_cast<PlayerControllerPrivate*>(data);<br></div><div> > > -    msg_Dbg( that->p_intf, "on_player_subtitle_delay_changed");<br></div><div> > > -    that->callAsync([that,new_delay] (){<br></div><div> > > -        that->m_subtitleDelay = new_delay;<br></div><div> > > -        emit that->q_func()->subtitleDelayChanged( new_delay );<br></div><div> > > +    msg_Dbg( that->p_intf, "on_player_category_delay_changed: %d", cat );<br></div><div> > > +    that->callAsync([that,cat,new_delay] (){<br></div><div> > > +        switch (cat)<br></div><div> > > +        {<br></div><div> > > +            case AUDIO_ES:<br></div><div> > > +                that->m_audioDelay = new_delay;<br></div><div> > > +                emit that->q_func()->audioDelayChanged( new_delay );<br></div><div> > > +                break;<br></div><div> > > +            case SPU_ES:<br></div><div> > > +                that->m_subtitleDelay = new_delay;<br></div><div> > > +                emit that->q_func()->subtitleDelayChanged( new_delay );<br></div><div> > > +                break;<br></div><div> > > +            default: vlc_assert_unreachable();<br></div><div> > > +        }<br></div><div> > >       });<br></div><div> > >   }<br></div><div> > >   <br></div><div> > > @@ -819,8 +819,7 @@ static const struct vlc_player_cbs player_cbs = {<br></div><div> > >       on_player_teletext_enabled_changed,<br></div><div> > >       on_player_teletext_page_changed,<br></div><div> > >       on_player_teletext_transparency_changed,<br></div><div> > > -    on_player_audio_delay_changed,<br></div><div> > > -    on_player_subtitle_delay_changed,<br></div><div> > > +    on_player_category_delay_changed,<br></div><div> > >       on_player_associated_subs_fps_changed,<br></div><div> > >       on_player_renderer_changed,<br></div><div> > >       on_player_record_changed,<br></div><div> > > diff --git a/src/input/player.c b/src/input/player.c<br></div><div> > > index cdb170f167..b5f8a8f46c 100644<br></div><div> > > --- a/src/input/player.c<br></div><div> > > +++ b/src/input/player.c<br></div><div> > > @@ -55,6 +55,7 @@ struct vlc_player_track_priv<br></div><div> > >   {<br></div><div> > >       struct vlc_player_track t;<br></div><div> > >       vout_thread_t *vout; /* weak reference */<br></div><div> > > +    vlc_tick_t delay;<br></div><div> > >   };<br></div><div> > >   <br></div><div> > >   typedef struct VLC_VECTOR(struct vlc_player_program *)<br></div><div> > > @@ -417,6 +418,7 @@ vlc_player_track_New(vlc_es_id_t *id, const char *name, const es_format_t *fmt)<br></div><div> > >       struct vlc_player_track_priv *trackpriv = malloc(sizeof(*trackpriv));<br></div><div> > >       if (!trackpriv)<br></div><div> > >           return NULL;<br></div><div> > > +    trackpriv->delay = 0;<br></div><div> > >       struct vlc_player_track *track = &trackpriv->t;<br></div><div> > >       track->name = strdup(name);<br></div><div> > >       if (!track->name)<br></div><div> > > @@ -2053,12 +2055,12 @@ input_thread_Events(input_thread_t *input_thread,<br></div><div> > >               break;<br></div><div> > >           case INPUT_EVENT_AUDIO_DELAY:<br></div><div> > >               input->audio_delay = event->audio_delay;<br></div><div> > > -            vlc_player_SendEvent(player, on_audio_delay_changed,<br></div><div> > > +            vlc_player_SendEvent(player, on_category_delay_changed, AUDIO_ES,<br></div><div> > >                                    input->audio_delay);<br></div><div> > >               break;<br></div><div> > >           case INPUT_EVENT_SUBTITLE_DELAY:<br></div><div> > >               input->subtitle_delay = event->subtitle_delay;<br></div><div> > > -            vlc_player_SendEvent(player, on_subtitle_delay_changed,<br></div><div> > > +            vlc_player_SendEvent(player, on_category_delay_changed, SPU_ES,<br></div><div> > >                                    input->subtitle_delay);<br></div><div> > >               break;<br></div><div> > >           case INPUT_EVENT_CACHE:<br></div><div> > > @@ -2823,62 +2825,61 @@ vlc_player_SetRecordingEnabled(vlc_player_t *player, bool enable)<br></div><div> > >                                  _("Recording") : _("Recording done"));<br></div><div> > >   }<br></div><div> > >   <br></div><div> > > -void<br></div><div> > > -vlc_player_SetAudioDelay(vlc_player_t *player, vlc_tick_t delay,<br></div><div> > > -                         enum vlc_player_whence whence)<br></div><div> > > +int<br></div><div> > > +vlc_player_SetCategoryDelay(vlc_player_t *player, enum es_format_category_e cat,<br></div><div> > > +                         vlc_tick_t delay, enum vlc_player_whence whence)<br></div><div> > >   {<br></div><div> > >       bool absolute = whence == VLC_PLAYER_WHENCE_ABSOLUTE;<br></div><div> > >       struct vlc_player_input *input = vlc_player_get_input_locked(player);<br></div><div> > >       if (!input)<br></div><div> > > -        return;<br></div><div> > > +        return VLC_EGENERIC;<br></div><div> > >   <br></div><div> > > -    input_ControlPush(input->thread, INPUT_CONTROL_SET_AUDIO_DELAY,<br></div><div> > > -        &(input_control_param_t) {<br></div><div> > > -            .delay = {<br></div><div> > > -                .b_absolute = whence == VLC_PLAYER_WHENCE_ABSOLUTE,<br></div><div> > > -                .i_val = delay,<br></div><div> > > -            },<br></div><div> > > -    });<br></div><div> > > +    switch (cat)<br></div><div> > > +    {<br></div><div> > > +        case AUDIO_ES:<br></div><div> > > +            input_ControlPush(input->thread, INPUT_CONTROL_SET_AUDIO_DELAY,<br></div><div> > > +                &(input_control_param_t) {<br></div><div> > > +                    .delay = {<br></div><div> > > +                        .b_absolute = absolute,<br></div><div> > > +                        .i_val = delay,<br></div><div> > > +                    },<br></div><div> > > +            });<br></div><div> > > +            break;<br></div><div> > > +        case SPU_ES:<br></div><div> > > +            input_ControlPush(input->thread, INPUT_CONTROL_SET_SPU_DELAY,<br></div><div> > > +                &(input_control_param_t) {<br></div><div> > > +                    .delay = {<br></div><div> > > +                        .b_absolute = absolute,<br></div><div> > > +                        .i_val = delay,<br></div><div> > > +                    },<br></div><div> > > +            });<br></div><div> > > +            break;<br></div><div> > > +        default:<br></div><div> > > +            return VLC_EGENERIC;<br></div><div> > > +    }<br></div><div> > >   <br></div><div> > > -    if (!absolute)<br></div><div> > > -        delay += input->audio_delay;<br></div><div> > > -    vlc_player_vout_OSDMessage(player, _("Audio delay: %i ms"),<br></div><div> > > +    vlc_player_vout_OSDMessage(player, _("%s delay: %s%i ms"),<br></div><div> > > +                               es_format_category_to_string(cat),<br></div><div> > > +                               absolute ? "" : "+",<br></div><div> > >                                  (int)MS_FROM_VLC_TICK(delay));<br></div><div> > > +    return VLC_SUCCESS;<br></div><div> > >   }<br></div><div> > >   <br></div><div> > >   vlc_tick_t<br></div><div> > > -vlc_player_GetAudioDelay(vlc_player_t *player)<br></div><div> > > +vlc_player_GetCategoryDelay(vlc_player_t *player, enum es_format_category_e cat)<br></div><div> > >   {<br></div><div> > > -    struct vlc_player_input *input = vlc_player_get_input_locked(player);<br></div><div> > > -    return input ? input->audio_delay : 0;<br></div><div> > > -}<br></div><div> > > -<br></div><div> > > -static void<br></div><div> > > -vlc_player_SetSubtitleDelayInternal(vlc_player_t *player, vlc_tick_t delay,<br></div><div> > > -                                    enum vlc_player_whence whence)<br></div><div> > > -{<br></div><div> > > -    bool absolute = whence == VLC_PLAYER_WHENCE_ABSOLUTE;<br></div><div> > >       struct vlc_player_input *input = vlc_player_get_input_locked(player);<br></div><div> > >       if (!input)<br></div><div> > > -        return;<br></div><div> > > -<br></div><div> > > -    input_ControlPush(input->thread, INPUT_CONTROL_SET_SPU_DELAY,<br></div><div> > > -        &(input_control_param_t) {<br></div><div> > > -            .delay = {<br></div><div> > > -                .b_absolute = absolute,<br></div><div> > > -                .i_val = delay,<br></div><div> > > -            },<br></div><div> > > -    });<br></div><div> > > -}<br></div><div> > > -<br></div><div> > > -void<br></div><div> > > -vlc_player_SetSubtitleDelay(vlc_player_t *player, vlc_tick_t delay,<br></div><div> > > -                            enum vlc_player_whence whence)<br></div><div> > > -{<br></div><div> > > -    vlc_player_SetSubtitleDelayInternal(player, delay, whence);<br></div><div> > > -    vlc_player_vout_OSDMessage(player, _("Subtitle delay: %s%i ms"),<br></div><div> > > -                               whence == VLC_PLAYER_WHENCE_ABSOLUTE ? "" : "+",<br></div><div> > > -                               (int)MS_FROM_VLC_TICK(delay));<br></div><div> > > +        return 0;<br></div><div> > > +    switch (cat)<br></div><div> > > +    {<br></div><div> > > +        case AUDIO_ES:<br></div><div> > > +            return input->audio_delay;<br></div><div> > > +        case SPU_ES:<br></div><div> > > +            return input->subtitle_delay;<br></div><div> > > +        default:<br></div><div> > > +            return 0;<br></div><div> > > +    }<br></div><div> > >   }<br></div><div> > >   <br></div><div> > >   static struct {<br></div><div> > > @@ -2931,13 +2932,6 @@ vlc_player_GetSubtitleTextScale(vlc_player_t *player)<br></div><div> > >       return var_GetInteger(player, "sub-text-scale");<br></div><div> > >   }<br></div><div> > >   <br></div><div> > > -vlc_tick_t<br></div><div> > > -vlc_player_GetSubtitleDelay(vlc_player_t *player)<br></div><div> > > -{<br></div><div> > > -    struct vlc_player_input *input = vlc_player_get_input_locked(player);<br></div><div> > > -    return input ? input->subtitle_delay : 0;<br></div><div> > > -}<br></div><div> > > -<br></div><div> > >   int<br></div><div> > >   vlc_player_GetSignal(vlc_player_t *player, float *quality, float *strength)<br></div><div> > >   {<br></div><div> > > diff --git a/src/libvlccore.sym b/src/libvlccore.sym<br></div><div> > > index 8cca2bbc01..6a4cc6040c 100644<br></div><div> > > --- a/src/libvlccore.sym<br></div><div> > > +++ b/src/libvlccore.sym<br></div><div> > > @@ -783,8 +783,8 @@ vlc_player_CondWait<br></div><div> > >   vlc_player_DisplayPosition<br></div><div> > >   vlc_player_DecrementRate<br></div><div> > >   vlc_player_Delete<br></div><div> > > -vlc_player_GetAudioDelay<br></div><div> > >   vlc_player_GetCapabilities<br></div><div> > > +vlc_player_GetCategoryDelay<br></div><div> > >   vlc_player_GetCategoryLanguage<br></div><div> > >   vlc_player_GetCurrentMedia<br></div><div> > >   vlc_player_GetError<br></div><div> > > @@ -801,7 +801,6 @@ vlc_player_GetSelectedTitleIdx<br></div><div> > >   vlc_player_GetSignal<br></div><div> > >   vlc_player_GetState<br></div><div> > >   vlc_player_GetStatistics<br></div><div> > > -vlc_player_GetSubtitleDelay<br></div><div> > >   vlc_player_GetSubtitleTextScale<br></div><div> > >   vlc_player_GetTeletextPage<br></div><div> > >   vlc_player_GetTime<br></div><div> > > @@ -848,7 +847,7 @@ vlc_player_SelectTitleIdx<br></div><div> > >   vlc_player_SelectTrack<br></div><div> > >   vlc_player_SetAssociatedSubsFPS<br></div><div> > >   vlc_player_SetAtoBLoop<br></div><div> > > -vlc_player_SetAudioDelay<br></div><div> > > +vlc_player_SetCategoryDelay<br></div><div> > >   vlc_player_SetCurrentMedia<br></div><div> > >   vlc_player_SetMediaStoppedAction<br></div><div> > >   vlc_player_SetRecordingEnabled<br></div><div> > > diff --git a/test/src/input/player.c b/test/src/input/player.c<br></div><div> > > index 2c031f83a4..e467f60073 100644<br></div><div> > > --- a/test/src/input/player.c<br></div><div> > > +++ b/test/src/input/player.c<br></div><div> > > @@ -104,8 +104,7 @@ struct report_media_subitems<br></div><div> > >       X(vlc_player_title_list *, on_titles_changed) \<br></div><div> > >       X(size_t, on_title_selection_changed) \<br></div><div> > >       X(struct report_chapter_selection, on_chapter_selection_changed) \<br></div><div> > > -    X(vlc_tick_t, on_audio_delay_changed) \<br></div><div> > > -    X(vlc_tick_t, on_subtitle_delay_changed) \<br></div><div> > > +    X(vlc_tick_t, on_category_delay_changed) \<br></div><div> > >       X(bool, on_recording_changed) \<br></div><div> > >       X(struct report_signal, on_signal_changed) \<br></div><div> > >       X(struct input_stats_t, on_statistics_changed) \<br></div><div> > > @@ -389,19 +388,11 @@ player_on_chapter_selection_changed(vlc_player_t *player,<br></div><div> > >   }<br></div><div> > >   <br></div><div> > >   static void<br></div><div> > > -player_on_audio_delay_changed(vlc_player_t *player, vlc_tick_t new_delay,<br></div><div> > > +player_on_category_delay_changed(vlc_player_t *player, vlc_tick_t new_delay,<br></div><div> > >                                 void *data)<br></div><div> > >   {<br></div><div> > >       struct ctx *ctx = get_ctx(player, data);<br></div><div> > > -    VEC_PUSH(on_audio_delay_changed, new_delay);<br></div><div> > > -}<br></div><div> > > -<br></div><div> > > -static void<br></div><div> > > -player_on_subtitle_delay_changed(vlc_player_t *player, vlc_tick_t new_delay,<br></div><div> > > -                                 void *data)<br></div><div> > > -{<br></div><div> > > -    struct ctx *ctx = get_ctx(player, data);<br></div><div> > > -    VEC_PUSH(on_subtitle_delay_changed, new_delay);<br></div><div> > > +    VEC_PUSH(on_category_delay_changed, new_delay);<br></div><div> > >   }<br></div><div> > >   <br></div><div> > >   static void<br></div><div> > _______________________________________________<br></div><div> > vlc-devel mailing list<br></div><div> > To unsubscribe or modify your subscription options:<br></div><div> > <a rel="noreferrer" href="https://mailman.videolan.org/listinfo/vlc-devel" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div><div> _______________________________________________<br></div><div> vlc-devel mailing list<br></div><div> To unsubscribe or modify your subscription options:<br></div><div> <a rel="noreferrer" href="https://mailman.videolan.org/listinfo/vlc-devel" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote></div></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote><div><br></div></div>_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a></blockquote></div></div>