Skip to content

Commit

Permalink
player: add --secondary-sub-override options
Browse files Browse the repository at this point in the history
  • Loading branch information
dyphire committed Oct 17, 2022
1 parent a343319 commit e3300e0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2423,6 +2423,11 @@ Subtitles
This also controls some bitmap subtitle overrides, as well as HTML tags in
formats like SRT, despite the name of the option.

``--secondary-sub-override=<yes|no>``
Control whether user style overrides of secondary subtitles should be applied.

Default: yes.

``--sub-ass-force-margins``
Enables placing toptitles and subtitles in black borders when they are
available, if the subtitles are in the ASS format.
Expand Down
2 changes: 2 additions & 0 deletions options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ const struct m_sub_options mp_subtitle_sub_opts = {
{"sub-ass-justify", OPT_FLAG(ass_justify)},
{"sub-ass-override", OPT_CHOICE(ass_style_override,
{"no", 0}, {"yes", 1}, {"force", 3}, {"scale", 4}, {"strip", 5})},
{"secondary-sub-override", OPT_FLAG(sec_sub_override)},
{"sub-scale-by-window", OPT_FLAG(sub_scale_by_window)},
{"sub-scale-with-window", OPT_FLAG(sub_scale_with_window)},
{"sub-ass-scale-with-window", OPT_FLAG(ass_scale_with_window)},
Expand Down Expand Up @@ -321,6 +322,7 @@ const struct m_sub_options mp_subtitle_sub_opts = {
.ass_feature_whole_text_layout = 0,
.ass_feature_wrap_unicode = 1,
.ass_style_override = 1,
.sec_sub_override = 1,
.ass_shaper = 1,
.use_embedded_fonts = 1,
},
Expand Down
1 change: 1 addition & 0 deletions options/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ struct mp_subtitle_opts {
char **ass_force_style_list;
char *ass_styles_file;
int ass_style_override;
int sec_sub_override;
int ass_hinting;
int ass_shaper;
int ass_justify;
Expand Down
4 changes: 3 additions & 1 deletion player/sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ void reinit_sub(struct MPContext *mpctx, struct track *track)
sub_select(track->d_sub, true);
int order = get_order(mpctx, track);
osd_set_sub(mpctx->osd, order, track->d_sub);
sub_control(track->d_sub, SD_CTRL_SET_TOP, &order);

if (mpctx->opts->subs_rend->sec_sub_override)
sub_control(track->d_sub, SD_CTRL_SET_TOP, &order);

if (mpctx->playback_initialized)
update_subtitles(mpctx, mpctx->playback_pts);
Expand Down

0 comments on commit e3300e0

Please sign in to comment.