diff options
author | wm4 <wm4@nowhere> | 2016-03-08 21:42:08 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-03-08 22:00:02 +0100 |
commit | 75a36662cb6bb0c8a2aeb3a4034d3f8dc745bbdd (patch) | |
tree | eeb8967caa71b555dcfa43ec932a90fcd9c52ebe /sub/osd_state.h | |
parent | ed254f29a93474defd932e52d6995628e01d82aa (diff) | |
download | mpv-75a36662cb6bb0c8a2aeb3a4034d3f8dc745bbdd.tar.bz2 mpv-75a36662cb6bb0c8a2aeb3a4034d3f8dc745bbdd.tar.xz |
osd, lua: manage multiple ASS overlays set with set_osd_ass() calls
Until now, there was only 1 global ASS overlay that could be set by all
scripts. This was often perceived as bug when multiple scripts tried to
set their own ASS overlay.
This was kind of hard to solve because the script could set its own ASS
PlayResX/Y, which makes it impossible to share a single ASS_Renderer for
multiple scripts. The OSC unfortunately makes use of this feature (and
unfortunately can't be fixed because it's a POS), so we're stuck with
this complication.
Implement the worst-case solution and fix this by creating separate ASS
track and renderer objects for each script that wants to set an ASS
overlay.
The z-order is decided by the order the scripts set their text first.
This is essentially random, unless you do it at script init, and you
pass scripts in a specific order. Script initialization is currently
serialized (as a feature), so the first loaded script gets lowest
Z-order.
The Lua script API interestingly remains the same. (And also will remain
undocumented, unsupported, and potentially volatile.)
Diffstat (limited to 'sub/osd_state.h')
-rw-r--r-- | sub/osd_state.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sub/osd_state.h b/sub/osd_state.h index 66fee5a387..c52c3354cd 100644 --- a/sub/osd_state.h +++ b/sub/osd_state.h @@ -20,7 +20,7 @@ struct osd_object { bool force_redraw; - // OSDTYPE_SUB/OSDTYPE_SUB2/OSDTYPE_OSD/OSDTYPE_EXTERNAL + // OSDTYPE_OSD char *text; // OSDTYPE_OSD @@ -30,7 +30,8 @@ struct osd_object { struct dec_sub *sub; // OSDTYPE_EXTERNAL - int external_res_x, external_res_y; + struct osd_external *externals; + int num_externals; // OSDTYPE_EXTERNAL2 struct sub_bitmaps *external2; @@ -48,6 +49,13 @@ struct osd_object { struct ass_state ass; }; +struct osd_external { + void *id; + char *text; + int res_x, res_y; + struct ass_state ass; +}; + struct osd_state { pthread_mutex_t lock; @@ -64,4 +72,6 @@ struct osd_state { struct mp_draw_sub_cache *draw_cache; }; +void osd_changed_unlocked(struct osd_state *osd, int obj); + #endif |