diff options
Diffstat (limited to 'video/out/opengl/osd.c')
-rw-r--r-- | video/out/opengl/osd.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/video/out/opengl/osd.c b/video/out/opengl/osd.c index 2678e12774..7030e8d8f4 100644 --- a/video/out/opengl/osd.c +++ b/video/out/opengl/osd.c @@ -66,7 +66,7 @@ struct mpgl_osd { struct mpgl_osd_part *parts[MAX_OSD_PARTS]; const struct ra_format *fmt_table[SUBBITMAP_COUNT]; bool formats[SUBBITMAP_COUNT]; - int64_t change_counter; + bool change_flag; // for reporting to API user only // temporary int stereo_mode; struct mp_osd_res osd_res; @@ -81,6 +81,7 @@ struct mpgl_osd *mpgl_osd_init(struct ra *ra, struct mp_log *log, .log = log, .osd = osd, .ra = ra, + .change_flag = true, .scratch = talloc_zero_size(ctx, 1), }; @@ -189,7 +190,7 @@ static void gen_osd_cb(void *pctx, struct sub_bitmaps *imgs) ok = false; osd->change_id = imgs->change_id; - ctx->change_counter += 1; + ctx->change_flag = true; } osd->num_subparts = ok ? imgs->num_parts : 0; @@ -310,6 +311,8 @@ void mpgl_osd_draw_finish(struct mpgl_osd *ctx, int index, gl_sc_blend(sc, factors[0], factors[1], factors[2], factors[3]); gl_sc_dispatch_draw(sc, target.tex, part->vertices, part->num_vertices); + + ctx->change_flag = false; } static void set_res(struct mpgl_osd *ctx, struct mp_osd_res res, int stereo_mode) @@ -338,7 +341,7 @@ void mpgl_osd_generate(struct mpgl_osd *ctx, struct mp_osd_res res, double pts, for (int n = 0; n < MAX_OSD_PARTS; n++) { struct mpgl_osd_part *part = ctx->parts[n]; if (part->num_subparts != part->prev_num_subparts) - ctx->change_counter += 1; + ctx->change_flag = true; part->prev_num_subparts = part->num_subparts; } } @@ -350,7 +353,9 @@ void mpgl_osd_resize(struct mpgl_osd *ctx, struct mp_osd_res res, int stereo_mod osd_resize(ctx->osd, ctx->osd_res); } -int64_t mpgl_get_change_counter(struct mpgl_osd *ctx) +bool mpgl_osd_check_change(struct mpgl_osd *ctx, struct mp_osd_res *res, + double pts) { - return ctx->change_counter; + mpgl_osd_generate(ctx, *res, pts, 0, 0); + return ctx->change_flag; } |