[FFmpeg-devel] [PATCH 02/17] swscale/format: add ff_fmt_clear()
Niklas Haas
ffmpeg at haasn.xyz
Sun May 18 17:59:38 EEST 2025
From: Niklas Haas <git at haasn.dev>
Reset an SwsFormat to its fully unset/invalid state.
---
libswscale/format.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/libswscale/format.h b/libswscale/format.h
index 3b6d745159..be92038f4f 100644
--- a/libswscale/format.h
+++ b/libswscale/format.h
@@ -85,6 +85,20 @@ typedef struct SwsFormat {
SwsColor color;
} SwsFormat;
+static inline void ff_fmt_clear(SwsFormat *fmt)
+{
+ *fmt = (SwsFormat) {
+ .format = AV_PIX_FMT_NONE,
+ .range = AVCOL_RANGE_UNSPECIFIED,
+ .csp = AVCOL_SPC_UNSPECIFIED,
+ .loc = AVCHROMA_LOC_UNSPECIFIED,
+ .color = {
+ .prim = AVCOL_PRI_UNSPECIFIED,
+ .trc = AVCOL_TRC_UNSPECIFIED,
+ },
+ };
+}
+
/**
* This function also sanitizes and strips the input data, removing irrelevant
* fields for certain formats.
--
2.49.0
More information about the ffmpeg-devel
mailing list