summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/command.c4
-rw-r--r--player/loadfile.c1
-rw-r--r--sub/osd.c34
-rw-r--r--sub/osd.h3
-rw-r--r--sub/osd_libass.c4
-rw-r--r--sub/osd_state.h5
6 files changed, 21 insertions, 30 deletions
diff --git a/player/command.c b/player/command.c
index 5d543e5552..1b7f9eb088 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2911,7 +2911,7 @@ static int property_osd_helper(void *ctx, struct m_property *prop,
{
MPContext *mpctx = ctx;
if (action == M_PROPERTY_SET)
- osd_changed_all(mpctx->osd);
+ osd_changed(mpctx->osd);
return mp_property_generic_option(mpctx, prop, action, arg);
}
@@ -4909,7 +4909,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
if (sub_control(sub, SD_CTRL_SUB_STEP, a) > 0) {
if (cmd->id == MP_CMD_SUB_STEP) {
opts->sub_delay -= a[0];
- osd_changed_all(mpctx->osd);
+ osd_changed(mpctx->osd);
show_property_osd(mpctx, "sub-delay", on_osd);
} else {
// We can easily get stuck by failing to seek to the video
diff --git a/player/loadfile.c b/player/loadfile.c
index 8f065e8d07..ebead19e4e 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -473,7 +473,6 @@ void mp_switch_track_n(struct MPContext *mpctx, int order, enum stream_type type
}
mp_notify(mpctx, MPV_EVENT_TRACK_SWITCHED, NULL);
- osd_changed_all(mpctx->osd);
talloc_free(mpctx->track_layout_hash);
mpctx->track_layout_hash = talloc_steal(mpctx, track_layout_hash(mpctx));
diff --git a/sub/osd.c b/sub/osd.c
index 381fa8892d..220c1d9c0d 100644
--- a/sub/osd.c
+++ b/sub/osd.c
@@ -146,10 +146,10 @@ void osd_free(struct osd_state *osd)
talloc_free(osd);
}
-void osd_changed_unlocked(struct osd_state *osd, int obj)
+void osd_changed_unlocked(struct osd_state *osd)
{
- osd->objs[obj]->force_redraw = true;
osd->want_redraw = true;
+ osd->want_redraw_notification = true;
}
void osd_set_text(struct osd_state *osd, const char *text)
@@ -161,7 +161,7 @@ void osd_set_text(struct osd_state *osd, const char *text)
if (strcmp(osd_obj->text, text) != 0) {
talloc_free(osd_obj->text);
osd_obj->text = talloc_strdup(osd_obj, text);
- osd_changed_unlocked(osd, osd_obj->type);
+ osd_changed_unlocked(osd);
}
pthread_mutex_unlock(&osd->lock);
}
@@ -171,6 +171,7 @@ 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;
+ osd_changed_unlocked(osd);
pthread_mutex_unlock(&osd->lock);
}
@@ -199,7 +200,7 @@ void osd_set_progbar(struct osd_state *osd, struct osd_progbar_state *s)
MP_TARRAY_GROW(osd_obj, osd_obj->progbar_state.stops, s->num_stops);
memcpy(osd_obj->progbar_state.stops, s->stops,
sizeof(osd_obj->progbar_state.stops[0]) * s->num_stops);
- osd_changed_unlocked(osd, osd_obj->type);
+ osd_changed_unlocked(osd);
pthread_mutex_unlock(&osd->lock);
}
@@ -207,7 +208,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_changed_unlocked(osd, OSDTYPE_EXTERNAL2);
+ osd_changed_unlocked(osd);
pthread_mutex_unlock(&osd->lock);
}
@@ -216,7 +217,7 @@ static void check_obj_resize(struct osd_state *osd, struct mp_osd_res res,
{
if (!osd_res_equals(res, obj->vo_res)) {
obj->vo_res = res;
- obj->force_redraw = true;
+ osd->want_redraw = true;
mp_client_broadcast_event(mp_client_api_get_core(osd->global->client_api),
MP_EVENT_WIN_RESIZE, NULL);
}
@@ -269,10 +270,6 @@ static void render_object(struct osd_state *osd, struct osd_object *obj,
osd_object_get_bitmaps(osd, obj, format, out_imgs);
}
- if (obj->force_redraw)
- out_imgs->change_id++;
-
- obj->force_redraw = false;
obj->vo_change_id += out_imgs->change_id;
if (out_imgs->num_parts == 0)
@@ -323,6 +320,9 @@ void osd_draw(struct osd_state *osd, struct mp_osd_res res,
sub_unlock(obj->sub);
}
+ if (!(draw_flags & OSD_DRAW_SUB_FILTER))
+ osd->want_redraw = osd->want_redraw_notification = false;
+
pthread_mutex_unlock(&osd->lock);
}
@@ -379,24 +379,18 @@ struct mp_osd_res osd_res_from_image_params(const struct mp_image_params *p)
};
}
-void osd_changed(struct osd_state *osd, int new_value)
+void osd_changed(struct osd_state *osd)
{
pthread_mutex_lock(&osd->lock);
- osd_changed_unlocked(osd, new_value);
+ osd_changed_unlocked(osd);
pthread_mutex_unlock(&osd->lock);
}
-void osd_changed_all(struct osd_state *osd)
-{
- for (int n = 0; n < MAX_OSD_PARTS; n++)
- osd_changed(osd, n);
-}
-
bool osd_query_and_reset_want_redraw(struct osd_state *osd)
{
pthread_mutex_lock(&osd->lock);
- bool r = osd->want_redraw;
- osd->want_redraw = false;
+ bool r = osd->want_redraw_notification;
+ osd->want_redraw_notification = false;
pthread_mutex_unlock(&osd->lock);
return r;
}
diff --git a/sub/osd.h b/sub/osd.h
index 6bfa6dd525..cf66392904 100644
--- a/sub/osd.h
+++ b/sub/osd.h
@@ -145,8 +145,7 @@ struct mpv_global;
struct dec_sub;
struct osd_state *osd_create(struct mpv_global *global);
-void osd_changed(struct osd_state *osd, int new_value);
-void osd_changed_all(struct osd_state *osd);
+void osd_changed(struct osd_state *osd);
void osd_free(struct osd_state *osd);
bool osd_query_and_reset_want_redraw(struct osd_state *osd);
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index a9ab7eabd2..9b634f5214 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -501,7 +501,7 @@ void osd_set_external(struct osd_state *osd, void *id, int res_x, int res_y,
entry->res_y = res_y;
update_external(osd, obj, entry);
obj->changed = true;
- osd_changed_unlocked(osd, obj->type);
+ osd_changed_unlocked(osd);
}
done:
@@ -527,7 +527,7 @@ static void append_ass(struct ass_state *ass, struct mp_osd_res *res,
void osd_object_get_bitmaps(struct osd_state *osd, struct osd_object *obj,
int format, struct sub_bitmaps *out_imgs)
{
- if (obj->force_redraw && obj->type == OSDTYPE_OSD)
+ if (osd->want_redraw && obj->type == OSDTYPE_OSD)
update_osd(osd, obj);
if (!obj->ass_packer)
diff --git a/sub/osd_state.h b/sub/osd_state.h
index 81bdbd633a..d054f3d06d 100644
--- a/sub/osd_state.h
+++ b/sub/osd_state.h
@@ -28,8 +28,6 @@ struct osd_object {
int type; // OSDTYPE_*
bool is_sub;
- bool force_redraw;
-
// OSDTYPE_OSD
char *text;
@@ -72,6 +70,7 @@ struct osd_state {
bool render_subs_in_filter;
bool want_redraw;
+ bool want_redraw_notification;
struct MPOpts *opts;
struct mpv_global *global;
@@ -80,6 +79,6 @@ struct osd_state {
struct mp_draw_sub_cache *draw_cache;
};
-void osd_changed_unlocked(struct osd_state *osd, int obj);
+void osd_changed_unlocked(struct osd_state *osd);
#endif