1
0
Fork 0

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.
This commit is contained in:
Oneric 2022-02-25 00:17:02 +01:00 committed by Ryan Lucia
parent f21d8a3607
commit 85ce9663a6
2 changed files with 4 additions and 0 deletions

View File

@ -170,6 +170,8 @@ LibassSubtitlesProvider::~LibassSubtitlesProvider() {
void LibassSubtitlesProvider::DrawSubtitles(VideoFrame &frame,double time) {
ass_set_frame_size(renderer(), frame.width, frame.height);
// Note: this relies on Aegisub always rendering at video storage res
ass_set_storage_size(renderer(), frame.width, frame.height);
ASS_Image* img = ass_render_frame(renderer(), ass_track, int(time * 1000), nullptr);

View File

@ -105,6 +105,8 @@ int csri_request_fmt(csri_inst *inst, const struct csri_fmt *fmt)
if (!csri_is_rgb(fmt->pixfmt) || csri_has_alpha(fmt->pixfmt))
return -1;
ass_set_frame_size(inst->ass_renderer, fmt->width, fmt->height);
// Note: this relies on CSRI always rendering at video storage res
ass_set_storage_size(inst->ass_renderer, fmt->width, fmt->height);
return 0;
}