[vlc-devel] [PATCH 0/5] File subtitle sync : audio bug correction and new features

Pascal Thomet pthomet at gmail.com
Mon Jun 9 21:00:22 CEST 2014


After a week, here is a correction of my last patch + some added features that make subtitles sync much easier

I now propose a series of 5 patches :
- The first patch corrects the bug I had already mentioned
- The second patch add a GUI in order to sync subtitles easily from 
  the "Track synchronization" window.
- The third patch gives hints on how to do the same GUI under OSX.
  I could not do it by myself, as"SyncTracks.xib" depends on 
  Interface Builder 3 (quite outdated). I prefer not to mess around it, 
  as I am not specialist enough with interface builder... 
  I added a comment in the file that explains the steps that should be taken.
- The fourth patch adds a convenient way to adjust subtitle fps when the subtitle
  has an incorrect fps 
- The fifth patch adds the possibility to save an adjusted subtitle file (.srt only). 

All these patches are for *file subtitles" only (.srt and the like). 
I did not modify the behavior as far as DVD and DVB subtitles are concerned.

If I can steal 5 minutes of your time, please have a look at the following video, 
which demonstrates the use of my patches : http://traineq.org/vlcsync/


Now, here are some answers to your previous questions:

@Rémi Denis-Courmont
>What do you mean by that? Subtitles have to be demuxed just like video 
>and audio, of course.
Of course! 
However 2 types of subtitles need to be considered:
    - File subtitles (.srt and the like) are parsed by vlc/modules/demux/subtitle.c
      They are parsed all at once, and then it is easy to apply a delay without 
      needing to call UpdatePtsDelay()
    - DVD and DVB subtitles are multiplexed, and cannot be delayed without 
      applying a delay (and thus UpdatePtsDelay() is called in that case).
      Beware, there is *another* subtitle.c file (vlc/modules/codec/avcodec/subtitle.c)
      I dit not modify this file.
My first patch introduces a behavior for subtitle sync that is different between "file subtitle" and multiplexed subtitles.

>That needs to be separated in other patches.
Done

@Felix Abecassis
>This seems to be breaking regular subtitle delay (positive and negative)
>with keys G and H.
That's right, it was broken with my first patch. Thanks for checking, it is now corrected!

@Julian Scheel
>This really depends on the subtitle source. In case of dvb subtitles in 
>mpeg ts they are not all in memory but come muxed into the stream.
>You should take DVB into account. Actually I had DVB in mind with my 
>previous mail.
You are right. The behavior is now different for DVD and DVB. It is still possible to apply
a delay for DVD/DVB. However the hotkeys 'G' and 'H' should be used as before 
(the GUI is not shown in that case)

@David Fuhrmann
>I think the same string should be used for qt and mac, to ease the translation.
The string is almost the same. However I could not make it strictly identical, since
"Ctrl-Shift-K" is changed to "Command-Shift-K" under OSX.
However, this tooltip is now of little use under windows/linux (since there are now
buttons in the Qt interface). It is more useful under OSX (until the track synchronization 
window is adapted under osx)


Thanks for your time, I understand this is a long series of patch and might take a while to read and process.


Pascal Thomet (5):
  Subtitle delay : fixed sync problem that breaks audio under linux
  Added GUI for subtitle sync in the "Track synchronization" window
  GUI for subtitle sync in the "Track synchronization" under OSX : *NOT*
    done
  Subtitle Sync : added a convenient way to adjust subtitle fps
  Added the possibility to save an adjusted subtitle file (.srt only)

 .../macosx/Resources/English.lproj/SyncTracks.xib  | 114 ++++
 modules/control/hotkeys.c                          | 127 ++---
 modules/demux/subtitle.c                           | 628 ++++++++++++++++++++-
 modules/gui/macosx/TrackSynchronization.m          |  17 +-
 modules/gui/qt4/components/extended_panels.cpp     | 122 +++-
 modules/gui/qt4/components/extended_panels.hpp     |   5 +
 src/input/input.c                                  |   9 +-
 src/input/var.c                                    |  11 +-
 8 files changed, 928 insertions(+), 105 deletions(-)

-- 
1.9.1




More information about the vlc-devel mailing list