[libcamera-devel,v2] test: gstreamer: Avoid call to deprecated gst_element_get_request_pad()
diff mbox series

Message ID 20211201075233.218836-1-xavier.roumegue@oss.nxp.com
State Accepted
Commit 4085372c517e1527114dc4098194c3ae3b973ba0
Headers show
Series
  • [libcamera-devel,v2] test: gstreamer: Avoid call to deprecated gst_element_get_request_pad()
Related show

Commit Message

Xavier Roumegue Dec. 1, 2021, 7:52 a.m. UTC
gst_element_get_request_pad() is being replaced by gst_element_request_simple()
since 1.19.1, throwing a warning in case of use until its definitive
replacement on 1.20.

Hence, prefer using gst_element_request_simple() in case gstreamer
version is >= 1.19.1 to avoid the compilation error below (tested on f35):

[258/391] Compiling C++ object test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o
FAILED: test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o
c++ -Itest/gstreamer/multi_stream_test.p -Itest/gstreamer -I../test/gstreamer -Itest/libtest -I../test/libtest -Iinclude -I../include -Iinclude/libcamera/ipa -Iinclude/libcamera -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++17 -g -Wshadow -include config.h -pthread -DLIBCAMERA_BASE_PRIVATE -MD -MQ test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o -MF test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o.d -o test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o -c ../test/gstreamer/gstreamer_multi_stream_test.cpp
../test/gstreamer/gstreamer_multi_stream_test.cpp: In member function ‘virtual int GstreamerMultiStreamTest::run()’:
../test/gstreamer/gstreamer_multi_stream_test.cpp:90:76: error: ‘GstPad* gst_element_get_request_pad(GstElement*, const gchar*)’ is deprecated: Use 'gst_element_request_pad_simple' instead [-Werror=deprecated-declarations]
   90 |                 g_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, "src_%u");
      |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gstreamer-1.0/gst/gstbin.h:27,
                 from /usr/include/gstreamer-1.0/gst/gst.h:35,
                 from ../test/gstreamer/gstreamer_multi_stream_test.cpp:13:
/usr/include/gstreamer-1.0/gst/gstelement.h:1042:25: note: declared here
 1042 | GstPad*                 gst_element_get_request_pad     (GstElement *element, const gchar *name);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
---
 test/gstreamer/gstreamer_multi_stream_test.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Dec. 1, 2021, 10:01 a.m. UTC | #1
Hi Xavier,

Thank you for the patch.

On Wed, Dec 01, 2021 at 08:52:33AM +0100, Xavier Roumegue wrote:
> gst_element_get_request_pad() is being replaced by gst_element_request_simple()
> since 1.19.1, throwing a warning in case of use until its definitive
> replacement on 1.20.
> 
> Hence, prefer using gst_element_request_simple() in case gstreamer
> version is >= 1.19.1 to avoid the compilation error below (tested on f35):
> 
> [258/391] Compiling C++ object test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o
> FAILED: test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o
> c++ -Itest/gstreamer/multi_stream_test.p -Itest/gstreamer -I../test/gstreamer -Itest/libtest -I../test/libtest -Iinclude -I../include -Iinclude/libcamera/ipa -Iinclude/libcamera -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++17 -g -Wshadow -include config.h -pthread -DLIBCAMERA_BASE_PRIVATE -MD -MQ test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o -MF test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o.d -o test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o -c ../test/gstreamer/gstreamer_multi_stream_test.cpp
> ../test/gstreamer/gstreamer_multi_stream_test.cpp: In member function ‘virtual int GstreamerMultiStreamTest::run()’:
> ../test/gstreamer/gstreamer_multi_stream_test.cpp:90:76: error: ‘GstPad* gst_element_get_request_pad(GstElement*, const gchar*)’ is deprecated: Use 'gst_element_request_pad_simple' instead [-Werror=deprecated-declarations]
>    90 |                 g_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, "src_%u");
>       |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from /usr/include/gstreamer-1.0/gst/gstbin.h:27,
>                  from /usr/include/gstreamer-1.0/gst/gst.h:35,
>                  from ../test/gstreamer/gstreamer_multi_stream_test.cpp:13:
> /usr/include/gstreamer-1.0/gst/gstelement.h:1042:25: note: declared here
>  1042 | GstPad*                 gst_element_get_request_pad     (GstElement *element, const gchar *name);
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1plus: all warnings being treated as errors
> 
> Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  test/gstreamer/gstreamer_multi_stream_test.cpp | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/test/gstreamer/gstreamer_multi_stream_test.cpp b/test/gstreamer/gstreamer_multi_stream_test.cpp
> index d3d7a9d3..112f1dee 100644
> --- a/test/gstreamer/gstreamer_multi_stream_test.cpp
> +++ b/test/gstreamer/gstreamer_multi_stream_test.cpp
> @@ -15,6 +15,14 @@
>  #include "gstreamer_test.h"
>  #include "test.h"
>  
> +#if !GST_CHECK_VERSION(1, 19, 1)
> +static inline GstPad *gst_element_request_pad_simple(GstElement *element,
> +						     const gchar *name)
> +{
> +	return gst_element_get_request_pad(element, name);
> +}
> +#endif
> +
>  using namespace std;
>  
>  class GstreamerMultiStreamTest : public GstreamerTest, public Test
> @@ -87,7 +95,7 @@ protected:
>  				 stream0_, stream1_, NULL);
>  
>  		g_autoptr(GstPad) src_pad = gst_element_get_static_pad(libcameraSrc_, "src");
> -		g_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, "src_%u");
> +		g_autoptr(GstPad) request_pad = gst_element_request_pad_simple(libcameraSrc_, "src_%u");
>  
>  		{
>  			g_autoptr(GstPad) queue0_sink_pad = gst_element_get_static_pad(stream0_, "sink");
Umang Jain Dec. 1, 2021, 10:04 a.m. UTC | #2
Hi Xaiver,

On 12/1/21 1:22 PM, Xavier Roumegue wrote:
> gst_element_get_request_pad() is being replaced by gst_element_request_simple()
> since 1.19.1, throwing a warning in case of use until its definitive
> replacement on 1.20.
>
> Hence, prefer using gst_element_request_simple() in case gstreamer
> version is >= 1.19.1 to avoid the compilation error below (tested on f35):
>
> [258/391] Compiling C++ object test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o
> FAILED: test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o
> c++ -Itest/gstreamer/multi_stream_test.p -Itest/gstreamer -I../test/gstreamer -Itest/libtest -I../test/libtest -Iinclude -I../include -Iinclude/libcamera/ipa -Iinclude/libcamera -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++17 -g -Wshadow -include config.h -pthread -DLIBCAMERA_BASE_PRIVATE -MD -MQ test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o -MF test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o.d -o test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o -c ../test/gstreamer/gstreamer_multi_stream_test.cpp
> ../test/gstreamer/gstreamer_multi_stream_test.cpp: In member function ‘virtual int GstreamerMultiStreamTest::run()’:
> ../test/gstreamer/gstreamer_multi_stream_test.cpp:90:76: error: ‘GstPad* gst_element_get_request_pad(GstElement*, const gchar*)’ is deprecated: Use 'gst_element_request_pad_simple' instead [-Werror=deprecated-declarations]
>     90 |                 g_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, "src_%u");
>        |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from /usr/include/gstreamer-1.0/gst/gstbin.h:27,
>                   from /usr/include/gstreamer-1.0/gst/gst.h:35,
>                   from ../test/gstreamer/gstreamer_multi_stream_test.cpp:13:
> /usr/include/gstreamer-1.0/gst/gstelement.h:1042:25: note: declared here
>   1042 | GstPad*                 gst_element_get_request_pad     (GstElement *element, const gchar *name);
>        |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1plus: all warnings being treated as errors
>
> Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>


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

> ---
>   test/gstreamer/gstreamer_multi_stream_test.cpp | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/test/gstreamer/gstreamer_multi_stream_test.cpp b/test/gstreamer/gstreamer_multi_stream_test.cpp
> index d3d7a9d3..112f1dee 100644
> --- a/test/gstreamer/gstreamer_multi_stream_test.cpp
> +++ b/test/gstreamer/gstreamer_multi_stream_test.cpp
> @@ -15,6 +15,14 @@
>   #include "gstreamer_test.h"
>   #include "test.h"
>   
> +#if !GST_CHECK_VERSION(1, 19, 1)
> +static inline GstPad *gst_element_request_pad_simple(GstElement *element,
> +						     const gchar *name)
> +{
> +	return gst_element_get_request_pad(element, name);
> +}
> +#endif
> +
>   using namespace std;
>   
>   class GstreamerMultiStreamTest : public GstreamerTest, public Test
> @@ -87,7 +95,7 @@ protected:
>   				 stream0_, stream1_, NULL);
>   
>   		g_autoptr(GstPad) src_pad = gst_element_get_static_pad(libcameraSrc_, "src");
> -		g_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, "src_%u");
> +		g_autoptr(GstPad) request_pad = gst_element_request_pad_simple(libcameraSrc_, "src_%u");
>   
>   		{
>   			g_autoptr(GstPad) queue0_sink_pad = gst_element_get_static_pad(stream0_, "sink");
Kieran Bingham Dec. 1, 2021, 10:52 a.m. UTC | #3
Quoting Xavier Roumegue (2021-12-01 07:52:33)
> gst_element_get_request_pad() is being replaced by gst_element_request_simple()
> since 1.19.1, throwing a warning in case of use until its definitive
> replacement on 1.20.
> 
> Hence, prefer using gst_element_request_simple() in case gstreamer
> version is >= 1.19.1 to avoid the compilation error below (tested on f35):
> 
> [258/391] Compiling C++ object test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o
> FAILED: test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o
> c++ -Itest/gstreamer/multi_stream_test.p -Itest/gstreamer -I../test/gstreamer -Itest/libtest -I../test/libtest -Iinclude -I../include -Iinclude/libcamera/ipa -Iinclude/libcamera -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++17 -g -Wshadow -include config.h -pthread -DLIBCAMERA_BASE_PRIVATE -MD -MQ test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o -MF test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o.d -o test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o -c ../test/gstreamer/gstreamer_multi_stream_test.cpp
> ../test/gstreamer/gstreamer_multi_stream_test.cpp: In member function ‘virtual int GstreamerMultiStreamTest::run()’:
> ../test/gstreamer/gstreamer_multi_stream_test.cpp:90:76: error: ‘GstPad* gst_element_get_request_pad(GstElement*, const gchar*)’ is deprecated: Use 'gst_element_request_pad_simple' instead [-Werror=deprecated-declarations]
>    90 |                 g_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, "src_%u");
>       |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from /usr/include/gstreamer-1.0/gst/gstbin.h:27,
>                  from /usr/include/gstreamer-1.0/gst/gst.h:35,
>                  from ../test/gstreamer/gstreamer_multi_stream_test.cpp:13:
> /usr/include/gstreamer-1.0/gst/gstelement.h:1042:25: note: declared here
>  1042 | GstPad*                 gst_element_get_request_pad     (GstElement *element, const gchar *name);
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1plus: all warnings being treated as errors
> 
> Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
> ---
>  test/gstreamer/gstreamer_multi_stream_test.cpp | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/test/gstreamer/gstreamer_multi_stream_test.cpp b/test/gstreamer/gstreamer_multi_stream_test.cpp
> index d3d7a9d3..112f1dee 100644
> --- a/test/gstreamer/gstreamer_multi_stream_test.cpp
> +++ b/test/gstreamer/gstreamer_multi_stream_test.cpp
> @@ -15,6 +15,14 @@
>  #include "gstreamer_test.h"
>  #include "test.h"
>  
> +#if !GST_CHECK_VERSION(1, 19, 1)

I had to go check, at least for myself if this supports later
versions...

" Check whether a GStreamer version equal to or greater than
major.minor.micro is present. "

so that's a pass...

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> +static inline GstPad *gst_element_request_pad_simple(GstElement *element,
> +                                                    const gchar *name)
> +{
> +       return gst_element_get_request_pad(element, name);
> +}
> +#endif
> +
>  using namespace std;
>  
>  class GstreamerMultiStreamTest : public GstreamerTest, public Test
> @@ -87,7 +95,7 @@ protected:
>                                  stream0_, stream1_, NULL);
>  
>                 g_autoptr(GstPad) src_pad = gst_element_get_static_pad(libcameraSrc_, "src");
> -               g_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, "src_%u");
> +               g_autoptr(GstPad) request_pad = gst_element_request_pad_simple(libcameraSrc_, "src_%u");
>  
>                 {
>                         g_autoptr(GstPad) queue0_sink_pad = gst_element_get_static_pad(stream0_, "sink");
> -- 
> 2.33.1
>

Patch
diff mbox series

diff --git a/test/gstreamer/gstreamer_multi_stream_test.cpp b/test/gstreamer/gstreamer_multi_stream_test.cpp
index d3d7a9d3..112f1dee 100644
--- a/test/gstreamer/gstreamer_multi_stream_test.cpp
+++ b/test/gstreamer/gstreamer_multi_stream_test.cpp
@@ -15,6 +15,14 @@ 
 #include "gstreamer_test.h"
 #include "test.h"
 
+#if !GST_CHECK_VERSION(1, 19, 1)
+static inline GstPad *gst_element_request_pad_simple(GstElement *element,
+						     const gchar *name)
+{
+	return gst_element_get_request_pad(element, name);
+}
+#endif
+
 using namespace std;
 
 class GstreamerMultiStreamTest : public GstreamerTest, public Test
@@ -87,7 +95,7 @@  protected:
 				 stream0_, stream1_, NULL);
 
 		g_autoptr(GstPad) src_pad = gst_element_get_static_pad(libcameraSrc_, "src");
-		g_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, "src_%u");
+		g_autoptr(GstPad) request_pad = gst_element_request_pad_simple(libcameraSrc_, "src_%u");
 
 		{
 			g_autoptr(GstPad) queue0_sink_pad = gst_element_get_static_pad(stream0_, "sink");