From 9b55009e8f6e81bdc19172b4469b58646464dc80 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 2 Oct 2019 23:00:28 +0200 Subject: f_autoconvert: provide a function to determine if conversion works This adds the function as seen in the f_autoconvert.h part of the patch. It's pretty simple, but goes along with an intrusive code move. I guess the resulting code is slightly nicer anyway. --- filters/f_autoconvert.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'filters/f_autoconvert.h') diff --git a/filters/f_autoconvert.h b/filters/f_autoconvert.h index d8fac346e5..c26612f2f9 100644 --- a/filters/f_autoconvert.h +++ b/filters/f_autoconvert.h @@ -2,6 +2,8 @@ #include "filter.h" +struct mp_image; + // A filter which automatically creates and uses a conversion filter based on // the filter settings, or passes through data unchanged if no conversion is // required. @@ -34,6 +36,17 @@ void mp_autoconvert_add_imgfmt(struct mp_autoconvert *c, int imgfmt, int subfmt) // as the normal semantics will exclude other formats (including hw ones). void mp_autoconvert_add_all_sw_imgfmts(struct mp_autoconvert *c); +// Approximate test for whether the input would be accepted for conversion +// according to the current settings. If false is returned, conversion will +// definitely fail; if true is returned, it might succeed, but with no hard +// guarantee. This is mainly intended for better error reporting to the user. +// The result is "approximate" because it could still fail at runtime. +// The mp_image is not mutated. +// This function is relatively slow. +// Accepting mp_image instead of any mp_frame is the result of laziness. +bool mp_autoconvert_probe_input_video(struct mp_autoconvert *c, + struct mp_image *img); + // Add the formats supported by the hwdec interops (or essentially refine them), // and trigger conversion if hw_subfmts mismatch. This is mostly a hack for // D3D11/ANGLE (which supports NV12 only). -- cgit v1.2.3