summaryrefslogtreecommitdiff
path: root/src/gstreamer/gstlibcamerapad.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gstreamer/gstlibcamerapad.cpp')
-rw-r--r--src/gstreamer/gstlibcamerapad.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp
index 840f391c..e184495a 100644
--- a/src/gstreamer/gstlibcamerapad.cpp
+++ b/src/gstreamer/gstlibcamerapad.cpp
@@ -63,9 +63,24 @@ gst_libcamera_pad_get_property(GObject *object, guint prop_id, GValue *value,
}
}
+static gboolean
+gst_libcamera_pad_query(GstPad *pad, GstObject *parent, GstQuery *query)
+{
+ auto *self = GST_LIBCAMERA_PAD(pad);
+
+ if (query->type != GST_QUERY_LATENCY)
+ return gst_pad_query_default(pad, parent, query);
+
+ /* TRUE here means live, we assumes that max latency is the same as min
+ * as we have no idea that duration of frames. */
+ gst_query_set_latency(query, TRUE, self->latency, self->latency);
+ return TRUE;
+}
+
static void
gst_libcamera_pad_init(GstLibcameraPad *self)
{
+ GST_PAD_QUERYFUNC(self) = gst_libcamera_pad_query;
}
static GType
@@ -173,3 +188,11 @@ gst_libcamera_pad_has_pending(GstPad *pad)
GLibLocker lock(GST_OBJECT(self));
return self->pending_buffers.length > 0;
}
+
+void
+gst_libcamera_pad_set_latency(GstPad *pad, GstClockTime latency)
+{
+ auto *self = GST_LIBCAMERA_PAD(pad);
+ GLibLocker lock(GST_OBJECT(self));
+ self->latency = latency;
+}