From 26a4b83d1b9443795dbcb21fa6c23117f113216a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Tue, 9 May 2023 23:15:43 +0000 Subject: libcamera: Remove `StreamRoles` alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that `Camera::generateConfiguration()` takes a `libcamera::Span` of `StreamRole`, remove the `StreamRoles` type, which was an alias to `std::vector`. The removal has two reasons: - it is no longer strictly necessary, - its presence may suggest that that is the preferred (or correct) way to build/pass a list of `StreamRole`. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham [Kieran: Fix small checkstyle report on roles initialiser] Signed-off-by: Kieran Bingham --- src/gstreamer/gstlibcameraprovider.cpp | 5 +++-- src/gstreamer/gstlibcamerasrc.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/gstreamer') diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp index 3f5e1fd6..ce3e0a08 100644 --- a/src/gstreamer/gstlibcameraprovider.cpp +++ b/src/gstreamer/gstlibcameraprovider.cpp @@ -6,6 +6,8 @@ * gstlibcameraprovider.c - GStreamer Device Provider */ +#include + #include "gstlibcameraprovider.h" #include @@ -141,11 +143,10 @@ gst_libcamera_device_class_init(GstLibcameraDeviceClass *klass) static GstDevice * gst_libcamera_device_new(const std::shared_ptr &camera) { + static const std::array roles{ StreamRole::VideoRecording }; g_autoptr(GstCaps) caps = gst_caps_new_empty(); const gchar *name = camera->id().c_str(); - StreamRoles roles; - roles.push_back(StreamRole::VideoRecording); std::unique_ptr config = camera->generateConfiguration(roles); if (!config || config->size() != roles.size()) { GST_ERROR("Failed to generate a default configuration for %s", name); diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index f764a87a..63d99571 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -466,7 +466,7 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, GST_DEBUG_OBJECT(self, "Streaming thread has started"); gint stream_id_num = 0; - StreamRoles roles; + std::vector roles; for (GstPad *srcpad : state->srcpads_) { /* Create stream-id and push stream-start. */ g_autofree gchar *stream_id_intermediate = g_strdup_printf("%i%i", state->group_id_, stream_id_num++); -- cgit v1.2.1