summaryrefslogtreecommitdiffstats
path: root/sub/sd_ass.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-03-08 20:49:33 +0100
committerwm4 <wm4@nowhere>2016-03-08 21:59:55 +0100
commitf5bfe01932b2895ad9b9faa8c04d8a1466dbeeb0 (patch)
treec29722a35a9b444b7677a0d8aa968979123736d8 /sub/sd_ass.c
parent87ae215853d3e5c6d691803907d3827b3ee88a06 (diff)
downloadmpv-f5bfe01932b2895ad9b9faa8c04d8a1466dbeeb0.tar.bz2
mpv-f5bfe01932b2895ad9b9faa8c04d8a1466dbeeb0.tar.xz
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.
Diffstat (limited to 'sub/sd_ass.c')
-rw-r--r--sub/sd_ass.c14
1 files changed, 10 insertions, 4 deletions
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 {