diff options
author | Niklas Haas <git@haasn.dev> | 2022-01-07 06:41:55 +0100 |
---|---|---|
committer | Niklas Haas <github-daiK1o@haasn.dev> | 2022-01-09 13:06:27 +0100 |
commit | 05ccc51d53424a771ece5bb818713d474d7874ce (patch) | |
tree | 62ceba70b76d8ab33ff081c45477400103f9dc83 /video | |
parent | 88047f7654f4b83ad9c4dc9e0a21221e7b380ee0 (diff) | |
download | mpv-05ccc51d53424a771ece5bb818713d474d7874ce.tar.bz2 mpv-05ccc51d53424a771ece5bb818713d474d7874ce.tar.xz |
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.
Diffstat (limited to 'video')
-rw-r--r-- | video/filter/vf_format.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c index b0cf04db7a..8aea1d5498 100644 --- a/video/filter/vf_format.c +++ b/video/filter/vf_format.c @@ -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, }, |