Unified · Split
| @@ -0,0 +1,6 @@ | ||
| 1 | +add `--sub-border-style` and `--osd-border-style` options | |
| 2 | +the border style does not depend on `--(sub/osd)-border-color` and `--(sub/osd)-shadow-color`; now it depends solely on `--(sub/osd)-border-style` | |
| 3 | +make `--(sub/osd)-border-color` an alias of `--(sub/osd)-outline-color` | |
| 4 | +make `--(sub/osd)-border-size` an alias of `--(sub/osd)-outline-size` | |
| 5 | +make `--(sub/osd)-shadow-color` an alias of `--(sub/osd)-back-color`; they cannot both be set now | |
| 6 | +make `--osd-bar-border-size` an alias of `--osd-bar-outline-size` | |
| @@ -2832,10 +2832,6 @@ Subtitles · 2831 unmodified lines | ||
| 2832 | 2832 | |
| 2833 | 2833 | Default: 55. |
| 2834 | 2834 | |
| 2835 | −``--sub-back-color=<color>`` | |
| 2836 | − See ``--sub-color``. Color used for sub text background. You can use | |
| 2837 | − ``--sub-shadow-offset`` to change its size relative to the text. | |
| 2838 | − | |
| 2839 | 2835 | ``--sub-blur=<0..20.0>`` |
| 2840 | 2836 | Gaussian blur factor applied to the sub font border. |
| 2841 | 2837 | 0 means no blur applied (default). |
| @@ -2846,15 +2842,48 @@ Subtitles · 4 unmodified lines | ||
| 2846 | 2842 | ``--sub-italic=<yes|no>`` |
| 2847 | 2843 | Format text on italic. |
| 2848 | 2844 | |
| 2849 | −``--sub-border-color=<color>`` | |
| 2850 | − See ``--sub-color``. Color used for the sub font border. | |
| 2845 | +``--sub-outline-color=<color>`` | |
| 2846 | + See ``--sub-color``. Color used for the sub font outline. | |
| 2847 | + | |
| 2848 | + ``--sub-border-color`` is an alias for ``--sub-outline-color``. | |
| 2849 | + | |
| 2850 | +``--sub-back-color=<color>`` | |
| 2851 | + See ``--sub-color``. Color used for sub text background. | |
| 2852 | + | |
| 2853 | + ``--sub-shadow-color`` is an alias for ``--sub-back-color``. | |
| 2854 | + | |
| 2855 | +``--sub-outline-size=<size>`` | |
| 2856 | + Size of the sub font outline in scaled pixels (see ``--sub-font-size`` | |
| 2857 | + for details). A value of 0 disables outlines. | |
| 2851 | 2858 | |
| 2852 | −``--sub-border-size=<size>`` | |
| 2853 | − Size of the sub font border in scaled pixels (see ``--sub-font-size`` | |
| 2854 | − for details). A value of 0 disables borders. | |
| 2859 | + ``--sub-border-size`` is an alias for ``--sub-outline-size``. | |
| 2855 | 2860 | |
| 2856 | 2861 | Default: 3. |
| 2857 | 2862 | |
| 2863 | +``--sub-border-style=<outline-and-shadow|opaque-box|background-box>`` | |
| 2864 | + The style of the border. | |
| 2865 | + | |
| 2866 | + - ``outline-and-shadow``: draw outline and shadow. | |
| 2867 | + The size of the outline is determined by ``--sub-outline-size``, | |
| 2868 | + and the offset of the shadow is determined by ``--sub-shadow-offset``. | |
| 2869 | + The outline is colored by ``--sub-outline-color``, | |
| 2870 | + and the shadow is colored by ``--sub-back-color``. | |
| 2871 | + This corresponds to ``BorderStyle=1`` in the ASS spec. | |
| 2872 | + - ``opaque-box``: draw outline and shadow as opaque boxes that tightly wrap each lines of text. | |
| 2873 | + The margin of the outline opaque box is determined by ``--sub-outline-size``, | |
| 2874 | + and the offset of the shadow opaque box is determined by ``--sub-shadow-offset``. | |
| 2875 | + The outline opaque box is colored by ``--sub-outline-color``, | |
| 2876 | + and the shadow opaque box is colored by ``--sub-back-color``. | |
| 2877 | + Despite its name, the opaque box can be semi-transparent. | |
| 2878 | + This corresponds to ``BorderStyle=3`` in the ASS spec. | |
| 2879 | + - ``background-box``: draw a background box that bounds all lines of text. | |
| 2880 | + The background box is colored by ``--sub-back-color``, | |
| 2881 | + and the margin of the background box is determined by ``--sub-shadow-offset``. | |
| 2882 | + The behavior of the outline is the same as the ``outline-and-shadow`` style. | |
| 2883 | + This corresponds to ``BorderStyle=4``, which is a libass-specific extension. | |
| 2884 | + | |
| 2885 | + Default: ``outline-and-shadow``. | |
| 2886 | + | |
| 2858 | 2887 | ``--sub-color=<color>`` |
| 2859 | 2888 | Specify the color used for unstyled text subtitles. |
| 2860 | 2889 | |
| @@ -2924,15 +2953,6 @@ Subtitles · 63 unmodified lines | ||
| 2924 | 2953 | if ``--sub-ass-override`` is not set to ``no``. |
| 2925 | 2954 | Default: ``no``. |
| 2926 | 2955 | |
| 2927 | −``--sub-shadow-color=<color>`` | |
| 2928 | − See ``--sub-color``. Color used for sub text shadow. | |
| 2929 | − | |
| 2930 | − .. note:: | |
| 2931 | − | |
| 2932 | − ignored when ``--sub-back-color`` is | |
| 2933 | − specified (or more exactly: when that option is not set to completely | |
| 2934 | − transparent). | |
| 2935 | − | |
| 2936 | 2956 | ``--sub-shadow-offset=<size>`` |
| 2937 | 2957 | Displacement of the sub text shadow in scaled pixels (see |
| 2938 | 2958 | ``--sub-font-size`` for details). A value of 0 disables shadows. |
| @@ -4411,14 +4431,13 @@ OSD · 1472 unmodified lines | ||
| 4411 | 4431 | ``--osd-bar-h=<0.1-50>`` |
| 4412 | 4432 | Height of the OSD bar, in percentage of the screen height (default: 3.125). |
| 4413 | 4433 | |
| 4414 | −``--osd-bar-border-size=<size>`` | |
| 4415 | − Size of the border of the OSD bar in scaled pixels (see ``--sub-font-size`` | |
| 4434 | +``--osd-bar-outline-size=<size>`` | |
| 4435 | + Size of the outline of the OSD bar in scaled pixels (see ``--sub-font-size`` | |
| 4416 | 4436 | for details). |
| 4417 | 4437 | |
| 4418 | − Default: 0.5. | |
| 4438 | + ``--osd-bar-border-size`` is an alias for ``--osd-bar-outline-size``. | |
| 4419 | 4439 | |
| 4420 | −``--osd-back-color=<color>`` | |
| 4421 | − See ``--sub-color``. Color used for OSD text background. | |
| 4440 | + Default: 0.5. | |
| 4422 | 4441 | |
| 4423 | 4442 | ``--osd-blur=<0..20.0>`` |
| 4424 | 4443 | Gaussian blur factor applied to the OSD font border. |
| @@ -4430,15 +4449,27 @@ OSD · 5 unmodified lines | ||
| 4430 | 4449 | ``--osd-italic=<yes|no>`` |
| 4431 | 4450 | Format text on italic. |
| 4432 | 4451 | |
| 4433 | −``--osd-border-color=<color>`` | |
| 4434 | − See ``--sub-color``. Color used for the OSD font border. | |
| 4452 | +``--osd-outline-color=<color>`` | |
| 4453 | + See ``--sub-color``. Color used for the OSD font outline. | |
| 4454 | + | |
| 4455 | + ``--osd-border-color`` is an alias for ``--osd-outline-color``. | |
| 4456 | + | |
| 4457 | +``--osd-back-color=<color>`` | |
| 4458 | + See ``--sub-color``. Color used for OSD text background. | |
| 4459 | + | |
| 4460 | + ``--osd-shadow-color`` is an alias for ``--osd-back-color``. | |
| 4435 | 4461 | |
| 4436 | −``--osd-border-size=<size>`` | |
| 4437 | − Size of the OSD font border in scaled pixels (see ``--sub-font-size`` | |
| 4438 | − for details). A value of 0 disables borders. | |
| 4462 | +``--osd-outline-size=<size>`` | |
| 4463 | + Size of the OSD font outline in scaled pixels (see ``--sub-font-size`` | |
| 4464 | + for details). A value of 0 disables outlines. | |
| 4465 | + | |
| 4466 | + ``--osd-border-size`` is an alias for ``--osd-outline-size``. | |
| 4439 | 4467 | |
| 4440 | 4468 | Default: 3. |
| 4441 | 4469 | |
| 4470 | +``--osd-border-style=<outline-and-shadow|opaque-box|background-box>`` | |
| 4471 | + See ``--sub-border-style``. Style used for OSD text border. | |
| 4472 | + | |
| 4442 | 4473 | ``--osd-color=<color>`` |
| 4443 | 4474 | Specify the color used for OSD. |
| 4444 | 4475 | See ``--sub-color`` for details. |
| @@ -4495,14 +4526,6 @@ OSD · 50 unmodified lines | ||
| 4495 | 4526 | respect the value of this option when deciding whether the elements |
| 4496 | 4527 | are scaled with window size or not. |
| 4497 | 4528 | |
| 4498 | −``--osd-shadow-color=<color>`` | |
| 4499 | − See ``--sub-color``. Color used for OSD shadow. | |
| 4500 | − | |
| 4501 | − .. note:: | |
| 4502 | − | |
| 4503 | − Ignored when ``--osd-back-color`` is specified (or more exactly: when | |
| 4504 | − that option is not set to completely transparent). | |
| 4505 | − | |
| 4506 | 4529 | ``--osd-shadow-offset=<size>`` |
| 4507 | 4530 | Displacement of the OSD shadow in scaled pixels (see |
| 4508 | 4531 | ``--sub-font-size`` for details). A value of 0 disables shadows. |
| @@ -398,7 +398,8 @@ const struct m_sub_options mp_osd_render_sub_opts = { · 397 unmodified lines | ||
| 398 | 398 | {"osd-bar-align-y", OPT_FLOAT(osd_bar_align_y), M_RANGE(-1.0, +1.0)}, |
| 399 | 399 | {"osd-bar-w", OPT_FLOAT(osd_bar_w), M_RANGE(1, 100)}, |
| 400 | 400 | {"osd-bar-h", OPT_FLOAT(osd_bar_h), M_RANGE(0.1, 50)}, |
| 401 | − {"osd-bar-border-size", OPT_FLOAT(osd_bar_border_size), M_RANGE(0, 1000.0)}, | |
| 401 | + {"osd-bar-outline-size", OPT_FLOAT(osd_bar_outline_size), M_RANGE(0, 1000.0)}, | |
| 402 | + {"osd-bar-border-size", OPT_ALIAS("osd-bar-outline-size")}, | |
| 402 | 403 | {"osd", OPT_SUBSTRUCT(osd_style, osd_style_conf)}, |
| 403 | 404 | {"osd-scale", OPT_FLOAT(osd_scale), M_RANGE(0, 100)}, |
| 404 | 405 | {"osd-scale-by-window", OPT_BOOL(osd_scale_by_window)}, |
| @@ -410,7 +411,7 @@ const struct m_sub_options mp_osd_render_sub_opts = { · 5 unmodified lines | ||
| 410 | 411 | .osd_bar_align_y = 0.5, |
| 411 | 412 | .osd_bar_w = 75.0, |
| 412 | 413 | .osd_bar_h = 3.125, |
| 413 | − .osd_bar_border_size = 0.5, | |
| 414 | + .osd_bar_outline_size = 0.5, | |
| 414 | 415 | .osd_scale = 1, |
| 415 | 416 | .osd_scale_by_window = true, |
| 416 | 417 | }, |
| @@ -143,7 +143,7 @@ struct mp_osd_render_opts { · 142 unmodified lines | ||
| 143 | 143 | float osd_bar_align_y; |
| 144 | 144 | float osd_bar_w; |
| 145 | 145 | float osd_bar_h; |
| 146 | − float osd_bar_border_size; | |
| 146 | + float osd_bar_outline_size; | |
| 147 | 147 | float osd_scale; |
| 148 | 148 | bool osd_scale_by_window; |
| 149 | 149 | struct osd_style_opts *osd_style; |
| @@ -514,7 +514,7 @@ local function update() · 513 unmodified lines | ||
| 514 | 514 | local clipping_coordinates = '0,' .. coordinate_top .. ',' .. |
| 515 | 515 | screenx .. ',' .. screeny |
| 516 | 516 | local ass = assdraw.ass_new() |
| 517 | − local has_shadow = mp.get_property('osd-back-color'):sub(2, 3) == '00' | |
| 517 | + local has_shadow = mp.get_property('osd-border-style'):find('box$') == nil | |
| 518 | 518 | local style = '{\\r' .. |
| 519 | 519 | '\\1a&H00&\\3a&H00&\\1c&Heeeeee&\\3c&H111111&' .. |
| 520 | 520 | (has_shadow and '\\4a&H99&\\4c&H000000&' or '') .. |
| @@ -62,15 +62,10 @@ void mp_ass_set_style(ASS_Style *style, double res_y, · 61 unmodified lines | ||
| 62 | 62 | style->FontSize = opts->font_size * scale; |
| 63 | 63 | style->PrimaryColour = MP_ASS_COLOR(opts->color); |
| 64 | 64 | style->SecondaryColour = style->PrimaryColour; |
| 65 | − style->OutlineColour = MP_ASS_COLOR(opts->border_color); | |
| 66 | − if (opts->back_color.a) { | |
| 67 | − style->BackColour = MP_ASS_COLOR(opts->back_color); | |
| 68 | − style->BorderStyle = 4; // opaque box | |
| 69 | − } else { | |
| 70 | − style->BackColour = MP_ASS_COLOR(opts->shadow_color); | |
| 71 | − style->BorderStyle = 1; // outline | |
| 72 | − } | |
| 73 | − style->Outline = opts->border_size * scale; | |
| 65 | + style->OutlineColour = MP_ASS_COLOR(opts->outline_color); | |
| 66 | + style->BackColour = MP_ASS_COLOR(opts->back_color); | |
| 67 | + style->BorderStyle = opts->border_style; | |
| 68 | + style->Outline = opts->outline_size * scale; | |
| 74 | 69 | style->Shadow = opts->shadow_offset * scale; |
| 75 | 70 | style->Spacing = opts->spacing * scale; |
| 76 | 71 | style->MarginL = opts->margin_x * scale; |
| @@ -48,10 +48,14 @@ static const m_option_t style_opts[] = { · 47 unmodified lines | ||
| 48 | 48 | {"font", OPT_STRING(font)}, |
| 49 | 49 | {"font-size", OPT_FLOAT(font_size), M_RANGE(1, 9000)}, |
| 50 | 50 | {"color", OPT_COLOR(color)}, |
| 51 | − {"border-color", OPT_COLOR(border_color)}, | |
| 52 | − {"shadow-color", OPT_COLOR(shadow_color)}, | |
| 51 | + {"outline-color", OPT_COLOR(outline_color)}, | |
| 53 | 52 | {"back-color", OPT_COLOR(back_color)}, |
| 54 | − {"border-size", OPT_FLOAT(border_size)}, | |
| 53 | + {"outline-size", OPT_FLOAT(outline_size)}, | |
| 54 | + {"border-color", OPT_ALIAS("outline-color"), .alias_use_prefix = true}, | |
| 55 | + {"shadow-color", OPT_ALIAS("back-color"), .alias_use_prefix = true}, | |
| 56 | + {"border-style", OPT_CHOICE(border_style, | |
| 57 | + {"outline-and-shadow", 1}, {"opaque-box", 3}, {"background-box", 4})}, | |
| 58 | + {"border-size", OPT_ALIAS("outline-size"), .alias_use_prefix = true}, | |
| 55 | 59 | {"shadow-offset", OPT_FLOAT(shadow_offset)}, |
| 56 | 60 | {"spacing", OPT_FLOAT(spacing), M_RANGE(-10, 10)}, |
| 57 | 61 | {"margin-x", OPT_INT(margin_x), M_RANGE(0, 300)}, |
| @@ -79,9 +83,10 @@ const struct m_sub_options osd_style_conf = { · 21 unmodified lines | ||
| 79 | 83 | .font = "sans-serif", |
| 80 | 84 | .font_size = 55, |
| 81 | 85 | .color = {255, 255, 255, 255}, |
| 82 | − .border_color = {0, 0, 0, 255}, | |
| 83 | − .shadow_color = {240, 240, 240, 128}, | |
| 84 | − .border_size = 3, | |
| 86 | + .outline_color = {0, 0, 0, 255}, | |
| 87 | + .back_color = {240, 240, 240, 128}, | |
| 88 | + .border_style = 1, | |
| 89 | + .outline_size = 3, | |
| 85 | 90 | .shadow_offset = 0, |
| 86 | 91 | .margin_x = 25, |
| 87 | 92 | .margin_y = 22, |
| @@ -98,9 +103,10 @@ const struct m_sub_options sub_style_conf = { · 10 unmodified lines | ||
| 98 | 103 | .font = "sans-serif", |
| 99 | 104 | .font_size = 55, |
| 100 | 105 | .color = {255, 255, 255, 255}, |
| 101 | − .border_color = {0, 0, 0, 255}, | |
| 102 | − .shadow_color = {240, 240, 240, 128}, | |
| 103 | − .border_size = 3, | |
| 106 | + .outline_color = {0, 0, 0, 255}, | |
| 107 | + .back_color = {240, 240, 240, 128}, | |
| 108 | + .border_style = 1, | |
| 109 | + .outline_size = 3, | |
| 104 | 110 | .shadow_offset = 0, |
| 105 | 111 | .margin_x = 25, |
| 106 | 112 | .margin_y = 22, |
| @@ -145,10 +145,10 @@ struct osd_style_opts { · 144 unmodified lines | ||
| 145 | 145 | char *font; |
| 146 | 146 | float font_size; |
| 147 | 147 | struct m_color color; |
| 148 | − struct m_color border_color; | |
| 149 | − struct m_color shadow_color; | |
| 148 | + struct m_color outline_color; | |
| 150 | 149 | struct m_color back_color; |
| 151 | − float border_size; | |
| 150 | + int border_style; | |
| 151 | + float outline_size; | |
| 152 | 152 | float shadow_offset; |
| 153 | 153 | float spacing; |
| 154 | 154 | int margin_x; |
| @@ -375,18 +375,15 @@ static void get_osd_bar_box(struct osd_state *osd, struct osd_object *obj, · 374 unmodified lines | ||
| 375 | 375 | |
| 376 | 376 | mp_ass_set_style(style, track->PlayResY, opts->osd_style); |
| 377 | 377 | |
| 378 | − if (osd->opts->osd_style->back_color.a) { | |
| 379 | − // override the default osd opaque-box into plain outline. Otherwise | |
| 380 | − // the opaque box is not aligned with the bar (even without shadow), | |
| 381 | − // and each bar ass event gets its own opaque box - breaking the bar. | |
| 382 | − style->BackColour = MP_ASS_COLOR(opts->osd_style->shadow_color); | |
| 383 | − style->BorderStyle = 1; // outline | |
| 384 | − } | |
| 378 | + // override the default osd opaque-box into plain outline. Otherwise | |
| 379 | + // the opaque box is not aligned with the bar (even without shadow), | |
| 380 | + // and each bar ass event gets its own opaque box - breaking the bar. | |
| 381 | + style->BorderStyle = 1; // outline | |
| 385 | 382 | |
| 386 | 383 | *o_w = track->PlayResX * (opts->osd_bar_w / 100.0); |
| 387 | 384 | *o_h = track->PlayResY * (opts->osd_bar_h / 100.0); |
| 388 | 385 | |
| 389 | − style->Outline = opts->osd_bar_border_size; | |
| 386 | + style->Outline = opts->osd_bar_outline_size; | |
| 390 | 387 | // Rendering with shadow is broken (because there's more than one shape) |
| 391 | 388 | style->Shadow = 0; |
| 392 | 389 | |
| @@ -428,7 +425,7 @@ static void update_progbar(struct osd_state *osd, struct osd_object *obj) · 35 unmodified lines | ||
| 428 | 425 | |
| 429 | 426 | struct ass_draw *d = &(struct ass_draw) { .scale = 4 }; |
| 430 | 427 | |
| 431 | − if (osd->opts->osd_style->back_color.a) { | |
| 428 | + if (osd->opts->osd_style->back_color.a && osd->opts->osd_style->border_style != 1) { | |
| 432 | 429 | // the bar style always ignores the --osd-back-color config - it messes |
| 433 | 430 | // up the bar. draw an artificial box at the original back color. |
| 434 | 431 | struct m_color bc = osd->opts->osd_style->back_color; |