diff options
author | wm4 <wm4@nowhere> | 2015-02-16 20:04:15 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-02-16 20:04:29 +0100 |
commit | 2308b3a2a6e78c980a568320a44367e394a05238 (patch) | |
tree | 7523c45ce62ce3177e852b7ae21e27b22ac24424 /sub | |
parent | b63503db04dd38991216bc1bdf4ebc4f84f082e5 (diff) |
sub: mess with styling defaults, change --ass-use-margins behavior
Now --ass-use-margins doesn't apply to normal subtitles anymore. This is
probably the inverse from the mpv behavior users expected so far, and
thus a breaking change, so rename the option, that the user at least has
a chance to lookup the option and decide whether the new behavior is
wanted or not.
The basic idea here is:
- plain text subtitles should have a certain useful defalt behavior,
like actually using margins
- ASS subtitles should never be broken by default
- ASS subtitles should look and behave like plaintext subtitles if
the --ass-style-override=force option is used
This also subtly changes --sub-scale-with-window and adds the --ass-
scale-with-window option. Since this one isn't so important, don't
bother with compatibility.
Diffstat (limited to 'sub')
-rw-r--r-- | sub/ass_mp.c | 35 | ||||
-rw-r--r-- | sub/ass_mp.h | 2 | ||||
-rw-r--r-- | sub/sd_ass.c | 2 |
3 files changed, 24 insertions, 15 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c index c71efe191f..973b78d6cb 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -126,34 +126,43 @@ ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts) return track; } -void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, +void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, bool is_ass, struct mp_osd_res *dim) { ass_set_frame_size(priv, dim->w, dim->h); ass_set_margins(priv, dim->mt, dim->mb, dim->ml, dim->mr); - int set_use_margins = 0; + bool set_use_margins = false; int set_sub_pos = 0; float set_line_spacing = 0; float set_font_scale = 1; int set_hinting = 0; - if (opts->ass_style_override) { + bool set_scale_with_window = false; + bool set_scale_by_window = true; + // With forced overrides, apply the --sub-* specific options + if (!is_ass || opts->ass_style_override == 3) { + set_scale_with_window = opts->sub_scale_with_window; + set_use_margins = opts->sub_use_margins; + set_scale_by_window = opts->sub_scale_by_window; + } else { + set_scale_with_window = opts->ass_scale_with_window; set_use_margins = opts->ass_use_margins; + } + if (!is_ass || opts->ass_style_override) { set_sub_pos = 100 - opts->sub_pos; set_line_spacing = opts->ass_line_spacing; set_hinting = opts->ass_hinting; 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); - } - if (!opts->sub_scale_by_window) { - double factor = dim->h / 720.0; - if (factor != 0.0) - set_font_scale /= factor; - } } - + if (set_scale_with_window) { + int vidh = dim->h - (dim->mt + dim->mb); + set_font_scale *= dim->h / (float)MPMAX(vidh, 1); + } + if (!set_scale_by_window) { + double factor = dim->h / 720.0; + if (factor != 0.0) + set_font_scale /= factor; + } ass_set_use_margins(priv, set_use_margins); #if LIBASS_VERSION >= 0x01010000 ass_set_line_position(priv, set_sub_pos); diff --git a/sub/ass_mp.h b/sub/ass_mp.h index 86c5c7ff0a..4e5cc88554 100644 --- a/sub/ass_mp.h +++ b/sub/ass_mp.h @@ -53,7 +53,7 @@ void mp_ass_add_default_styles(ASS_Track *track, struct MPOpts *opts); ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts); struct MPOpts; -void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, +void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, bool is_ass, struct mp_osd_res *dim); void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts, struct mpv_global *global, struct mp_log *log); diff --git a/sub/sd_ass.c b/sub/sd_ass.c index 9e08c2c3b6..73b836c98a 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -145,7 +145,7 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res dim, double pts, if (isnormal(par)) scale = par; } - mp_ass_configure(renderer, opts, &dim); + mp_ass_configure(renderer, opts, !ctx->is_converted, &dim); ass_set_aspect_ratio(renderer, scale, 1); #if LIBASS_VERSION >= 0x01020000 if (!ctx->is_converted && (!opts->ass_style_override || |