osd_libass: avoid libass warnings if scripts set ASS text early

Lua scripts can call osd_set_external() early (before the VO window is
created and obj->vo_res is filled), in which case the PlayResX field
would be set to nonsense, and libass would print a pointless warning.

There's an easy and a hard fix: either just go on and pass dummy values
to libass (basically like before, just clamp them to avoid the values
which make libass print the warning). Or attempt to update the PlayRes
field to correct values on rendering (since at rendering time, you
always know the screen size and the correct values). Do the latter.

Since various things use PlayRes for scaling things, this might still
not be fully ideal. This is a general problem with the async scripting
interface.
This commit is contained in:
wm4
2017-07-16 13:33:19 +02:00
parent ddd068491c
commit 572802e866
2 changed files with 30 additions and 19 deletions

View File

@@ -22,6 +22,7 @@ struct ass_state {
struct ass_track *track;
struct ass_renderer *render;
struct ass_library *library;
int res_x, res_y;
};
struct osd_object {