aboutsummaryrefslogtreecommitdiffhomepage
path: root/sub
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2014-06-14 19:17:31 +0200
committerGravatar wm4 <wm4@nowhere>2014-06-14 19:17:31 +0200
commit63266d43720dfce15f89c06f200e9a3350642542 (patch)
treef74d26c2c9a07c8dc9bc65de3e3b11a6ca59eda0 /sub
parenta9fd52e493a411f10e9a5fa0e0e428ef353842ab (diff)
sub: add --sub-scale-with-window option
Implements the feature requested in #839 and #186.
Diffstat (limited to 'sub')
-rw-r--r--sub/ass_mp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index a4a22b61a6..02172605d5 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -27,8 +27,7 @@
#include <ass/ass.h>
#include <ass/ass_types.h>
-#include <libavutil/common.h>
-
+#include "common/common.h"
#include "common/global.h"
#include "common/msg.h"
#include "options/path.h"
@@ -146,9 +145,13 @@ void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
set_sub_pos = 100 - opts->sub_pos;
#endif
set_line_spacing = opts->ass_line_spacing;
- set_font_scale = opts->sub_scale;
set_hinting = opts->ass_hinting;
set_force_override = opts->ass_style_override == 3;
+ set_font_scale = opts->sub_scale;
+ if (opts->sub_scale_with_window) {
+ int vidh = dim->h - (dim->mt + dim->mb);
+ set_font_scale *= dim->h / (float)MPMAX(vidh, 1);
+ }
}
ass_set_use_margins(priv, set_use_margins);
@@ -205,7 +208,7 @@ void mp_ass_render_frame(ASS_Renderer *renderer, ASS_Track *track, double time,
if (img->w == 0 || img->h == 0)
continue;
if (res->num_parts >= num_parts_alloc) {
- num_parts_alloc = FFMAX(num_parts_alloc * 2, 32);
+ num_parts_alloc = MPMAX(num_parts_alloc * 2, 32);
res->parts = talloc_realloc(NULL, res->parts, struct sub_bitmap,
num_parts_alloc);
}