diff options
author | Niklas Haas <git@haasn.dev> | 2024-10-09 23:33:44 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.dev> | 2024-10-23 23:06:16 +0200 |
commit | 5e50a56b9c4998838005ddaaed1422a9d717c50f (patch) | |
tree | 39a0d0b52f8728778f61c72ba016f2762ff807ba /libswscale/swscale.h | |
parent | e2637a083ae2876d55adafad6bddf698fe09da3f (diff) | |
download | ffmpeg-5e50a56b9c4998838005ddaaed1422a9d717c50f.tar.gz |
swscale: add new frame testing API
Replacing the old sws_isSupported* API with a more consistent family
of functions that follows the same signature and naming convention,
including a placeholder for testing the color space parameters that
we don't currently implement conversions for.
These functions also perform some extra basic sanity checking.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
Diffstat (limited to 'libswscale/swscale.h')
-rw-r--r-- | libswscale/swscale.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/libswscale/swscale.h b/libswscale/swscale.h index 763c1dbccf..e3362d5328 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -85,6 +85,61 @@ SwsContext *sws_alloc_context(void); */ void sws_free_context(SwsContext **ctx); +/*************************** + * Supported frame formats * + ***************************/ + +/** + * Test if a given pixel format is supported. + * + * @param output If 0, test if compatible with the source/input frame; + * otherwise, with the destination/output frame. + * @param format The format to check. + * + * @return A positive integer if supported, 0 otherwise. + */ +int sws_test_format(enum AVPixelFormat format, int output); + +/** + * Test if a given color space is supported. + * + * @param output If 0, test if compatible with the source/input frame; + * otherwise, with the destination/output frame. + * @param colorspace The colorspace to check. + * + * @return A positive integer if supported, 0 otherwise. + */ +int sws_test_colorspace(enum AVColorSpace colorspace, int output); + +/** + * Test if a given set of color primaries is supported. + * + * @param output If 0, test if compatible with the source/input frame; + * otherwise, with the destination/output frame. + * @param primaries The color primaries to check. + * + * @return A positive integer if supported, 0 otherwise. + */ +int sws_test_primaries(enum AVColorPrimaries primaries, int output); + +/** + * Test if a given color transfer function is supported. + * + * @param output If 0, test if compatible with the source/input frame; + * otherwise, with the destination/output frame. + * @param trc The color transfer function to check. + * + * @return A positive integer if supported, 0 otherwise. + */ +int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output); + +/** + * Helper function to run all sws_test_* against a frame, as well as testing + * the basic frame properties for sanity. Ignores irrelevant properties - for + * example, AVColorSpace is not checked for RGB frames. + */ +int sws_test_frame(const AVFrame *frame, int output); + /* values for the flags, the stuff on the command line is different */ #define SWS_FAST_BILINEAR 1 #define SWS_BILINEAR 2 |