[vlc-devel] [PATCH] Fix https://trac.videolan.org/vlc/ticket/10749 Video was getting stuck while using subtitle delay option when setting a negative subtitle delay.

Pascal Thomet pthomet at gmail.com
Tue Oct 3 20:19:55 CEST 2017


Thanks for your answer.

You are right, this has to be handled differently depending on the source
of the subtitles.

This patch actually tries to introduce two different behaviors

- if the subtitles come from the subtitle demux, then the delay is removed
- if the subtitles come from another source, then the old behavior is
conserved (and a delay is still applied)

Details :

- a new variable ("sub-isfilesub") is added inside input/var.c. It is set
to *false* by default

- if this variable is set to false, the old behavior remains strictly
identical : the two functions that handle the delay
(namely input/input.c:UpdatePtsDelay and  input/var.c:EsDelayCallback) keep
the *exact* same behavior as before

- if this variable is set to true, than effectively, the delay will be

- So, I agree, we would need to make sure that, inside we have a reliable
way to tell "file subtitles" apart from other subtitle types in order to
correctly set this variable ?
Is it impossible or too difficult ?

Here is what I can tell about the lifetime of this variable :
* it is set to false upon construction (inside input/var.c)
* it is also re-set to false at the very beginning of input.c:LoadSlaves
(which is called each time a new movie is loaded, I think)
* the only place where it is set to true is inside
input.c:input_SlaveSourceAdd (and only if "slave_type" is equal to
"SLAVE_TYPE_SPU". See input.c:3333)

Below is the callstack when entering demux/subtitle.c:Open():

1  Open                 subtitle.c 309
2  demux_Probe          demux.c    191
3  module_load          modules.c  183
4  vlc_module_load      modules.c  279
5  demux_NewAdvanced    demux.c    264
6  InputDemuxNew        input.c    2553
7  InputSourceNew       input.c    2663
8  input_SlaveSourceAdd input.c    3325    <-- sub-isfilesub is set to true
here if slave_type==SLAVE_TYPE_SPU
9  LoadSlaves           input.c    1161    <-- sub-filesub is set to false
10 Init                 input.c    1363
11 Run                  input.c    497

I assumed that testing for  slave_type==SLAVE_TYPE_SPU (inside
input.c:input_SlaveSourceAdd) would be a good test .
However, it could be done elsewhere in this callstack.

My initial intent was to set "sub-isfilesub" directly inside the Open()
function. However, it seems it is not possible to set an inherited var from
there. Did I miss something ?

Do you know of another place in the callstack where it would be more suited
to change it ?

Sorry for the long email, and thus many thanks for your attention,


Pascal Thomet

On Tue, Oct 3, 2017 at 5:29 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:

>         Hello,
> This seems to assume that all subtitles come from the subtitle demux,
> which is
> definitely not true.
> --
> 雷米‧德尼-库尔蒙
> https://www.remlab.net/
> _______________________________________________
> 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/20171003/0797d304/attachment.html>

More information about the vlc-devel mailing list