gstreamer: Check gstreamer version before using newer macros

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: fc9783acc6 ("gstreamer: Provide colorimetry <> ColorSpace mappings")
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>
Reviewed-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
Vedant Paranjape 2022-09-12 18:35:09 +05:30 committed by Umang Jain
parent 5fd18af233
commit 046f83e8df

View file

@ -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;