diff options
author | wm4 <wm4@nowhere> | 2012-10-04 17:16:36 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-10-16 07:26:32 +0200 |
commit | 05f4f00e24caf23646a2b551b8e1a1a1abe76de7 (patch) | |
tree | f7f5684385025a9a7dfe22082209ddc266a3059b /sub/sub.c | |
parent | 17f5019b468d5269408b7dae53a24e17426de7d5 (diff) | |
download | mpv-05f4f00e24caf23646a2b551b8e1a1a1abe76de7.tar.bz2 mpv-05f4f00e24caf23646a2b551b8e1a1a1abe76de7.tar.xz |
sub: cleanup: don't pass parameters via global variables
Passing parameters from caller to subtitle renderer was done by
temporarily setting certain members in the osd_state struct (which for
all practical purposes are as good as global variables). This was the
only purpose of these members.
Rather than using such a messy way to pass parameter, put these into a
struct sub_render_params. The struct was already introduced in earlier
commits, and this commit just removes the parameter passing hack.
Diffstat (limited to 'sub/sub.c')
-rw-r--r-- | sub/sub.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -178,18 +178,13 @@ static bool render_object(struct osd_state *osd, struct osd_object *obj, out_imgs->bitmap_pos_id++; } } else if (obj->type == OSDTYPE_SUB) { - double pts = sub_params->pts; - if (pts != MP_NOPTS_VALUE) - pts += sub_delay - osd->sub_offset; - - // passing the parameters is a big temporary hack - osd->sub_pts = pts; - osd->dim = sub_params->dim; - osd->normal_scale = sub_params->normal_scale; - osd->vsfilter_scale = sub_params->vsfilter_scale; - osd->support_rgba = formats[SUBBITMAP_RGBA]; - - sub_get_bitmaps(osd, out_imgs); + struct sub_render_params p = *sub_params; + if (p.pts != MP_NOPTS_VALUE) + p.pts += sub_delay - osd->sub_offset; + + p.support_rgba = formats[SUBBITMAP_RGBA]; + + sub_get_bitmaps(osd, &p, out_imgs); } else { osd_object_get_bitmaps(osd, obj, out_imgs); } |