summaryrefslogtreecommitdiffstats
path: root/filters
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2024-02-10 23:46:04 +0100
committerDudemanguy <random342@airmail.cc>2024-03-09 05:58:52 +0000
commit391261f7576ff2abc738cf8d566bdc8aad267f1f (patch)
treeaeee31dab84ead2dd19370668e5d924fe1820e9f /filters
parent120b0ac4125859fc5bfb555e73ffd4f8905fe881 (diff)
downloadmpv-391261f7576ff2abc738cf8d566bdc8aad267f1f.tar.bz2
mpv-391261f7576ff2abc738cf8d566bdc8aad267f1f.tar.xz
mp_image: add mp_image_params_static_equal for finer comparision
In case of dynamic HDR metadata is present.
Diffstat (limited to 'filters')
-rw-r--r--filters/f_autoconvert.c2
-rw-r--r--filters/f_decoder_wrapper.c21
-rw-r--r--filters/f_output_chain.c32
3 files changed, 32 insertions, 23 deletions
diff --git a/filters/f_autoconvert.c b/filters/f_autoconvert.c
index dcd5ea2485..aaea7fe4f1 100644
--- a/filters/f_autoconvert.c
+++ b/filters/f_autoconvert.c
@@ -157,7 +157,7 @@ static bool build_image_converter(struct mp_autoconvert *c, struct mp_log *log,
*/
if (samefmt && samesubffmt) {
if (p->imgparams_set) {
- if (!mp_image_params_equal(&p->imgparams, &img->params))
+ if (!mp_image_params_static_equal(&p->imgparams, &img->params))
break;
}
return true;
diff --git a/filters/f_decoder_wrapper.c b/filters/f_decoder_wrapper.c
index e85463ce90..ba867621c5 100644
--- a/filters/f_decoder_wrapper.c
+++ b/filters/f_decoder_wrapper.c
@@ -551,31 +551,36 @@ void mp_decoder_wrapper_set_play_dir(struct mp_decoder_wrapper *d, int dir)
}
static void fix_image_params(struct priv *p,
- struct mp_image_params *params)
+ struct mp_image_params *params,
+ bool quiet)
{
struct mp_image_params m = *params;
struct mp_codec_params *c = p->codec;
struct dec_wrapper_opts *opts = p->opts;
- MP_VERBOSE(p, "Decoder format: %s\n", mp_image_params_to_str(params));
+ if (!quiet)
+ MP_VERBOSE(p, "Decoder format: %s\n", mp_image_params_to_str(params));
p->dec_format = *params;
// While mp_image_params normally always have to have d_w/d_h set, the
// decoder signals unknown bitstream aspect ratio with both set to 0.
bool use_container = true;
if (opts->aspect_method == 1 && m.p_w > 0 && m.p_h > 0) {
- MP_VERBOSE(p, "Using bitstream aspect ratio.\n");
+ if (!quiet)
+ MP_VERBOSE(p, "Using bitstream aspect ratio.\n");
use_container = false;
}
if (use_container && c->par_w > 0 && c->par_h) {
- MP_VERBOSE(p, "Using container aspect ratio.\n");
+ if (!quiet)
+ MP_VERBOSE(p, "Using container aspect ratio.\n");
m.p_w = c->par_w;
m.p_h = c->par_h;
}
if (opts->movie_aspect >= 0) {
- MP_VERBOSE(p, "Forcing user-set aspect ratio.\n");
+ if (!quiet)
+ MP_VERBOSE(p, "Forcing user-set aspect ratio.\n");
if (opts->movie_aspect == 0) {
m.p_w = m.p_h = 1;
} else {
@@ -819,8 +824,10 @@ static void process_output_frame(struct priv *p, struct mp_frame frame)
correct_video_pts(p, mpi);
- if (!mp_image_params_equal(&p->last_format, &mpi->params))
- fix_image_params(p, &mpi->params);
+ if (!mp_image_params_equal(&p->last_format, &mpi->params)) {
+ fix_image_params(p, &mpi->params,
+ mp_image_params_static_equal(&p->last_format, &mpi->params));
+ }
mpi->params = p->fixed_format;
mpi->nominal_fps = p->fps;
diff --git a/filters/f_output_chain.c b/filters/f_output_chain.c
index ffad932a57..6c14ebc12b 100644
--- a/filters/f_output_chain.c
+++ b/filters/f_output_chain.c
@@ -100,27 +100,29 @@ static void check_in_format_change(struct mp_user_filter *u,
struct mp_image *img = frame.data;
if (!mp_image_params_equal(&img->params, &u->last_in_vformat)) {
- MP_VERBOSE(p, "[%s] %s\n", u->name,
- mp_image_params_to_str(&img->params));
- u->last_in_vformat = img->params;
-
if (u == p->input) {
p->public.input_params = img->params;
} else if (u == p->output) {
p->public.output_params = img->params;
}
- // Unfortunately there's no good place to update these.
- // But a common case is enabling HW decoding, which
- // might init some support of them in the VO, and update
- // the VO's format list.
- //
- // But as this is only relevant to the "convert" filter, don't
- // do this for the other filters as it is wasted work.
- if (strcmp(u->name, "convert") == 0)
- update_output_caps(p);
-
- p->public.reconfig_happened = true;
+ if (!mp_image_params_static_equal(&img->params, &u->last_in_vformat)) {
+ MP_VERBOSE(p, "[%s] %s\n", u->name,
+ mp_image_params_to_str(&img->params));
+
+ // Unfortunately there's no good place to update these.
+ // But a common case is enabling HW decoding, which
+ // might init some support of them in the VO, and update
+ // the VO's format list.
+ //
+ // But as this is only relevant to the "convert" filter, don't
+ // do this for the other filters as it is wasted work.
+ if (strcmp(u->name, "convert") == 0)
+ update_output_caps(p);
+
+ p->public.reconfig_happened = true;
+ }
+ u->last_in_vformat = img->params;
}
}