[libcamera-devel,RFC,6/6] gst: utils: Add framerate to caps
diff mbox series

Message ID 20210316155211.6679-7-m.cichy@pengutronix.de
State Superseded
Headers show
Series
  • Add propagation of sensor frame interval
Related show

Commit Message

Marian Cichy March 16, 2021, 3:52 p.m. UTC
The framerate of a stream is the inverse of the frame interval from the
stream configuration.

Signed-off-by: Marian Cichy <m.cichy@pengutronix.de>
---
 src/gstreamer/gstlibcamera-utils.cpp | 2 ++
 1 file changed, 2 insertions(+)

Comments

Nicolas Dufresne March 16, 2021, 9:04 p.m. UTC | #1
Le mardi 16 mars 2021 à 16:52 +0100, Marian Cichy a écrit :
> The framerate of a stream is the inverse of the frame interval from the
> stream configuration.
> 
> Signed-off-by: Marian Cichy <m.cichy@pengutronix.de>
> ---
>  src/gstreamer/gstlibcamera-utils.cpp | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp
> b/src/gstreamer/gstlibcamera-utils.cpp
> index 61370d5f..7516f84a 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -125,6 +125,8 @@ gst_libcamera_stream_configuration_to_caps(const
> StreamConfiguration &stream_cfg
>         gst_structure_set(s,
>                           "width", G_TYPE_INT, stream_cfg.size.width,
>                           "height", G_TYPE_INT, stream_cfg.size.height,
> +                         "framerate", GST_TYPE_FRACTION,
> stream_cfg.frameInterval.denominator,
> +                                                       stream_cfg.frameInterv
> al.numerator,

So only fixed sizes can have a framerate ? What about the size ranges ? Do we
expect backend to repeat the sizes in order to offer multiple rate ?

>                           nullptr);
>         gst_caps_append_structure(caps, s);
>

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
index 61370d5f..7516f84a 100644
--- a/src/gstreamer/gstlibcamera-utils.cpp
+++ b/src/gstreamer/gstlibcamera-utils.cpp
@@ -125,6 +125,8 @@  gst_libcamera_stream_configuration_to_caps(const StreamConfiguration &stream_cfg
 	gst_structure_set(s,
 			  "width", G_TYPE_INT, stream_cfg.size.width,
 			  "height", G_TYPE_INT, stream_cfg.size.height,
+			  "framerate", GST_TYPE_FRACTION, stream_cfg.frameInterval.denominator,
+			  				stream_cfg.frameInterval.numerator,
 			  nullptr);
 	gst_caps_append_structure(caps, s);