From f5bfe01932b2895ad9b9faa8c04d8a1466dbeeb0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 8 Mar 2016 20:49:33 +0100 Subject: osd: refactor how mp_ass_render_frame() is called Instead of passing an explicit cache to the function, the res parameter is used. Also, instead of replacing its contents, sub bitmaps are now appended to it (all assuming the format doesn't actually change). This is preparation for the following commits. --- sub/sd_ass.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'sub/sd_ass.c') diff --git a/sub/sd_ass.c b/sub/sd_ass.c index 23f0c882f8..788b78f3a4 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -44,7 +44,7 @@ struct sd_ass_priv { bool is_converted; struct lavc_conv *converter; bool on_top; - struct sub_bitmap *parts; + struct sub_bitmaps part_cache; char last_text[500]; struct mp_image_params video_params; struct mp_image_params last_params; @@ -454,13 +454,19 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res dim, double pts, ctx->num_seen_packets = 0; sd->preload_ok = false; } + if (no_ass) fill_plaintext(sd, pts); - mp_ass_render_frame(renderer, track, ts, &ctx->parts, res); - talloc_steal(ctx, ctx->parts); + + ctx->part_cache.change_id = 0; + ctx->part_cache.num_parts = 0; + mp_ass_render_frame(renderer, track, ts, &ctx->part_cache); + talloc_steal(ctx, ctx->part_cache.parts); if (!converted) - mangle_colors(sd, res); + mangle_colors(sd, &ctx->part_cache); + + *res = ctx->part_cache; } struct buf { -- cgit v1.2.3