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/osd_libass.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sub/osd_libass.c') 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; } -- cgit v1.2.3