summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.c
diff options
context:
space:
mode:
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r--sub/dec_sub.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index 4a048b27a6..5ceb3b2422 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -39,13 +39,13 @@ void sub_init(struct sh_sub *sh, struct osd_state *osd)
if (opts->ass_enabled && is_text_sub(sh->type))
sh->sd_driver = &sd_ass;
#endif
- if (strchr("bpx", sh->type))
+ if (strchr("bpxv", sh->type))
sh->sd_driver = &sd_lavc;
if (sh->sd_driver) {
if (sh->sd_driver->init(sh, osd) < 0)
return;
osd->sh_sub = sh;
- osd->bitmap_id = ++osd->bitmap_pos_id;
+ osd->switch_sub_id++;
sh->initialized = true;
sh->active = true;
}
@@ -58,13 +58,12 @@ void sub_decode(struct sh_sub *sh, struct osd_state *osd, void *data,
sh->sd_driver->decode(sh, osd, data, data_len, pts, duration);
}
-void sub_get_bitmaps(struct osd_state *osd, struct sub_bitmaps *res)
+void sub_get_bitmaps(struct osd_state *osd, struct mp_osd_res dim, double pts,
+ struct sub_bitmaps *res)
{
struct MPOpts *opts = osd->opts;
- *res = (struct sub_bitmaps){ .type = SUBBITMAP_EMPTY,
- .bitmap_id = osd->bitmap_id,
- .bitmap_pos_id = osd->bitmap_pos_id };
+ *res = (struct sub_bitmaps) {0};
if (!opts->sub_visibility || !osd->sh_sub || !osd->sh_sub->active) {
/* Change ID in case we just switched from visible subtitles
* to current state. Hopefully, unnecessarily claiming that
@@ -72,14 +71,15 @@ void sub_get_bitmaps(struct osd_state *osd, struct sub_bitmaps *res)
* Increase osd-> values ahead so that _next_ returned id
* is also guaranteed to differ from this one.
*/
- res->bitmap_id = ++res->bitmap_pos_id;
- osd->bitmap_id = osd->bitmap_pos_id += 2;
- return;
+ osd->switch_sub_id++;
+ } else {
+ if (osd->sh_sub->sd_driver->get_bitmaps)
+ osd->sh_sub->sd_driver->get_bitmaps(osd->sh_sub, osd, dim, pts, res);
}
- if (osd->sh_sub->sd_driver->get_bitmaps)
- osd->sh_sub->sd_driver->get_bitmaps(osd->sh_sub, osd, res);
- osd->bitmap_id = res->bitmap_id;
- osd->bitmap_pos_id = res->bitmap_pos_id;
+
+ res->bitmap_id += osd->switch_sub_id;
+ res->bitmap_pos_id += osd->switch_sub_id;
+ osd->switch_sub_id = 0;
}
void sub_reset(struct sh_sub *sh, struct osd_state *osd)