[vlc-devel] [VLC] subtitles in vplayer format do not disappear - fix offered.

Marek Moskal marek.moskal at gmail.com
Mon Jun 4 23:44:45 CEST 2007


Hi Folks,

VLS supports subtitles in VPlayer format, but it has a bug.
This time-based format only specifies start time. Players
are supposed to automatically remove subtitle after 3 seconds,
but VLC doesn't do it. Sample discussion of the problem:
http://forum.videolan.org/viewtopic.php?t=7663&highlight=vplayer&sid=5809b8234926cbdbf12bd8dbfa8df238

I am not a programmer, but I have found this bug and have a fix.

The issue is in subtitle demuxer at the following source file:
http://trac.videolan.org/vlc/browser/trunk/modules/demux/subtitle.c

Procedure "ParseVplayer" (line 1038) should parse line from file
and put correct start/stop time in variables i_start and i_end.

i_start is found correctly in line 1074 and later copied
to p_subtitle->i_start in line 1089.

Bug is that p_subtitle->i_stop is set to "0" (never disappear).

Fix: in line 1091 change i_stop to i_start + 3 seconds (I believe
it will be 3000 units since you use milliseconds.

Old:
    p_subtitle->i_start = i_start;
    p_subtitle->i_stop  = 0;

New:
    p_subtitle->i_start = i_start;
    p_subtitle->i_stop  = i_start + 3000;


If you want to make a better handling, you could make "3000" not
a constant, but configuration variable that can be changed from
GUI/CLI. I do not know VLC code enough to find how to do that.

PS: it is also possible that other parser might have the same issue,
so instead of treating i_stop == 0 as "never disappear" it could be
changed to if (i_stop == 0) then (wait a FIXED_DELAY).
IMVHO a better fix would be: "remove subtitle when the next appears
or after 3 seconds if not" but this is more complex change that I can't
fully make at the moment.

FYI: sample VPLayer format subtitles (five lines):

00:00:02:-One
00:00:12:-Two
00:00:13:-Three
00:00:20:-Four
00:00:21:-Five

Best Regards,
                               Marek Moskal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20070604/f1998baa/attachment.html>


More information about the vlc-devel mailing list