summaryrefslogtreecommitdiffstats
path: root/filters/f_autoconvert.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-21 01:29:48 +0200
committerwm4 <wm4@nowhere>2019-10-21 01:38:25 +0200
commit5dba244c226383f9f3b15b07dfa5133ad08b6497 (patch)
tree3b6e46e9ef3350670f32a56140322980e3b37954 /filters/f_autoconvert.h
parent8a4e9d5c180157684546db4c1235d8c958172ca9 (diff)
downloadmpv-5dba244c226383f9f3b15b07dfa5133ad08b6497.tar.bz2
mpv-5dba244c226383f9f3b15b07dfa5133ad08b6497.tar.xz
filters: extend vf_format so that it can convert color parameters
Form some reason (and because of my fault), vf_format converts image formats, but nothing else. For example, setting the "colormatrix" sub-parameter would not convert it to the new value, but instead overwrite the metadata (basically "reinterpreting" the image data without changing it). Make the historical mistake worse, and go all the way and extend it such that it can perform a conversion. For compatibility reasons, this needs to be requested explicitly. (Maybe this would deserve a separate filter to begin with, but things are messed up anyway. Feel free to suggest an elegant and simple solution.) This demonstrates how zimg can properly perform some conversions which swscale cannot (see examples added to vf.rst). Stupidly this requires 2 code paths, one for conversion, and one for overriding the parameters. Due to the filter bullshit (what was I thinking), this requires quite some acrobatics that would not be necessary without these abstractions. On the other hand, it'd definitely be more of a mess without it. Oh whatever.
Diffstat (limited to 'filters/f_autoconvert.h')
-rw-r--r--filters/f_autoconvert.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/filters/f_autoconvert.h b/filters/f_autoconvert.h
index e8c5a44134..ae08fd4e51 100644
--- a/filters/f_autoconvert.h
+++ b/filters/f_autoconvert.h
@@ -3,6 +3,7 @@
#include "filter.h"
struct mp_image;
+struct mp_image_params;
// A filter which automatically creates and uses a conversion filter based on
// the filter settings, or passes through data unchanged if no conversion is
@@ -22,6 +23,14 @@ struct mp_autoconvert {
// (to free this, free the filter itself, mp_autoconvert.f)
struct mp_autoconvert *mp_autoconvert_create(struct mp_filter *parent);
+// Require that output frames have the following params set.
+// This implicitly clears the image format list, and calls
+// mp_autoconvert_add_imgfmt() with the values in *p.
+// Idempotent on subsequent calls (no reinit forced if parameters don't change).
+// Mixing this with other format-altering calls has undefined effects.
+void mp_autoconvert_set_target_image_params(struct mp_autoconvert *c,
+ struct mp_image_params *p);
+
// Add the imgfmt as allowed video image format, and error on non-video frames.
// Each call adds to the list of allowed formats. Before the first call, all
// formats are allowed (even non-video).