Skip to content

Commit bc8ed62

Browse files
committed
Pass storage size to libass to fix rendering
Since ASS rendering depends on the storage size of the video libass needs to know about it to render the subtitles correctly. If it isn't told about the storage size libass uses the value from PlayRes{X,Y} as a guess, but this isn't always correct. With Aegisub currently always rendering at storage resolution this ends up the same as the frame size.
1 parent 72343b7 commit bc8ed62

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/subtitles_provider_libass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ LibassSubtitlesProvider::~LibassSubtitlesProvider() {
170170

171171
void LibassSubtitlesProvider::DrawSubtitles(VideoFrame &frame,double time) {
172172
ass_set_frame_size(renderer(), frame.width, frame.height);
173+
// Note: this relies on Aegisub always rendering at video storage res
174+
ass_set_storage_size(renderer(), frame.width, frame.height);
173175

174176
ASS_Image* img = ass_render_frame(renderer(), ass_track, int(time * 1000), nullptr);
175177

vendor/csri/backends/libass/libass_csri.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ int csri_request_fmt(csri_inst *inst, const struct csri_fmt *fmt)
105105
if (!csri_is_rgb(fmt->pixfmt) || csri_has_alpha(fmt->pixfmt))
106106
return -1;
107107
ass_set_frame_size(inst->ass_renderer, fmt->width, fmt->height);
108+
// Note: this relies on CSRI always rendering at video storage res
109+
ass_set_storage_size(inst->ass_renderer, fmt->width, fmt->height);
108110
return 0;
109111
}
110112

0 commit comments

Comments
 (0)