[libcamera-devel] gstreamer: Check gstreamer version before using newer macros
diff mbox series

Message ID 20220909213951.591934-1-vedantparanjape160201@gmail.com
State Accepted
Commit 046f83e8df1ec0d58bc6ed80f71dc2ce6d8f7c58
Headers show
Series
  • [libcamera-devel] gstreamer: Check gstreamer version before using newer macros
Related show

Commit Message

Vedant Paranjape Sept. 9, 2022, 9:39 p.m. UTC
GST_VIDEO_TRANSFER_BT601 and GST_VIDEO_TRANSFER_BT2020_10 macros are
defined in GST Version 1.18.0.

Use of these macros breaks libcamera if GST_VERSION < 1.18.0, these
macros are used only if GST_VERSION >= 1.18.0. Fixes 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

Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
---
 src/gstreamer/gstlibcamera-utils.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Umang Jain Sept. 10, 2022, 2:22 p.m. UTC | #1
Hi Vedant,

Thank you for the patch

On 9/10/22 3:09 AM, Vedant Paranjape via libcamera-devel wrote:
> GST_VIDEO_TRANSFER_BT601 and GST_VIDEO_TRANSFER_BT2020_10 macros are
> defined in GST Version 1.18.0.
>
> Use of these macros breaks libcamera if GST_VERSION < 1.18.0, these

s/Use of/Usage of

s/ breaks libcamera / causes gstlibcamerasrc compilation failure /

s/, these/. These/
> macros are used only if GST_VERSION >= 1.18.0. Fixes the following

s/Fixes/Fix/
> 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
>
> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
> ---
>   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 4df5dd6c14fd..244a4a79845d 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:

The latest debian stable is currently shipping with 1.18.4  [1]  but the 
oldstable is still supported till 2024 [2].

Hence, I am fine with the changes here.

[1] https://packages.debian.org/bullseye/libgstreamer1.0-0
[2] https://packages.debian.org/buster/libgstreamer1.0-0

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

>   	case GST_VIDEO_TRANSFER_BT709:
>   		colorspace->transferFunction = ColorSpace::TransferFunction::Rec709;
>   		break;
Umang Jain Sept. 11, 2022, 4:58 p.m. UTC | #2
CC Rishi

Hi, Can you please review and add your tags here, I guess you have tested ?

On 9/10/22 3:09 AM, Vedant Paranjape via libcamera-devel wrote:
> GST_VIDEO_TRANSFER_BT601 and GST_VIDEO_TRANSFER_BT2020_10 macros are
> defined in GST Version 1.18.0.
>
> Use of these macros breaks libcamera if GST_VERSION < 1.18.0, these
> macros are used only if GST_VERSION >= 1.18.0. Fixes 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
>
> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
> ---
>   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 4df5dd6c14fd..244a4a79845d 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;
Rishikesh Donadkar Sept. 11, 2022, 5:41 p.m. UTC | #3
> On 9/10/22 3:09 AM, Vedant Paranjape via libcamera-devel wrote:
> > GST_VIDEO_TRANSFER_BT601 and GST_VIDEO_TRANSFER_BT2020_10 macros are
> > defined in GST Version 1.18.0.
> >
> > Use of these macros breaks libcamera if GST_VERSION < 1.18.0, these
> > macros are used only if GST_VERSION >= 1.18.0. Fixes 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
> >
> > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>

Tested-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>
Reviewed-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>




On Sun, Sep 11, 2022 at 10:28 PM Umang Jain <umang.jain@ideasonboard.com> wrote:
>
> CC Rishi
>
> Hi, Can you please review and add your tags here, I guess you have tested ?
>
> On 9/10/22 3:09 AM, Vedant Paranjape via libcamera-devel wrote:
> > GST_VIDEO_TRANSFER_BT601 and GST_VIDEO_TRANSFER_BT2020_10 macros are
> > defined in GST Version 1.18.0.
> >
> > Use of these macros breaks libcamera if GST_VERSION < 1.18.0, these
> > macros are used only if GST_VERSION >= 1.18.0. Fixes 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
> >
> > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
> > ---
> >   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 4df5dd6c14fd..244a4a79845d 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;
>

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
index 4df5dd6c14fd..244a4a79845d 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;