[vlc-devel] [RFC 0/3] vout subtitles

Salah-Eddin Shaban salah at videolan.org
Wed Mar 1 14:37:01 CET 2017


Here's a follow-up to my previous RFC patch.

The second of the three patches is a fix for a problem I noticed when taking snapshots in direct3d9 with the first patch applied. When the display was larger than the video, subpictures were rendered correctly on screen but were misplaced in snapshots. I had to resize the display to match the video then seek back to force the subtitle to be reloaded to get correct subs in snapshots again.

After much hair pulling it turned out to be caused by the subtitle-overlap support. When this feature was added all subtitles were made absolute on first rendering, which has caused the position to be calculated only once. So if the video is resized while a subpicture is on the screen the subpicture position is not updated (even though it is resized correctly) and it appears misplaced. This patch fixes both the snapshot and video resize issues, without affecting the handling of overlapped subtitles.

The third patch adds an option for overriding subtitle position. It's working well with or without the first patch. But there are still issues we need to consider:

- The i_align field in subpicture_region_t seems to be interpreted as both internal (alignment of text within a region) and external (alignment of the region itself). We should probably make it two fields/options without breaking existing code.

- There is already a similar subsdec-align option which seems to be meant for internal alignment, but doesn't seem to work. Maybe fixing this option is better than adding a vout one?

- The sub-margin option, as far as I can see, was added mainly to allow for subs outside the video, but was only working within video boundaries. So we should either dump it now or, for completeness, substitute it with two or four margin options.

I will wrap this up with the first two patches, and finish the third along with dual-subtitle support.

Salah-Eddin Shaban (3):
  vout: subtitles outside the video area in direct3d9
  subtitles: fix misplaced subs on video resize
  vout: allow subtitle position override

 include/vlc_subpicture.h               |  2 ++
 include/vlc_vout_display.h             |  1 +
 modules/video_output/win32/common.c    | 14 +++++++++++++-
 modules/video_output/win32/direct3d9.c | 20 ++++++++++++--------
 src/libvlc-module.c                    | 10 ++++++++++
 src/misc/subpicture.c                  |  6 ++++++
 src/video_output/video_output.c        |  9 +++++++++
 src/video_output/vout_subpictures.c    | 16 ++++++++++------
 8 files changed, 63 insertions(+), 15 deletions(-)


More information about the vlc-devel mailing list