osd: fix subtitle/overlay update problems

This could in theory lead to missed updates if subtitles were switched
or external OSD overlays (via overlay-add) were updated. While the
change IDs of each of those were consistent, switching between two
separate OSD sources is not, and we have to explicitly trigger a change.

Regression since commit 9c9cf125. The new code is actually better,
because we do exactly what is needed, and don't just mess with the
update ID for libass-based OSD.
This commit is contained in:
wm4 2016-09-16 14:21:09 +02:00
parent b83bfea05d
commit f845f64c2a
1 changed files with 6 additions and 2 deletions

View File

@ -169,8 +169,11 @@ void osd_set_text(struct osd_state *osd, const char *text)
void osd_set_sub(struct osd_state *osd, int index, struct dec_sub *dec_sub)
{
pthread_mutex_lock(&osd->lock);
if (index >= 0 && index < 2)
osd->objs[OSDTYPE_SUB + index]->sub = dec_sub;
if (index >= 0 && index < 2) {
struct osd_object *obj = osd->objs[OSDTYPE_SUB + index];
obj->sub = dec_sub;
obj->vo_change_id += 1;
}
osd_changed_unlocked(osd);
pthread_mutex_unlock(&osd->lock);
}
@ -208,6 +211,7 @@ void osd_set_external2(struct osd_state *osd, struct sub_bitmaps *imgs)
{
pthread_mutex_lock(&osd->lock);
osd->objs[OSDTYPE_EXTERNAL2]->external2 = imgs;
osd->objs[OSDTYPE_EXTERNAL2]->vo_change_id += 1;
osd_changed_unlocked(osd);
pthread_mutex_unlock(&osd->lock);
}