summaryrefslogtreecommitdiffstats
path: root/sub/osd_libass.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/osd_libass.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/osd_libass.c')
-rw-r--r--sub/osd_libass.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index cd28396746..36fe6ca7d6 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -77,6 +77,7 @@ void osd_destroy_backend(struct osd_state *osd)
if (obj->osd_ass_library)
ass_library_done(obj->osd_ass_library);
obj->osd_ass_library = NULL;
+ talloc_free(obj->parts_cache.parts);
}
}
@@ -467,13 +468,15 @@ void osd_object_get_bitmaps(struct osd_state *osd, struct osd_object *obj,
if (obj->force_redraw)
update_object(osd, obj);
- *out_imgs = (struct sub_bitmaps) {0};
if (!obj->osd_track)
return;
+ obj->parts_cache.change_id = 0;
+ obj->parts_cache.num_parts = 0;
+
ass_set_frame_size(obj->osd_render, obj->vo_res.w, obj->vo_res.h);
ass_set_aspect_ratio(obj->osd_render, obj->vo_res.display_par, 1.0);
- mp_ass_render_frame(obj->osd_render, obj->osd_track, 0,
- &obj->parts_cache, out_imgs);
- talloc_steal(obj, obj->parts_cache);
+ mp_ass_render_frame(obj->osd_render, obj->osd_track, 0, &obj->parts_cache);
+
+ *out_imgs = obj->parts_cache;
}