From 046f83e8df1ec0d58bc6ed80f71dc2ce6d8f7c58 Mon Sep 17 00:00:00 2001 From: Vedant Paranjape Date: Mon, 12 Sep 2022 18:35:09 +0530 Subject: gstreamer: Check gstreamer version before using newer macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GST_VIDEO_TRANSFER_BT601 and GST_VIDEO_TRANSFER_BT2020_10 macros are defined in GST Version 1.18.0. Usage of these macros causes gstlibcamera compilation failure if GST_VERSION < 1.18.0. These macros are used only if GST_VERSION >= 1.18.0. Fix the following compilation error: ../src/gstreamer/gstlibcamera-utils.cpp:157:7: error: ‘GST_VIDEO_TRANSFER_BT601’ was not declared in this scope; did you mean ‘GST_VIDEO_TRANSFER_BT709’? 157 | case GST_VIDEO_TRANSFER_BT601: | ^~~~~~~~~~~~~~~~~~~~~~~~ | GST_VIDEO_TRANSFER_BT709 ../src/gstreamer/gstlibcamera-utils.cpp:159:7: error: ‘GST_VIDEO_TRANSFER_BT2020_10’ was not declared in this scope; did you mean ‘GST_VIDEO_TRANSFER_BT2020_12’? 159 | case GST_VIDEO_TRANSFER_BT2020_10: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | GST_VIDEO_TRANSFER_BT2020_12 Fixes: fc9783acc608 ("gstreamer: Provide colorimetry <> ColorSpace mappings") Signed-off-by: Vedant Paranjape Reviewed-by: Umang Jain Tested-by: Rishikesh Donadkar Reviewed-by: Rishikesh Donadkar Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Umang Jain --- src/gstreamer/gstlibcamera-utils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp index 4df5dd6c..244a4a79 100644 --- a/src/gstreamer/gstlibcamera-utils.cpp +++ b/src/gstreamer/gstlibcamera-utils.cpp @@ -154,9 +154,11 @@ colorspace_from_colorimetry(const GstVideoColorimetry &colorimetry) case GST_VIDEO_TRANSFER_SRGB: colorspace->transferFunction = ColorSpace::TransferFunction::Srgb; break; +#if GST_CHECK_VERSION(1, 18, 0) case GST_VIDEO_TRANSFER_BT601: - case GST_VIDEO_TRANSFER_BT2020_12: case GST_VIDEO_TRANSFER_BT2020_10: +#endif + case GST_VIDEO_TRANSFER_BT2020_12: case GST_VIDEO_TRANSFER_BT709: colorspace->transferFunction = ColorSpace::TransferFunction::Rec709; break; -- cgit v1.2.1