summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2020-01-21 19:11:29 -0500
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-07 01:57:45 +0200
commit6d69661c24eb66981c8554a2dfd532057dc1baef (patch)
treefe747ac11a2c63552629843a859cb8437acd6549
parentd41b356564caef80ceee4096405a1ef439976cfa (diff)
gst: libcamerasrc: Store the srcpad in a vector
This will allow implementing generic algorithm even if we cannot request pads yet. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/gstreamer/gstlibcamerasrc.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index 35f75124..aa91619f 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -8,6 +8,8 @@
#include "gstlibcamerasrc.h"
+#include <vector>
+
#include <libcamera/camera.h>
#include <libcamera/camera_manager.h>
@@ -23,6 +25,7 @@ GST_DEBUG_CATEGORY_STATIC(source_debug);
struct GstLibcameraSrcState {
std::unique_ptr<CameraManager> cm_;
std::shared_ptr<Camera> cam_;
+ std::vector<GstPad *> srcpads_;
};
struct _GstLibcameraSrc {
@@ -30,7 +33,6 @@ struct _GstLibcameraSrc {
GRecMutex stream_lock;
GstTask *task;
- GstPad *srcpad;
gchar *camera_name;
@@ -265,8 +267,8 @@ gst_libcamera_src_init(GstLibcameraSrc *self)
gst_task_set_leave_callback(self->task, gst_libcamera_src_task_leave, self, nullptr);
gst_task_set_lock(self->task, &self->stream_lock);
- self->srcpad = gst_pad_new_from_template(templ, "src");
- gst_element_add_pad(GST_ELEMENT(self), self->srcpad);
+ state->srcpads_.push_back(gst_pad_new_from_template(templ, "src"));
+ gst_element_add_pad(GST_ELEMENT(self), state->srcpads_[0]);
self->state = state;
}