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:
parent
f21d8a3607
commit
85ce9663a6
2 changed files with 4 additions and 0 deletions
|
@ -170,6 +170,8 @@ LibassSubtitlesProvider::~LibassSubtitlesProvider() {
|
||||||
|
|
||||||
void LibassSubtitlesProvider::DrawSubtitles(VideoFrame &frame,double time) {
|
void LibassSubtitlesProvider::DrawSubtitles(VideoFrame &frame,double time) {
|
||||||
ass_set_frame_size(renderer(), frame.width, frame.height);
|
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);
|
ASS_Image* img = ass_render_frame(renderer(), ass_track, int(time * 1000), nullptr);
|
||||||
|
|
||||||
|
|
|
@ -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))
|
if (!csri_is_rgb(fmt->pixfmt) || csri_has_alpha(fmt->pixfmt))
|
||||||
return -1;
|
return -1;
|
||||||
ass_set_frame_size(inst->ass_renderer, fmt->width, fmt->height);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue