diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index b8a904d9955b1..4558ab8f3ab75 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -60,6 +60,7 @@ Interface changes - rename `--background` to `--background-color` - remove `--alpha` and reintroduce `--background` option for better control over blending alpha components into specific background types + - add `--border-background` option --- mpv 0.37.0 --- - `--save-position-on-quit` and its associated commands now store state files in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 4e9392861b77b..67ca746ac7fb6 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -6941,6 +6941,10 @@ them. Color used to draw parts of the mpv window not covered by video. See the ``--sub-color`` option for how colors are defined. +``--border-background=`` + Same as ``--background`` but only applies to the black bar/border area of + the window. ``vo=gpu-next`` only. Defaults to ``color``. + ``--opengl-rectangle-textures`` Force use of rectangle textures (default: no). Normally this shouldn't have any advantages over normal textures. Note that hardware decoding overrides diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index d51ee50a34c61..f65f803a86e0c 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -165,6 +165,7 @@ static void update_lut(struct priv *p, struct user_lut *lut); struct gl_next_opts { bool delayed_peak; + int border_background; float corner_rounding; bool inter_preserve; struct user_lut lut; @@ -186,6 +187,10 @@ const struct m_opt_choice_alternatives lut_types[] = { const struct m_sub_options gl_next_conf = { .opts = (const struct m_option[]) { {"allow-delayed-peak-detect", OPT_BOOL(delayed_peak)}, + {"border-background", OPT_CHOICE(border_background, + {"none", BACKGROUND_NONE}, + {"color", BACKGROUND_COLOR}, + {"tiles", BACKGROUND_TILES})}, {"corner-rounding", OPT_FLOAT(corner_rounding), M_RANGE(0, 1)}, {"interpolation-preserve", OPT_BOOL(inter_preserve)}, {"lut", OPT_STRING(lut.opt), .flags = M_OPT_FILE}, @@ -199,6 +204,7 @@ const struct m_sub_options gl_next_conf = { {0}, }, .defaults = &(struct gl_next_opts) { + .border_background = BACKGROUND_COLOR, .inter_preserve = true, }, .size = sizeof(struct gl_next_opts), @@ -1458,9 +1464,13 @@ static void update_ra_ctx_options(struct vo *vo) { struct priv *p = vo->priv; struct gl_video_opts *gl_opts = p->opts_cache->opts; + bool border_alpha = (p->next_opts->border_background == BACKGROUND_COLOR && + gl_opts->background_color.a != 255) || + p->next_opts->border_background == BACKGROUND_NONE; p->ra_ctx->opts.want_alpha = (gl_opts->background == BACKGROUND_COLOR && gl_opts->background_color.a != 255) || - gl_opts->background == BACKGROUND_NONE; + gl_opts->background == BACKGROUND_NONE || + border_alpha; } static int control(struct vo *vo, uint32_t request, void *data) @@ -2100,6 +2110,7 @@ static void update_render_options(struct vo *vo) { BACKGROUND_TILES, PL_CLEAR_TILES }, }; pars->params.background = map_background_types[opts->background][1]; + pars->params.border = map_background_types[p->next_opts->border_background][1]; #else pars->params.blend_against_tiles = opts->background == BACKGROUND_TILES; #endif