summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-04-22 10:04:40 +0300
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-04-22 10:51:48 +0300
commit81fbdf1e460fd198a53903cc8f250cc4508f25fe (patch)
treef1ab93dc07d9bc6e2d673e5559c4a335c56e3780 /kms++
parent2867a98ad1767759405a5c71c6bee129de5afcde (diff)
pixelformats: Disable constexpr for older compilers
gcc 11 and earlier do not support constexpr strings and vectors. Add tests and ifdefs to only use constexpr on selected places for gcc 12+. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Diffstat (limited to 'kms++')
-rw-r--r--kms++/inc/kms++/pixelformats.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/kms++/inc/kms++/pixelformats.h b/kms++/inc/kms++/pixelformats.h
index 6049c20..fac9c0f 100644
--- a/kms++/inc/kms++/pixelformats.h
+++ b/kms++/inc/kms++/pixelformats.h
@@ -15,7 +15,12 @@ constexpr uint32_t str_to_fourcc(const std::string_view fourcc)
return fourcc[0] | (fourcc[1] << 8) | (fourcc[2] << 16) | (fourcc[3] << 24);
}
-constexpr std::string fourcc_to_str(uint32_t fourcc)
+#if HAS_CONSTEXPR_STR
+constexpr
+#else
+static inline
+#endif
+std::string fourcc_to_str(uint32_t fourcc)
{
char buf[4] = {
(char)((fourcc >> 0) & 0xff),
@@ -146,7 +151,10 @@ struct PixelFormatPlaneInfo {
};
struct PixelFormatInfo {
- constexpr PixelFormatInfo(const std::string_view name,
+ #if HAS_CONSTEXPR_STR && HAS_CONSTEXPR_VEC
+ constexpr
+ #endif
+ PixelFormatInfo(const std::string_view name,
const std::string_view drm_fourcc,
const std::string_view v4l2_4cc,
PixelColorType color,