diff options
author | Rishikesh Donadkar <rishikeshdonadkar@gmail.com> | 2022-09-15 17:17:34 +0530 |
---|---|---|
committer | Umang Jain <umang.jain@ideasonboard.com> | 2022-11-12 00:15:05 +0530 |
commit | ccfe0a1af77c3d13e81a913b25206d6a4a4747e4 (patch) | |
tree | dc11c18a8600afc25946afe2fa2ee93c698755d2 /src/gstreamer/gstlibcamera-utils.h | |
parent | 872588301fe6badb4b22cd8d16ab094753138b52 (diff) |
gstreamer: Provide framerate support for libcamerasrc
Control the framerate by passing the controls::FrameDurationLimits
during Camera::start(). Framerate in gstreamer is expressed as
GST_TYPE_FRACTION so we maximise on maintaining it as a fraction
throughout and only do arithematic computations as and when required
(to compute frame-duration and vice-versa).
To weed out abritrary framerate as input, place the clamping via the
controls::FrameDurationLimits provided after camera::configure() phase.
This is handled by a helper function
gst_libcamera_clamp_and_set_frameduration().
Set the bound checked framerate (done in the above mentioned helper)
into the caps and pass the ControlList containing the frame-duration
to Camera::start(ctrls).
Signed-off-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Diffstat (limited to 'src/gstreamer/gstlibcamera-utils.h')
-rw-r--r-- | src/gstreamer/gstlibcamera-utils.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gstreamer/gstlibcamera-utils.h b/src/gstreamer/gstlibcamera-utils.h index 164189a2..fd304a8b 100644 --- a/src/gstreamer/gstlibcamera-utils.h +++ b/src/gstreamer/gstlibcamera-utils.h @@ -9,6 +9,7 @@ #pragma once #include <libcamera/camera_manager.h> +#include <libcamera/controls.h> #include <libcamera/stream.h> #include <gst/gst.h> @@ -18,6 +19,12 @@ GstCaps *gst_libcamera_stream_formats_to_caps(const libcamera::StreamFormats &fo GstCaps *gst_libcamera_stream_configuration_to_caps(const libcamera::StreamConfiguration &stream_cfg); void gst_libcamera_configure_stream_from_caps(libcamera::StreamConfiguration &stream_cfg, GstCaps *caps); +void gst_libcamera_get_framerate_from_caps(GstCaps *caps, GstStructure *element_caps); +void gst_libcamera_clamp_and_set_frameduration(libcamera::ControlList &controls, + const libcamera::ControlInfoMap &camera_controls, + GstStructure *element_caps); +void gst_libcamera_framerate_to_caps(GstCaps *caps, const GstStructure *element_caps); + #if !GST_CHECK_VERSION(1, 17, 1) gboolean gst_task_resume(GstTask *task); #endif |