|
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/gstelem/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* libcamera V4L2 Subdevice format handling test
*/
#include <iostream>
#include <limits.h>
#include "libcamera/internal/v4l2_subdevice.h"
#include "v4l2_subdevice_test.h"
using namespace std;
using namespace libcamera;
/* Test format handling on the "Scaler" subdevice of vimc media device. */
class FormatHandlingTest : public V4L2SubdeviceTest
{
protected:
int run() override;
};
int FormatHandlingTest::run()
{
V4L2SubdeviceFormat format = {};
/*
* Get format on a non-existing Scaler pad: expect failure.
*/
int ret = scaler_->getFormat(2, &format);
if (!ret) {
cerr << "Getting format on a non existing pad should fail" << endl;
return TestFail;
}
ret = scaler_->getFormat(0, &format);
if (ret) {
cerr << "Failed to get format" << endl;
return TestFail;
}
/*
* Set unrealistic image resolutions and make sure it gets updated.
*/
format.size = { UINT_MAX, UINT_MAX };
ret = scaler_->setFormat(0, &format);
if (ret) {
cerr << "Failed to set format: image resolution is wrong, but "
<< "setFormat() should not fail." << endl;
return TestFail;
}
if (format.size.width == UINT_MAX ||
format.size.height == UINT_MAX) {
cerr << "Failed to update image format" << endl;
return TestFail;
}
format.size = { 0, 0 };
ret = scaler_->setFormat(0, &format);
if (ret) {
cerr << "Failed to set format: image resolution is wrong, but "
<< "setFormat() should not fail." << endl;
return TestFail;
}
if (format.size.isNull()) {
cerr << "Failed to update image format" << endl;
return TestFail;
}
return TestPass;
}
TEST_REGISTER(FormatHandlingTest)
|