[libcamera-devel,RFC,0/6] Add propagation of sensor frame interval
mbox series

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

Message

Marian Cichy March 16, 2021, 3:52 p.m. UTC
This patch series is meant to demonstrate my use-case and to start a
discussion. The main target is to have a mechanism where the
application, e.g. libcamerasrc can read out the frame interval set by
the driver.

It is generally useful for applications to know the framerate, e.g. one
can build pipelines with Gstreamer where the framerate is used to
pre-allocate a proper amount of memory or to compute the latency. It is
also an useful debug-information in general.

this approach uses the frame_interval ioctls which is for my driver the
only way to get the frame rate. I suspect there is also a different
approach using controls::FrameDurations which I find in some parts of
libcamera. However, it is not clear to me, how I would use this and what
the driver needs to do here or if it even would be the better approach
for my use-case. Any comments to this are welcome.


Marian Cichy (6):
  libcamera: Add fraction.h
  libcamera: stream: Add frame interval attribute
  libcamera: v4l2_subdevice: Add methods to get/set frame interval
  pipeline: simple: Propagate frame interval through pipeline
  pipeline: simple: rename setupFormats to setupStreamProperties
  gst: utils: Add framerate to caps

 include/libcamera/fraction.h                | 34 ++++++++++++
 include/libcamera/internal/v4l2_subdevice.h |  4 ++
 include/libcamera/stream.h                  |  2 +
 src/gstreamer/gstlibcamera-utils.cpp        |  2 +
 src/libcamera/fraction.cpp                  | 60 +++++++++++++++++++++
 src/libcamera/meson.build                   |  1 +
 src/libcamera/pipeline/simple/simple.cpp    | 31 +++++++++--
 src/libcamera/v4l2_subdevice.cpp            | 43 +++++++++++++++
 8 files changed, 173 insertions(+), 4 deletions(-)
 create mode 100644 include/libcamera/fraction.h
 create mode 100644 src/libcamera/fraction.cpp

Comments

Laurent Pinchart March 16, 2021, 7:30 p.m. UTC | #1
Hi Marian,

On Tue, Mar 16, 2021 at 04:52:05PM +0100, Marian Cichy wrote:
> This patch series is meant to demonstrate my use-case and to start a
> discussion. The main target is to have a mechanism where the
> application, e.g. libcamerasrc can read out the frame interval set by
> the driver.
> 
> It is generally useful for applications to know the framerate, e.g. one
> can build pipelines with Gstreamer where the framerate is used to
> pre-allocate a proper amount of memory or to compute the latency. It is
> also an useful debug-information in general.
> 
> this approach uses the frame_interval ioctls which is for my driver the
> only way to get the frame rate. I suspect there is also a different
> approach using controls::FrameDurations which I find in some parts of
> libcamera. However, it is not clear to me, how I would use this and what
> the driver needs to do here or if it even would be the better approach
> for my use-case. Any comments to this are welcome.

Using FrameDurations doesn't have any implication on the driver, it's
only the API between applications and pipeline handlers. How you
configure the kernel devices is entirely up to the pipeline handler.

> Marian Cichy (6):
>   libcamera: Add fraction.h
>   libcamera: stream: Add frame interval attribute
>   libcamera: v4l2_subdevice: Add methods to get/set frame interval
>   pipeline: simple: Propagate frame interval through pipeline
>   pipeline: simple: rename setupFormats to setupStreamProperties
>   gst: utils: Add framerate to caps
> 
>  include/libcamera/fraction.h                | 34 ++++++++++++
>  include/libcamera/internal/v4l2_subdevice.h |  4 ++
>  include/libcamera/stream.h                  |  2 +
>  src/gstreamer/gstlibcamera-utils.cpp        |  2 +
>  src/libcamera/fraction.cpp                  | 60 +++++++++++++++++++++
>  src/libcamera/meson.build                   |  1 +
>  src/libcamera/pipeline/simple/simple.cpp    | 31 +++++++++--
>  src/libcamera/v4l2_subdevice.cpp            | 43 +++++++++++++++
>  8 files changed, 173 insertions(+), 4 deletions(-)
>  create mode 100644 include/libcamera/fraction.h
>  create mode 100644 src/libcamera/fraction.cpp