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.
This commit is contained in:
wm4
2016-03-08 20:49:33 +01:00
parent 87ae215853
commit f5bfe01932
6 changed files with 22 additions and 16 deletions

View File

@@ -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 {