1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-17 21:27:08 +00:00

vf_format: add dolbyvision sub-option

Useful to strip dolbyvision from the output, in cases where the user
does not want it applied. Doing this as a video filter gives users the
abiilty to easily toggle this stripping at runtime in a way that
properly propagates to any (potentially stateful) VO.

It also thematically fits the rest of the options in vf_format, which
are similarly concerned with modifying the video image parameters.
This commit is contained in:
Niklas Haas 2022-01-07 06:41:55 +01:00 committed by Niklas Haas
parent 88047f7654
commit 05ccc51d53
3 changed files with 13 additions and 2 deletions

View File

@ -38,6 +38,7 @@ Interface changes
- add `--gamut-mapping-mode`, replacing `--gamut-clipping` and `--gamut-warning`
- add `--tone-mapping-mode`, replacing `--tone-mapping-desaturate` and
`--tone-mapping-desaturate-exponent`.
- add `dolbyvision` sub-parameter to `format` video filter
--- mpv 0.34.0 ---
- deprecate selecting by card number with `--drm-connector`, add
`--drm-device` which can be used instead

View File

@ -308,6 +308,10 @@ Available mpv-only filters are:
:709-1886: Scene-referred using the BT709+BT1886 interaction
:gamma1.2: Scene-referred using a pure power OOTF (gamma=1.2)
``<dolbyvision=yes|no>``
Whether or not to include Dolby Vision metadata (default: yes). If
disabled, any Dolby Vision metadata will be stripped from frames.
``<stereo-in>``
Set the stereo mode the video is assumed to be encoded in. Use
``--vf=format:stereo-in=help`` to list all available modes. Check with

View File

@ -22,6 +22,7 @@
#include <math.h>
#include <libavutil/rational.h>
#include <libavutil/buffer.h>
#include "common/msg.h"
#include "common/common.h"
@ -56,6 +57,7 @@ struct vf_format_opts {
double dar;
int convert;
int force_scaler;
int dovi;
};
static void set_params(struct vf_format_opts *p, struct mp_image_params *out,
@ -141,14 +143,16 @@ static void vf_format_process(struct mp_filter *f)
if (mp_pin_can_transfer_data(f->ppins[1], priv->conv->f->pins[1])) {
struct mp_frame frame = mp_pin_out_read(priv->conv->f->pins[1]);
struct mp_image *img = frame.data;
if (!priv->opts->convert && frame.type == MP_FRAME_VIDEO) {
struct mp_image *img = frame.data;
set_params(priv->opts, &img->params, false);
mp_image_params_guess_csp(&img->params);
}
if (!priv->opts->dovi)
av_buffer_unref(&img->dovi);
mp_pin_in_write(f->ppins[1], frame);
}
}
@ -206,6 +210,7 @@ static const m_option_t vf_opts_fields[] = {
{"dh", OPT_INT(dh)},
{"dar", OPT_DOUBLE(dar)},
{"convert", OPT_FLAG(convert)},
{"dolbyvision", OPT_FLAG(dovi)},
{"force-scaler", OPT_CHOICE(force_scaler,
{"auto", MP_SWS_AUTO},
{"sws", MP_SWS_SWS},
@ -222,6 +227,7 @@ const struct mp_user_filter_entry vf_format = {
.priv_size = sizeof(OPT_BASE_STRUCT),
.priv_defaults = &(const OPT_BASE_STRUCT){
.rotate = -1,
.dovi = 1,
},
.options = vf_opts_fields,
},